mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 12:02:36 +08:00
Implement LWG#2873: 'Add noexcept to several shared_ptr related functions' This issue missed a couple, so I added those as well (see LWG#2942)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299963 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -433,8 +433,8 @@ public:
|
|||||||
long use_count() const noexcept;
|
long use_count() const noexcept;
|
||||||
bool unique() const noexcept;
|
bool unique() const noexcept;
|
||||||
explicit operator bool() const noexcept;
|
explicit operator bool() const noexcept;
|
||||||
template<class U> bool owner_before(shared_ptr<U> const& b) const;
|
template<class U> bool owner_before(shared_ptr<U> const& b) const noexcept;
|
||||||
template<class U> bool owner_before(weak_ptr<U> const& b) const;
|
template<class U> bool owner_before(weak_ptr<U> const& b) const noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
// shared_ptr comparisons:
|
// shared_ptr comparisons:
|
||||||
@@ -531,8 +531,8 @@ public:
|
|||||||
long use_count() const noexcept;
|
long use_count() const noexcept;
|
||||||
bool expired() const noexcept;
|
bool expired() const noexcept;
|
||||||
shared_ptr<T> lock() const noexcept;
|
shared_ptr<T> lock() const noexcept;
|
||||||
template<class U> bool owner_before(shared_ptr<U> const& b) const;
|
template<class U> bool owner_before(shared_ptr<U> const& b) const noexcept;
|
||||||
template<class U> bool owner_before(weak_ptr<U> const& b) const;
|
template<class U> bool owner_before(weak_ptr<U> const& b) const noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
// weak_ptr specialized algorithms:
|
// weak_ptr specialized algorithms:
|
||||||
@@ -546,9 +546,9 @@ struct owner_less<shared_ptr<T>>
|
|||||||
: binary_function<shared_ptr<T>, shared_ptr<T>, bool>
|
: binary_function<shared_ptr<T>, shared_ptr<T>, bool>
|
||||||
{
|
{
|
||||||
typedef bool result_type;
|
typedef bool result_type;
|
||||||
bool operator()(shared_ptr<T> const&, shared_ptr<T> const&) const;
|
bool operator()(shared_ptr<T> const&, shared_ptr<T> const&) const noexcept;
|
||||||
bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
|
bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const noexcept;
|
||||||
bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
|
bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -556,9 +556,24 @@ struct owner_less<weak_ptr<T>>
|
|||||||
: binary_function<weak_ptr<T>, weak_ptr<T>, bool>
|
: binary_function<weak_ptr<T>, weak_ptr<T>, bool>
|
||||||
{
|
{
|
||||||
typedef bool result_type;
|
typedef bool result_type;
|
||||||
bool operator()(weak_ptr<T> const&, weak_ptr<T> const&) const;
|
bool operator()(weak_ptr<T> const&, weak_ptr<T> const&) const noexcept;
|
||||||
bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
|
bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const noexcept;
|
||||||
bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
|
bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> // Added in C++14
|
||||||
|
struct owner_less<void>
|
||||||
|
{
|
||||||
|
template <class _Tp, class _Up>
|
||||||
|
bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const noexcept;
|
||||||
|
template <class _Tp, class _Up>
|
||||||
|
bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const noexcept;
|
||||||
|
template <class _Tp, class _Up>
|
||||||
|
bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const noexcept;
|
||||||
|
template <class _Tp, class _Up>
|
||||||
|
bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const noexcept;
|
||||||
|
|
||||||
|
typedef void is_transparent;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -3807,11 +3822,11 @@ public:
|
|||||||
_LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return get() != 0;}
|
_LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return get() != 0;}
|
||||||
template <class _Up>
|
template <class _Up>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool owner_before(shared_ptr<_Up> const& __p) const
|
bool owner_before(shared_ptr<_Up> const& __p) const _NOEXCEPT
|
||||||
{return __cntrl_ < __p.__cntrl_;}
|
{return __cntrl_ < __p.__cntrl_;}
|
||||||
template <class _Up>
|
template <class _Up>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool owner_before(weak_ptr<_Up> const& __p) const
|
bool owner_before(weak_ptr<_Up> const& __p) const _NOEXCEPT
|
||||||
{return __cntrl_ < __p.__cntrl_;}
|
{return __cntrl_ < __p.__cntrl_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
@@ -4907,11 +4922,11 @@ public:
|
|||||||
shared_ptr<_Tp> lock() const _NOEXCEPT;
|
shared_ptr<_Tp> lock() const _NOEXCEPT;
|
||||||
template<class _Up>
|
template<class _Up>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool owner_before(const shared_ptr<_Up>& __r) const
|
bool owner_before(const shared_ptr<_Up>& __r) const _NOEXCEPT
|
||||||
{return __cntrl_ < __r.__cntrl_;}
|
{return __cntrl_ < __r.__cntrl_;}
|
||||||
template<class _Up>
|
template<class _Up>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool owner_before(const weak_ptr<_Up>& __r) const
|
bool owner_before(const weak_ptr<_Up>& __r) const _NOEXCEPT
|
||||||
{return __cntrl_ < __r.__cntrl_;}
|
{return __cntrl_ < __r.__cntrl_;}
|
||||||
|
|
||||||
template <class _Up> friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
|
template <class _Up> friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
|
||||||
@@ -5120,13 +5135,13 @@ struct _LIBCPP_TEMPLATE_VIS owner_less<shared_ptr<_Tp> >
|
|||||||
{
|
{
|
||||||
typedef bool result_type;
|
typedef bool result_type;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const
|
bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT
|
||||||
{return __x.owner_before(__y);}
|
{return __x.owner_before(__y);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const
|
bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT
|
||||||
{return __x.owner_before(__y);}
|
{return __x.owner_before(__y);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const
|
bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT
|
||||||
{return __x.owner_before(__y);}
|
{return __x.owner_before(__y);}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5136,13 +5151,13 @@ struct _LIBCPP_TEMPLATE_VIS owner_less<weak_ptr<_Tp> >
|
|||||||
{
|
{
|
||||||
typedef bool result_type;
|
typedef bool result_type;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const
|
bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT
|
||||||
{return __x.owner_before(__y);}
|
{return __x.owner_before(__y);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const
|
bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT
|
||||||
{return __x.owner_before(__y);}
|
{return __x.owner_before(__y);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const
|
bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT
|
||||||
{return __x.owner_before(__y);}
|
{return __x.owner_before(__y);}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5152,19 +5167,19 @@ struct _LIBCPP_TEMPLATE_VIS owner_less<void>
|
|||||||
{
|
{
|
||||||
template <class _Tp, class _Up>
|
template <class _Tp, class _Up>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const
|
bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT
|
||||||
{return __x.owner_before(__y);}
|
{return __x.owner_before(__y);}
|
||||||
template <class _Tp, class _Up>
|
template <class _Tp, class _Up>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const
|
bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT
|
||||||
{return __x.owner_before(__y);}
|
{return __x.owner_before(__y);}
|
||||||
template <class _Tp, class _Up>
|
template <class _Tp, class _Up>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const
|
bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT
|
||||||
{return __x.owner_before(__y);}
|
{return __x.owner_before(__y);}
|
||||||
template <class _Tp, class _Up>
|
template <class _Tp, class _Up>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const
|
bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT
|
||||||
{return __x.owner_before(__y);}
|
{return __x.owner_before(__y);}
|
||||||
typedef void is_transparent;
|
typedef void is_transparent;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,10 +11,11 @@
|
|||||||
|
|
||||||
// shared_ptr
|
// shared_ptr
|
||||||
|
|
||||||
// template <class U> bool owner_before(shared_ptr<U> const& b) const;
|
// template <class U> bool owner_before(shared_ptr<U> const& b) const noexcept;
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@@ -25,4 +26,5 @@ int main()
|
|||||||
assert(!p2.owner_before(p1));
|
assert(!p2.owner_before(p1));
|
||||||
assert(p1.owner_before(p3) || p3.owner_before(p1));
|
assert(p1.owner_before(p3) || p3.owner_before(p1));
|
||||||
assert(p3.owner_before(p1) == p3.owner_before(p2));
|
assert(p3.owner_before(p1) == p3.owner_before(p2));
|
||||||
|
ASSERT_NOEXCEPT(p1.owner_before(p2));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,11 @@
|
|||||||
|
|
||||||
// shared_ptr
|
// shared_ptr
|
||||||
|
|
||||||
// template <class U> bool owner_before(weak_ptr<U> const& b) const;
|
// template <class U> bool owner_before(weak_ptr<U> const& b) const noexcept;
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@@ -28,4 +29,5 @@ int main()
|
|||||||
assert(!p2.owner_before(w1));
|
assert(!p2.owner_before(w1));
|
||||||
assert(p1.owner_before(w3) || p3.owner_before(w1));
|
assert(p1.owner_before(w3) || p3.owner_before(w1));
|
||||||
assert(p3.owner_before(w1) == p3.owner_before(w2));
|
assert(p3.owner_before(w1) == p3.owner_before(w2));
|
||||||
|
ASSERT_NOEXCEPT(p1.owner_before(w2));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,9 @@
|
|||||||
// : binary_function<shared_ptr<T>, shared_ptr<T>, bool>
|
// : binary_function<shared_ptr<T>, shared_ptr<T>, bool>
|
||||||
// {
|
// {
|
||||||
// typedef bool result_type;
|
// typedef bool result_type;
|
||||||
// bool operator()(shared_ptr<T> const&, shared_ptr<T> const&) const;
|
// bool operator()(shared_ptr<T> const&, shared_ptr<T> const&) const noexcept;
|
||||||
// bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
|
// bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const noexcept;
|
||||||
// bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
|
// bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const noexcept;
|
||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
// template <class T>
|
// template <class T>
|
||||||
@@ -26,22 +26,22 @@
|
|||||||
// : binary_function<weak_ptr<T>, weak_ptr<T>, bool>
|
// : binary_function<weak_ptr<T>, weak_ptr<T>, bool>
|
||||||
// {
|
// {
|
||||||
// typedef bool result_type;
|
// typedef bool result_type;
|
||||||
// bool operator()(weak_ptr<T> const&, weak_ptr<T> const&) const;
|
// bool operator()(weak_ptr<T> const&, weak_ptr<T> const&) const noexcept;
|
||||||
// bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
|
// bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const noexcept;
|
||||||
// bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
|
// bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const noexcept;
|
||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
// Added in C++17
|
// Added in C++17
|
||||||
// template<> struct owner_less<void>
|
// template<> struct owner_less<void>
|
||||||
// {
|
// {
|
||||||
// template<class T, class U>
|
// template<class T, class U>
|
||||||
// bool operator()(shared_ptr<T> const&, shared_ptr<U> const&) const;
|
// bool operator()(shared_ptr<T> const&, shared_ptr<U> const&) const noexcept;
|
||||||
// template<class T, class U>
|
// template<class T, class U>
|
||||||
// bool operator()(shared_ptr<T> const&, weak_ptr<U> const&) const;
|
// bool operator()(shared_ptr<T> const&, weak_ptr<U> const&) const noexcept;
|
||||||
// template<class T, class U>
|
// template<class T, class U>
|
||||||
// bool operator()(weak_ptr<T> const&, shared_ptr<U> const&) const;
|
// bool operator()(weak_ptr<T> const&, shared_ptr<U> const&) const noexcept;
|
||||||
// template<class T, class U>
|
// template<class T, class U>
|
||||||
// bool operator()(weak_ptr<T> const&, weak_ptr<U> const&) const;
|
// bool operator()(weak_ptr<T> const&, weak_ptr<U> const&) const noexcept;
|
||||||
//
|
//
|
||||||
// typedef unspecified is_transparent;
|
// typedef unspecified is_transparent;
|
||||||
// };
|
// };
|
||||||
@@ -69,16 +69,19 @@ int main()
|
|||||||
static_assert((std::is_same<std::shared_ptr<int>, CS::first_argument_type>::value), "" );
|
static_assert((std::is_same<std::shared_ptr<int>, CS::first_argument_type>::value), "" );
|
||||||
static_assert((std::is_same<std::shared_ptr<int>, CS::second_argument_type>::value), "" );
|
static_assert((std::is_same<std::shared_ptr<int>, CS::second_argument_type>::value), "" );
|
||||||
static_assert((std::is_same<bool, CS::result_type>::value), "" );
|
static_assert((std::is_same<bool, CS::result_type>::value), "" );
|
||||||
|
|
||||||
assert(!cs(p1, p2));
|
assert(!cs(p1, p2));
|
||||||
assert(!cs(p2, p1));
|
assert(!cs(p2, p1));
|
||||||
assert(cs(p1 ,p3) || cs(p3, p1));
|
assert(cs(p1 ,p3) || cs(p3, p1));
|
||||||
assert(cs(p3, p1) == cs(p3, p2));
|
assert(cs(p3, p1) == cs(p3, p2));
|
||||||
|
ASSERT_NOEXCEPT(cs(p1, p1));
|
||||||
|
|
||||||
assert(!cs(p1, w2));
|
assert(!cs(p1, w2));
|
||||||
assert(!cs(p2, w1));
|
assert(!cs(p2, w1));
|
||||||
assert(cs(p1, w3) || cs(p3, w1));
|
assert(cs(p1, w3) || cs(p3, w1));
|
||||||
assert(cs(p3, w1) == cs(p3, w2));
|
assert(cs(p3, w1) == cs(p3, w2));
|
||||||
|
ASSERT_NOEXCEPT(cs(p1, w1));
|
||||||
|
ASSERT_NOEXCEPT(cs(w1, p1));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef std::owner_less<std::weak_ptr<int> > CS;
|
typedef std::owner_less<std::weak_ptr<int> > CS;
|
||||||
@@ -92,11 +95,14 @@ int main()
|
|||||||
assert(!cs(w2, w1));
|
assert(!cs(w2, w1));
|
||||||
assert(cs(w1, w3) || cs(w3, w1));
|
assert(cs(w1, w3) || cs(w3, w1));
|
||||||
assert(cs(w3, w1) == cs(w3, w2));
|
assert(cs(w3, w1) == cs(w3, w2));
|
||||||
|
ASSERT_NOEXCEPT(cs(w1, w1));
|
||||||
|
|
||||||
assert(!cs(w1, p2));
|
assert(!cs(w1, p2));
|
||||||
assert(!cs(w2, p1));
|
assert(!cs(w2, p1));
|
||||||
assert(cs(w1, p3) || cs(w3, p1));
|
assert(cs(w1, p3) || cs(w3, p1));
|
||||||
assert(cs(w3, p1) == cs(w3, p2));
|
assert(cs(w3, p1) == cs(w3, p2));
|
||||||
|
ASSERT_NOEXCEPT(cs(w1, p1));
|
||||||
|
ASSERT_NOEXCEPT(cs(p1, w1));
|
||||||
}
|
}
|
||||||
#if TEST_STD_VER > 14
|
#if TEST_STD_VER > 14
|
||||||
{
|
{
|
||||||
@@ -111,6 +117,10 @@ int main()
|
|||||||
cmp(sp1, sp3);
|
cmp(sp1, sp3);
|
||||||
cmp(wp1, sp1);
|
cmp(wp1, sp1);
|
||||||
cmp(wp1, wp1);
|
cmp(wp1, wp1);
|
||||||
|
ASSERT_NOEXCEPT(cmp(sp1, sp1));
|
||||||
|
ASSERT_NOEXCEPT(cmp(sp1, wp1));
|
||||||
|
ASSERT_NOEXCEPT(cmp(wp1, sp1));
|
||||||
|
ASSERT_NOEXCEPT(cmp(wp1, wp1));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// test heterogeneous lookups
|
// test heterogeneous lookups
|
||||||
|
|||||||
@@ -11,10 +11,11 @@
|
|||||||
|
|
||||||
// weak_ptr
|
// weak_ptr
|
||||||
|
|
||||||
// template<class U> bool owner_before(const shared_ptr<U>& b);
|
// template<class U> bool owner_before(const shared_ptr<U>& b) const noexcept;
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@@ -28,4 +29,6 @@ int main()
|
|||||||
assert(!w2.owner_before(p1));
|
assert(!w2.owner_before(p1));
|
||||||
assert(w1.owner_before(p3) || w3.owner_before(p1));
|
assert(w1.owner_before(p3) || w3.owner_before(p1));
|
||||||
assert(w3.owner_before(p1) == w3.owner_before(p2));
|
assert(w3.owner_before(p1) == w3.owner_before(p2));
|
||||||
|
// change to 'ASSERT_NOEXCEPT' when LWG2942 is adopted
|
||||||
|
LIBCPP_ASSERT_NOEXCEPT(w1.owner_before(p2));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,11 @@
|
|||||||
|
|
||||||
// weak_ptr
|
// weak_ptr
|
||||||
|
|
||||||
// template<class U> bool owner_before(const weak_ptr<U>& b);
|
// template<class U> bool owner_before(const weak_ptr<U>& b) const noexcept;
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@@ -28,4 +29,6 @@ int main()
|
|||||||
assert(!w2.owner_before(w1));
|
assert(!w2.owner_before(w1));
|
||||||
assert(w1.owner_before(w3) || w3.owner_before(w1));
|
assert(w1.owner_before(w3) || w3.owner_before(w1));
|
||||||
assert(w3.owner_before(w1) == w3.owner_before(w2));
|
assert(w3.owner_before(w1) == w3.owner_before(w2));
|
||||||
|
// change to 'ASSERT_NOEXCEPT' when LWG2942 is adopted
|
||||||
|
LIBCPP_ASSERT_NOEXCEPT(w1.owner_before(w2));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -465,11 +465,11 @@
|
|||||||
<tr><td><a href="http://wg21.link/LWG2853">2853</a></td><td>Possible inconsistency in specification of erase in [vector.modifiers]</td><td>Kona</td><td></td></tr>
|
<tr><td><a href="http://wg21.link/LWG2853">2853</a></td><td>Possible inconsistency in specification of erase in [vector.modifiers]</td><td>Kona</td><td></td></tr>
|
||||||
<tr><td><a href="http://wg21.link/LWG2855">2855</a></td><td>std::throw_with_nested("string_literal")</td><td>Kona</td><td></td></tr>
|
<tr><td><a href="http://wg21.link/LWG2855">2855</a></td><td>std::throw_with_nested("string_literal")</td><td>Kona</td><td></td></tr>
|
||||||
<tr><td><a href="http://wg21.link/LWG2857">2857</a></td><td>{variant,optional,any}::emplace should return the constructed value</td><td>Kona</td><td></td></tr>
|
<tr><td><a href="http://wg21.link/LWG2857">2857</a></td><td>{variant,optional,any}::emplace should return the constructed value</td><td>Kona</td><td></td></tr>
|
||||||
<tr><td><a href="http://wg21.link/LWG2861">2861</a></td><td>basic_string should require that charT match traits::char_type</td><td>Kona</td><td>Clow</td></tr>
|
<tr><td><a href="http://wg21.link/LWG2861">2861</a></td><td>basic_string should require that charT match traits::char_type</td><td>Kona</td><td>Complete</td></tr>
|
||||||
<tr><td><a href="http://wg21.link/LWG2866">2866</a></td><td>Incorrect derived classes constraints</td><td>Kona</td><td></td></tr>
|
<tr><td><a href="http://wg21.link/LWG2866">2866</a></td><td>Incorrect derived classes constraints</td><td>Kona</td><td></td></tr>
|
||||||
<tr><td><a href="http://wg21.link/LWG2868">2868</a></td><td>Missing specification of bad_any_cast::what()</td><td>Kona</td><td>Complete</td></tr>
|
<tr><td><a href="http://wg21.link/LWG2868">2868</a></td><td>Missing specification of bad_any_cast::what()</td><td>Kona</td><td>Complete</td></tr>
|
||||||
<tr><td><a href="http://wg21.link/LWG2872">2872</a></td><td>Add definition for direct-non-list-initialization</td><td>Kona</td><td>Complete</td></tr>
|
<tr><td><a href="http://wg21.link/LWG2872">2872</a></td><td>Add definition for direct-non-list-initialization</td><td>Kona</td><td>Complete</td></tr>
|
||||||
<tr><td><a href="http://wg21.link/LWG2873">2873</a></td><td>Add noexcept to several shared_ptr related functions</td><td>Kona</td><td></td></tr>
|
<tr><td><a href="http://wg21.link/LWG2873">2873</a></td><td>Add noexcept to several shared_ptr related functions</td><td>Kona</td><td>Complete</td></tr>
|
||||||
<tr><td><a href="http://wg21.link/LWG2874">2874</a></td><td>Constructor shared_ptr::shared_ptr(Y*) should be constrained</td><td>Kona</td><td></td></tr>
|
<tr><td><a href="http://wg21.link/LWG2874">2874</a></td><td>Constructor shared_ptr::shared_ptr(Y*) should be constrained</td><td>Kona</td><td></td></tr>
|
||||||
<tr><td><a href="http://wg21.link/LWG2875">2875</a></td><td>shared_ptr::shared_ptr(Y*, D, […]) constructors should be constrained</td><td>Kona</td><td></td></tr>
|
<tr><td><a href="http://wg21.link/LWG2875">2875</a></td><td>shared_ptr::shared_ptr(Y*, D, […]) constructors should be constrained</td><td>Kona</td><td></td></tr>
|
||||||
<tr><td><a href="http://wg21.link/LWG2876">2876</a></td><td>shared_ptr::shared_ptr(const weak_ptr<Y>&) constructor should be constrained</td><td>Kona</td><td></td></tr>
|
<tr><td><a href="http://wg21.link/LWG2876">2876</a></td><td>shared_ptr::shared_ptr(const weak_ptr<Y>&) constructor should be constrained</td><td>Kona</td><td></td></tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user