Merge branch 'tobias-loew-develop' into develop

This commit is contained in:
Ion Gaztañaga
2018-11-12 22:53:50 +01:00
23 changed files with 867 additions and 255 deletions

View File

@@ -2238,7 +2238,7 @@ class deque : protected deque_base<Allocator>
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
};
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template <typename InputIterator>
deque(InputIterator, InputIterator) -> deque<typename iterator_traits<InputIterator>::value_type>;
template <typename InputIterator, typename Allocator>

View File

@@ -23,6 +23,7 @@
#include <boost/intrusive/detail/iterator.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/container/detail/mpl.hpp>
namespace boost {
namespace container {
@@ -63,6 +64,18 @@ class back_emplacer
back_emplacer& operator++(int){ return *this; }
};
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template<class InputIterator>
using it_based_non_const_first_type_t = typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type;
template<class InputIterator>
using it_based_second_type_t = typename iterator_traits<InputIterator>::value_type::second_type;
template<class InputIterator>
using it_based_value_type_t = typename iterator_traits<InputIterator>::value_type;
#endif
} //namespace container {
} //namespace boost {

View File

@@ -61,6 +61,7 @@ using boost::move_detail::enable_if_and;
using boost::move_detail::disable_if_and;
using boost::move_detail::enable_if_or;
using boost::move_detail::disable_if_or;
using boost::move_detail::remove_const;
template <class FirstType>
struct select1st
@@ -102,6 +103,36 @@ struct enable_if_transparent
: boost::move_detail::enable_if_c<dtl::is_transparent<C>::value, R>
{};
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
// void_t (void_t for C++11)
template<typename...> using variadic_void_t = void;
// Trait to detect Allocator-like types.
template<typename Allocator, typename = void>
struct is_allocator
{
static const bool value = false;
};
template <typename T>
T&& ctad_declval();
template<typename Allocator>
struct is_allocator < Allocator,
variadic_void_t< typename Allocator::value_type
, decltype(ctad_declval<Allocator&>().allocate(size_t{})) >>
{
static const bool value = true;
};
template<class T>
using require_allocator_t = typename enable_if_c<is_allocator<T>::value, T>::type;
template<class T>
using require_nonallocator_t = typename enable_if_c<!is_allocator<T>::value, T>::type;
#endif
} //namespace dtl {
} //namespace container {

View File

@@ -119,4 +119,11 @@
#define BOOST_CONTAINER_ASAN
#endif
#if (__cplusplus >= 201703L)
//CTAD supported
#else
#define BOOST_CONTAINER_NO_CXX17_CTAD
#endif
#endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP

View File

@@ -319,6 +319,21 @@ class flat_map
: m_flat_tree(ordered_range, first, last, comp, dtl::force<const impl_allocator_type>(a))
{}
//! <b>Effects</b>: Constructs an empty flat_map using the specified allocator and
//! inserts elements from the ordered range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE
flat_map(ordered_unique_range_t, InputIterator first, InputIterator last, const allocator_type& a)
: m_flat_tree(ordered_range, first, last, Compare(), a)
{}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: Constructs an empty flat_map and
//! inserts elements from the range [il.begin() ,il.end()).
@@ -1563,55 +1578,63 @@ class flat_map
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
};
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template <typename InputIterator>
flat_map(InputIterator, InputIterator) ->
flat_map< typename dtl::remove_const< typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type>;
flat_map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>>;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
flat_map(InputIterator, InputIterator, Allocator const&) ->
flat_map< typename dtl::remove_const< typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
, std::less<typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type>
flat_map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, std::less<it_based_non_const_first_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
flat_map(InputIterator, InputIterator, Compare const&) ->
flat_map< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
flat_map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
flat_map(InputIterator, InputIterator, Compare const&, Allocator const&) ->
flat_map< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
flat_map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare
, Allocator>;
template <typename InputIterator>
flat_map(ordered_unique_range_t, InputIterator, InputIterator) ->
flat_map< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type>;
flat_map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>>;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
flat_map(ordered_unique_range_t, InputIterator, InputIterator, Allocator const&) ->
flat_map< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
, std::less<typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type>
flat_map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, std::less<it_based_non_const_first_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
flat_map(ordered_unique_range_t, InputIterator, InputIterator, Compare const&) ->
flat_map< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
flat_map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
flat_map(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) ->
flat_map< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
flat_map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare
, Allocator>;
@@ -1878,6 +1901,21 @@ class flat_multimap
: m_flat_tree(ordered_range, first, last, comp, a)
{}
//! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object and
//! inserts elements from the ordered range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE
flat_multimap(ordered_range_t, InputIterator first, InputIterator last, const allocator_type &a)
: m_flat_tree(ordered_range, first, last, Compare(), a)
{}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: Constructs an empty flat_map and
//! inserts elements from the range [il.begin(), il.end()).
@@ -2846,57 +2884,65 @@ class flat_multimap
{ x.swap(y); }
};
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template <typename InputIterator>
flat_multimap(InputIterator, InputIterator) ->
flat_multimap<typename dtl::remove_const< typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type>;
flat_multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>>;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
flat_multimap(InputIterator, InputIterator, Allocator const&) ->
flat_multimap<typename dtl::remove_const< typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
, std::less<typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type>
, Allocator>;
flat_multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, std::less<it_based_non_const_first_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
flat_multimap(InputIterator, InputIterator, Compare const&) ->
flat_multimap< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
, Compare>;
flat_multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
flat_multimap(InputIterator, InputIterator, Compare const&, Allocator const&) ->
flat_multimap< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
, Compare
, Allocator>;
flat_multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare
, Allocator>;
template <typename InputIterator>
flat_multimap(ordered_range_t, InputIterator, InputIterator) ->
flat_multimap< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type>;
flat_multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>>;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
flat_multimap(ordered_range_t, InputIterator, InputIterator, Allocator const&) ->
flat_multimap< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
, std::less<typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type>
, Allocator>;
flat_multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, std::less<it_based_non_const_first_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
flat_multimap(ordered_range_t, InputIterator, InputIterator, Compare const&) ->
flat_multimap< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
, Compare>;
flat_multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
flat_multimap(ordered_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) ->
flat_multimap< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
, Compare
, Allocator>;
flat_multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare
, Allocator>;
#endif

View File

@@ -257,6 +257,22 @@ class flat_set
: tree_t(ordered_unique_range, first, last, comp, a)
{}
//! <b>Effects</b>: Constructs an empty container using the specified allocator and
//! inserts elements from the ordered unique range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE
flat_set(ordered_unique_range_t, InputIterator first, InputIterator last, const allocator_type& a)
: tree_t(ordered_unique_range, first, last, Compare(), a)
{}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: Constructs an empty container and
//! inserts elements from the range [il.begin(), il.end()).
@@ -1108,39 +1124,57 @@ class flat_set
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
};
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template <typename InputIterator>
flat_set(InputIterator, InputIterator) ->
flat_set<typename iterator_traits<InputIterator>::value_type>;
flat_set< it_based_value_type_t<InputIterator> >;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
flat_set(InputIterator, InputIterator, Allocator const&) ->
flat_set<typename iterator_traits<InputIterator>::value_type, std::less<typename iterator_traits<InputIterator>::value_type>, Allocator>;
flat_set< it_based_value_type_t<InputIterator>
, std::less<it_based_value_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
flat_set(InputIterator, InputIterator, Compare const&) ->
flat_set<typename iterator_traits<InputIterator>::value_type, Compare>;
flat_set< it_based_value_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
flat_set(InputIterator, InputIterator, Compare const&, Allocator const&) ->
flat_set<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
flat_set< it_based_value_type_t<InputIterator>
, Compare
, Allocator>;
template <typename InputIterator>
flat_set(ordered_unique_range_t, InputIterator, InputIterator) ->
flat_set<typename iterator_traits<InputIterator>::value_type>;
flat_set< it_based_value_type_t<InputIterator>>;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
flat_set(ordered_unique_range_t, InputIterator, InputIterator, Allocator const&) ->
flat_set<typename iterator_traits<InputIterator>::value_type, std::less<typename iterator_traits<InputIterator>::value_type>, Allocator>;
flat_set< it_based_value_type_t<InputIterator>
, std::less<it_based_value_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
flat_set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&) ->
flat_set<typename iterator_traits<InputIterator>::value_type, Compare>;
flat_set< it_based_value_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
flat_set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) ->
flat_set<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
flat_set< it_based_value_type_t<InputIterator>
, Compare
, Allocator>;
#endif
@@ -1320,6 +1354,20 @@ class flat_multiset
: tree_t(ordered_range, first, last, comp, a)
{}
//! <b>Effects</b>: Constructs an empty flat_multiset using the specified allocator and
//! inserts elements from the ordered range [first ,last ). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, InputIterator first, InputIterator last, const allocator_type &a)
: tree_t(ordered_range, first, last, Compare(), a)
{}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type)
BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il)
@@ -1805,43 +1853,57 @@ class flat_multiset
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
};
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template <typename InputIterator>
flat_multiset(InputIterator, InputIterator) ->
flat_multiset<typename iterator_traits<InputIterator>::value_type>;
flat_multiset< it_based_value_type_t<InputIterator> >;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
flat_multiset(InputIterator, InputIterator, Allocator const&) ->
flat_multiset< typename iterator_traits<InputIterator>::value_type
, std::less<typename iterator_traits<InputIterator>::value_type>
, Allocator>;
flat_multiset< it_based_value_type_t<InputIterator>
, std::less<it_based_value_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
flat_multiset(InputIterator, InputIterator, Compare const&) ->
flat_multiset<typename iterator_traits<InputIterator>::value_type, Compare>;
flat_multiset< it_based_value_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
flat_multiset(InputIterator, InputIterator, Compare const&, Allocator const&) ->
flat_multiset<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
flat_multiset< it_based_value_type_t<InputIterator>
, Compare
, Allocator>;
template <typename InputIterator>
flat_multiset(ordered_range_t, InputIterator, InputIterator) ->
flat_multiset<typename iterator_traits<InputIterator>::value_type>;
flat_multiset< it_based_value_type_t<InputIterator>>;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
flat_multiset(ordered_range_t, InputIterator, InputIterator, Allocator const&) ->
flat_multiset< typename iterator_traits<InputIterator>::value_type
, std::less<typename iterator_traits<InputIterator>::value_type>
, Allocator>;
flat_multiset< it_based_value_type_t<InputIterator>
, std::less<it_based_value_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
flat_multiset(ordered_range_t, InputIterator, InputIterator, Compare const&) ->
flat_multiset< typename iterator_traits<InputIterator>::value_type, Compare>;
flat_multiset< it_based_value_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
flat_multiset(ordered_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) ->
flat_multiset<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
flat_multiset< it_based_value_type_t<InputIterator>
, Compare
, Allocator>;
#endif

View File

@@ -1498,7 +1498,7 @@ class list
};
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template <typename InputIterator>
list(InputIterator, InputIterator) ->
list<typename iterator_traits<InputIterator>::value_type>;

View File

@@ -256,6 +256,22 @@ class map
: base_t(ordered_range, first, last, comp, a)
{}
//! <b>Effects</b>: Constructs an empty map using the specified allocator object and
//! inserts elements from the ordered unique range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE map(ordered_unique_range_t, InputIterator first, InputIterator last, const allocator_type& a)
: base_t(ordered_range, first, last, Compare(), a)
{}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: Constructs an empty map and
//! inserts elements from the range [il.begin(), il.end()).
@@ -1279,55 +1295,63 @@ class map
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
};
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template <typename InputIterator>
map(InputIterator, InputIterator) ->
map< typename dtl::remove_const< typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type>;
map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>>;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
map(InputIterator, InputIterator, Allocator const&) ->
map< typename dtl::remove_const< typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
, std::less<typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type>
map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, std::less<it_based_non_const_first_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
map(InputIterator, InputIterator, Compare const&) ->
map< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
map(InputIterator, InputIterator, Compare const&, Allocator const&) ->
map< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare
, Allocator>;
template <typename InputIterator>
map(ordered_unique_range_t, InputIterator, InputIterator) ->
map< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type>;
map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>>;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
map(ordered_unique_range_t, InputIterator, InputIterator, Allocator const&) ->
map< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
, std::less<typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type>
map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, std::less<it_based_non_const_first_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
map(ordered_unique_range_t, InputIterator, InputIterator, Compare const&) ->
map< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
map(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) ->
map< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
map< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare
, Allocator>;
@@ -1552,6 +1576,20 @@ class multimap
: base_t(ordered_range, first, last, comp, a)
{}
//! <b>Effects</b>: Constructs an empty multimap using the specified allocator and
//! inserts elements from the ordered range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE multimap(ordered_range_t, InputIterator first, InputIterator last, const allocator_type& a)
: base_t(ordered_range, first, last, Compare(), a)
{}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: Constructs an empty multimap and
//! and inserts elements from the range [il.begin(), il.end()).
@@ -2184,58 +2222,65 @@ class multimap
#endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
};
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template <typename InputIterator>
multimap(InputIterator, InputIterator) ->
multimap<typename dtl::remove_const< typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type>;
multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>>;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
multimap(InputIterator, InputIterator, Allocator const&) ->
multimap<typename dtl::remove_const< typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
, std::less<typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type>
, Allocator>;
multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, std::less<it_based_non_const_first_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
multimap(InputIterator, InputIterator, Compare const&) ->
multimap< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
multimap(InputIterator, InputIterator, Compare const&, Allocator const&) ->
multimap< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare
, Allocator>;
template <typename InputIterator>
multimap(ordered_range_t, InputIterator, InputIterator) ->
multimap< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type>;
multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>>;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
multimap(ordered_range_t, InputIterator, InputIterator, Allocator const&) ->
multimap< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
, std::less<typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type>
multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, std::less<it_based_non_const_first_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
multimap(ordered_range_t, InputIterator, InputIterator, Compare const&) ->
multimap< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
multimap(ordered_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) ->
multimap< typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type
, typename iterator_traits<InputIterator>::value_type::second_type
multimap< it_based_non_const_first_type_t<InputIterator>
, it_based_second_type_t<InputIterator>
, Compare
, Allocator>;
#endif
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED

View File

@@ -227,6 +227,21 @@ class set
: base_t(ordered_range, first, last, comp, a)
{}
//! <b>Effects</b>: Constructs an empty set using the specified allocator and
//! inserts elements from the ordered unique range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE set(ordered_unique_range_t, InputIterator first, InputIterator last, const allocator_type& a)
: base_t(ordered_range, first, last, Compare(), a)
{}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: Constructs an empty set and
//! inserts elements from the range [il.begin(), il.end()).
@@ -944,39 +959,57 @@ class set
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
};
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template <typename InputIterator>
set(InputIterator, InputIterator) ->
set<typename iterator_traits<InputIterator>::value_type>;
set< it_based_value_type_t<InputIterator> >;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
set(InputIterator, InputIterator, Allocator const&) ->
set<typename iterator_traits<InputIterator>::value_type, std::less<typename iterator_traits<InputIterator>::value_type>, Allocator>;
set< it_based_value_type_t<InputIterator>
, std::less<it_based_value_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
set(InputIterator, InputIterator, Compare const&) ->
set<typename iterator_traits<InputIterator>::value_type, Compare>;
set< it_based_value_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
set(InputIterator, InputIterator, Compare const&, Allocator const&) ->
set<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
set< it_based_value_type_t<InputIterator>
, Compare
, Allocator>;
template <typename InputIterator>
set(ordered_unique_range_t, InputIterator, InputIterator) ->
set<typename iterator_traits<InputIterator>::value_type>;
set< it_based_value_type_t<InputIterator>>;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
set(ordered_unique_range_t, InputIterator, InputIterator, Allocator const&) ->
set<typename iterator_traits<InputIterator>::value_type, std::less<typename iterator_traits<InputIterator>::value_type>, Allocator>;
set< it_based_value_type_t<InputIterator>
, std::less<it_based_value_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&) ->
set<typename iterator_traits<InputIterator>::value_type, Compare>;
set< it_based_value_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) ->
set<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
set< it_based_value_type_t<InputIterator>
, Compare
, Allocator>;
#endif
@@ -1150,6 +1183,20 @@ class multiset
: base_t(ordered_range, first, last, comp, a)
{}
//! <b>Effects</b>: Constructs an empty multiset using the specified allocator and
//! inserts elements from the ordered range [first ,last ). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
//!
//! <b>Complexity</b>: Linear in N.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE multiset(ordered_range_t, InputIterator first, InputIterator last, const allocator_type &a)
: base_t(ordered_range, first, last, Compare(), a)
{}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! @copydoc ::boost::container::set::set(std::initializer_list<value_type>)
BOOST_CONTAINER_FORCEINLINE multiset(std::initializer_list<value_type> il)
@@ -1573,43 +1620,57 @@ class multiset
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
};
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template <typename InputIterator>
multiset(InputIterator, InputIterator) ->
multiset<typename iterator_traits<InputIterator>::value_type>;
multiset< it_based_value_type_t<InputIterator> >;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
multiset(InputIterator, InputIterator, Allocator const&) ->
multiset< typename iterator_traits<InputIterator>::value_type
, std::less<typename iterator_traits<InputIterator>::value_type>
, Allocator>;
multiset< it_based_value_type_t<InputIterator>
, std::less<it_based_value_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
multiset(InputIterator, InputIterator, Compare const&) ->
multiset<typename iterator_traits<InputIterator>::value_type, Compare>;
multiset< it_based_value_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
multiset(InputIterator, InputIterator, Compare const&, Allocator const&) ->
multiset<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
multiset< it_based_value_type_t<InputIterator>
, Compare
, Allocator>;
template <typename InputIterator>
multiset(ordered_range_t, InputIterator, InputIterator) ->
multiset<typename iterator_traits<InputIterator>::value_type>;
multiset< it_based_value_type_t<InputIterator>>;
template <typename InputIterator, typename Allocator>
template < typename InputIterator, typename Allocator
, typename = dtl::require_allocator_t<Allocator>>
multiset(ordered_range_t, InputIterator, InputIterator, Allocator const&) ->
multiset< typename iterator_traits<InputIterator>::value_type
, std::less<typename iterator_traits<InputIterator>::value_type>
, Allocator>;
multiset< it_based_value_type_t<InputIterator>
, std::less<it_based_value_type_t<InputIterator>>
, Allocator>;
template <typename InputIterator, typename Compare>
template < typename InputIterator, typename Compare
, typename = dtl::require_nonallocator_t<Compare>>
multiset(ordered_range_t, InputIterator, InputIterator, Compare const&) ->
multiset< typename iterator_traits<InputIterator>::value_type, Compare>;
multiset< it_based_value_type_t<InputIterator>
, Compare>;
template <typename InputIterator, typename Compare, typename Allocator>
template < typename InputIterator, typename Compare, typename Allocator
, typename = dtl::require_nonallocator_t<Compare>
, typename = dtl::require_allocator_t<Allocator>>
multiset(ordered_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) ->
multiset<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
multiset< it_based_value_type_t<InputIterator>
, Compare
, Allocator>;
#endif

View File

@@ -1668,7 +1668,7 @@ class slist
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
};
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template <typename InpIt>
slist(InpIt, InpIt) ->

View File

@@ -2142,7 +2142,7 @@ class stable_vector
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
};
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template <typename InputIterator>
stable_vector(InputIterator, InputIterator) ->

View File

@@ -2978,7 +2978,7 @@ class basic_string
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
};
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template <typename InputIterator>
basic_string(InputIterator, InputIterator) ->

View File

@@ -3370,7 +3370,7 @@ class vector
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
};
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template <typename InputIterator>
vector(InputIterator, InputIterator) ->

View File

@@ -268,7 +268,7 @@ bool do_test()
if(!test::CheckEqualContainers(cntdeque, stddeque)) return 1;
}
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
//Check Constructor Template Auto Deduction
{
auto gold = MyStdDeque{ 1, 2, 3 };

View File

@@ -178,28 +178,98 @@ bool flat_tree_ordered_insertion_test()
bool constructor_template_auto_deduction_test()
{
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
using namespace boost::container;
const std::size_t NumElements = 100;
//Ordered insertion map
{
std::map<int, int> int_map;
for(std::size_t i = 0; i != NumElements; ++i){
int_map.insert(std::map<int, int>::value_type(static_cast<int>(i), static_cast<int>(i)));
}
//Construction insertion
auto fmap = flat_map(ordered_unique_range, int_map.begin(), int_map.end());
if(!CheckEqualContainers(int_map, fmap))
return false;
std::multimap<int, int> int_mmap;
for(std::size_t i = 0; i != NumElements; ++i){
for (std::size_t i = 0; i != NumElements; ++i) {
int_mmap.insert(std::multimap<int, int>::value_type(static_cast<int>(i), static_cast<int>(i)));
}
//Construction insertion
auto fmmap = flat_multimap(ordered_range, int_mmap.begin(), int_mmap.end());
if(!CheckEqualContainers(int_mmap, fmmap))
return false;
typedef std::less<int> comp_int_t;
typedef std::allocator<std::pair<int, int> > alloc_pair_int_t;
//range
{
auto fmap = flat_map(int_map.begin(), int_map.end());
if (!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = flat_multimap(int_mmap.begin(), int_mmap.end());
if (!CheckEqualContainers(int_mmap, fmmap))
return false;
}
//range+comp
{
auto fmap = flat_map(int_map.begin(), int_map.end(), comp_int_t());
if (!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = flat_multimap(int_mmap.begin(), int_mmap.end(), comp_int_t());
if (!CheckEqualContainers(int_mmap, fmmap))
return false;
}
//range+comp+alloc
{
auto fmap = flat_map(int_map.begin(), int_map.end(), comp_int_t(), alloc_pair_int_t());
if (!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = flat_multimap(int_mmap.begin(), int_mmap.end(), comp_int_t(), alloc_pair_int_t());
if (!CheckEqualContainers(int_mmap, fmmap))
return false;
}
//range+alloc
{
auto fmap = flat_map(int_map.begin(), int_map.end(), alloc_pair_int_t());
if (!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = flat_multimap(int_mmap.begin(), int_mmap.end(), alloc_pair_int_t());
if (!CheckEqualContainers(int_mmap, fmmap))
return false;
}
//ordered_unique_range / ordered_range
//range
{
auto fmap = flat_map(ordered_unique_range, int_map.begin(), int_map.end());
if(!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = flat_multimap(ordered_range, int_mmap.begin(), int_mmap.end());
if(!CheckEqualContainers(int_mmap, fmmap))
return false;
}
//range+comp
{
auto fmap = flat_map(ordered_unique_range, int_map.begin(), int_map.end(), comp_int_t());
if (!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = flat_multimap(ordered_range, int_mmap.begin(), int_mmap.end(), comp_int_t());
if (!CheckEqualContainers(int_mmap, fmmap))
return false;
}
//range+comp+alloc
{
auto fmap = flat_map(ordered_unique_range, int_map.begin(), int_map.end(), comp_int_t(), alloc_pair_int_t());
if (!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = flat_multimap(ordered_range, int_mmap.begin(), int_mmap.end(), comp_int_t(), alloc_pair_int_t());
if (!CheckEqualContainers(int_mmap, fmmap))
return false;
}
//range+alloc
{
auto fmap = flat_map(ordered_unique_range, int_map.begin(), int_map.end(),alloc_pair_int_t());
if (!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = flat_multimap(ordered_range, int_mmap.begin(), int_mmap.end(),alloc_pair_int_t());
if (!CheckEqualContainers(int_mmap, fmmap))
return false;
}
}
#endif
@@ -476,7 +546,7 @@ bool test_heterogeneous_lookups()
int main()
{
using namespace boost::container::test;
/*
//Allocator argument container
{
flat_map<int, int> map_((flat_map<int, int>::allocator_type()));
@@ -530,7 +600,7 @@ int main()
if (!test_heterogeneous_lookups())
return 1;
*/
////////////////////////////////////
// Testing allocator implementations
////////////////////////////////////
@@ -546,7 +616,7 @@ int main()
std::cout << "Error in map_test<std::allocator<void> >" << std::endl;
return 1;
}
/*
if (0 != test::map_test
< GetMapContainer<new_allocator<void> >::apply<int>::map_type
, MyStdMap
@@ -581,9 +651,9 @@ int main()
, MyStdMultiMap>()) {
std::cout << "Error in map_test<new_allocator<void> >" << std::endl;
return 1;
}*/
}
}
/*
if(!boost::container::test::test_map_support_for_initialization_list_for<flat_map<int, int> >())
return 1;
@@ -628,7 +698,7 @@ int main()
return 1;
}
}
*/
return 0;
}

View File

@@ -276,6 +276,106 @@ bool flat_tree_ordered_insertion_test()
return true;
}
bool constructor_template_auto_deduction_test()
{
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
using namespace boost::container;
const std::size_t NumElements = 100;
{
std::set<int> int_set;
for (std::size_t i = 0; i != NumElements; ++i) {
int_set.insert(static_cast<int>(i));
}
std::multiset<int> int_mset;
for (std::size_t i = 0; i != NumElements; ++i) {
int_mset.insert(static_cast<int>(i));
}
typedef std::less<int> comp_int_t;
typedef std::allocator<int> alloc_int_t;
//range
{
auto fset = flat_set(int_set.begin(), int_set.end());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = flat_multiset(int_mset.begin(), int_mset.end());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
//range+comp
{
auto fset = flat_set(int_set.begin(), int_set.end(), comp_int_t());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = flat_multiset(int_mset.begin(), int_mset.end(), comp_int_t());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
//range+comp+alloc
{
auto fset = flat_set(int_set.begin(), int_set.end(), comp_int_t(), alloc_int_t());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = flat_multiset(int_mset.begin(), int_mset.end(), comp_int_t(), alloc_int_t());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
//range+alloc
{
auto fset = flat_set(int_set.begin(), int_set.end(), alloc_int_t());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = flat_multiset(int_mset.begin(), int_mset.end(), alloc_int_t());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
//ordered_unique_range / ordered_range
//range
{
auto fset = flat_set(ordered_unique_range, int_set.begin(), int_set.end());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = flat_multiset(ordered_range, int_mset.begin(), int_mset.end());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
//range+comp
{
auto fset = flat_set(ordered_unique_range, int_set.begin(), int_set.end(), comp_int_t());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = flat_multiset(ordered_range, int_mset.begin(), int_mset.end(), comp_int_t());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
//range+comp+alloc
{
auto fset = flat_set(ordered_unique_range, int_set.begin(), int_set.end(), comp_int_t(), alloc_int_t());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = flat_multiset(ordered_range, int_mset.begin(), int_mset.end(), comp_int_t(), alloc_int_t());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
//range+alloc
{
auto fset = flat_set(ordered_unique_range, int_set.begin(), int_set.end(), alloc_int_t());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = flat_multiset(ordered_range, int_mset.begin(), int_mset.end(), alloc_int_t());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
}
#endif
return true;
}
template< class RandomIt >
void random_shuffle( RandomIt first, RandomIt last )
{
@@ -594,6 +694,13 @@ int main()
return 1;
}
////////////////////////////////////
// Constructor Template Auto Deduction test
////////////////////////////////////
if (!constructor_template_auto_deduction_test()) {
return 1;
}
////////////////////////////////////
// Extract/Adopt test
////////////////////////////////////
@@ -706,30 +813,6 @@ int main()
}
}
#if __cplusplus >= 201703L
////////////////////////////////////
// Constructor Template Auto Deduction
////////////////////////////////////
{
auto gold = std::set({ 1, 2, 3 });
auto test = boost::container::flat_set(gold.begin(), gold.end());
if (test.size() != 3)
return 1;
test = boost::container::flat_set(ordered_unique_range, gold.begin(), gold.end());
if (test.size() != 3)
return 1;
}
{
auto gold = std::multiset({ 1, 2, 3 });
auto test = boost::container::flat_multiset(gold.begin(), gold.end());
if (test.size() != 3)
return 1;
test = boost::container::flat_multiset(ordered_range, gold.begin(), gold.end());
if (test.size() != 3)
return 1;
}
#endif
return 0;
}

View File

@@ -214,7 +214,7 @@ int main ()
}
}
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
////////////////////////////////////
// Constructor Template Auto Deduction Tests
////////////////////////////////////

View File

@@ -337,6 +337,106 @@ bool test_heterogeneous_lookups()
return true;
}
bool constructor_template_auto_deduction_test()
{
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
using namespace boost::container;
const std::size_t NumElements = 100;
{
std::map<int, int> int_map;
for(std::size_t i = 0; i != NumElements; ++i){
int_map.insert(std::map<int, int>::value_type(static_cast<int>(i), static_cast<int>(i)));
}
std::multimap<int, int> int_mmap;
for (std::size_t i = 0; i != NumElements; ++i) {
int_mmap.insert(std::multimap<int, int>::value_type(static_cast<int>(i), static_cast<int>(i)));
}
typedef std::less<int> comp_int_t;
typedef std::allocator<std::pair<const int, int> > alloc_pair_int_t;
//range
{
auto fmap = map(int_map.begin(), int_map.end());
if (!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = multimap(int_mmap.begin(), int_mmap.end());
if (!CheckEqualContainers(int_mmap, fmmap))
return false;
}
//range+comp
{
auto fmap = map(int_map.begin(), int_map.end(), comp_int_t());
if (!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = multimap(int_mmap.begin(), int_mmap.end(), comp_int_t());
if (!CheckEqualContainers(int_mmap, fmmap))
return false;
}
//range+comp+alloc
{
auto fmap = map(int_map.begin(), int_map.end(), comp_int_t(), alloc_pair_int_t());
if (!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = multimap(int_mmap.begin(), int_mmap.end(), comp_int_t(), alloc_pair_int_t());
if (!CheckEqualContainers(int_mmap, fmmap))
return false;
}
//range+alloc
{
auto fmap = map(int_map.begin(), int_map.end(), alloc_pair_int_t());
if (!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = multimap(int_mmap.begin(), int_mmap.end(), alloc_pair_int_t());
if (!CheckEqualContainers(int_mmap, fmmap))
return false;
}
//ordered_unique_range / ordered_range
//range
{
auto fmap = map(ordered_unique_range, int_map.begin(), int_map.end());
if(!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = multimap(ordered_range, int_mmap.begin(), int_mmap.end());
if(!CheckEqualContainers(int_mmap, fmmap))
return false;
}
//range+comp
{
auto fmap = map(ordered_unique_range, int_map.begin(), int_map.end(), comp_int_t());
if (!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = multimap(ordered_range, int_mmap.begin(), int_mmap.end(), comp_int_t());
if (!CheckEqualContainers(int_mmap, fmmap))
return false;
}
//range+comp+alloc
{
auto fmap = map(ordered_unique_range, int_map.begin(), int_map.end(), comp_int_t(), alloc_pair_int_t());
if (!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = multimap(ordered_range, int_mmap.begin(), int_mmap.end(), comp_int_t(), alloc_pair_int_t());
if (!CheckEqualContainers(int_mmap, fmmap))
return false;
}
//range+alloc
{
auto fmap = map(ordered_unique_range, int_map.begin(), int_map.end(),alloc_pair_int_t());
if (!CheckEqualContainers(int_map, fmap))
return false;
auto fmmap = multimap(ordered_range, int_mmap.begin(), int_mmap.end(),alloc_pair_int_t());
if (!CheckEqualContainers(int_mmap, fmmap))
return false;
}
}
#endif
return true;
}
}}} //namespace boost::container::test
int main ()
@@ -474,30 +574,19 @@ int main ()
}
}
#if __cplusplus >= 201703L
////////////////////////////////////
// Constructor Template Auto Deduction
////////////////////////////////////
{
auto gold = std::map<int, int>({ {1,1}, {2,2}, {3,3} } );
auto test = boost::container::map(gold.begin(), gold.end());
if (test.size() != 3)
return 1;
}
{
auto gold = std::multimap<int, int>({ {1,1}, {2,2}, {3,3} } );
auto test = boost::container::multimap(gold.begin(), gold.end());
if (test.size() != 3)
return 1;
}
#endif
////////////////////////////////////
// Node extraction/insertion testing functions
////////////////////////////////////
if(!node_type_test())
return 1;
////////////////////////////////////
// Constructor Template Auto Deduction test
////////////////////////////////////
if (!test::constructor_template_auto_deduction_test()) {
return 1;
}
if (!boost::container::test::instantiate_constructors<map<int, int>, multimap<int, int> >())
return 1;

View File

@@ -206,6 +206,104 @@ struct alloc_propagate_base<boost_container_multiset>
};
};
bool constructor_template_auto_deduction_test()
{
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
using namespace boost::container;
const std::size_t NumElements = 100;
{
std::set<int> int_set;
for (std::size_t i = 0; i != NumElements; ++i) {
int_set.insert(static_cast<int>(i));
}
std::multiset<int> int_mset;
for (std::size_t i = 0; i != NumElements; ++i) {
int_mset.insert(static_cast<int>(i));
}
typedef std::less<int> comp_int_t;
typedef std::allocator<int> alloc_int_t;
//range
{
auto fset = set(int_set.begin(), int_set.end());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = multiset(int_mset.begin(), int_mset.end());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
//range+comp
{
auto fset = set(int_set.begin(), int_set.end(), comp_int_t());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = multiset(int_mset.begin(), int_mset.end(), comp_int_t());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
//range+comp+alloc
{
auto fset = set(int_set.begin(), int_set.end(), comp_int_t(), alloc_int_t());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = multiset(int_mset.begin(), int_mset.end(), comp_int_t(), alloc_int_t());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
//range+alloc
{
auto fset = set(int_set.begin(), int_set.end(), alloc_int_t());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = multiset(int_mset.begin(), int_mset.end(), alloc_int_t());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
//ordered_unique_range / ordered_range
//range
{
auto fset = set(ordered_unique_range, int_set.begin(), int_set.end());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = multiset(ordered_range, int_mset.begin(), int_mset.end());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
//range+comp
{
auto fset = set(ordered_unique_range, int_set.begin(), int_set.end(), comp_int_t());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = multiset(ordered_range, int_mset.begin(), int_mset.end(), comp_int_t());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
//range+comp+alloc
{
auto fset = set(ordered_unique_range, int_set.begin(), int_set.end(), comp_int_t(), alloc_int_t());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = multiset(ordered_range, int_mset.begin(), int_mset.end(), comp_int_t(), alloc_int_t());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
//range+alloc
{
auto fset = set(ordered_unique_range, int_set.begin(), int_set.end(), alloc_int_t());
if (!CheckEqualContainers(int_set, fset))
return false;
auto fmset = multiset(ordered_range, int_mset.begin(), int_mset.end(), alloc_int_t());
if (!CheckEqualContainers(int_mset, fmset))
return false;
}
}
#endif
return true;
}
}}} //boost::container::test
template<class VoidAllocator, boost::container::tree_type_enum tree_type_value>
@@ -360,6 +458,13 @@ int main ()
test_merge_from_different_comparison();
////////////////////////////////////
// Constructor Template Auto Deduction test
////////////////////////////////////
if (!test::constructor_template_auto_deduction_test()) {
return 1;
}
if(!test_heterogeneous_lookups())
return 1;
@@ -500,7 +605,7 @@ int main ()
if(!node_type_test())
return 1;
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
////////////////////////////////////
// Constructor Template Auto Deduction
////////////////////////////////////

View File

@@ -217,7 +217,7 @@ int main ()
return 1;
}
}
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
////////////////////////////////////
// Constructor Template Auto Deduction Tests
////////////////////////////////////

View File

@@ -177,7 +177,7 @@ int main()
}
}
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
////////////////////////////////////
// Constructor Template Auto Deduction testing
////////////////////////////////////

View File

@@ -456,7 +456,7 @@ int string_test()
return 1;
}
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
//Chect Constructor Template Auto Deduction
{
auto gold = StdString(string_literals<CharType>::String());

View File

@@ -61,15 +61,15 @@ struct X;
template<typename T>
struct XRef
{
explicit XRef(T* ptr) noexcept : ptr(ptr) {}
operator T*() const noexcept { return ptr; }
explicit XRef(T* ptr) : ptr(ptr) {}
operator T*() const { return ptr; }
T* ptr;
};
struct X
{
XRef<X const> operator&() const noexcept { return XRef<X const>(this); }
XRef<X> operator&() noexcept { return XRef<X>(this); }
XRef<X const> operator&() const { return XRef<X const>(this); }
XRef<X> operator&() { return XRef<X>(this); }
};
@@ -260,7 +260,7 @@ int main()
}
}
#if __cplusplus >= 201703L
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
////////////////////////////////////
// Constructor Template Auto Deduction testing
////////////////////////////////////