Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-09-15 16:12:31


Alexander Shyrokov wrote:
>>>> struct resize_vector_bool
>>
>> Should'nt that be
>>
>> struct resize_vector_bool : public std::binary_function<V,N,void> ?
>
> Thanks Hendrik, it solved the problem though I had to define template
> parameters. This is the final working version:
>
> template <class V, class N>
> struct resize_vector_bool : public std::binary_function<V,N,void>
> {
> void operator()(V& v, N n) const
> {
> v.resize(n);
> }
> };

If you want to go this way (there's nothing wrong in practice with using
&vector<>::resize IMO), you only need to either:

1. Define result_type:

struct resize_vector_bool
{
    typedef void result_type;

    void operator()(V& v, N n) const
    {
        v.resize(n);
    }
};

or

2. Supply it at the bind call by using bind<void>( ... ).

This approach avoids having to specify V and N at the bind call.


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