mirror of git://gcc.gnu.org/git/gcc.git
boost_shared_ptr.h: Trivial formatting fixes.
2006-09-22 Paolo Carlini <pcarlini@suse.de> * include/tr1/boost_shared_ptr.h: Trivial formatting fixes. From-SVN: r117145
This commit is contained in:
parent
53e3e587a9
commit
459f9f82ec
|
|
@ -1,3 +1,7 @@
|
||||||
|
2006-09-22 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
|
* include/tr1/boost_shared_ptr.h: Trivial formatting fixes.
|
||||||
|
|
||||||
2006-09-21 Benjamin Kosnik <bkoz@redhat.com>
|
2006-09-21 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
* include/ext/type_traits.h (__numeric_traits_integer): New.
|
* include/ext/type_traits.h (__numeric_traits_integer): New.
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,8 @@ class bad_weak_ptr : public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual char const*
|
virtual char const*
|
||||||
what() const throw() { return "tr1::bad_weak_ptr"; }
|
what() const throw()
|
||||||
|
{ return "tr1::bad_weak_ptr"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Substitute for bad_weak_ptr object in the case of -fno-exceptions.
|
// Substitute for bad_weak_ptr object in the case of -fno-exceptions.
|
||||||
|
|
@ -102,7 +103,6 @@ template<>
|
||||||
class _Mutex_base<_S_mutex> : public __gnu_cxx::__mutex
|
class _Mutex_base<_S_mutex> : public __gnu_cxx::__mutex
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
|
|
||||||
template<_Lock_policy _Lp = __default_lock_policy>
|
template<_Lock_policy _Lp = __default_lock_policy>
|
||||||
class _Sp_counted_base : public _Mutex_base<_Lp>
|
class _Sp_counted_base : public _Mutex_base<_Lp>
|
||||||
{
|
{
|
||||||
|
|
@ -217,7 +217,8 @@ template<>
|
||||||
// Replace the current counter value with the old value + 1, as
|
// Replace the current counter value with the old value + 1, as
|
||||||
// long as it's not changed meanwhile.
|
// long as it's not changed meanwhile.
|
||||||
}
|
}
|
||||||
while (!__sync_bool_compare_and_swap(&_M_use_count, __count, __count + 1));
|
while (!__sync_bool_compare_and_swap(&_M_use_count, __count,
|
||||||
|
__count + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Ptr, typename _Deleter, _Lock_policy _Lp>
|
template<typename _Ptr, typename _Deleter, _Lock_policy _Lp>
|
||||||
|
|
@ -278,7 +279,8 @@ template<_Lock_policy _Lp = __default_lock_policy>
|
||||||
|
|
||||||
// Special case for auto_ptr<_Tp> to provide the strong guarantee.
|
// Special case for auto_ptr<_Tp> to provide the strong guarantee.
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
explicit shared_count(std::auto_ptr<_Tp>& __r)
|
explicit
|
||||||
|
shared_count(std::auto_ptr<_Tp>& __r)
|
||||||
: _M_pi(new _Sp_counted_base_impl<_Tp*,
|
: _M_pi(new _Sp_counted_base_impl<_Tp*,
|
||||||
_Sp_deleter<_Tp>, _Lp >(__r.get(), _Sp_deleter<_Tp>()))
|
_Sp_deleter<_Tp>, _Lp >(__r.get(), _Sp_deleter<_Tp>()))
|
||||||
{ __r.release(); }
|
{ __r.release(); }
|
||||||
|
|
@ -314,7 +316,8 @@ template<_Lock_policy _Lp = __default_lock_policy>
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap(shared_count& __r) // nothrow
|
void
|
||||||
|
swap(shared_count& __r) // nothrow
|
||||||
{
|
{
|
||||||
_Sp_counted_base<_Lp>* __tmp = __r._M_pi;
|
_Sp_counted_base<_Lp>* __tmp = __r._M_pi;
|
||||||
__r._M_pi = _M_pi;
|
__r._M_pi = _M_pi;
|
||||||
|
|
@ -422,7 +425,8 @@ template<_Lock_policy _Lp>
|
||||||
|
|
||||||
template<_Lock_policy _Lp>
|
template<_Lock_policy _Lp>
|
||||||
inline
|
inline
|
||||||
shared_count<_Lp>::shared_count(const weak_count<_Lp>& __r)
|
shared_count<_Lp>::
|
||||||
|
shared_count(const weak_count<_Lp>& __r)
|
||||||
: _M_pi(__r._M_pi)
|
: _M_pi(__r._M_pi)
|
||||||
{
|
{
|
||||||
if (_M_pi != 0)
|
if (_M_pi != 0)
|
||||||
|
|
@ -448,24 +452,24 @@ struct __dynamic_cast_tag { };
|
||||||
struct __polymorphic_cast_tag { };
|
struct __polymorphic_cast_tag { };
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
struct shared_ptr_traits
|
struct __shared_ptr_reference
|
||||||
{ typedef _Tp& reference; };
|
{ typedef _Tp& __type; };
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct shared_ptr_traits<void>
|
struct __shared_ptr_reference<void>
|
||||||
{ typedef void reference; };
|
{ typedef void __type; };
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct shared_ptr_traits<void const>
|
struct __shared_ptr_reference<void const>
|
||||||
{ typedef void reference; };
|
{ typedef void __type; };
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct shared_ptr_traits<void volatile>
|
struct __shared_ptr_reference<void volatile>
|
||||||
{ typedef void reference; };
|
{ typedef void __type; };
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct shared_ptr_traits<void const volatile>
|
struct __shared_ptr_reference<void const volatile>
|
||||||
{ typedef void reference; };
|
{ typedef void __type; };
|
||||||
|
|
||||||
|
|
||||||
// Support for enable_shared_from_this.
|
// Support for enable_shared_from_this.
|
||||||
|
|
@ -474,8 +478,8 @@ template<>
|
||||||
template<_Lock_policy _Lp, typename _Tp1, typename _Tp2>
|
template<_Lock_policy _Lp, typename _Tp1, typename _Tp2>
|
||||||
void
|
void
|
||||||
__enable_shared_from_this_helper(const shared_count<_Lp>&,
|
__enable_shared_from_this_helper(const shared_count<_Lp>&,
|
||||||
const __enable_shared_from_this<_Tp1, _Lp>*,
|
const __enable_shared_from_this<_Tp1,
|
||||||
const _Tp2*);
|
_Lp>*, const _Tp2*);
|
||||||
|
|
||||||
template<_Lock_policy _Lp>
|
template<_Lock_policy _Lp>
|
||||||
inline void
|
inline void
|
||||||
|
|
@ -487,13 +491,13 @@ template<_Lock_policy _Lp>
|
||||||
* @class shared_ptr <tr1/memory>
|
* @class shared_ptr <tr1/memory>
|
||||||
*
|
*
|
||||||
* A smart pointer with reference-counted copy semantics.
|
* A smart pointer with reference-counted copy semantics.
|
||||||
* The object pointed to is deleted when the last shared_ptr pointing to it
|
* The object pointed to is deleted when the last shared_ptr pointing to
|
||||||
* is destroyed or reset.
|
* it is destroyed or reset.
|
||||||
*/
|
*/
|
||||||
template<typename _Tp, _Lock_policy _Lp>
|
template<typename _Tp, _Lock_policy _Lp>
|
||||||
class __shared_ptr
|
class __shared_ptr
|
||||||
{
|
{
|
||||||
typedef typename shared_ptr_traits<_Tp>::reference _Reference;
|
typedef typename __shared_ptr_reference<_Tp>::__type _Reference;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef _Tp element_type;
|
typedef _Tp element_type;
|
||||||
|
|
@ -511,7 +515,8 @@ template<typename _Tp, _Lock_policy _Lp>
|
||||||
* @throw std::bad_alloc, in which case @c delete @a p is called.
|
* @throw std::bad_alloc, in which case @c delete @a p is called.
|
||||||
*/
|
*/
|
||||||
template<typename _Tp1>
|
template<typename _Tp1>
|
||||||
explicit __shared_ptr(_Tp1* __p)
|
explicit
|
||||||
|
__shared_ptr(_Tp1* __p)
|
||||||
: _M_ptr(__p), _M_refcount(__p, _Sp_deleter<_Tp1>())
|
: _M_ptr(__p), _M_refcount(__p, _Sp_deleter<_Tp1>())
|
||||||
{
|
{
|
||||||
__glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
|
__glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
|
||||||
|
|
@ -542,8 +547,9 @@ template<typename _Tp, _Lock_policy _Lp>
|
||||||
|
|
||||||
// generated copy constructor, assignment, destructor are fine.
|
// generated copy constructor, assignment, destructor are fine.
|
||||||
|
|
||||||
/** @brief If @a r is empty, constructs an empty %__shared_ptr; otherwise
|
/** @brief If @a r is empty, constructs an empty %__shared_ptr;
|
||||||
* construct a %__shared_ptr that shares ownership with @a r.
|
* otherwise construct a %__shared_ptr that shares ownership
|
||||||
|
* with @a r.
|
||||||
* @param r A %__shared_ptr.
|
* @param r A %__shared_ptr.
|
||||||
* @post get() == r.get() && use_count() == r.use_count()
|
* @post get() == r.get() && use_count() == r.use_count()
|
||||||
* @throw std::bad_alloc, in which case
|
* @throw std::bad_alloc, in which case
|
||||||
|
|
@ -561,7 +567,8 @@ template<typename _Tp, _Lock_policy _Lp>
|
||||||
* in which case the constructor has no effect.
|
* in which case the constructor has no effect.
|
||||||
*/
|
*/
|
||||||
template<typename _Tp1>
|
template<typename _Tp1>
|
||||||
explicit __shared_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
|
explicit
|
||||||
|
__shared_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
|
||||||
: _M_refcount(__r._M_refcount) // may throw
|
: _M_refcount(__r._M_refcount) // may throw
|
||||||
{
|
{
|
||||||
__glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
|
__glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
|
||||||
|
|
@ -574,7 +581,8 @@ template<typename _Tp, _Lock_policy _Lp>
|
||||||
* @post use_count() == 1 and r.get() == 0
|
* @post use_count() == 1 and r.get() == 0
|
||||||
*/
|
*/
|
||||||
template<typename _Tp1>
|
template<typename _Tp1>
|
||||||
explicit __shared_ptr(std::auto_ptr<_Tp1>& __r)
|
explicit
|
||||||
|
__shared_ptr(std::auto_ptr<_Tp1>& __r)
|
||||||
: _M_ptr(__r.get()), _M_refcount()
|
: _M_ptr(__r.get()), _M_refcount()
|
||||||
{
|
{
|
||||||
// TODO requires r.release() convertible to _Tp*, Tp1 is complete,
|
// TODO requires r.release() convertible to _Tp*, Tp1 is complete,
|
||||||
|
|
@ -1001,7 +1009,8 @@ template<typename _Tp>
|
||||||
shared_ptr() : __shared_ptr<_Tp>() { }
|
shared_ptr() : __shared_ptr<_Tp>() { }
|
||||||
|
|
||||||
template<typename _Tp1>
|
template<typename _Tp1>
|
||||||
explicit shared_ptr(_Tp1* __p)
|
explicit
|
||||||
|
shared_ptr(_Tp1* __p)
|
||||||
: __shared_ptr<_Tp>(__p) { }
|
: __shared_ptr<_Tp>(__p) { }
|
||||||
|
|
||||||
template<typename _Tp1, typename _Deleter>
|
template<typename _Tp1, typename _Deleter>
|
||||||
|
|
@ -1013,11 +1022,13 @@ template<typename _Tp>
|
||||||
: __shared_ptr<_Tp>(__r) { }
|
: __shared_ptr<_Tp>(__r) { }
|
||||||
|
|
||||||
template<typename _Tp1>
|
template<typename _Tp1>
|
||||||
explicit shared_ptr(const __weak_ptr<_Tp1>& __r)
|
explicit
|
||||||
|
shared_ptr(const __weak_ptr<_Tp1>& __r)
|
||||||
: __shared_ptr<_Tp>(__r) { }
|
: __shared_ptr<_Tp>(__r) { }
|
||||||
|
|
||||||
template<typename _Tp1>
|
template<typename _Tp1>
|
||||||
explicit shared_ptr(std::auto_ptr<_Tp1>& __r)
|
explicit
|
||||||
|
shared_ptr(std::auto_ptr<_Tp1>& __r)
|
||||||
: __shared_ptr<_Tp>(__r) { }
|
: __shared_ptr<_Tp>(__r) { }
|
||||||
|
|
||||||
template<typename _Tp1>
|
template<typename _Tp1>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue