Fixed Trac #12256 (set<std::pair<int,int>>::insert cause compilation error in debug configuration in Visual Studio 2012)

This commit is contained in:
Ion Gaztañaga
2016-08-09 00:59:39 +02:00
parent 4122e722a4
commit 37c1558a81
4 changed files with 27 additions and 6 deletions

View File

@@ -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<std::pair<int,int>>::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.

View File

@@ -53,16 +53,16 @@ struct value_to_node_compare
{}
bool operator()(const Node &a, const Node &b) const
{ return static_cast<const Pred&>(*this)(a.m_data, b.m_data); }
{ return static_cast<const Pred&>(*this)(a.get_data(), b.get_data()); }
bool operator()(const Node &a) const
{ return static_cast<const Pred&>(*this)(a.m_data); }
{ return static_cast<const Pred&>(*this)(a.get_data()); }
bool operator()(const Node &a, const Node &b)
{ return static_cast<Pred&>(*this)(a.m_data, b.m_data); }
{ return static_cast<Pred&>(*this)(a.get_data(), b.get_data()); }
bool operator()(const Node &a)
{ return static_cast<Pred&>(*this)(a.m_data); }
{ return static_cast<Pred&>(*this)(a.get_data()); }
predicate_type & predicate() { return static_cast<predicate_type&>(*this); }
const predicate_type & predicate() const { return static_cast<predicate_type&>(*this); }

View File

@@ -242,6 +242,17 @@ int main ()
test_move<multimap<recursive_multimap, recursive_multimap> >();
}
//Test std::pair value type as tree has workarounds to make old std::pair
//implementations movable that can break things
{
typedef std::pair<int,int> pair_t;
boost::container::map<pair_t, pair_t> s;
std::pair<const pair_t,pair_t> p;
s.insert(p);
s.emplace(p);
return 0;
}
////////////////////////////////////
// Testing allocator implementations
////////////////////////////////////

View File

@@ -264,6 +264,15 @@ int main ()
test_move<set<recursive_set> >();
test_move<multiset<recursive_multiset> >();
}
//Test std::pair value type as tree has workarounds to make old std::pair
//implementations movable that can break things
{
boost::container::set<std::pair<int,int> > s;
std::pair<int,int> p(0, 0);
s.insert(p);
s.emplace(p);
return 0;
}
////////////////////////////////////
// Testing allocator implementations