Update of /cvsroot/boost/boost/boost/interprocess/smart_ptr
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22035/smart_ptr
Modified Files:
scoped_ptr.hpp shared_ptr.hpp
Log Message:
New Interprocess version
Index: scoped_ptr.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/interprocess/smart_ptr/scoped_ptr.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- scoped_ptr.hpp 23 Jun 2007 12:53:01 -0000 1.5
+++ scoped_ptr.hpp 22 Jul 2007 14:06:05 -0000 1.6
@@ -17,20 +17,21 @@
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/detail/pointer_type.hpp>
#include <boost/assert.hpp>
namespace boost {
namespace interprocess {
-/*!scoped_ptr stores a pointer to a dynamically allocated object.
- The object pointed to is guaranteed to be deleted, either on destruction
- of the scoped_ptr, or via an explicit reset. The user can avoid this
- deletion using release().
- scoped_ptr is parameterized on T (the type of the object pointed to) and
- Deleter (the functor to be executed to delete the internal pointer).
- The internal pointer will be of the same pointer type as typename
- Deleter::pointer type (that is, if typename Deleter::pointer is
- offset_ptr<void>, the internal pointer will be offset_ptr<T>).*/
+//!scoped_ptr stores a pointer to a dynamically allocated object.
+//!The object pointed to is guaranteed to be deleted, either on destruction
+//!of the scoped_ptr, or via an explicit reset. The user can avoid this
+//!deletion using release().
+//!scoped_ptr is parameterized on T (the type of the object pointed to) and
+//!Deleter (the functor to be executed to delete the internal pointer).
+//!The internal pointer will be of the same pointer type as typename
+//!Deleter::pointer type (that is, if typename Deleter::pointer is
+//!offset_ptr<void>, the internal pointer will be offset_ptr<T>).
template<class T, class Deleter>
class scoped_ptr
: private Deleter
@@ -45,21 +46,22 @@
public:
- /*!Provides the type of the stored pointer.*/
typedef T element_type;
+ typedef Deleter deleter_type;
+ typedef typename detail::pointer_type<T, Deleter>::type pointer;
- /*!Provides the type of the internal stored pointer.*/
- typedef typename detail::pointer_to_other
- <typename Deleter::pointer, T>::type pointer;
+ //!Provides the type of the internal stored pointer
+// typedef typename detail::pointer_to_other
+// <typename Deleter::pointer, T>::type pointer;
- /*!Constructs a scoped_ptr, storing a copy of p(which can be 0) and d.
- Does not throw.*/
+ //!Constructs a scoped_ptr, storing a copy of p(which can be 0) and d.
+ //!Does not throw.
explicit scoped_ptr(const pointer &p = 0, const Deleter &d = Deleter())
: Deleter(d), m_ptr(p) // throws if pointer/Deleter copy ctor throws
{}
- /*!If the stored pointer is not 0, destroys the object pointed to by the
stored pointer.
- calling the operator() of the stored deleter. Never throws*/
+ //!If the stored pointer is not 0, destroys the object pointed to by the
stored pointer.
+ //!calling the operator() of the stored deleter. Never throws
~scoped_ptr()
{
if(m_ptr){
@@ -68,54 +70,60 @@
}
}
- /*!Deletes the object pointed to by the stored pointer and then
- stores a copy of p. Never throws*/
+ //!Deletes the object pointed to by the stored pointer and then
+ //!stores a copy of p. Never throws
void reset(const pointer &p = 0) // never throws
{ BOOST_ASSERT(p == 0 || p != m_ptr); this_type(p).swap(*this); }
- /*!Deletes the object pointed to by the stored pointer and then
- stores a copy of p and a copy of d.*/
+ //!Deletes the object pointed to by the stored pointer and then
+ //!stores a copy of p and a copy of d.
void reset(const pointer &p, const Deleter &d) // never throws
{ BOOST_ASSERT(p == 0 || p != m_ptr); this_type(p).swap(*this); }
- /*!Assigns internal pointer as 0 and returns previous pointer. This will
- avoid deletion on destructor*/
+ //!Assigns internal pointer as 0 and returns previous pointer. This will
+ //!avoid deletion on destructor
pointer release()
{ pointer tmp(m_ptr); m_ptr = 0; return tmp; }
- /*!Returns a reference to the object pointed to by the stored pointer.
- Never throws.*/
+ //!Returns a reference to the object pointed to by the stored pointer.
+ //!Never throws.
reference operator*() const
{ BOOST_ASSERT(m_ptr != 0); return *m_ptr; }
- /*!Returns the internal stored pointer.*/
- pointer &operator->() // never throws
+ //!Returns the internal stored pointer.
+ //!Never throws.
+ pointer &operator->()
{ BOOST_ASSERT(m_ptr != 0); return m_ptr; }
- /*!Returns the internal stored pointer. Never throws.*/
+ //!Returns the internal stored pointer.
+ //!Never throws.
const pointer &operator->() const
{ BOOST_ASSERT(m_ptr != 0); return m_ptr; }
- /*!Returns the stored pointer. Never throws.*/
+ //!Returns the stored pointer.
+ //!Never throws.
pointer & get()
{ return m_ptr; }
- /*!Returns the stored pointer. Never throws.*/
+ //!Returns the stored pointer.
+ //!Never throws.
const pointer & get() const
{ return m_ptr; }
- // implicit conversion to "bool"
typedef pointer this_type::*unspecified_bool_type;
- operator unspecified_bool_type() const // never throws
+ //!Conversion to bool
+ //!Never throws
+ operator unspecified_bool_type() const
{ return m_ptr == 0? 0: &this_type::m_ptr; }
- /*!Returns true if the stored pointer is 0. Never throws.*/
+ //!Returns true if the stored pointer is 0.
+ //!Never throws.
bool operator! () const // never throws
{ return m_ptr == 0; }
- /*!Exchanges the internal pointer and deleter with other scoped_ptr
- Never throws.*/
+ //!Exchanges the internal pointer and deleter with other scoped_ptr
+ //!Never throws.
void swap(scoped_ptr & b) // never throws
{ detail::do_swap<Deleter>(*this, b); detail::do_swap(m_ptr, b.m_ptr); }
@@ -125,13 +133,14 @@
/// @endcond
};
-/*!Exchanges the internal pointer and deleter with other scoped_ptr
- Never throws.*/
+//!Exchanges the internal pointer and deleter with other scoped_ptr
+//!Never throws.
template<class T, class D> inline
-void swap(scoped_ptr<T, D> & a, scoped_ptr<T, D> & b) // never throws
+void swap(scoped_ptr<T, D> & a, scoped_ptr<T, D> & b)
{ a.swap(b); }
-/*!Returns a copy of the stored pointer*/
+//!Returns a copy of the stored pointer
+//!Never throws
template<class T, class D> inline
typename scoped_ptr<T, D>::pointer get_pointer(scoped_ptr<T, D> const & p)
{ return p.get(); }
@@ -139,12 +148,13 @@
} // namespace interprocess
/// @cond
+
#if defined(_MSC_VER) && (_MSC_VER < 1400)
-/*!Returns a copy of the stored pointer*/
template<class T, class D> inline
T *get_pointer(boost::interprocess::scoped_ptr<T, D> const & p)
{ return p.get(); }
#endif
+
/// @endcond
} // namespace boost
Index: shared_ptr.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/interprocess/smart_ptr/shared_ptr.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- shared_ptr.hpp 23 Jun 2007 12:53:01 -0000 1.5
+++ shared_ptr.hpp 22 Jul 2007 14:06:05 -0000 1.6
@@ -274,12 +274,14 @@
} // namespace interprocess
/// @cond
+
#if defined(_MSC_VER) && (_MSC_VER < 1400)
// get_pointer() enables boost::mem_fn to recognize shared_ptr
template<class T, class VA, class D> inline
T * get_pointer(boost::interprocess::shared_ptr<T, VA, D> const & p)
{ return p.get(); }
#endif
+
/// @endcond
} // namespace boost
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs