Boost logo

Boost :

From: Matias Capeletto (matias.capeletto_at_[hidden])
Date: 2007-06-01 20:18:13


On 6/1/07, Eric Niebler <eric_at_[hidden]> wrote:
> Matias Capeletto wrote:
> >> 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... :)
>
> Budu? Wikipedia tells me that's a fish sauce. Hardly complimentary. ;-)

Voodoo stuff, black magic... :P

> > 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?
>
> Yes.
>
> > If this is true we are there is an extra copy of each element that I
> > would want to avoid.
>
> Possibly not, if your compiler does RVO.

The copies are:
std::pair --> map_type::value_type --> stored_type

if you directly pass a map_type::value_type, then:

map_type::value_type --> stored_type

> > Is there a way to xpressivize the following code:
> >
> > result.insert( map_type::value_type(s1,s2) )
>
> Yes.
>
> sregex pair =
> ( (s1= +_w) >> "=>" >> (s2= +_d) )
> [ ref(result)->*insert(
> construct<map_type::value_type>(s1, as<int>(s2)))
> ];
>
> Pls sync again, if you can. :-P

I can't :(
Anyway, that was what I was looking for.
Thanks!
Matias


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