Boost logo

Boost Users :

From: David Greene (greened_at_[hidden])
Date: 2004-12-23 13:27:27


David Abrahams wrote:

>>{
>> replaceit<
>> vector<
>> charm
>
>
> You should be seeing a syntax error right here.

:) I'll admit I had to patch something up in the e-mail. Obviously
I mistyped.

>>What's the right way to do this?
>
> Use an algorithm like transform that _computes_ the new values rather
> than simply replacing them with a constant value:

Ok, thanks. I have to read some more to better understand which
algorithms operate on constants and which invoke metafunctions.
I should have been clued in by the name to look up the STL version.

>>Furthermore, is there a better way to identify pairs in
>>replace_if than deriving from a special class? All I can
>>think of is writing a predicate class and specializing it
>>for mpl::pair<U, V>. Seems like there should be an easier
>>way.
>
> Why? That seems like a pretty darned good approach to me.

I guess it didn't feel like the "mpl way" to me. I remember
back when MPL was first being discussed that the STL-ness of
it was compared to the pattern-matching approach of Loki. I
was a doubter about the STL-ness but now that I've used it
some I'm warming up to it. :)

Thanks again. I'm slowly climbing the curve...

                          -Dave


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