Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // <string> |
| 11 | |
| 12 | // basic_string(basic_string<charT,traits,Allocator>&& str); |
| 13 | |
| 14 | #include <string> |
| 15 | #include <cassert> |
| 16 | |
| 17 | #ifdef _LIBCPP_MOVE |
| 18 | |
| 19 | #include "../test_allocator.h" |
| 20 | |
| 21 | template <class S> |
| 22 | void |
| 23 | test(S s0) |
| 24 | { |
| 25 | S s1 = s0; |
| 26 | S s2 = std::move(s0); |
| 27 | assert(s2.__invariants()); |
| 28 | assert(s0.__invariants()); |
| 29 | assert(s2 == s1); |
| 30 | assert(s2.capacity() >= s2.size()); |
| 31 | assert(s2.get_allocator() == s1.get_allocator()); |
| 32 | } |
| 33 | |
Howard Hinnant | 6e0a1f4 | 2010-08-22 00:47:54 +0000 | [diff] [blame] | 34 | #endif // _LIBCPP_MOVE |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 35 | |
| 36 | int main() |
| 37 | { |
| 38 | #ifdef _LIBCPP_MOVE |
| 39 | typedef test_allocator<char> A; |
| 40 | typedef std::basic_string<char, std::char_traits<char>, A> S; |
| 41 | test(S(A(3))); |
| 42 | test(S("1", A(5))); |
| 43 | test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A(7))); |
Howard Hinnant | 6e0a1f4 | 2010-08-22 00:47:54 +0000 | [diff] [blame] | 44 | #endif // _LIBCPP_MOVE |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 45 | } |