Boost logo

Boost Users :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2006-05-05 07:55:48


Hossein Haeri wrote:
> Dear all,
>
> A fragment of code of mine is like this:
>
> template <class Container, size_t i>
> struct print
> {
> ostream& operator ()
> (const Container& c, ostream& out) const
> {
> if(out)
> {
> typedef typename Container::value_type
> value_type;
> typedef print<value_type, i - 1> NewPrint;
> NewPrint newPrint;
>
> for(typename Container::const_iterator
> j = c.begin(); j != c.end(); ++j)
> newPrint(*j, out);
> /*for_each(c.begin(),
> c.end(),
> bind(newPrint, _2, out)); //Error!*/

            bind( newPrint, _1, boost::ref(out) ); //untested

I'm not sure why you thought you would use _2?

Jeff Flinn


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net