1 #ifndef _RHEOLEF_PAIR_UTIL_H
2 #define _RHEOLEF_PAIR_UTIL_H
10 template <
class T1,
class T2>
11 struct get_first : std::unary_function<std::pair<T1,T2>, T1> {
12 T1
operator() (
const std::pair<T1,T2>& x)
const {
return x.first; }
14 template <
class T1,
class T2>
15 struct get_second : std::unary_function<std::pair<T1,T2>, T2> {
16 T2
operator() (
const std::pair<T1,T2>& x)
const {
return x.second; }
19 template<
typename InputPairIterator,
typename OutputPairIterator,
typename UnaryOperation>
22 InputPairIterator first,
23 InputPairIterator last,
24 OutputPairIterator result,
25 UnaryOperation unary_op)
27 for (; first != last; ++first, ++result)
28 (*result).second = unary_op ((*first).second);
32 template <
class T1,
class T2>
34 operator<< (std::ostream& out, const std::pair<T1,T2>& x)
36 return out <<
"pair("<<x.first<<
","<<x.second<<
")";
41 #endif // _RHEOLEF_PAIR_UTIL_H