|
Boost : |
From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2008-08-29 09:27:44
On Fri, Aug 29, 2008 at 3:13 PM, Arno Schödl <aschoedl_at_[hidden]> wrote:
> I have seen your | operator. It is o.k. for unary things, like rng | filter( predicate ), but for binary things, it is a bit weird:
>
> rngA | difference(rngB)
>
> I find the alternatives clearer: rngA - rngB would be nice (but requires concept checking), or difference( rngA, rngB ).
What about Infix a-la FC++?
(rngA ^difference^ rngB)
I love the syntax, but maybe this is too much operator abuse.
>
> But regardless of notation, doesn't this suffer from the same problem that these
> objects are temporaries?
I'm still missing something: where is the problem in:
vector<int> vecnA;
vector<int> vecnB;
DoSomethingWithRangeThatStoresIterators( difference_range< int, int >
diffrng( vecnA, vecnB ) );
This works, as long as the range doesn't escape from DSWRTSI, or a copy is made.
[of course a make_difference_range would make the code much cleaner]
-- gpd
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk