Boost logo

Boost Users :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2006-05-05 08:38:15


Hossein Haeri wrote:
> Hi Jeff.
>
>>> bind(newPrint, _2, out));
>> //Error!*/
>>
>> bind( newPrint, _1, boost::ref(out) );
>> //untested
>
> Doesn't work! :(
>
>> I'm not sure why you thought you would use _2?
>
> You mean it starts from 0, and the second argument
> should be dealed with _1?

No, the first argument if _1. Your function object's operator():

  ostream& operator ()( const Container& c, ostream& out )const

has only two arguments. And

    bind( newPrint // instance of function object
        , _1 // placeholder to recieve
*value_type::const_iterator
        , boost::ref(out) // bound reference to ostream
        )

is as if a function

    ostream& f( const value_type::value_type& _1 )
    {
        print<value_type,i-1>()( _1, out );
    }

is being passed to for_each.

I think your problems lie elsewhere. Try this out with simpler
non-templated, non-recursive functions first.

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