Boost logo

Boost :

From: Mark Rodgers (mark.rodgers_at_[hidden])
Date: 2000-11-20 02:48:02


From: "Jens Maurer" <Jens.Maurer_at_[hidden]>

> In short, I believe Comeau is correct and all declarations of not1, not2
> in functional.hpp should be changed to
>
> template<class Pred>
> void functor(Pred p);
>
> instead.
>
> What's your opinion?
>
> Jens Maurer

I believe you are right that Comeau is correct. However, I would prefer
not to pass by value in case the functor is of not trivial size, so wonder
if an overload would be appropriate:

    template <class Predicate>
    unary_negate<Predicate> not1(const Predicate &pred)
    {
        // ... as now
    }

    // new
    template <class Predicate>
    unary_negate<Predicate> not1(Predicate &pred)
    {
        return unary_negate<Predicate>(pred);
    }

What does Comeau make of this? BCC5.5 and GCC 2.95.2 seem to be happy
that it doesn't introduce any ambiguity.

Mark


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