1 #ifndef _RHEOLEF_PAIR_UTIL_H
2 #define _RHEOLEF_PAIR_UTIL_H
30 template <
class T1,
class T2>
31 struct get_first : std::unary_function<std::pair<T1,T2>, T1> {
32 T1
operator() (
const std::pair<T1,T2>& x)
const {
return x.first; }
34 template <
class T1,
class T2>
35 struct get_second : std::unary_function<std::pair<T1,T2>, T2> {
36 T2
operator() (
const std::pair<T1,T2>& x)
const {
return x.second; }
39 template<
typename InputPairIterator,
typename OutputPairIterator,
typename UnaryOperation>
42 InputPairIterator first,
43 InputPairIterator last,
44 OutputPairIterator result,
45 UnaryOperation unary_op)
47 for (; first != last; ++first, ++result)
48 (*result).second = unary_op ((*first).second);
52 template <
class T1,
class T2>
56 return out <<
"pair("<<x.first<<
","<<x.second<<
")";
61 #endif // _RHEOLEF_PAIR_UTIL_H