T
tomerdr
Hi,
I have the following function and functor and i want to print all
values of a map
but pair does not support operator << of course.
so i wonder what are my options?
can i extend the pair struct? can i create a values iterator?
how do i do it?
Thanks in advance.
template <class Iterator, class Function>
void apply(Iterator begin, Iterator end, const Function& f)
{
for(;begin != end; ++begin)
f(*begin);
}
class Print
{
public:
template<class T> void operator()(const T& printable) const
{
cout << printable << endl;
}
};
I have the following function and functor and i want to print all
values of a map
but pair does not support operator << of course.
so i wonder what are my options?
can i extend the pair struct? can i create a values iterator?
how do i do it?
Thanks in advance.
template <class Iterator, class Function>
void apply(Iterator begin, Iterator end, const Function& f)
{
for(;begin != end; ++begin)
f(*begin);
}
class Print
{
public:
template<class T> void operator()(const T& printable) const
{
cout << printable << endl;
}
};