From 37c1558a811ef1b320ac7b20fe0d938538c2930a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Tue, 9 Aug 2016 00:59:39 +0200 Subject: [PATCH] Fixed Trac #12256 (set>::insert cause compilation error in debug configuration in Visual Studio 2012) --- doc/container.qbk | 5 +++-- include/boost/container/detail/compare_functors.hpp | 8 ++++---- test/map_test.cpp | 11 +++++++++++ test/set_test.cpp | 9 +++++++++ 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/doc/container.qbk b/doc/container.qbk index bd83a1a..db96a11 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -1219,11 +1219,12 @@ use [*Boost.Container]? There are several reasons for that: * [@https://svn.boost.org/trac/boost/ticket/11170 Trac #11170: ['"Doc slip for index_of"]]. * [@https://svn.boost.org/trac/boost/ticket/12177 Trac #12177: ['"vector::priv_merge uses unqualified uintptr_t"]]. * [@https://svn.boost.org/trac/boost/ticket/12183 Trac #12183: ['"GCC 6.1 thinks boost::container::string violates strict aliasing"]]. + * [@https://svn.boost.org/trac/boost/ticket/12256 Trac #12256: ['"set>::insert cause compilation error in debug configuration in Visual Studio 2012"]]. + * [@https://svn.boost.org/trac/boost/ticket/12273 Trac #12273: ['"static_vector max_size() and capacity() should be constant expressions"]]. + Added constant `static_vector<>::static_capacity` to use the configured capacity in constant expressions. * [@https://svn.boost.org/trac/boost/ticket/12286 Trac #12286: ['"PMR flat_map from Boost Container does not compile"]]. * [@https://svn.boost.org/trac/boost/ticket/12296 Trac #12296: ['"{deque,string} combine for a memory leak"]]. * [@https://svn.boost.org/trac/boost/ticket/12319 Trac #12319: ['"flat_set` should be nothrow move constructible"]]. - * [@https://svn.boost.org/trac/boost/ticket/12273 Trac #12273: ['"static_vector max_size() and capacity() should be constant expressions"]]. - Added constant `static_vector<>::static_capacity` to use the configured capacity in constant expressions. * Revised noexcept expressions of default and move constructors in all containers. diff --git a/include/boost/container/detail/compare_functors.hpp b/include/boost/container/detail/compare_functors.hpp index 4220d50..28f9093 100644 --- a/include/boost/container/detail/compare_functors.hpp +++ b/include/boost/container/detail/compare_functors.hpp @@ -53,16 +53,16 @@ struct value_to_node_compare {} bool operator()(const Node &a, const Node &b) const - { return static_cast(*this)(a.m_data, b.m_data); } + { return static_cast(*this)(a.get_data(), b.get_data()); } bool operator()(const Node &a) const - { return static_cast(*this)(a.m_data); } + { return static_cast(*this)(a.get_data()); } bool operator()(const Node &a, const Node &b) - { return static_cast(*this)(a.m_data, b.m_data); } + { return static_cast(*this)(a.get_data(), b.get_data()); } bool operator()(const Node &a) - { return static_cast(*this)(a.m_data); } + { return static_cast(*this)(a.get_data()); } predicate_type & predicate() { return static_cast(*this); } const predicate_type & predicate() const { return static_cast(*this); } diff --git a/test/map_test.cpp b/test/map_test.cpp index aca18ca..df27b5c 100644 --- a/test/map_test.cpp +++ b/test/map_test.cpp @@ -242,6 +242,17 @@ int main () test_move >(); } + //Test std::pair value type as tree has workarounds to make old std::pair + //implementations movable that can break things + { + typedef std::pair pair_t; + boost::container::map s; + std::pair p; + s.insert(p); + s.emplace(p); + return 0; + } + //////////////////////////////////// // Testing allocator implementations //////////////////////////////////// diff --git a/test/set_test.cpp b/test/set_test.cpp index c59bd3d..c447060 100644 --- a/test/set_test.cpp +++ b/test/set_test.cpp @@ -264,6 +264,15 @@ int main () test_move >(); test_move >(); } + //Test std::pair value type as tree has workarounds to make old std::pair + //implementations movable that can break things + { + boost::container::set > s; + std::pair p(0, 0); + s.insert(p); + s.emplace(p); + return 0; + } //////////////////////////////////// // Testing allocator implementations