Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2005-06-26 19:17:25


"Peter Dimov" <pdimov_at_[hidden]> writes:

>> bool parse_numbers(char const* str, vector<double> &v) {
>> return parse(str,
>> real_p[bind<void>(&F,v,_1)] >>
>> *(',' >> real_p[bind<void>(&F,v,_1)]),
>> space_p).full;
>> }
>
> I've no idea what is the exact problem you're having, but one thing's for
> sure: bind(&F, v, _1) stores a copy of v. I don't think that this is what
> you want. Use ref(v). You don't need to use <void> with ordinary functions,
> and the & in front of F isn't needed, too. bind(&vector<double>::push_back,
> &v, _1) is also possible.

Technically it's undefined behavior to take the address of a standard
library [member] function, but you could probably get away with it.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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