1#ifndef _RHEOLEF_PAIR_UTIL_H
2#define _RHEOLEF_PAIR_UTIL_H
30template <
class T1,
class T2>
31struct get_first : std::unary_function<std::pair<T1,T2>, T1> {
32 T1
operator() (
const std::pair<T1,T2>& x)
const {
return x.first; }
34template <
class T1,
class T2>
35struct get_second : std::unary_function<std::pair<T1,T2>, T2> {
36 T2
operator() (
const std::pair<T1,T2>& x)
const {
return x.second; }
39template<
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);
52template <
class T1,
class T2>
54operator<< (std::ostream& out,
const std::pair<T1,T2>& x)
56 return out <<
"pair("<<x.first<<
","<<x.second<<
")";
This file is part of Rheolef.
std::ostream & operator<<(std::ostream &os, const catchmark &m)
OutputPairIterator pair_transform_second(InputPairIterator first, InputPairIterator last, OutputPairIterator result, UnaryOperation unary_op)
T1 operator()(const std::pair< T1, T2 > &x) const
T2 operator()(const std::pair< T1, T2 > &x) const