Boost logo

Boost :

From: Matias Capeletto (matias.capeletto_at_[hidden])
Date: 2007-06-01 19:57:09


On 6/1/07, Eric Niebler <eric_at_[hidden]> wrote:
> Matias Capeletto wrote:
> >
> > But when operator[] is not present I have tried to use insert
> > but failed.
> > Being able to parse a file is a nice addition to bimap docs.
> > I know I have to wait to your docs but I want to know now :)
> > Can you help me?
>
> Sure. What is the signature of bimap::insert? In
> xpressive/regex_action.hpp, there is a lazy insert function object that
> can be used to insert stuff into sequences, strings and associative
> containers. For instance, my example could have been written as:
>
> sregex pair = ( (s1= +_w) >> "=>" >> (s2= +_d) )
> [ insert(ref(result), make_pair(s1, as<int>(s2))) ];

Great!

> But be sure to sync up. I just had to add xpressive::make_pair. :-)

I can not get cvs to work... I think that there is something wrong
with sourceforg.
I wanna try it... buuu...

> which is also equivalent, via some Proto magic, to:
>
> sregex pair = ( (s1= +_w) >> "=>" >> (s2= +_d) )
> [ ref(result)->*insert(make_pair(s1, as<int>(s2))) ];

Budu stuff... :)

The signature of bimaps insert is the same as standard map inserts.
I have a question about the performance of this.
Will make_pair create a std::pair?
If this is true we are there is an extra copy of each element that I
would want to avoid.
Is there a way to xpressivize the following code:

   result.insert( map_type::value_type(s1,s2) )

?

Thanks
Regards
Matias
>
> --
> Eric Niebler
> Boost Consulting
> www.boost-consulting.com
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk