diff options
Diffstat (limited to 'test/support')
| -rw-r--r-- | test/support/Counter.h | 4 | ||||
| -rw-r--r-- | test/support/MoveOnly.h | 4 | ||||
| -rw-r--r-- | test/support/allocators.h | 4 | ||||
| -rw-r--r-- | test/support/nasty_containers.hpp | 34 | ||||
| -rw-r--r-- | test/support/tracked_value.h | 6 | 
5 files changed, 24 insertions, 28 deletions
diff --git a/test/support/Counter.h b/test/support/Counter.h index eb6e04e72ef6..602f35f70671 100644 --- a/test/support/Counter.h +++ b/test/support/Counter.h @@ -12,6 +12,8 @@  #include <functional> // for std::hash +#include "test_macros.h" +  struct Counter_base { static int gConstructed; };  template <typename T> @@ -22,7 +24,7 @@ public:      Counter(const T &data) : data_(data)            { ++gConstructed; }      Counter(const Counter& rhs) : data_(rhs.data_)  { ++gConstructed; }      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& operator=(Counter&& rhs) { ++gConstructed; data_ = std::move(rhs.data_); return *this; }  #endif diff --git a/test/support/MoveOnly.h b/test/support/MoveOnly.h index 0ffb4ffe3b2f..4afa8aef7104 100644 --- a/test/support/MoveOnly.h +++ b/test/support/MoveOnly.h @@ -12,7 +12,7 @@  #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11  #include <cstddef>  #include <functional> @@ -49,6 +49,6 @@ struct hash<MoveOnly>  } -#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif  // TEST_STD_VER >= 11  #endif  // MOVEONLY_H diff --git a/test/support/allocators.h b/test/support/allocators.h index 4aa467f824aa..b1eea8d0b683 100644 --- a/test/support/allocators.h +++ b/test/support/allocators.h @@ -15,7 +15,7 @@  #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11  template <class T>  class A1 @@ -186,6 +186,6 @@ bool operator!=(const A3<T>& x, const A3<U>& y)      return !(x == y);  } -#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif  // TEST_STD_VER >= 11  #endif  // ALLOCATORS_H diff --git a/test/support/nasty_containers.hpp b/test/support/nasty_containers.hpp index dcad6c259ff6..99e91d617f6d 100644 --- a/test/support/nasty_containers.hpp +++ b/test/support/nasty_containers.hpp @@ -39,7 +39,7 @@ public:      explicit nasty_vector(size_type n) : v_(n) {}      nasty_vector(size_type n, const value_type& value) : v_(n, value) {}      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) {}  #endif      ~nasty_vector() {} @@ -47,7 +47,7 @@ public:      template <class InputIterator>          void assign(InputIterator first, InputIterator last) { v_.assign(first, last); }      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); }  #endif @@ -87,24 +87,20 @@ public:      const value_type* data() const TEST_NOEXCEPT { return v_.data(); }      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)); } -#ifndef _LIBCPP_HAS_NO_VARIADICS      template <class... Args>          void emplace_back(Args&&... args)   { v_.emplace_back(std::forward<Args>(args)...); }  #endif -#endif      void pop_back()                         { v_.pop_back(); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11      template <class... Args> iterator emplace(const_iterator pos, Args&&... args)      { return v_.emplace(pos, std::forward<Args>(args)...); }  #endif -#endif      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)); }  #endif      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)      { 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); }  #endif @@ -166,19 +162,19 @@ public:      nasty_list(size_type n, const value_type& value)  : l_(n,value) {}      template <class Iter>          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) {}  #endif      ~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; }  #endif      template <class Iter>          void assign(Iter first, Iter last) { l_.assign(first, last); }      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); }  #endif @@ -209,28 +205,24 @@ public:      void push_front(const value_type& x)    { l_.push_front(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_front(value_type&& x)         { l_.push_back(std::forward<value_type&&>(x)); } -#ifndef _LIBCPP_HAS_NO_VARIADICS      template <class... Args>          void emplace_back(Args&&... args)   { l_.emplace_back(std::forward<Args>(args)...); }      template <class... Args>          void emplace_front(Args&&... args)  { l_.emplace_front(std::forward<Args>(args)...); }  #endif -#endif      void pop_front()                        { l_.pop_front(); }      void pop_back()                         { l_.pop_back(); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11      template <class... Args> iterator emplace(const_iterator pos, Args&&... args)      { return l_.emplace(pos, std::forward<Args>(args)...); }  #endif -#endif      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)); }  #endif      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)      { 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); }  #endif diff --git a/test/support/tracked_value.h b/test/support/tracked_value.h index 14d96b88368e..6b75516e627b 100644 --- a/test/support/tracked_value.h +++ b/test/support/tracked_value.h @@ -11,6 +11,8 @@  #include <cassert> +#include "test_macros.h" +  struct TrackedValue {      enum State { CONSTRUCTED, MOVED_FROM, DESTROYED };      State state; @@ -22,7 +24,7 @@ struct TrackedValue {          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) {          assert(t.state != State::MOVED_FROM && "double moving from an object");          assert(t.state != State::DESTROYED  && "moving from a destroyed object"); @@ -38,7 +40,7 @@ struct TrackedValue {          return *this;      } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11      TrackedValue& operator=(TrackedValue&& t) {          assert(state != State::DESTROYED && "move assigning into destroyed object");          assert(t.state != State::MOVED_FROM && "double moving from an object");  | 
