Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2005-04-26 12:15:41

On Apr 26, 2005, at 11:37 AM, Peter Dimov wrote:

> ConstPropagation policy (with the default being No for shallow copy
> and Yes for deep copy).

I've been toying with a smart pointer adaptor for this one. I really
haven't fully fleshed out the thinking on it though...

template <class SP>
class deep_const
        typedef SP pointer;
        pointer sp_;

        typedef decltype(*pointer()) reference;
        deep_const() {}
        deep_const(const pointer& p) : sp_(p) {}
        deep_const(pointer&& p) : sp_(std::move(p)) {}
        deep_const(const deep_const& p) : sp_(p.sp_) {}
        deep_const(deep_const&& p) : sp_(std::move(p.sp_)) {}
        deep_const& operator=(const deep_const& p) {sp_ = p.sp_; return *this;}
        deep_const& operator=(deep_const&& p) {sp_ = std::move(p.sp_); return

              reference operator*() {return *sp_;}
        const reference operator*() const {return *sp_;}


deep_const<shared_ptr<std::string> > sp;


Boost list run by bdawes at, gregod at, cpdaniel at, john at