Sha256: e63860b69d25326ea21efbd9e837c226b743f9adc3f7d38e125c570bc5387363

Contents?: true

Size: 1.57 KB

Versions: 30

Compression:

Stored size: 1.57 KB

Contents

#ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
#define BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED

//
//  enable_shared_from_this.hpp
//
//  Copyright (c) 2002 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
//  http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html
//

#include <boost/weak_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/assert.hpp>
#include <boost/config.hpp>

namespace boost
{

template<class T> class enable_shared_from_this
{
protected:

    enable_shared_from_this()
    {
    }

    enable_shared_from_this(enable_shared_from_this const &)
    {
    }

    enable_shared_from_this & operator=(enable_shared_from_this const &)
    {
        return *this;
    }

    ~enable_shared_from_this()
    {
    }

public:

    shared_ptr<T> shared_from_this()
    {
        shared_ptr<T> p(_internal_weak_this);
        BOOST_ASSERT(p.get() == this);
        return p;
    }

    shared_ptr<T const> shared_from_this() const
    {
        shared_ptr<T const> p(_internal_weak_this);
        BOOST_ASSERT(p.get() == this);
        return p;
    }

//  Note: No, you don't need to initialize _internal_weak_this
//
//  Please read the documentation, not the code
//
//  http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html

    typedef T _internal_element_type; // for bcc 5.5.1
    mutable weak_ptr<_internal_element_type> _internal_weak_this;
};

} // namespace boost

#endif  // #ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED

Version data entries

30 entries across 30 versions & 5 rubygems

Version Path
rockdog-passenger-0.0.1 ext/boost/enable_shared_from_this.hpp
vanity-1.7.1 vendor/ruby/1.9.1/gems/passenger-2.2.15/ext/boost/enable_shared_from_this.hpp
passenger-2.2.15 ext/boost/enable_shared_from_this.hpp
passenger-2.2.14 ext/boost/enable_shared_from_this.hpp
passenger-2.2.13 ext/boost/enable_shared_from_this.hpp
passenger-2.2.12 ext/boost/enable_shared_from_this.hpp
colouringcode-passenger-0.2 ext/boost/enable_shared_from_this.hpp
passenger-2.2.11 ext/boost/enable_shared_from_this.hpp
passenger-jmazzi-2.2.10 ext/boost/enable_shared_from_this.hpp
passenger-2.2.10 ext/boost/enable_shared_from_this.hpp
passenger-jmazzi-2.2.9 ext/boost/enable_shared_from_this.hpp
passenger-2.2.9 ext/boost/enable_shared_from_this.hpp
passenger-2.2.8 ext/boost/enable_shared_from_this.hpp
colouringcode-passenger-0.1 ext/boost/enable_shared_from_this.hpp
passenger-2.2.7 ext/boost/enable_shared_from_this.hpp
passenger-2.2.6 ext/boost/enable_shared_from_this.hpp
passenger-2.2.5 ext/boost/enable_shared_from_this.hpp
passenger-2.2.3 ext/boost/enable_shared_from_this.hpp
passenger-2.2.4 ext/boost/enable_shared_from_this.hpp
passenger-2.0.1 ext/boost/enable_shared_from_this.hpp