// Copyright (C) 2012-2016 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // . // { dg-do compile { target c++11 } } // libstdc++/52591 #include #include #include // As an extension we allow move-assignment of std::vector when the element // type is not MoveAssignable, as long as the allocator type propagates or // is known to always compare equal. struct C { C& operator=(C&&) = delete; }; template struct A1 : std::allocator { template struct rebind { typedef A1 other; }; A1() = default; template A1(const A1&) { } using propagate_on_container_move_assignment = std::true_type; }; void test01() { using test_type = std::vector>; static_assert(std::is_nothrow_move_assignable::value, "vector is nothrow move-assignable if allocator propagates"); } template struct A2 : std::allocator { template struct rebind { typedef A1 other; }; A2() = default; template A2(const A2&) { } using propagate_on_container_move_assignment = std::false_type; using is_always_equal = std::true_type; }; void test02() { using test_type = std::vector>; static_assert(std::is_nothrow_move_assignable::value, "vector is nothrow move-assignable if allocator is always equal"); }