From 7f3d3ef8f95cacc6fb8d882b7de695f5897840a8 Mon Sep 17 00:00:00 2001 From: Tobias Loew Date: Wed, 21 Nov 2018 15:09:33 +0100 Subject: [PATCH] merge CTADs with equivalent parameter-declaration-clauses --- include/boost/container/flat_map.hpp | 108 ++++++++++++++------------- 1 file changed, 58 insertions(+), 50 deletions(-) diff --git a/include/boost/container/flat_map.hpp b/include/boost/container/flat_map.hpp index 5cbbf9c..255d53d 100644 --- a/include/boost/container/flat_map.hpp +++ b/include/boost/container/flat_map.hpp @@ -49,6 +49,10 @@ #include #endif +#ifndef BOOST_CONTAINER_NO_CXX17_CTAD +#include +#endif + namespace boost { namespace container { @@ -1585,20 +1589,21 @@ flat_map(InputIterator, InputIterator) -> flat_map< it_based_non_const_first_type_t , it_based_second_type_t>; -template < typename InputIterator, typename Allocator - , typename = dtl::require_allocator_t> -flat_map(InputIterator, InputIterator, Allocator const&) -> - flat_map< it_based_non_const_first_type_t - , it_based_second_type_t - , std::less> - , Allocator>; - -template < typename InputIterator, typename Compare - , typename = dtl::require_nonallocator_t> -flat_map(InputIterator, InputIterator, Compare const&) -> - flat_map< it_based_non_const_first_type_t - , it_based_second_type_t - , Compare>; +template < typename InputIterator, typename AllocatorOrCompare> + flat_map(InputIterator, InputIterator, AllocatorOrCompare const&) -> + flat_map< it_based_non_const_first_type_t + , it_based_second_type_t + , std::conditional_t< // Compare + dtl::is_allocator::value + , std::less> + , AllocatorOrCompare + > + , std::conditional_t< // Allocator + dtl::is_allocator::value + , AllocatorOrCompare + , new_allocator, it_based_second_type_t>> + > + >; template < typename InputIterator, typename Compare, typename Allocator , typename = dtl::require_nonallocator_t @@ -1614,20 +1619,21 @@ flat_map(ordered_unique_range_t, InputIterator, InputIterator) -> flat_map< it_based_non_const_first_type_t , it_based_second_type_t>; -template < typename InputIterator, typename Allocator - , typename = dtl::require_allocator_t> -flat_map(ordered_unique_range_t, InputIterator, InputIterator, Allocator const&) -> +template < typename InputIterator, typename AllocatorOrCompare> +flat_map(ordered_unique_range_t, InputIterator, InputIterator, AllocatorOrCompare const&) -> flat_map< it_based_non_const_first_type_t , it_based_second_type_t - , std::less> - , Allocator>; - -template < typename InputIterator, typename Compare - , typename = dtl::require_nonallocator_t> -flat_map(ordered_unique_range_t, InputIterator, InputIterator, Compare const&) -> - flat_map< it_based_non_const_first_type_t - , it_based_second_type_t - , Compare>; + , std::conditional_t< // Compare + dtl::is_allocator::value + , std::less> + , AllocatorOrCompare + > + , std::conditional_t< // Allocator + dtl::is_allocator::value + , AllocatorOrCompare + , new_allocator, it_based_second_type_t>> + > + >; template < typename InputIterator, typename Compare, typename Allocator , typename = dtl::require_nonallocator_t @@ -2891,20 +2897,21 @@ flat_multimap(InputIterator, InputIterator) -> flat_multimap< it_based_non_const_first_type_t , it_based_second_type_t>; -template < typename InputIterator, typename Allocator - , typename = dtl::require_allocator_t> -flat_multimap(InputIterator, InputIterator, Allocator const&) -> +template < typename InputIterator, typename AllocatorOrCompare> +flat_multimap(InputIterator, InputIterator, AllocatorOrCompare const&) -> flat_multimap< it_based_non_const_first_type_t , it_based_second_type_t - , std::less> - , Allocator>; - -template < typename InputIterator, typename Compare - , typename = dtl::require_nonallocator_t> -flat_multimap(InputIterator, InputIterator, Compare const&) -> - flat_multimap< it_based_non_const_first_type_t - , it_based_second_type_t - , Compare>; + , std::conditional_t< // Compare + dtl::is_allocator::value + , std::less> + , AllocatorOrCompare + > + , std::conditional_t< // Allocator + dtl::is_allocator::value + , AllocatorOrCompare + , new_allocator, it_based_second_type_t>> + > + >; template < typename InputIterator, typename Compare, typename Allocator , typename = dtl::require_nonallocator_t @@ -2920,20 +2927,21 @@ flat_multimap(ordered_range_t, InputIterator, InputIterator) -> flat_multimap< it_based_non_const_first_type_t , it_based_second_type_t>; -template < typename InputIterator, typename Allocator - , typename = dtl::require_allocator_t> -flat_multimap(ordered_range_t, InputIterator, InputIterator, Allocator const&) -> +template < typename InputIterator, typename AllocatorOrCompare> +flat_multimap(ordered_range_t, InputIterator, InputIterator, AllocatorOrCompare const&) -> flat_multimap< it_based_non_const_first_type_t , it_based_second_type_t - , std::less> - , Allocator>; - -template < typename InputIterator, typename Compare - , typename = dtl::require_nonallocator_t> -flat_multimap(ordered_range_t, InputIterator, InputIterator, Compare const&) -> - flat_multimap< it_based_non_const_first_type_t - , it_based_second_type_t - , Compare>; + , std::conditional_t< // Compare + dtl::is_allocator::value + , std::less> + , AllocatorOrCompare + > + , std::conditional_t< // Allocator + dtl::is_allocator::value + , AllocatorOrCompare + , new_allocator, it_based_second_type_t>> + > + >; template < typename InputIterator, typename Compare, typename Allocator , typename = dtl::require_nonallocator_t