forked from boostorg/unordered
Flesh out deduction_tests to include unordered_[multi]set, update to use BOOST_TEST_TRAIT_SAME
This commit is contained in:
@ -3,11 +3,14 @@
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/core/lightweight_test_trait.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#if BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES
|
||||
|
||||
struct hash_equals
|
||||
{
|
||||
template <typename T> bool operator()(T const& x) const
|
||||
@ -33,22 +36,15 @@ template <typename T> struct test_allocator
|
||||
bool operator==(test_allocator const&) const { return true; }
|
||||
bool operator!=(test_allocator const&) const { return false; }
|
||||
};
|
||||
#endif
|
||||
|
||||
int main()
|
||||
template <template <class...> class UnorderedMap> void map_tests()
|
||||
{
|
||||
std::cout << "BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES: "
|
||||
<< BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES << std::endl;
|
||||
|
||||
#if BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES
|
||||
std::vector<std::pair<int, int> > x;
|
||||
x.push_back(std::make_pair(1, 3));
|
||||
x.push_back(std::make_pair(5, 10));
|
||||
test_allocator<std::pair<const int, int> > pair_allocator;
|
||||
hash_equals f;
|
||||
|
||||
// unordered_map
|
||||
|
||||
/*
|
||||
template<class InputIterator,
|
||||
class Hash = hash<iter_key_t<InputIterator>>,
|
||||
@ -63,32 +59,28 @@ int main()
|
||||
*/
|
||||
|
||||
{
|
||||
boost::unordered_map m(x.begin(), x.end());
|
||||
static_assert(
|
||||
std::is_same<decltype(m), boost::unordered_map<int, int> >::value);
|
||||
}
|
||||
|
||||
/* Ambiguous:
|
||||
{
|
||||
boost::unordered_map m(x.begin(), x.end(), 0, std::hash<int>());
|
||||
static_assert(std::is_same<decltype(m),boost::unordered_map<int, int,
|
||||
std::hash<int>>>::value);
|
||||
UnorderedMap m(x.begin(), x.end());
|
||||
BOOST_TEST_TRAIT_SAME(decltype(m), UnorderedMap<int, int>);
|
||||
}
|
||||
|
||||
{
|
||||
boost::unordered_map m(x.begin(), x.end(), 0, std::hash<int>(),
|
||||
std::equal_to<int>());
|
||||
static_assert(std::is_same<decltype(m),boost::unordered_map<int, int,
|
||||
std::hash<int>, std::equal_to<int>>>::value);
|
||||
UnorderedMap m(x.begin(), x.end(), 0, std::hash<int>());
|
||||
BOOST_TEST_TRAIT_SAME(decltype(m), UnorderedMap<int, int, std::hash<int> >);
|
||||
}
|
||||
*/
|
||||
|
||||
{
|
||||
boost::unordered_map m(x.begin(), x.end(), 0, std::hash<int>(),
|
||||
UnorderedMap m(
|
||||
x.begin(), x.end(), 0, std::hash<int>(), std::equal_to<int>());
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(m), UnorderedMap<int, int, std::hash<int>, std::equal_to<int> >);
|
||||
}
|
||||
|
||||
{
|
||||
UnorderedMap m(x.begin(), x.end(), 0, std::hash<int>(),
|
||||
std::equal_to<int>(), pair_allocator);
|
||||
static_assert(std::is_same<decltype(m),
|
||||
boost::unordered_map<int, int, std::hash<int>, std::equal_to<int>,
|
||||
test_allocator<std::pair<const int, int> > > >::value);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(m), UnorderedMap<int, int, std::hash<int>, std::equal_to<int>,
|
||||
test_allocator<std::pair<const int, int> > >);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -102,33 +94,51 @@ int main()
|
||||
*/
|
||||
|
||||
{
|
||||
boost::unordered_map m({std::pair<int const, int>(1, 2)});
|
||||
static_assert(
|
||||
std::is_same<decltype(m), boost::unordered_map<int, int> >::value);
|
||||
}
|
||||
|
||||
/* Ambiguous
|
||||
{
|
||||
boost::unordered_map m({std::pair<int const, int>(1,2)}, 0,
|
||||
std::hash<int>());
|
||||
static_assert(std::is_same<decltype(m),boost::unordered_map<int, int,
|
||||
std::hash<int>>>::value);
|
||||
UnorderedMap m({std::pair<int const, int>(1, 2)});
|
||||
BOOST_TEST_TRAIT_SAME(decltype(m), UnorderedMap<int, int>);
|
||||
}
|
||||
|
||||
{
|
||||
boost::unordered_map m({std::pair<int const, int>(1,2)}, 0,
|
||||
std::hash<int>(), std::equal_to<int>());
|
||||
static_assert(std::is_same<decltype(m),boost::unordered_map<int, int,
|
||||
std::hash<int>, std::equal_to<int>>>::value);
|
||||
UnorderedMap m({std::pair<int, int>(1, 2)});
|
||||
BOOST_TEST_TRAIT_SAME(decltype(m), UnorderedMap<int, int>);
|
||||
}
|
||||
*/
|
||||
|
||||
{
|
||||
boost::unordered_map m(
|
||||
{std::pair<int const, int>(1, 2)}, 0, f, f, pair_allocator);
|
||||
static_assert(std::is_same<decltype(m),
|
||||
boost::unordered_map<int, int, hash_equals, hash_equals,
|
||||
test_allocator<std::pair<const int, int> > > >::value);
|
||||
UnorderedMap m({std::pair<int const, int>(1, 2)}, 0, std::hash<int>());
|
||||
BOOST_TEST_TRAIT_SAME(decltype(m), UnorderedMap<int, int, std::hash<int> >);
|
||||
}
|
||||
|
||||
{
|
||||
UnorderedMap m({std::pair<int, int>(1, 2)}, 0, std::hash<int>());
|
||||
BOOST_TEST_TRAIT_SAME(decltype(m), UnorderedMap<int, int, std::hash<int> >);
|
||||
}
|
||||
|
||||
{
|
||||
UnorderedMap m({std::pair<int const, int>(1, 2)}, 0, std::hash<int>(),
|
||||
std::equal_to<int>());
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(m), UnorderedMap<int, int, std::hash<int>, std::equal_to<int> >);
|
||||
}
|
||||
|
||||
{
|
||||
UnorderedMap m(
|
||||
{std::pair<int, int>(1, 2)}, 0, std::hash<int>(), std::equal_to<int>());
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(m), UnorderedMap<int, int, std::hash<int>, std::equal_to<int> >);
|
||||
}
|
||||
|
||||
{
|
||||
UnorderedMap m({std::pair<int const, int>(1, 2)}, 0, f, f, pair_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(m), UnorderedMap<int, int, hash_equals, hash_equals,
|
||||
test_allocator<std::pair<const int, int> > >);
|
||||
}
|
||||
|
||||
{
|
||||
UnorderedMap m({std::pair<int, int>(1, 2)}, 0, f, f, pair_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(m), UnorderedMap<int, int, hash_equals, hash_equals,
|
||||
test_allocator<std::pair<const int, int> > >);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -141,14 +151,12 @@ int main()
|
||||
Allocator>;
|
||||
*/
|
||||
|
||||
/* Ambiguous
|
||||
{
|
||||
boost::unordered_map m(x.begin(), x.end(), 0u, pair_allocator);
|
||||
static_assert(std::is_same<decltype(m), boost::unordered_map<int, int,
|
||||
boost::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int,
|
||||
int>>>>::value);
|
||||
UnorderedMap m(x.begin(), x.end(), 0u, pair_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(m), UnorderedMap<int, int, boost::hash<int>, std::equal_to<int>,
|
||||
test_allocator<std::pair<const int, int> > >);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
template<class InputIterator, class Allocator>
|
||||
@ -159,14 +167,12 @@ int main()
|
||||
Allocator>;
|
||||
*/
|
||||
|
||||
/* No constructor:
|
||||
{
|
||||
boost::unordered_map m(x.begin(), x.end(), pair_allocator);
|
||||
static_assert(std::is_same<decltype(m), boost::unordered_map<int, int,
|
||||
boost::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int,
|
||||
int>>>>::value);
|
||||
UnorderedMap m(x.begin(), x.end(), pair_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(m), UnorderedMap<int, int, boost::hash<int>, std::equal_to<int>,
|
||||
test_allocator<std::pair<const int, int> > >);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
template<class InputIterator, class Hash, class Allocator>
|
||||
@ -177,14 +183,12 @@ int main()
|
||||
equal_to<iter_key_t<InputIterator>>, Allocator>;
|
||||
*/
|
||||
|
||||
/* Ambiguous
|
||||
{
|
||||
boost::unordered_map m(x.begin(), x.end(), 0u, f, pair_allocator);
|
||||
static_assert(std::is_same<decltype(m), boost::unordered_map<int, int,
|
||||
hash_equals, std::equal_to<int>, test_allocator<std::pair<const int,
|
||||
int>>>>::value);
|
||||
UnorderedMap m(x.begin(), x.end(), 0u, f, pair_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(m), UnorderedMap<int, int, hash_equals, std::equal_to<int>,
|
||||
test_allocator<std::pair<const int, int> > >);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
template<class Key, class T, typename Allocator>
|
||||
@ -194,14 +198,19 @@ int main()
|
||||
-> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>;
|
||||
*/
|
||||
|
||||
/* Ambiguous
|
||||
{
|
||||
boost::unordered_map m({std::pair<int const, int>(1,2)}, 0, pair_allocator);
|
||||
static_assert(std::is_same<decltype(m),boost::unordered_map<int, int,
|
||||
boost::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int,
|
||||
int>>>>::value);
|
||||
UnorderedMap m({std::pair<int const, int>(1, 2)}, 0, pair_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(m), UnorderedMap<int, int, boost::hash<int>, std::equal_to<int>,
|
||||
test_allocator<std::pair<const int, int> > >);
|
||||
}
|
||||
|
||||
{
|
||||
UnorderedMap m({std::pair<int, int>(1, 2)}, 0, pair_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(m), UnorderedMap<int, int, boost::hash<int>, std::equal_to<int>,
|
||||
test_allocator<std::pair<const int, int> > >);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
template<class Key, class T, typename Allocator>
|
||||
@ -210,10 +219,17 @@ int main()
|
||||
*/
|
||||
|
||||
{
|
||||
boost::unordered_map m({std::pair<int const, int>(1, 2)}, pair_allocator);
|
||||
static_assert(std::is_same<decltype(m),
|
||||
boost::unordered_map<int, int, boost::hash<int>, std::equal_to<int>,
|
||||
test_allocator<std::pair<const int, int> > > >::value);
|
||||
UnorderedMap m({std::pair<int const, int>(1, 2)}, pair_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(m), UnorderedMap<int, int, boost::hash<int>, std::equal_to<int>,
|
||||
test_allocator<std::pair<const int, int> > >);
|
||||
}
|
||||
|
||||
{
|
||||
UnorderedMap m({std::pair<int, int>(1, 2)}, pair_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(m), UnorderedMap<int, int, boost::hash<int>, std::equal_to<int>,
|
||||
test_allocator<std::pair<const int, int> > >);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -224,129 +240,168 @@ int main()
|
||||
-> unordered_map<Key, T, Hash, equal_to<Key>, Allocator>;
|
||||
*/
|
||||
|
||||
/* Ambiguous
|
||||
{
|
||||
boost::unordered_map m({std::pair<int const, int>(1,2)}, 0, f,
|
||||
pair_allocator);
|
||||
static_assert(std::is_same<decltype(m),boost::unordered_map<int, int,
|
||||
boost::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int,
|
||||
int>>>>::value);
|
||||
}
|
||||
*/
|
||||
|
||||
// unordered_multimap
|
||||
|
||||
{
|
||||
boost::unordered_multimap m(x.begin(), x.end());
|
||||
static_assert(
|
||||
std::is_same<decltype(m), boost::unordered_multimap<int, int> >::value);
|
||||
}
|
||||
|
||||
/* Ambiguous:
|
||||
{
|
||||
boost::unordered_multimap m(x.begin(), x.end(), 0, std::hash<int>());
|
||||
static_assert(std::is_same<decltype(m),boost::unordered_multimap<int, int,
|
||||
std::hash<int>>>::value);
|
||||
UnorderedMap m({std::pair<int const, int>(1, 2)}, 0, f, pair_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(m), UnorderedMap<int, int, hash_equals, std::equal_to<int>,
|
||||
test_allocator<std::pair<const int, int> > >);
|
||||
}
|
||||
|
||||
{
|
||||
boost::unordered_multimap m(x.begin(), x.end(), 0, std::hash<int>(),
|
||||
std::equal_to<int>());
|
||||
static_assert(std::is_same<decltype(m),boost::unordered_multimap<int, int,
|
||||
std::hash<int>, std::equal_to<int>>>::value);
|
||||
UnorderedMap m({std::pair<int, int>(1, 2)}, 0, f, pair_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(m), UnorderedMap<int, int, hash_equals, std::equal_to<int>,
|
||||
test_allocator<std::pair<const int, int> > >);
|
||||
}
|
||||
}
|
||||
|
||||
template <template <class...> class UnorderedSet> void set_tests()
|
||||
{
|
||||
std::vector<int> y;
|
||||
y.push_back(1);
|
||||
y.push_back(2);
|
||||
|
||||
hash_equals f;
|
||||
|
||||
test_allocator<int> int_allocator;
|
||||
|
||||
/* template<class InputIt,
|
||||
class Hash = std::hash<typename
|
||||
std::iterator_traits<InputIt>::value_type>, class Pred =
|
||||
std::equal_to<typename std::iterator_traits<InputIt>::value_type>, class
|
||||
Alloc = std::allocator<typename std::iterator_traits<InputIt>::value_type>>
|
||||
unordered_set(InputIt, InputIt,
|
||||
typename see below ::size_type = see below,
|
||||
Hash = Hash(), Pred = Pred(), Alloc = Alloc())
|
||||
-> unordered_set<typename std::iterator_traits<InputIt>::value_type, Hash,
|
||||
Pred, Alloc>; */
|
||||
|
||||
{
|
||||
UnorderedSet s(y.begin(), y.end());
|
||||
BOOST_TEST_TRAIT_SAME(decltype(s), UnorderedSet<int>);
|
||||
}
|
||||
|
||||
{
|
||||
UnorderedSet s(y.begin(), y.end(), 0, std::hash<int>());
|
||||
BOOST_TEST_TRAIT_SAME(decltype(s), UnorderedSet<int, std::hash<int> >);
|
||||
}
|
||||
|
||||
{
|
||||
UnorderedSet s(
|
||||
y.begin(), y.end(), 0, std::hash<int>(), std::equal_to<int>());
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(s), UnorderedSet<int, std::hash<int>, std::equal_to<int> >);
|
||||
}
|
||||
|
||||
{
|
||||
UnorderedSet s(y.begin(), y.end(), 0, std::hash<int>(),
|
||||
std::equal_to<int>(), int_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(s), UnorderedSet<int, std::hash<int>, std::equal_to<int>,
|
||||
test_allocator<int> >);
|
||||
}
|
||||
|
||||
/* template<class T,
|
||||
class Hash = std::hash<T>,
|
||||
class Pred = std::equal_to<T>,
|
||||
class Alloc = std::allocator<T>>
|
||||
unordered_set(std::initializer_list<T>,
|
||||
typename see below::size_type = see below,
|
||||
Hash = Hash(), Pred = Pred(), Alloc = Alloc())
|
||||
-> unordered_set<T, Hash, Pred, Alloc>; */
|
||||
|
||||
{
|
||||
UnorderedSet s({1, 2});
|
||||
BOOST_TEST_TRAIT_SAME(decltype(s), UnorderedSet<int>);
|
||||
}
|
||||
|
||||
{
|
||||
UnorderedSet s({1, 2}, 0, std::hash<int>());
|
||||
BOOST_TEST_TRAIT_SAME(decltype(s), UnorderedSet<int, std::hash<int> >);
|
||||
}
|
||||
|
||||
{
|
||||
UnorderedSet s({1, 2}, 0, std::hash<int>(), std::equal_to<int>());
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(s), UnorderedSet<int, std::hash<int>, std::equal_to<int> >);
|
||||
}
|
||||
|
||||
{
|
||||
UnorderedSet s(
|
||||
{1, 2}, 0, std::hash<int>(), std::equal_to<int>(), int_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(s), UnorderedSet<int, std::hash<int>, std::equal_to<int>,
|
||||
test_allocator<int> >);
|
||||
}
|
||||
|
||||
{
|
||||
UnorderedSet s({1, 2}, 0, f, f, int_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(decltype(s),
|
||||
UnorderedSet<int, hash_equals, hash_equals, test_allocator<int> >);
|
||||
}
|
||||
|
||||
/* template<class InputIt, class Alloc>
|
||||
unordered_set(InputIt, InputIt, typename see below::size_type, Alloc)
|
||||
-> unordered_set<typename std::iterator_traits<InputIt>::value_type,
|
||||
std::hash<typename std::iterator_traits<InputIt>::value_type>,
|
||||
std::equal_to<typename
|
||||
std::iterator_traits<InputIt>::value_type>, Alloc>; */
|
||||
|
||||
{
|
||||
UnorderedSet s(y.begin(), y.end(), 0u, int_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(s), UnorderedSet<int, boost::hash<int>, std::equal_to<int>,
|
||||
test_allocator<int> >);
|
||||
}
|
||||
|
||||
/* template<class InputIt, class Hash, class Alloc>
|
||||
unordered_set(InputIt, InputIt, typename see below::size_type, Hash, Alloc)
|
||||
-> unordered_set<typename std::iterator_traits<InputIt>::value_type, Hash,
|
||||
std::equal_to<typename
|
||||
std::iterator_traits<InputIt>::value_type>, Allocator>; */
|
||||
|
||||
{
|
||||
UnorderedSet s(y.begin(), y.end(), 0u, f, int_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(decltype(s),
|
||||
UnorderedSet<int, hash_equals, std::equal_to<int>, test_allocator<int> >);
|
||||
}
|
||||
|
||||
/* template<class T, class Allocator>
|
||||
unordered_set(std::initializer_list<T>, typename see below::size_type,
|
||||
Allocator)
|
||||
-> unordered_set<T, std::hash<T>, std::equal_to<T>, Alloc>; */
|
||||
|
||||
{
|
||||
UnorderedSet s({1, 2}, 0u, int_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(
|
||||
decltype(s), UnorderedSet<int, boost::hash<int>, std::equal_to<int>,
|
||||
test_allocator<int> >);
|
||||
}
|
||||
|
||||
/* template<class T, class Hash, class Alloc>
|
||||
unordered_set(std::initializer_list<T>, typename see below::size_type, Hash,
|
||||
Alloc)
|
||||
-> unordered_set<T, Hash, std::equal_to<T>, Alloc>; */
|
||||
{
|
||||
UnorderedSet s({1, 2}, 0u, f, int_allocator);
|
||||
BOOST_TEST_TRAIT_SAME(decltype(s),
|
||||
UnorderedSet<int, hash_equals, std::equal_to<int>, test_allocator<int> >);
|
||||
}
|
||||
*/
|
||||
|
||||
{
|
||||
boost::unordered_multimap m(x.begin(), x.end(), 0, std::hash<int>(),
|
||||
std::equal_to<int>(), pair_allocator);
|
||||
static_assert(std::is_same<decltype(m),
|
||||
boost::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>,
|
||||
test_allocator<std::pair<const int, int> > > >::value);
|
||||
}
|
||||
|
||||
{
|
||||
boost::unordered_multimap m({std::pair<int const, int>(1, 2)});
|
||||
static_assert(
|
||||
std::is_same<decltype(m), boost::unordered_multimap<int, int> >::value);
|
||||
}
|
||||
|
||||
/* Ambiguous
|
||||
{
|
||||
boost::unordered_multimap m({std::pair<int const, int>(1,2)}, 0,
|
||||
std::hash<int>());
|
||||
static_assert(std::is_same<decltype(m),boost::unordered_multimap<int, int,
|
||||
std::hash<int>>>::value);
|
||||
}
|
||||
|
||||
{
|
||||
boost::unordered_multimap m({std::pair<int const, int>(1,2)}, 0,
|
||||
std::hash<int>(), std::equal_to<int>());
|
||||
static_assert(std::is_same<decltype(m),boost::unordered_multimap<int, int,
|
||||
std::hash<int>, std::equal_to<int>>>::value);
|
||||
}
|
||||
*/
|
||||
|
||||
{
|
||||
boost::unordered_multimap m(
|
||||
{std::pair<int const, int>(1, 2)}, 0, f, f, pair_allocator);
|
||||
static_assert(std::is_same<decltype(m),
|
||||
boost::unordered_multimap<int, int, hash_equals, hash_equals,
|
||||
test_allocator<std::pair<const int, int> > > >::value);
|
||||
}
|
||||
|
||||
/* Ambiguous
|
||||
{
|
||||
boost::unordered_multimap m(x.begin(), x.end(), 0u, pair_allocator);
|
||||
static_assert(std::is_same<decltype(m), boost::unordered_multimap<int, int,
|
||||
boost::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int,
|
||||
int>>>>::value);
|
||||
}
|
||||
*/
|
||||
|
||||
/* No constructor:
|
||||
{
|
||||
boost::unordered_multimap m(x.begin(), x.end(), pair_allocator);
|
||||
static_assert(std::is_same<decltype(m), boost::unordered_multimap<int, int,
|
||||
boost::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int,
|
||||
int>>>>::value);
|
||||
}
|
||||
*/
|
||||
|
||||
/* Ambiguous
|
||||
{
|
||||
boost::unordered_multimap m(x.begin(), x.end(), 0u, f, pair_allocator);
|
||||
static_assert(std::is_same<decltype(m), boost::unordered_multimap<int, int,
|
||||
hash_equals, std::equal_to<int>, test_allocator<std::pair<const int,
|
||||
int>>>>::value);
|
||||
}
|
||||
|
||||
{
|
||||
boost::unordered_multimap m({std::pair<int const, int>(1,2)}, 0,
|
||||
pair_allocator);
|
||||
static_assert(std::is_same<decltype(m),boost::unordered_multimap<int, int,
|
||||
boost::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int,
|
||||
int>>>>::value);
|
||||
}
|
||||
*/
|
||||
|
||||
{
|
||||
boost::unordered_multimap m(
|
||||
{std::pair<int const, int>(1, 2)}, pair_allocator);
|
||||
static_assert(std::is_same<decltype(m),
|
||||
boost::unordered_multimap<int, int, boost::hash<int>, std::equal_to<int>,
|
||||
test_allocator<std::pair<const int, int> > > >::value);
|
||||
}
|
||||
|
||||
/* Ambiguous
|
||||
{
|
||||
boost::unordered_multimap m({std::pair<int const, int>(1,2)}, 0, f,
|
||||
pair_allocator);
|
||||
static_assert(std::is_same<decltype(m),boost::unordered_multimap<int, int,
|
||||
boost::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int,
|
||||
int>>>>::value);
|
||||
}
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES: "
|
||||
<< BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES << std::endl;
|
||||
|
||||
#if BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES
|
||||
map_tests<boost::unordered_map>();
|
||||
map_tests<boost::unordered_multimap>();
|
||||
set_tests<boost::unordered_set>();
|
||||
set_tests<boost::unordered_multiset>();
|
||||
|
||||
return boost::report_errors();
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user