diff --git a/include/boost/container/deque.hpp b/include/boost/container/deque.hpp index 9565144..fe05120 100644 --- a/include/boost/container/deque.hpp +++ b/include/boost/container/deque.hpp @@ -2238,6 +2238,13 @@ class deque : protected deque_base #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L +template +deque(InputIterator, InputIterator) -> deque::value_type>; +template +deque(InputIterator, InputIterator, Allocator const&) -> deque::value_type, Allocator>; +#endif + }} #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED diff --git a/include/boost/container/flat_map.hpp b/include/boost/container/flat_map.hpp index 6361352..0e24493 100644 --- a/include/boost/container/flat_map.hpp +++ b/include/boost/container/flat_map.hpp @@ -1545,6 +1545,25 @@ class flat_map #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L +template +flat_map(InputIterator, InputIterator) -> flat_map::value_type::first_type>, typename std::iterator_traits::value_type::second_type>; +template +flat_map(InputIterator, InputIterator, Allocator const&) -> flat_map::value_type::first_type>, typename std::iterator_traits::value_type::second_type, std::less::value_type::first_type>>, Allocator>; +template +flat_map(InputIterator, InputIterator, Compare const&) -> flat_map::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare>; +template +flat_map(InputIterator, InputIterator, Compare const&, Allocator const&) -> flat_map::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare, Allocator>; +template +flat_map(ordered_unique_range_t, InputIterator, InputIterator) -> flat_map::value_type::first_type>, typename std::iterator_traits::value_type::second_type>; +template +flat_map(ordered_unique_range_t, InputIterator, InputIterator, Allocator const&) -> flat_map::value_type::first_type>, typename std::iterator_traits::value_type::second_type, std::less::value_type::first_type>>, Allocator>; +template +flat_map(ordered_unique_range_t, InputIterator, InputIterator, Compare const&) -> flat_map::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare>; +template +flat_map(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> flat_map::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare, Allocator>; +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED } //namespace container { @@ -2756,6 +2775,25 @@ class flat_multimap { x.swap(y); } }; +#if __cplusplus >= 201703L +template +flat_multimap(InputIterator, InputIterator) -> flat_multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type>; +template +flat_multimap(InputIterator, InputIterator, Allocator const&) -> flat_multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type, std::less::value_type::first_type>>, Allocator>; +template +flat_multimap(InputIterator, InputIterator, Compare const&) -> flat_multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare>; +template +flat_multimap(InputIterator, InputIterator, Compare const&, Allocator const&) -> flat_multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare, Allocator>; +template +flat_multimap(ordered_range_t, InputIterator, InputIterator) -> flat_multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type>; +template +flat_multimap(ordered_range_t, InputIterator, InputIterator, Allocator const&) -> flat_multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type, std::less::value_type::first_type>>, Allocator>; +template +flat_multimap(ordered_range_t, InputIterator, InputIterator, Compare const&) -> flat_multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare>; +template +flat_multimap(ordered_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> flat_multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare, Allocator>; +#endif + }} #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED diff --git a/include/boost/container/flat_set.hpp b/include/boost/container/flat_set.hpp index a873b6a..3dda0ca 100644 --- a/include/boost/container/flat_set.hpp +++ b/include/boost/container/flat_set.hpp @@ -1091,6 +1091,25 @@ class flat_set #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L +template +flat_set(InputIterator, InputIterator) -> flat_set::value_type>; +template +flat_set(InputIterator, InputIterator, Allocator const&) -> flat_set::value_type, std::less::value_type>, Allocator>; +template +flat_set(InputIterator, InputIterator, Compare const&) -> flat_set::value_type, Compare>; +template +flat_set(InputIterator, InputIterator, Compare const&, Allocator const&) -> flat_set::value_type, Compare, Allocator>; +template +flat_set(ordered_unique_range_t, InputIterator, InputIterator) -> flat_set::value_type>; +template +flat_set(ordered_unique_range_t, InputIterator, InputIterator, Allocator const&) -> flat_set::value_type, std::less::value_type>, Allocator>; +template +flat_set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&) -> flat_set::value_type, Compare>; +template +flat_set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> flat_set::value_type, Compare, Allocator>; +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED } //namespace container { @@ -1745,6 +1764,25 @@ class flat_multiset #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L +template +flat_multiset(InputIterator, InputIterator) -> flat_multiset::value_type>; +template +flat_multiset(InputIterator, InputIterator, Allocator const&) -> flat_multiset::value_type, std::less::value_type>, Allocator>; +template +flat_multiset(InputIterator, InputIterator, Compare const&) -> flat_multiset::value_type, Compare>; +template +flat_multiset(InputIterator, InputIterator, Compare const&, Allocator const&) -> flat_multiset::value_type, Compare, Allocator>; +template +flat_multiset(ordered_range_t, InputIterator, InputIterator) -> flat_multiset::value_type>; +template +flat_multiset(ordered_range_t, InputIterator, InputIterator, Allocator const&) -> flat_multiset::value_type, std::less::value_type>, Allocator>; +template +flat_multiset(ordered_range_t, InputIterator, InputIterator, Compare const&) -> flat_multiset::value_type, Compare>; +template +flat_multiset(ordered_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> flat_multiset::value_type, Compare, Allocator>; +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED } //namespace container { diff --git a/include/boost/container/list.hpp b/include/boost/container/list.hpp index c74372f..3cafd4c 100644 --- a/include/boost/container/list.hpp +++ b/include/boost/container/list.hpp @@ -1464,6 +1464,13 @@ class list }; +#if __cplusplus >= 201703L +template +list(InputIterator, InputIterator) -> list::value_type>; +template +list(InputIterator, InputIterator, Allocator const&) -> list::value_type, Allocator>; +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED } //namespace container { diff --git a/include/boost/container/map.hpp b/include/boost/container/map.hpp index 93058bf..8fe50d5 100644 --- a/include/boost/container/map.hpp +++ b/include/boost/container/map.hpp @@ -1263,6 +1263,25 @@ class map #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L +template +map(InputIterator, InputIterator) -> map::value_type::first_type>, typename std::iterator_traits::value_type::second_type>; +template +map(InputIterator, InputIterator, Allocator const&) -> map::value_type::first_type>, typename std::iterator_traits::value_type::second_type, std::less::value_type::first_type>>, Allocator>; +template +map(InputIterator, InputIterator, Compare const&) -> map::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare>; +template +map(InputIterator, InputIterator, Compare const&, Allocator const&) -> map::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare, Allocator>; +template +map(ordered_unique_range_t, InputIterator, InputIterator) -> map::value_type::first_type>, typename std::iterator_traits::value_type::second_type>; +template +map(ordered_unique_range_t, InputIterator, InputIterator, Allocator const&) -> map::value_type::first_type>, typename std::iterator_traits::value_type::second_type, std::less::value_type::first_type>>, Allocator>; +template +map(ordered_unique_range_t, InputIterator, InputIterator, Compare const&) -> map::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare>; +template +map(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> map::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare, Allocator>; +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -2098,6 +2117,25 @@ class multimap #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) }; +#if __cplusplus >= 201703L +template +multimap(InputIterator, InputIterator) -> multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type>; +template +multimap(InputIterator, InputIterator, Allocator const&) -> multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type, std::less::value_type::first_type>>, Allocator>; +template +multimap(InputIterator, InputIterator, Compare const&) -> multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare>; +template +multimap(InputIterator, InputIterator, Compare const&, Allocator const&) -> multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare, Allocator>; +template +multimap(ordered_range_t, InputIterator, InputIterator) -> multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type>; +template +multimap(ordered_range_t, InputIterator, InputIterator, Allocator const&) -> multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type, std::less::value_type::first_type>>, Allocator>; +template +multimap(ordered_range_t, InputIterator, InputIterator, Compare const&) -> multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare>; +template +multimap(ordered_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> multimap::value_type::first_type>, typename std::iterator_traits::value_type::second_type, Compare, Allocator>; +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED } //namespace container { diff --git a/include/boost/container/set.hpp b/include/boost/container/set.hpp index 433d60d..5eda825 100644 --- a/include/boost/container/set.hpp +++ b/include/boost/container/set.hpp @@ -934,6 +934,25 @@ class set #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L +template +set(InputIterator, InputIterator) -> set::value_type>; +template +set(InputIterator, InputIterator, Allocator const&) -> set::value_type, std::less::value_type>, Allocator>; +template +set(InputIterator, InputIterator, Compare const&) -> set::value_type, Compare>; +template +set(InputIterator, InputIterator, Compare const&, Allocator const&) -> set::value_type, Compare, Allocator>; +template +set(ordered_unique_range_t, InputIterator, InputIterator) -> set::value_type>; +template +set(ordered_unique_range_t, InputIterator, InputIterator, Allocator const&) -> set::value_type, std::less::value_type>, Allocator>; +template +set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&) -> set::value_type, Compare>; +template +set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> set::value_type, Compare, Allocator>; +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED } //namespace container { @@ -1520,6 +1539,25 @@ class multiset #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L +template +multiset(InputIterator, InputIterator) -> multiset::value_type>; +template +multiset(InputIterator, InputIterator, Allocator const&) -> multiset::value_type, std::less::value_type>, Allocator>; +template +multiset(InputIterator, InputIterator, Compare const&) -> multiset::value_type, Compare>; +template +multiset(InputIterator, InputIterator, Compare const&, Allocator const&) -> multiset::value_type, Compare, Allocator>; +template +multiset(ordered_range_t, InputIterator, InputIterator) -> multiset::value_type>; +template +multiset(ordered_range_t, InputIterator, InputIterator, Allocator const&) -> multiset::value_type, std::less::value_type>, Allocator>; +template +multiset(ordered_range_t, InputIterator, InputIterator, Compare const&) -> multiset::value_type, Compare>; +template +multiset(ordered_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> multiset::value_type, Compare, Allocator>; +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED } //namespace container { diff --git a/include/boost/container/slist.hpp b/include/boost/container/slist.hpp index d721e4f..be80939 100644 --- a/include/boost/container/slist.hpp +++ b/include/boost/container/slist.hpp @@ -1632,6 +1632,13 @@ class slist #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L +template +slist(InpIt, InpIt) -> slist::value_type>; +template +slist(InpIt, InpIt, Allocator const&) -> slist::value_type, Allocator>; +#endif + }} #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED diff --git a/include/boost/container/stable_vector.hpp b/include/boost/container/stable_vector.hpp index 88518bc..612b911 100644 --- a/include/boost/container/stable_vector.hpp +++ b/include/boost/container/stable_vector.hpp @@ -2085,6 +2085,13 @@ class stable_vector #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L +template +stable_vector(InputIterator, InputIterator) -> stable_vector::value_type>; +template +stable_vector(InputIterator, InputIterator, Allocator const&) -> stable_vector::value_type, Allocator>; +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #undef STABLE_VECTOR_CHECK_INVARIANT diff --git a/include/boost/container/string.hpp b/include/boost/container/string.hpp index 8829fda..a3db188 100644 --- a/include/boost/container/string.hpp +++ b/include/boost/container/string.hpp @@ -2933,6 +2933,13 @@ class basic_string #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L +template +basic_string(InputIterator, InputIterator) -> basic_string::value_type>; +template +basic_string(InputIterator, InputIterator, Allocator const&) -> basic_string::value_type, Allocator>; +#endif + #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED //!Typedef for a basic_string of diff --git a/include/boost/container/vector.hpp b/include/boost/container/vector.hpp index 89ed12e..5a14b73 100644 --- a/include/boost/container/vector.hpp +++ b/include/boost/container/vector.hpp @@ -931,6 +931,12 @@ class vector //! throws or T's constructor taking a dereferenced InIt throws. //! //! Complexity: Linear to the range [first, last). +// template +// vector(InIt first, InIt last +// BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_c +// < dtl::is_convertible::value +// BOOST_MOVE_I dtl::nat >::type * = 0) +// ) -> vector::value_type, new_allocator::value_type>>; template vector(InIt first, InIt last BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_c @@ -947,6 +953,12 @@ class vector //! throws or T's constructor taking a dereferenced InIt throws. //! //! Complexity: Linear to the range [first, last). +// template +// vector(InIt first, InIt last, const allocator_type& a +// BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_c +// < dtl::is_convertible::value +// BOOST_MOVE_I dtl::nat >::type * = 0) +// ) -> vector::value_type, new_allocator::value_type>>; template vector(InIt first, InIt last, const allocator_type& a BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_c @@ -3352,6 +3364,14 @@ class vector #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L +template +vector(InputIterator, InputIterator) -> vector::value_type>; +template +vector(InputIterator, InputIterator, Allocator const&) -> vector::value_type, Allocator>; +#endif + + }} //namespace boost::container #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED diff --git a/test/deque_test.cpp b/test/deque_test.cpp index bb9e162..b226f8f 100644 --- a/test/deque_test.cpp +++ b/test/deque_test.cpp @@ -282,6 +282,20 @@ bool do_test() if(!test::CheckEqualContainers(cntdeque, stddeque)) return 1; } +#if __cplusplus >= 201703L + //Check Constructor Template Auto Deduction + { + auto gold = MyStdDeque{ 1, 2, 3 }; + auto test = deque(gold.begin(), gold.end()); + if(!test::CheckEqualContainers(gold, test)) return false; + } + { + auto gold = MyStdDeque{ 1, 2, 3 }; + auto test = deque(gold.begin(), gold.end(), new_allocator()); + if(!test::CheckEqualContainers(gold, test)) return false; + } +#endif + std::cout << std::endl << "Test OK!" << std::endl; return true; } diff --git a/test/flat_map_test.cpp b/test/flat_map_test.cpp index 950502a..7a9a3e7 100644 --- a/test/flat_map_test.cpp +++ b/test/flat_map_test.cpp @@ -248,6 +248,36 @@ bool flat_tree_ordered_insertion_test() return true; } +bool constructor_template_auto_deduction_test() +{ +#if __cplusplus >= 201703L + using namespace boost::container; + const std::size_t NumElements = 100; + //Ordered insertion map + { + std::map int_map; + for(std::size_t i = 0; i != NumElements; ++i){ + int_map.insert(std::map::value_type(static_cast(i), static_cast(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_mmap; + for(std::size_t i = 0; i != NumElements; ++i){ + int_mmap.insert(std::multimap::value_type(static_cast(i), static_cast(i))); + } + //Construction insertion + auto fmmap = flat_multimap(ordered_range, int_mmap.begin(), int_mmap.end()); + if(!CheckEqualContainers(int_mmap, fmmap)) + return false; + } +#endif + + return true; +} + template< class RandomIt > void random_shuffle( RandomIt first, RandomIt last ) { @@ -596,6 +626,13 @@ int main() return 1; } + //////////////////////////////////// + // Constructor Template Auto Deduction test + //////////////////////////////////// + if(!constructor_template_auto_deduction_test()){ + return 1; + } + //////////////////////////////////// // Extract/Adopt test //////////////////////////////////// diff --git a/test/flat_set_test.cpp b/test/flat_set_test.cpp index 54f0359..fc8233a 100644 --- a/test/flat_set_test.cpp +++ b/test/flat_set_test.cpp @@ -777,6 +777,30 @@ 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; } diff --git a/test/list_test.cpp b/test/list_test.cpp index aa56b09..aefa008 100644 --- a/test/list_test.cpp +++ b/test/list_test.cpp @@ -211,6 +211,44 @@ int main () } } +#if __cplusplus >= 201703L + //////////////////////////////////// + // Constructor Template Auto Deduction Tests + //////////////////////////////////// + { + auto gold = std::list{ 1, 2, 3 }; + auto test = boost::container::list(gold.begin(), gold.end()); + if (test.size() != 3) { + return 1; + } + if (test.front() != 1) + return 1; + test.pop_front(); + if (test.front() != 2) + return 1; + test.pop_front(); + if (test.front() != 3) + return 1; + test.pop_front(); + } + { + auto gold = std::list{ 1, 2, 3 }; + auto test = boost::container::list(gold.begin(), gold.end(), new_allocator()); + if (test.size() != 3) { + return 1; + } + if (test.front() != 1) + return 1; + test.pop_front(); + if (test.front() != 2) + return 1; + test.pop_front(); + if (test.front() != 3) + return 1; + test.pop_front(); + } +#endif + return 0; } diff --git a/test/map_test.cpp b/test/map_test.cpp index ab131a1..619646a 100644 --- a/test/map_test.cpp +++ b/test/map_test.cpp @@ -505,6 +505,24 @@ int main () } } +#if __cplusplus >= 201703L + //////////////////////////////////// + // Constructor Template Auto Deduction + //////////////////////////////////// + { + auto gold = std::map({ {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({ {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 //////////////////////////////////// diff --git a/test/set_test.cpp b/test/set_test.cpp index 0f72a77..6fc311d 100644 --- a/test/set_test.cpp +++ b/test/set_test.cpp @@ -536,6 +536,30 @@ int main () if(!node_type_test()) return 1; +#if __cplusplus >= 201703L + //////////////////////////////////// + // Constructor Template Auto Deduction + //////////////////////////////////// + { + auto gold = std::set({ 1, 2, 3 }); + auto test = boost::container::set(gold.begin(), gold.end()); + if (test.size() != 3) + return 1; + test = boost::container::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::multiset(gold.begin(), gold.end()); + if (test.size() != 3) + return 1; + test = boost::container::multiset(ordered_range, gold.begin(), gold.end()); + if (test.size() != 3) + return 1; + } +#endif + return 0; } diff --git a/test/slist_test.cpp b/test/slist_test.cpp index 9d0c17e..3f1f910 100644 --- a/test/slist_test.cpp +++ b/test/slist_test.cpp @@ -251,6 +251,45 @@ int main () return 1; } } +#if __cplusplus >= 201703L + //////////////////////////////////// + // Constructor Template Auto Deduction Tests + //////////////////////////////////// + { + auto gold = std::list{ 1, 2, 3 }; + auto test = boost::container::slist(gold.begin(), gold.end()); + if (test.size() != 3) { + return 1; + } + if (test.front() != 1) + return 1; + test.pop_front(); + if (test.front() != 2) + return 1; + test.pop_front(); + if (test.front() != 3) + return 1; + test.pop_front(); + } + { + auto gold = std::list{ 1, 2, 3 }; + auto test = boost::container::slist(gold.begin(), gold.end(), new_allocator()); + if (test.size() != 3) { + return 1; + } + if (test.front() != 1) + return 1; + test.pop_front(); + if (test.front() != 2) + return 1; + test.pop_front(); + if (test.front() != 3) + return 1; + test.pop_front(); + } +#endif + + return 0; } #include diff --git a/test/stable_vector_test.cpp b/test/stable_vector_test.cpp index 1286285..16e2ca8 100644 --- a/test/stable_vector_test.cpp +++ b/test/stable_vector_test.cpp @@ -193,6 +193,22 @@ int main() } } +#if __cplusplus >= 201703L + //////////////////////////////////// + // Constructor Template Auto Deduction testing + //////////////////////////////////// + { + auto gold = std::vector{ 1, 2, 3 }; + auto test = boost::container::stable_vector(gold.begin(), gold.end()); + if (test.size() != 3) { + return 1; + } + if (!(test[0] == 1 && test[1] == 2 && test[2] == 3)) { + return 1; + } + } +#endif + return 0; } diff --git a/test/string_test.cpp b/test/string_test.cpp index f54a350..16397b0 100644 --- a/test/string_test.cpp +++ b/test/string_test.cpp @@ -478,6 +478,18 @@ int string_test() return 1; } +#if __cplusplus >= 201703L + //Chect Constructor Template Auto Deduction + { + auto gold = StdString(string_literals::String()); + auto test = basic_string(gold.begin(), gold.end()); + if(!StringEqual()(gold, test)) { + return 1; + } + } +#endif + + //When done, delete vector delete boostStringVect; delete stdStringVect; diff --git a/test/vector_test.cpp b/test/vector_test.cpp index 6c1597a..201f201 100644 --- a/test/vector_test.cpp +++ b/test/vector_test.cpp @@ -250,5 +250,31 @@ int main() return 1; } } + +#if __cplusplus >= 201703L + //////////////////////////////////// + // Constructor Template Auto Deduction testing + //////////////////////////////////// + { + auto gold = std::vector{ 1, 2, 3 }; + auto test = boost::container::vector(gold.begin(), gold.end()); + if (test.size() != 3) { + return 1; + } + if (!(test[0] == 1 && test[1] == 2 && test[2] == 3)) { + return 1; + } + } + { + auto gold = std::vector{ 1, 2, 3 }; + auto test = boost::container::vector(gold.begin(), gold.end(), boost::container::new_allocator()); + if (test.size() != 3) { + return 1; + } + if (!(test[0] == 1 && test[1] == 2 && test[2] == 3)) { + return 1; + } + } +#endif return 0; }