Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2007-06-01 20:09:39


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. ;-)

> 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.

> 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

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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