Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-03-29 23:50:42


Not a stupid idea, but I think this introduces overheads that we don't want
to pay for.

-Dave

----- Original Message -----
From: "Arun Sivaramakrishnan" <aruns_at_[hidden]>
To: boost_at_[hidden]

> How about storing a pointer or a scoped_ptr to the
AdaptableUnaryFunction
> intialized to NULL in the default constructor of
> transform_iterator_policies
> and intialized to a valid one in its other constructor,
> ie
>
> template <class AdaptableUnaryFunction>
> struct transform_iterator_policies : public default_iterator_policies
> {
> transform_iterator_policies() { }
> transform_iterator_policies(const AdaptableUnaryFunction& f)
> : m_pf(new AdaptableUnaryFunction(f)) { }
>
> template <class Reference, class Iterator>
> Reference dereference(type<Reference>, const Iterator& iter) const
> { return *m_pf(*iter); }
>
> scoped_ptr<AdaptableUnaryFunction> m_pf;
> };
>
>


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