mirror of git://gcc.gnu.org/git/gcc.git
Fix indentation of experimental::shared_ptr code
* include/experimental/bits/shared_ptr.h: Fix indentation. From-SVN: r241311
This commit is contained in:
parent
8a9ff71f5b
commit
6dddab0845
|
|
@ -1,5 +1,7 @@
|
||||||
2016-10-18 Jonathan Wakely <jwakely@redhat.com>
|
2016-10-18 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
* include/experimental/bits/shared_ptr.h: Fix indentation.
|
||||||
|
|
||||||
* include/experimental/bits/shared_ptr.h (shared_ptr(shared_ptr&&)):
|
* include/experimental/bits/shared_ptr.h (shared_ptr(shared_ptr&&)):
|
||||||
Remove const from parameter.
|
Remove const from parameter.
|
||||||
(operator<(const shared_ptr<T>&, nullptr_t)): Use correct
|
(operator<(const shared_ptr<T>&, nullptr_t)): Use correct
|
||||||
|
|
|
||||||
|
|
@ -768,170 +768,170 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
};
|
};
|
||||||
|
|
||||||
// C++14 §20.8.2.2.7 //DOING
|
// C++14 §20.8.2.2.7 //DOING
|
||||||
template<typename _Tp1, typename _Tp2>
|
template<typename _Tp1, typename _Tp2>
|
||||||
bool operator==(const shared_ptr<_Tp1>& __a,
|
bool operator==(const shared_ptr<_Tp1>& __a,
|
||||||
const shared_ptr<_Tp2>& __b) noexcept
|
const shared_ptr<_Tp2>& __b) noexcept
|
||||||
{ return __a.get() == __b.get(); }
|
{ return __a.get() == __b.get(); }
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
inline bool
|
inline bool
|
||||||
operator==(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
|
operator==(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
|
||||||
{ return !__a; }
|
{ return !__a; }
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
inline bool
|
inline bool
|
||||||
operator==(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
|
operator==(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
|
||||||
{ return !__a; }
|
{ return !__a; }
|
||||||
|
|
||||||
template<typename _Tp1, typename _Tp2>
|
template<typename _Tp1, typename _Tp2>
|
||||||
inline bool
|
inline bool
|
||||||
operator!=(const shared_ptr<_Tp1>& __a,
|
operator!=(const shared_ptr<_Tp1>& __a,
|
||||||
const shared_ptr<_Tp2>& __b) noexcept
|
|
||||||
{ return __a.get() != __b.get(); }
|
|
||||||
|
|
||||||
template<typename _Tp>
|
|
||||||
inline bool
|
|
||||||
operator!=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
|
|
||||||
{ return (bool)__a; }
|
|
||||||
|
|
||||||
template<typename _Tp>
|
|
||||||
inline bool
|
|
||||||
operator!=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
|
|
||||||
{ return (bool)__a; }
|
|
||||||
|
|
||||||
template<typename _Tp1, typename _Tp2>
|
|
||||||
inline bool
|
|
||||||
operator<(const shared_ptr<_Tp1>& __a,
|
|
||||||
const shared_ptr<_Tp2>& __b) noexcept
|
const shared_ptr<_Tp2>& __b) noexcept
|
||||||
{
|
{ return __a.get() != __b.get(); }
|
||||||
using __elem_t1 = typename shared_ptr<_Tp1>::element_type;
|
|
||||||
using __elem_t2 = typename shared_ptr<_Tp2>::element_type;
|
|
||||||
using _CT = common_type_t<__elem_t1*, __elem_t2*>;
|
|
||||||
return std::less<_CT>()(__a.get(), __b.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
inline bool
|
inline bool
|
||||||
operator<(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
|
operator!=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
|
||||||
{
|
{ return (bool)__a; }
|
||||||
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
|
||||||
return std::less<__elem_t*>()(__a.get(), nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
inline bool
|
inline bool
|
||||||
operator<(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
|
operator!=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
|
||||||
{
|
{ return (bool)__a; }
|
||||||
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
|
||||||
return std::less<__elem_t*>()(nullptr, __a.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename _Tp1, typename _Tp2>
|
template<typename _Tp1, typename _Tp2>
|
||||||
inline bool
|
inline bool
|
||||||
operator<=(const shared_ptr<_Tp1>& __a,
|
operator<(const shared_ptr<_Tp1>& __a,
|
||||||
const shared_ptr<_Tp2>& __b) noexcept
|
const shared_ptr<_Tp2>& __b) noexcept
|
||||||
{ return !(__b < __a); }
|
{
|
||||||
|
using __elem_t1 = typename shared_ptr<_Tp1>::element_type;
|
||||||
|
using __elem_t2 = typename shared_ptr<_Tp2>::element_type;
|
||||||
|
using _CT = common_type_t<__elem_t1*, __elem_t2*>;
|
||||||
|
return std::less<_CT>()(__a.get(), __b.get());
|
||||||
|
}
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
inline bool
|
inline bool
|
||||||
operator<=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
|
operator<(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
|
||||||
{ return !(nullptr < __a); }
|
{
|
||||||
|
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
||||||
|
return std::less<__elem_t*>()(__a.get(), nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
inline bool
|
inline bool
|
||||||
operator<=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
|
operator<(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
|
||||||
{ return !(__a < nullptr); }
|
{
|
||||||
|
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
||||||
|
return std::less<__elem_t*>()(nullptr, __a.get());
|
||||||
|
}
|
||||||
|
|
||||||
template<typename _Tp1, typename _Tp2>
|
template<typename _Tp1, typename _Tp2>
|
||||||
inline bool
|
inline bool
|
||||||
operator>(const shared_ptr<_Tp1>& __a,
|
operator<=(const shared_ptr<_Tp1>& __a,
|
||||||
const shared_ptr<_Tp2>& __b) noexcept
|
const shared_ptr<_Tp2>& __b) noexcept
|
||||||
{ return (__b < __a); }
|
{ return !(__b < __a); }
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
inline bool
|
inline bool
|
||||||
operator>(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
|
operator<=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
|
||||||
{
|
{ return !(nullptr < __a); }
|
||||||
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
|
||||||
return std::less<__elem_t*>()(nullptr, __a.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
inline bool
|
inline bool
|
||||||
operator>(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
|
operator<=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
|
||||||
{
|
{ return !(__a < nullptr); }
|
||||||
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
|
||||||
return std::less<__elem_t*>()(__a.get(), nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename _Tp1, typename _Tp2>
|
template<typename _Tp1, typename _Tp2>
|
||||||
inline bool
|
inline bool
|
||||||
operator>=(const shared_ptr<_Tp1>& __a,
|
operator>(const shared_ptr<_Tp1>& __a,
|
||||||
const shared_ptr<_Tp2>& __b) noexcept
|
const shared_ptr<_Tp2>& __b) noexcept
|
||||||
{ return !(__a < __b); }
|
{ return (__b < __a); }
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
inline bool
|
inline bool
|
||||||
operator>=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
|
operator>(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
|
||||||
{ return !(__a < nullptr); }
|
{
|
||||||
|
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
||||||
|
return std::less<__elem_t*>()(nullptr, __a.get());
|
||||||
|
}
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
inline bool
|
inline bool
|
||||||
operator>=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
|
operator>(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
|
||||||
{ return !(nullptr < __a); }
|
{
|
||||||
|
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
||||||
|
return std::less<__elem_t*>()(__a.get(), nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
// C++14 §20.8.2.2.8
|
template<typename _Tp1, typename _Tp2>
|
||||||
template<typename _Tp>
|
inline bool
|
||||||
inline void
|
operator>=(const shared_ptr<_Tp1>& __a,
|
||||||
swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>& __b) noexcept
|
const shared_ptr<_Tp2>& __b) noexcept
|
||||||
{ __a.swap(__b); }
|
{ return !(__a < __b); }
|
||||||
|
|
||||||
// 8.2.1.3, shared_ptr casts
|
template<typename _Tp>
|
||||||
template<typename _Tp, typename _Tp1>
|
inline bool
|
||||||
inline shared_ptr<_Tp>
|
operator>=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
|
||||||
static_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept
|
{ return !(__a < nullptr); }
|
||||||
{
|
|
||||||
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
|
||||||
return shared_ptr<_Tp>(__r, static_cast<__elem_t*>(__r.get()));
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename _Tp, typename _Tp1>
|
template<typename _Tp>
|
||||||
inline shared_ptr<_Tp>
|
inline bool
|
||||||
dynamic_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept
|
operator>=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
|
||||||
{
|
{ return !(nullptr < __a); }
|
||||||
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
|
||||||
if (_Tp* __p = dynamic_cast<__elem_t*>(__r.get()))
|
|
||||||
return shared_ptr<_Tp>(__r, __p);
|
|
||||||
return shared_ptr<_Tp>();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename _Tp, typename _Tp1>
|
// C++14 §20.8.2.2.8
|
||||||
inline shared_ptr<_Tp>
|
template<typename _Tp>
|
||||||
const_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept
|
inline void
|
||||||
{
|
swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>& __b) noexcept
|
||||||
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
{ __a.swap(__b); }
|
||||||
return shared_ptr<_Tp>(__r, const_cast<__elem_t*>(__r.get()));
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename _Tp, typename _Tp1>
|
// 8.2.1.3, shared_ptr casts
|
||||||
inline shared_ptr<_Tp>
|
template<typename _Tp, typename _Tp1>
|
||||||
reinterpret_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept
|
inline shared_ptr<_Tp>
|
||||||
{
|
static_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept
|
||||||
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
{
|
||||||
return shared_ptr<_Tp>(__r, reinterpret_cast<__elem_t*>(__r.get()));
|
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
||||||
}
|
return shared_ptr<_Tp>(__r, static_cast<__elem_t*>(__r.get()));
|
||||||
|
}
|
||||||
|
|
||||||
// C++14 §20.8.2.3
|
template<typename _Tp, typename _Tp1>
|
||||||
template<typename _Tp>
|
inline shared_ptr<_Tp>
|
||||||
class weak_ptr : public __weak_ptr<_Tp>
|
dynamic_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept
|
||||||
{
|
{
|
||||||
|
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
||||||
|
if (_Tp* __p = dynamic_cast<__elem_t*>(__r.get()))
|
||||||
|
return shared_ptr<_Tp>(__r, __p);
|
||||||
|
return shared_ptr<_Tp>();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename _Tp, typename _Tp1>
|
||||||
|
inline shared_ptr<_Tp>
|
||||||
|
const_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept
|
||||||
|
{
|
||||||
|
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
||||||
|
return shared_ptr<_Tp>(__r, const_cast<__elem_t*>(__r.get()));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename _Tp, typename _Tp1>
|
||||||
|
inline shared_ptr<_Tp>
|
||||||
|
reinterpret_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept
|
||||||
|
{
|
||||||
|
using __elem_t = typename shared_ptr<_Tp>::element_type;
|
||||||
|
return shared_ptr<_Tp>(__r, reinterpret_cast<__elem_t*>(__r.get()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// C++14 §20.8.2.3
|
||||||
|
template<typename _Tp>
|
||||||
|
class weak_ptr : public __weak_ptr<_Tp>
|
||||||
|
{
|
||||||
template<typename _Tp1, typename _Res = void>
|
template<typename _Tp1, typename _Res = void>
|
||||||
using _Compatible
|
using _Compatible
|
||||||
= enable_if_t<__sp_compatible<_Tp1, _Tp>::value, _Res>;
|
= enable_if_t<__sp_compatible<_Tp1, _Tp>::value, _Res>;
|
||||||
|
|
||||||
using _Base_type = __weak_ptr<_Tp>;
|
using _Base_type = __weak_ptr<_Tp>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
constexpr weak_ptr() noexcept = default;
|
constexpr weak_ptr() noexcept = default;
|
||||||
|
|
||||||
template<typename _Tp1, typename = _Compatible<_Tp1>>
|
template<typename _Tp1, typename = _Compatible<_Tp1>>
|
||||||
|
|
@ -985,13 +985,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
{ return shared_ptr<_Tp>(*this, std::nothrow); }
|
{ return shared_ptr<_Tp>(*this, std::nothrow); }
|
||||||
|
|
||||||
friend class enable_shared_from_this<_Tp>;
|
friend class enable_shared_from_this<_Tp>;
|
||||||
};
|
};
|
||||||
|
|
||||||
// C++14 §20.8.2.3.6
|
// C++14 §20.8.2.3.6
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
inline void
|
inline void
|
||||||
swap(weak_ptr<_Tp>& __a, weak_ptr<_Tp>& __b) noexcept
|
swap(weak_ptr<_Tp>& __a, weak_ptr<_Tp>& __b) noexcept
|
||||||
{ __a.swap(__b); }
|
{ __a.swap(__b); }
|
||||||
|
|
||||||
/// C++14 §20.8.2.2.10
|
/// C++14 §20.8.2.2.10
|
||||||
template<typename _Del, typename _Tp, _Lock_policy _Lp>
|
template<typename _Del, typename _Tp, _Lock_policy _Lp>
|
||||||
|
|
@ -1009,8 +1009,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
return __os;
|
return __os;
|
||||||
}
|
}
|
||||||
|
|
||||||
// C++14 §20.8.2.4
|
// C++14 §20.8.2.4
|
||||||
template<typename _Tp = void> class owner_less;
|
template<typename _Tp = void> class owner_less;
|
||||||
|
|
||||||
/// Partial specialization of owner_less for shared_ptr.
|
/// Partial specialization of owner_less for shared_ptr.
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue