Clp 1.17.6

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CoinDistance.hpp
Go to the documentation of this file.
1 /* $Id: CoinDistance.hpp 2083 2019-01-06 19:38:09Z unxusr $ */
2 // Copyright (C) 2000, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5
6 #ifndef CoinDistance_H
7 #define CoinDistance_H
8
9 #include <iterator>
10
11 //-------------------------------------------------------------------
12 //
13 // Attempt to provide an std::distance function
14 // that will work on multiple platforms
15 //
16 //-------------------------------------------------------------------
17
23 template < class ForwardIterator, class Distance >
24 void coinDistance(ForwardIterator first, ForwardIterator last,
25 Distance &n)
26 {
27 #if defined(__SUNPRO_CC)
28 n = 0;
29 std::distance(first, last, n);
30 #else
31 n = std::distance(first, last);
32 #endif
33 }
34
35 template < class ForwardIterator >
36 size_t coinDistance(ForwardIterator first, ForwardIterator last)
37 {
38 size_t retVal;
39 #if defined(__SUNPRO_CC)
40 retVal = 0;
41 std::distance(first, last, retVal);
42 #else
43 retVal = std::distance(first, last);
44 #endif
45 return retVal;
46 }
47
48 #endif
49
50 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
51 */
coinDistance
void coinDistance(ForwardIterator first, ForwardIterator last, Distance &n)
CoinDistance.
Definition: CoinDistance.hpp:24