Cleanup _LIBCPP_HAS_NO_<c++11-feature> in support headers and final tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300637 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
#include "asan_testing.h"
|
#include "asan_testing.h"
|
||||||
|
|
||||||
class X {
|
class X {
|
||||||
@@ -70,7 +71,7 @@ void test_push_back() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void test_emplace_back() {
|
void test_emplace_back() {
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
#if TEST_STD_VER >= 11
|
||||||
std::vector<X> v;
|
std::vector<X> v;
|
||||||
v.reserve(2);
|
v.reserve(2);
|
||||||
v.push_back(X(2));
|
v.push_back(X(2));
|
||||||
@@ -83,7 +84,7 @@ void test_emplace_back() {
|
|||||||
}
|
}
|
||||||
assert(v.size() == 1);
|
assert(v.size() == 1);
|
||||||
assert(is_contiguous_container_asan_correct(v));
|
assert(is_contiguous_container_asan_correct(v));
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_insert_range() {
|
void test_insert_range() {
|
||||||
@@ -121,7 +122,7 @@ void test_insert() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void test_emplace() {
|
void test_emplace() {
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
#if TEST_STD_VER >= 11
|
||||||
std::vector<X> v;
|
std::vector<X> v;
|
||||||
v.reserve(3);
|
v.reserve(3);
|
||||||
v.insert(v.end(), X(1));
|
v.insert(v.end(), X(1));
|
||||||
@@ -135,7 +136,7 @@ void test_emplace() {
|
|||||||
}
|
}
|
||||||
assert(v.size() == 2);
|
assert(v.size() == 2);
|
||||||
assert(is_contiguous_container_asan_correct(v));
|
assert(is_contiguous_container_asan_correct(v));
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_insert_range2() {
|
void test_insert_range2() {
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ int main()
|
|||||||
static_assert(( std::__libcpp_is_trivial_iterator<std::basic_string<char>::reverse_iterator> ::value), "");
|
static_assert(( std::__libcpp_is_trivial_iterator<std::basic_string<char>::reverse_iterator> ::value), "");
|
||||||
static_assert(( std::__libcpp_is_trivial_iterator<std::basic_string<char>::const_reverse_iterator>::value), "");
|
static_assert(( std::__libcpp_is_trivial_iterator<std::basic_string<char>::const_reverse_iterator>::value), "");
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#if TEST_STD_VER >= 11
|
||||||
// Initializer list (which has no reverse iterators)
|
// Initializer list (which has no reverse iterators)
|
||||||
static_assert(( std::__libcpp_is_trivial_iterator<std::initializer_list<char>::iterator> ::value), "");
|
static_assert(( std::__libcpp_is_trivial_iterator<std::initializer_list<char>::iterator> ::value), "");
|
||||||
static_assert(( std::__libcpp_is_trivial_iterator<std::initializer_list<char>::const_iterator> ::value), "");
|
static_assert(( std::__libcpp_is_trivial_iterator<std::initializer_list<char>::const_iterator> ::value), "");
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ int main()
|
|||||||
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::reverse_iterator> ::value), "");
|
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::reverse_iterator> ::value), "");
|
||||||
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::const_reverse_iterator>::value), "");
|
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::const_reverse_iterator>::value), "");
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#if TEST_STD_VER >= 11
|
||||||
// Initializer list (which has no reverse iterators)
|
// Initializer list (which has no reverse iterators)
|
||||||
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::iterator> ::value), "");
|
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::iterator> ::value), "");
|
||||||
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::const_iterator> ::value), "");
|
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::const_iterator> ::value), "");
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
#include "test_iterators.h"
|
#include "test_iterators.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
@@ -72,7 +73,7 @@ int main()
|
|||||||
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::reverse_iterator> ::value), "");
|
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::reverse_iterator> ::value), "");
|
||||||
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::const_reverse_iterator>::value), "");
|
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::basic_string<char>::const_reverse_iterator>::value), "");
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#if TEST_STD_VER >= 11
|
||||||
// Initializer list (which has no reverse iterators)
|
// Initializer list (which has no reverse iterators)
|
||||||
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::iterator> ::value), "");
|
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::iterator> ::value), "");
|
||||||
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::const_iterator> ::value), "");
|
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::initializer_list<char>::const_iterator> ::value), "");
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
// UNSUPPORTED: c++98, c++03
|
||||||
|
|
||||||
// type_traits
|
// type_traits
|
||||||
|
|
||||||
// extension
|
// extension
|
||||||
@@ -16,7 +18,6 @@
|
|||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
|
|
||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
@@ -54,11 +55,9 @@ struct J
|
|||||||
constexpr J* operator&() const &&;
|
constexpr J* operator&() const &&;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
static_assert(std::__has_operator_addressof<int>::value == false, "");
|
static_assert(std::__has_operator_addressof<int>::value == false, "");
|
||||||
static_assert(std::__has_operator_addressof<A>::value == false, "");
|
static_assert(std::__has_operator_addressof<A>::value == false, "");
|
||||||
static_assert(std::__has_operator_addressof<B>::value == true, "");
|
static_assert(std::__has_operator_addressof<B>::value == true, "");
|
||||||
@@ -67,5 +66,4 @@ int main()
|
|||||||
static_assert(std::__has_operator_addressof<G>::value == true, "");
|
static_assert(std::__has_operator_addressof<G>::value == true, "");
|
||||||
static_assert(std::__has_operator_addressof<H>::value == true, "");
|
static_assert(std::__has_operator_addressof<H>::value == true, "");
|
||||||
static_assert(std::__has_operator_addressof<J>::value == true, "");
|
static_assert(std::__has_operator_addressof<J>::value == true, "");
|
||||||
#endif // _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
#include <functional> // for std::hash
|
#include <functional> // for std::hash
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
struct Counter_base { static int gConstructed; };
|
struct Counter_base { static int gConstructed; };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@@ -22,7 +24,7 @@ public:
|
|||||||
Counter(const T &data) : data_(data) { ++gConstructed; }
|
Counter(const T &data) : data_(data) { ++gConstructed; }
|
||||||
Counter(const Counter& rhs) : data_(rhs.data_) { ++gConstructed; }
|
Counter(const Counter& rhs) : data_(rhs.data_) { ++gConstructed; }
|
||||||
Counter& operator=(const Counter& rhs) { ++gConstructed; data_ = rhs.data_; return *this; }
|
Counter& operator=(const Counter& rhs) { ++gConstructed; data_ = rhs.data_; return *this; }
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#if TEST_STD_VER >= 11
|
||||||
Counter(Counter&& rhs) : data_(std::move(rhs.data_)) { ++gConstructed; }
|
Counter(Counter&& rhs) : data_(std::move(rhs.data_)) { ++gConstructed; }
|
||||||
Counter& operator=(Counter&& rhs) { ++gConstructed; data_ = std::move(rhs.data_); return *this; }
|
Counter& operator=(Counter&& rhs) { ++gConstructed; data_ = std::move(rhs.data_); return *this; }
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#if TEST_STD_VER >= 11
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@@ -49,6 +49,6 @@ struct hash<MoveOnly>
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // TEST_STD_VER >= 11
|
||||||
|
|
||||||
#endif // MOVEONLY_H
|
#endif // MOVEONLY_H
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#if TEST_STD_VER >= 11
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class A1
|
class A1
|
||||||
@@ -186,6 +186,6 @@ bool operator!=(const A3<T>& x, const A3<U>& y)
|
|||||||
return !(x == y);
|
return !(x == y);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // TEST_STD_VER >= 11
|
||||||
|
|
||||||
#endif // ALLOCATORS_H
|
#endif // ALLOCATORS_H
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
explicit nasty_vector(size_type n) : v_(n) {}
|
explicit nasty_vector(size_type n) : v_(n) {}
|
||||||
nasty_vector(size_type n, const value_type& value) : v_(n, value) {}
|
nasty_vector(size_type n, const value_type& value) : v_(n, value) {}
|
||||||
template <class InputIterator> nasty_vector(InputIterator first, InputIterator last) : v_(first, last) {}
|
template <class InputIterator> nasty_vector(InputIterator first, InputIterator last) : v_(first, last) {}
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#if TEST_STD_VER >= 11
|
||||||
nasty_vector(std::initializer_list<value_type> il) : v_(il) {}
|
nasty_vector(std::initializer_list<value_type> il) : v_(il) {}
|
||||||
#endif
|
#endif
|
||||||
~nasty_vector() {}
|
~nasty_vector() {}
|
||||||
@@ -47,7 +47,7 @@ public:
|
|||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
void assign(InputIterator first, InputIterator last) { v_.assign(first, last); }
|
void assign(InputIterator first, InputIterator last) { v_.assign(first, last); }
|
||||||
void assign(size_type n, const value_type& u) { v_.assign(n, u); }
|
void assign(size_type n, const value_type& u) { v_.assign(n, u); }
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#if TEST_STD_VER >= 11
|
||||||
void assign(std::initializer_list<value_type> il) { v_.assign(il); }
|
void assign(std::initializer_list<value_type> il) { v_.assign(il); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -87,24 +87,20 @@ public:
|
|||||||
const value_type* data() const TEST_NOEXCEPT { return v_.data(); }
|
const value_type* data() const TEST_NOEXCEPT { return v_.data(); }
|
||||||
|
|
||||||
void push_back(const value_type& x) { v_.push_back(x); }
|
void push_back(const value_type& x) { v_.push_back(x); }
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#if TEST_STD_VER >= 11
|
||||||
void push_back(value_type&& x) { v_.push_back(std::forward<value_type&&>(x)); }
|
void push_back(value_type&& x) { v_.push_back(std::forward<value_type&&>(x)); }
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
template <class... Args>
|
template <class... Args>
|
||||||
void emplace_back(Args&&... args) { v_.emplace_back(std::forward<Args>(args)...); }
|
void emplace_back(Args&&... args) { v_.emplace_back(std::forward<Args>(args)...); }
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
void pop_back() { v_.pop_back(); }
|
void pop_back() { v_.pop_back(); }
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#if TEST_STD_VER >= 11
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
template <class... Args> iterator emplace(const_iterator pos, Args&&... args)
|
template <class... Args> iterator emplace(const_iterator pos, Args&&... args)
|
||||||
{ return v_.emplace(pos, std::forward<Args>(args)...); }
|
{ return v_.emplace(pos, std::forward<Args>(args)...); }
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
iterator insert(const_iterator pos, const value_type& x) { return v_.insert(pos, x); }
|
iterator insert(const_iterator pos, const value_type& x) { return v_.insert(pos, x); }
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#if TEST_STD_VER >= 11
|
||||||
iterator insert(const_iterator pos, value_type&& x) { return v_.insert(pos, std::forward<value_type>(x)); }
|
iterator insert(const_iterator pos, value_type&& x) { return v_.insert(pos, std::forward<value_type>(x)); }
|
||||||
#endif
|
#endif
|
||||||
iterator insert(const_iterator pos, size_type n, const value_type& x) { return v_.insert(pos, n, x); }
|
iterator insert(const_iterator pos, size_type n, const value_type& x) { return v_.insert(pos, n, x); }
|
||||||
@@ -112,7 +108,7 @@ public:
|
|||||||
iterator insert(const_iterator pos, InputIterator first, InputIterator last)
|
iterator insert(const_iterator pos, InputIterator first, InputIterator last)
|
||||||
{ return v_.insert(pos, first, last); }
|
{ return v_.insert(pos, first, last); }
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#if TEST_STD_VER >= 11
|
||||||
iterator insert(const_iterator pos, std::initializer_list<value_type> il) { return v_.insert(pos, il); }
|
iterator insert(const_iterator pos, std::initializer_list<value_type> il) { return v_.insert(pos, il); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -166,19 +162,19 @@ public:
|
|||||||
nasty_list(size_type n, const value_type& value) : l_(n,value) {}
|
nasty_list(size_type n, const value_type& value) : l_(n,value) {}
|
||||||
template <class Iter>
|
template <class Iter>
|
||||||
nasty_list(Iter first, Iter last) : l_(first, last) {}
|
nasty_list(Iter first, Iter last) : l_(first, last) {}
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#if TEST_STD_VER >= 11
|
||||||
nasty_list(std::initializer_list<value_type> il) : l_(il) {}
|
nasty_list(std::initializer_list<value_type> il) : l_(il) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
~nasty_list() {}
|
~nasty_list() {}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#if TEST_STD_VER >= 11
|
||||||
nasty_list& operator=(std::initializer_list<value_type> il) { l_ = il; return *this; }
|
nasty_list& operator=(std::initializer_list<value_type> il) { l_ = il; return *this; }
|
||||||
#endif
|
#endif
|
||||||
template <class Iter>
|
template <class Iter>
|
||||||
void assign(Iter first, Iter last) { l_.assign(first, last); }
|
void assign(Iter first, Iter last) { l_.assign(first, last); }
|
||||||
void assign(size_type n, const value_type& t) { l_.assign(n, t); }
|
void assign(size_type n, const value_type& t) { l_.assign(n, t); }
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#if TEST_STD_VER >= 11
|
||||||
void assign(std::initializer_list<value_type> il) { l_.assign(il); }
|
void assign(std::initializer_list<value_type> il) { l_.assign(il); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -209,28 +205,24 @@ public:
|
|||||||
|
|
||||||
void push_front(const value_type& x) { l_.push_front(x); }
|
void push_front(const value_type& x) { l_.push_front(x); }
|
||||||
void push_back(const value_type& x) { l_.push_back(x); }
|
void push_back(const value_type& x) { l_.push_back(x); }
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#if TEST_STD_VER >= 11
|
||||||
void push_back(value_type&& x) { l_.push_back(std::forward<value_type&&>(x)); }
|
void push_back(value_type&& x) { l_.push_back(std::forward<value_type&&>(x)); }
|
||||||
void push_front(value_type&& x) { l_.push_back(std::forward<value_type&&>(x)); }
|
void push_front(value_type&& x) { l_.push_back(std::forward<value_type&&>(x)); }
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
template <class... Args>
|
template <class... Args>
|
||||||
void emplace_back(Args&&... args) { l_.emplace_back(std::forward<Args>(args)...); }
|
void emplace_back(Args&&... args) { l_.emplace_back(std::forward<Args>(args)...); }
|
||||||
template <class... Args>
|
template <class... Args>
|
||||||
void emplace_front(Args&&... args) { l_.emplace_front(std::forward<Args>(args)...); }
|
void emplace_front(Args&&... args) { l_.emplace_front(std::forward<Args>(args)...); }
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
void pop_front() { l_.pop_front(); }
|
void pop_front() { l_.pop_front(); }
|
||||||
void pop_back() { l_.pop_back(); }
|
void pop_back() { l_.pop_back(); }
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#if TEST_STD_VER >= 11
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
template <class... Args> iterator emplace(const_iterator pos, Args&&... args)
|
template <class... Args> iterator emplace(const_iterator pos, Args&&... args)
|
||||||
{ return l_.emplace(pos, std::forward<Args>(args)...); }
|
{ return l_.emplace(pos, std::forward<Args>(args)...); }
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
iterator insert(const_iterator pos, const value_type& x) { return l_.insert(pos, x); }
|
iterator insert(const_iterator pos, const value_type& x) { return l_.insert(pos, x); }
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#if TEST_STD_VER >= 11
|
||||||
iterator insert(const_iterator pos, value_type&& x) { return l_.insert(pos, std::forward<value_type>(x)); }
|
iterator insert(const_iterator pos, value_type&& x) { return l_.insert(pos, std::forward<value_type>(x)); }
|
||||||
#endif
|
#endif
|
||||||
iterator insert(const_iterator pos, size_type n, const value_type& x) { return l_.insert(pos, n, x); }
|
iterator insert(const_iterator pos, size_type n, const value_type& x) { return l_.insert(pos, n, x); }
|
||||||
@@ -238,7 +230,7 @@ public:
|
|||||||
iterator insert(const_iterator pos, InputIterator first, InputIterator last)
|
iterator insert(const_iterator pos, InputIterator first, InputIterator last)
|
||||||
{ return l_.insert(pos, first, last); }
|
{ return l_.insert(pos, first, last); }
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#if TEST_STD_VER >= 11
|
||||||
iterator insert(const_iterator pos, std::initializer_list<value_type> il) { return l_.insert(pos, il); }
|
iterator insert(const_iterator pos, std::initializer_list<value_type> il) { return l_.insert(pos, il); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
struct TrackedValue {
|
struct TrackedValue {
|
||||||
enum State { CONSTRUCTED, MOVED_FROM, DESTROYED };
|
enum State { CONSTRUCTED, MOVED_FROM, DESTROYED };
|
||||||
State state;
|
State state;
|
||||||
@@ -22,7 +24,7 @@ struct TrackedValue {
|
|||||||
assert(t.state != State::DESTROYED && "copying a destroyed object");
|
assert(t.state != State::DESTROYED && "copying a destroyed object");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#if TEST_STD_VER >= 11
|
||||||
TrackedValue(TrackedValue&& t) : state(State::CONSTRUCTED) {
|
TrackedValue(TrackedValue&& t) : state(State::CONSTRUCTED) {
|
||||||
assert(t.state != State::MOVED_FROM && "double moving from an object");
|
assert(t.state != State::MOVED_FROM && "double moving from an object");
|
||||||
assert(t.state != State::DESTROYED && "moving from a destroyed object");
|
assert(t.state != State::DESTROYED && "moving from a destroyed object");
|
||||||
@@ -38,7 +40,7 @@ struct TrackedValue {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#if TEST_STD_VER >= 11
|
||||||
TrackedValue& operator=(TrackedValue&& t) {
|
TrackedValue& operator=(TrackedValue&& t) {
|
||||||
assert(state != State::DESTROYED && "move assigning into destroyed object");
|
assert(state != State::DESTROYED && "move assigning into destroyed object");
|
||||||
assert(t.state != State::MOVED_FROM && "double moving from an object");
|
assert(t.state != State::MOVED_FROM && "double moving from an object");
|
||||||
|
|||||||
Reference in New Issue
Block a user