forked from boostorg/container
Rewrite [flat_]map/set insert overloads to be more standard compliant. Fixes #102 ("flat_map::insert ambiguous with initializer list & pairs that need to convert").
This commit is contained in:
1 parent
621cd3a0ab
commit
d7e99e56c6
7 files changed
+182
-234
No files matched your search
@@ -667,7 +667,7 @@ class flat_set
|
||||
private:
|
||||
typedef std::pair<iterator, bool> insert_return_pair;
|
||||
public:
|
||||
BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, insert_return_pair, this->priv_insert)
|
||||
BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, insert_return_pair, this->tree_t::insert_unique)
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
@@ -695,7 +695,7 @@ class flat_set
|
||||
//! <b>Note</b>: If an element is inserted it might invalidate elements.
|
||||
iterator insert(const_iterator p, value_type &&x);
|
||||
#else
|
||||
BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator)
|
||||
BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->tree_t::insert_unique, const_iterator, const_iterator)
|
||||
#endif
|
||||
|
||||
//! <b>Requires</b>: first, last are not iterators into *this.
|
||||
@@ -1117,17 +1117,6 @@ class flat_set
|
||||
//! <b>Throws</b>: If the move assignment throws
|
||||
BOOST_CONTAINER_FORCEINLINE void adopt_sequence(ordered_unique_range_t, BOOST_RV_REF(sequence_type) seq)
|
||||
{ this->tree_t::adopt_sequence_unique(ordered_unique_range_t(), boost::move(seq)); }
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
private:
|
||||
template<class KeyType>
|
||||
BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> priv_insert(BOOST_FWD_REF(KeyType) x)
|
||||
{ return this->tree_t::insert_unique(::boost::forward<KeyType>(x)); }
|
||||
|
||||
template<class KeyType>
|
||||
BOOST_CONTAINER_FORCEINLINE iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
|
||||
{ return this->tree_t::insert_unique(p, ::boost::forward<KeyType>(x)); }
|
||||
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
};
|
||||
|
||||
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
|
||||
@@ -1617,7 +1606,7 @@ class flat_multiset
|
||||
//! <b>Note</b>: If an element is inserted it might invalidate elements.
|
||||
iterator insert(value_type &&x);
|
||||
#else
|
||||
BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, iterator, this->priv_insert)
|
||||
BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, iterator, this->tree_t::insert_equal)
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
@@ -1645,7 +1634,7 @@ class flat_multiset
|
||||
//! <b>Note</b>: If an element is inserted it might invalidate elements.
|
||||
iterator insert(const_iterator p, value_type &&x);
|
||||
#else
|
||||
BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator)
|
||||
BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->tree_t::insert_equal, const_iterator, const_iterator)
|
||||
#endif
|
||||
|
||||
//! <b>Requires</b>: first, last are not iterators into *this.
|
||||
@@ -1849,17 +1838,6 @@ class flat_multiset
|
||||
//! <b>Throws</b>: If the move assignment throws
|
||||
BOOST_CONTAINER_FORCEINLINE void adopt_sequence(ordered_range_t, BOOST_RV_REF(sequence_type) seq)
|
||||
{ this->tree_t::adopt_sequence_equal(ordered_range_t(), boost::move(seq)); }
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
private:
|
||||
template <class KeyType>
|
||||
BOOST_CONTAINER_FORCEINLINE iterator priv_insert(BOOST_FWD_REF(KeyType) x)
|
||||
{ return this->tree_t::insert_equal(::boost::forward<KeyType>(x)); }
|
||||
|
||||
template <class KeyType>
|
||||
BOOST_CONTAINER_FORCEINLINE iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
|
||||
{ return this->tree_t::insert_equal(p, ::boost::forward<KeyType>(x)); }
|
||||
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
};
|
||||
|
||||
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
|
||||
|
||||
Reference in new issue
Block a user