Use bind to populate a deque<bool>

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Use bind to populate a deque<bool>

yinglcs2@yahoo.com
Hi,

I am trying to use the transform algorithm to populate
a deque<bool> :

vector<int> orgList;
deque<bool> skipped;
               
transform(orgList.begin(), orgList.end(),
back_inserter(skipped ) , _1 = false);
       
But this does not compile, please tell me what did I
do wrong?
Thank you.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Use bind to populate a deque<bool>

Sebastian Redl
[hidden email] wrote:

>Hi,
>
>I am trying to use the transform algorithm to populate
>a deque<bool> :
>
>vector<int> orgList;
>deque<bool> skipped;
>
>transform(orgList.begin(), orgList.end(),
>back_inserter(skipped ) , _1 = false);
>
>But this does not compile, please tell me what did I
>do wrong?
>Thank you.
>  
>
_1 is a function parameter, not a return value. Your use of transform
here does not make sense. Here's a better way:

deque<bool> skipped(orgList.size(), false);

Sebastian Redl
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users