summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/hana/test/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/hana/test/map')
-rw-r--r--src/boost/libs/hana/test/map/any_of.cpp52
-rw-r--r--src/boost/libs/hana/test/map/assign.copy.cpp57
-rw-r--r--src/boost/libs/hana/test/map/assign.move.cpp92
-rw-r--r--src/boost/libs/hana/test/map/at_key.collisions.cpp149
-rw-r--r--src/boost/libs/hana/test/map/at_key.cpp60
-rw-r--r--src/boost/libs/hana/test/map/at_key.ref.cpp84
-rw-r--r--src/boost/libs/hana/test/map/at_key.stackoverflow.cpp38
-rw-r--r--src/boost/libs/hana/test/map/cnstr.copy.cpp114
-rw-r--r--src/boost/libs/hana/test/map/cnstr.default.cpp74
-rw-r--r--src/boost/libs/hana/test/map/cnstr.move.cpp123
-rw-r--r--src/boost/libs/hana/test/map/cnstr.trap.cpp72
-rw-r--r--src/boost/libs/hana/test/map/cnstr.variadic.cpp186
-rw-r--r--src/boost/libs/hana/test/map/contains.cpp117
-rw-r--r--src/boost/libs/hana/test/map/difference.cpp106
-rw-r--r--src/boost/libs/hana/test/map/equal.cpp97
-rw-r--r--src/boost/libs/hana/test/map/erase_key.cpp70
-rw-r--r--src/boost/libs/hana/test/map/find_if.cpp52
-rw-r--r--src/boost/libs/hana/test/map/fold_left.cpp58
-rw-r--r--src/boost/libs/hana/test/map/fold_right.cpp58
-rw-r--r--src/boost/libs/hana/test/map/insert.cpp68
-rw-r--r--src/boost/libs/hana/test/map/intersection.cpp99
-rw-r--r--src/boost/libs/hana/test/map/is_subset.cpp51
-rw-r--r--src/boost/libs/hana/test/map/keys.cpp49
-rw-r--r--src/boost/libs/hana/test/map/laws.cpp37
-rw-r--r--src/boost/libs/hana/test/map/map.cpp33
-rw-r--r--src/boost/libs/hana/test/map/symmetric_difference.cpp80
-rw-r--r--src/boost/libs/hana/test/map/to.cpp92
-rw-r--r--src/boost/libs/hana/test/map/union.cpp82
-rw-r--r--src/boost/libs/hana/test/map/unpack.cpp50
-rw-r--r--src/boost/libs/hana/test/map/values.cpp48
30 files changed, 2348 insertions, 0 deletions
diff --git a/src/boost/libs/hana/test/map/any_of.cpp b/src/boost/libs/hana/test/map/any_of.cpp
new file mode 100644
index 000000000..8d352c56d
--- /dev/null
+++ b/src/boost/libs/hana/test/map/any_of.cpp
@@ -0,0 +1,52 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/any_of.hpp>
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/not.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::any_of(
+ hana::make_map(),
+ hana::equal.to(key<1>()
+ ))));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::any_of(
+ hana::make_map(p<1, 1>()),
+ hana::equal.to(key<1>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::any_of(
+ hana::make_map(p<1, 1>()),
+ hana::equal.to(key<2>())
+ )));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::any_of(
+ hana::make_map(p<1, 1>(), p<2, 2>()),
+ hana::equal.to(key<1>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::any_of(
+ hana::make_map(p<1, 1>(), p<2, 2>()),
+ hana::equal.to(key<2>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::any_of(
+ hana::make_map(p<1, 1>(), p<2, 2>()),
+ hana::equal.to(key<3>())
+ )));
+}
diff --git a/src/boost/libs/hana/test/map/assign.copy.cpp b/src/boost/libs/hana/test/map/assign.copy.cpp
new file mode 100644
index 000000000..d5d098392
--- /dev/null
+++ b/src/boost/libs/hana/test/map/assign.copy.cpp
@@ -0,0 +1,57 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/at_key.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/pair.hpp>
+
+#include <laws/base.hpp>
+
+#include <string>
+namespace hana = boost::hana;
+namespace test = hana::test;
+
+
+int main() {
+ {
+ using Map = hana::map<>;
+ Map map0;
+ Map map;
+ map0 = map;
+ }
+ {
+ using Map = hana::map<hana::pair<test::ct_eq<0>, int>>;
+ Map map0 = hana::make_map(hana::make_pair(test::ct_eq<0>{}, 999));
+ Map map = hana::make_map(hana::make_pair(test::ct_eq<0>{}, 4));
+ map0 = map;
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<0>{}) == 4);
+ }
+ {
+ using Map = hana::map<hana::pair<test::ct_eq<0>, int>,
+ hana::pair<test::ct_eq<1>, char>>;
+ Map map0 = hana::make_map(hana::make_pair(test::ct_eq<0>{}, 999),
+ hana::make_pair(test::ct_eq<1>{}, 'z'));
+ Map map = hana::make_map(hana::make_pair(test::ct_eq<0>{}, 4),
+ hana::make_pair(test::ct_eq<1>{}, 'a'));
+ map0 = map;
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<0>{}) == 4);
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<1>{}) == 'a');
+ }
+ {
+ using Map = hana::map<hana::pair<test::ct_eq<0>, int>,
+ hana::pair<test::ct_eq<1>, char>,
+ hana::pair<test::ct_eq<2>, std::string>>;
+ Map map0 = hana::make_map(hana::make_pair(test::ct_eq<0>{}, 999),
+ hana::make_pair(test::ct_eq<1>{}, 'z'),
+ hana::make_pair(test::ct_eq<2>{}, std::string{"zzzzzzzz"}));
+ Map map = hana::make_map(hana::make_pair(test::ct_eq<0>{}, 4),
+ hana::make_pair(test::ct_eq<1>{}, 'a'),
+ hana::make_pair(test::ct_eq<2>{}, std::string{"abc"}));
+ map0 = map;
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<0>{}) == 4);
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<1>{}) == 'a');
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<2>{}) == "abc");
+ }
+}
diff --git a/src/boost/libs/hana/test/map/assign.move.cpp b/src/boost/libs/hana/test/map/assign.move.cpp
new file mode 100644
index 000000000..a04f55e4a
--- /dev/null
+++ b/src/boost/libs/hana/test/map/assign.move.cpp
@@ -0,0 +1,92 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/at_key.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/pair.hpp>
+
+#include <laws/base.hpp>
+
+#include <string>
+#include <utility>
+namespace hana = boost::hana;
+namespace test = hana::test;
+
+
+struct MoveOnly {
+ int data_;
+ MoveOnly(MoveOnly const&) = delete;
+ MoveOnly& operator=(MoveOnly const&) = delete;
+ MoveOnly(int data = 1) : data_(data) { }
+ MoveOnly(MoveOnly&& x) : data_(x.data_) { x.data_ = 0; }
+
+ MoveOnly& operator=(MoveOnly&& x)
+ { data_ = x.data_; x.data_ = 0; return *this; }
+
+ int get() const {return data_;}
+ bool operator==(const MoveOnly& x) const { return data_ == x.data_; }
+ bool operator< (const MoveOnly& x) const { return data_ < x.data_; }
+};
+
+int main() {
+ {
+ using Map = hana::map<>;
+ Map map0;
+ Map map;
+ map0 = std::move(map);
+ }
+ {
+ using Map = hana::map<hana::pair<test::ct_eq<0>, MoveOnly>>;
+ Map map0 = hana::make_map(hana::make_pair(test::ct_eq<0>{}, MoveOnly{999}));
+ Map map = hana::make_map(hana::make_pair(test::ct_eq<0>{}, MoveOnly{4}));
+ map0 = std::move(map);
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<0>{}) == MoveOnly{4});
+ }
+ {
+ using Map = hana::map<hana::pair<test::ct_eq<0>, MoveOnly>,
+ hana::pair<test::ct_eq<1>, MoveOnly>>;
+ Map map0 = hana::make_map(hana::make_pair(test::ct_eq<0>{}, MoveOnly{999}),
+ hana::make_pair(test::ct_eq<1>{}, MoveOnly{888}));
+ Map map = hana::make_map(hana::make_pair(test::ct_eq<0>{}, MoveOnly{4}),
+ hana::make_pair(test::ct_eq<1>{}, MoveOnly{5}));
+ map0 = std::move(map);
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<0>{}) == MoveOnly{4});
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<1>{}) == MoveOnly{5});
+ }
+ {
+ using Map = hana::map<hana::pair<test::ct_eq<0>, MoveOnly>,
+ hana::pair<test::ct_eq<1>, MoveOnly>,
+ hana::pair<test::ct_eq<2>, MoveOnly>>;
+ Map map0 = hana::make_map(hana::make_pair(test::ct_eq<0>{}, MoveOnly{999}),
+ hana::make_pair(test::ct_eq<1>{}, MoveOnly{888}),
+ hana::make_pair(test::ct_eq<2>{}, MoveOnly{777}));
+ Map map = hana::make_map(hana::make_pair(test::ct_eq<0>{}, MoveOnly{4}),
+ hana::make_pair(test::ct_eq<1>{}, MoveOnly{5}),
+ hana::make_pair(test::ct_eq<2>{}, MoveOnly{6}));
+ map0 = std::move(map);
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<0>{}) == MoveOnly{4});
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<1>{}) == MoveOnly{5});
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<2>{}) == MoveOnly{6});
+ }
+ {
+ using Map = hana::map<hana::pair<test::ct_eq<0>, MoveOnly>,
+ hana::pair<test::ct_eq<1>, MoveOnly>,
+ hana::pair<test::ct_eq<2>, MoveOnly>,
+ hana::pair<test::ct_eq<3>, std::string>>;
+ Map map0 = hana::make_map(hana::make_pair(test::ct_eq<0>{}, MoveOnly{999}),
+ hana::make_pair(test::ct_eq<1>{}, MoveOnly{888}),
+ hana::make_pair(test::ct_eq<2>{}, MoveOnly{777}),
+ hana::make_pair(test::ct_eq<3>{}, std::string{"zzzzz"}));
+ Map map = hana::make_map(hana::make_pair(test::ct_eq<0>{}, MoveOnly{4}),
+ hana::make_pair(test::ct_eq<1>{}, MoveOnly{5}),
+ hana::make_pair(test::ct_eq<2>{}, MoveOnly{6}),
+ hana::make_pair(test::ct_eq<3>{}, std::string{"abc"}));
+ map0 = std::move(map);
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<0>{}) == MoveOnly{4});
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<1>{}) == MoveOnly{5});
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<2>{}) == MoveOnly{6});
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<3>{}) == std::string{"abc"});
+ }
+}
diff --git a/src/boost/libs/hana/test/map/at_key.collisions.cpp b/src/boost/libs/hana/test/map/at_key.collisions.cpp
new file mode 100644
index 000000000..3df10c4a0
--- /dev/null
+++ b/src/boost/libs/hana/test/map/at_key.collisions.cpp
@@ -0,0 +1,149 @@
+// Copyright Jason Rice 2016
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/at_key.hpp>
+#include <boost/hana/core/to.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/hash.hpp>
+#include <boost/hana/integral_constant.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/not.hpp>
+#include <boost/hana/pair.hpp>
+#include <boost/hana/tuple.hpp>
+namespace hana = boost::hana;
+
+
+struct A { };
+struct B { };
+
+struct the_hash;
+
+namespace boost { namespace hana {
+ template <>
+ struct hash_impl<A> {
+ static constexpr auto apply(A const&) {
+ return hana::type_c<the_hash>;
+ }
+ };
+
+ template <>
+ struct hash_impl<B> {
+ static constexpr auto apply(B const&) {
+ return hana::type_c<the_hash>;
+ }
+ };
+
+ template <>
+ struct equal_impl<A, A> {
+ static constexpr auto apply(A const&, A const&) {
+ return hana::true_c;
+ }
+ };
+
+ template <>
+ struct equal_impl<B, B> {
+ static constexpr auto apply(B const&, B const&) {
+ return hana::true_c;
+ }
+ };
+}}
+
+int main() {
+ constexpr auto key1 = A{};
+ constexpr auto key2 = B{};
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(key1, key1));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(key2, key2));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(key1, key2)));
+
+ // ensure the hashes actually collide
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(hana::hash(key1), hana::hash(key2)));
+
+ {
+ auto map = hana::to_map(hana::make_tuple(
+ hana::make_pair(key1, key1),
+ hana::make_pair(key2, key2)
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(map, key1),
+ key1
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(map, key2),
+ key2
+ ));
+ }
+
+ {
+ auto map = hana::to_map(hana::make_tuple(
+ hana::make_pair(key2, key2),
+ hana::make_pair(key1, key1)
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(map, key1),
+ key1
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(map, key2),
+ key2
+ ));
+ }
+
+ {
+ auto map = hana::to_map(hana::make_tuple(
+ hana::make_pair(key1, key1),
+ hana::make_pair(hana::int_c<56>, hana::int_c<56>),
+ hana::make_pair(key2, key2)
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(map, key1),
+ key1
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(map, hana::int_c<56>),
+ hana::int_c<56>
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(map, key2),
+ key2
+ ));
+ }
+
+ {
+ auto map = hana::to_map(hana::make_tuple(
+ hana::make_pair(key1, key1),
+ hana::make_pair(hana::int_c<56>, hana::int_c<56>),
+ hana::make_pair(key2, key2),
+ hana::make_pair(hana::int_c<42>, hana::int_c<42>)
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(map, key1),
+ key1
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(map, hana::int_c<56>),
+ hana::int_c<56>
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(map, key2),
+ key2
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(map, hana::int_c<42>),
+ hana::int_c<42>
+ ));
+ }
+}
diff --git a/src/boost/libs/hana/test/map/at_key.cpp b/src/boost/libs/hana/test/map/at_key.cpp
new file mode 100644
index 000000000..c948216cb
--- /dev/null
+++ b/src/boost/libs/hana/test/map/at_key.cpp
@@ -0,0 +1,60 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/at_key.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/map.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+
+#include <utility>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(hana::make_map(p<0, 0>()), key<0>()),
+ val<0>()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(hana::make_map(p<0, 0>(), p<1,1>()), key<0>()),
+ val<0>()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(hana::make_map(p<0, 0>(), p<1,1>()), key<1>()),
+ val<1>()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(hana::make_map(p<0, 0>(), p<1,1>(), p<2,2>()), key<0>()),
+ val<0>()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(hana::make_map(p<0, 0>(), p<1,1>(), p<2,2>()), key<1>()),
+ val<1>()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::at_key(hana::make_map(p<0, 0>(), p<1,1>(), p<2,2>()), key<2>()),
+ val<2>()
+ ));
+
+ // check operators
+ auto m = hana::make_map(p<2, 2>(), p<1, 1>());
+ auto const const_m = hana::make_map(p<2, 2>(), p<1, 1>());
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(m[key<1>()], val<1>()));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(const_m[key<1>()], val<1>()));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(std::move(m)[key<1>()], val<1>()));
+}
diff --git a/src/boost/libs/hana/test/map/at_key.ref.cpp b/src/boost/libs/hana/test/map/at_key.ref.cpp
new file mode 100644
index 000000000..c845bc134
--- /dev/null
+++ b/src/boost/libs/hana/test/map/at_key.ref.cpp
@@ -0,0 +1,84 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/at_key.hpp>
+#include <boost/hana/integral_constant.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/pair.hpp>
+
+#include <utility>
+namespace hana = boost::hana;
+
+
+template <typename T>
+T const& cref(T& t) { return t; }
+
+int main() {
+ // using at_key
+ {
+ auto xs = hana::make_map(
+ hana::make_pair(hana::int_c<0>, 0),
+ hana::make_pair(hana::int_c<1>, '1'),
+ hana::make_pair(hana::int_c<2>, 2.2)
+ );
+
+ // Make sure we return lvalue-references
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(xs, hana::int_c<0>) == 0);
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(xs, hana::int_c<1>) == '1');
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(xs, hana::int_c<2>) == 2.2);
+
+ int& a = hana::at_key(xs, hana::int_c<0>);
+ char& b = hana::at_key(xs, hana::int_c<1>);
+ double& c = hana::at_key(xs, hana::int_c<2>);
+ a = 9;
+ b = '9';
+ c = 9.9;
+
+ // Make sure we return lvalue-references to const on a const map
+ int const& ca = hana::at_key(cref(xs), hana::int_c<0>);
+ char const& cb = hana::at_key(cref(xs), hana::int_c<1>);
+ double const& cc = hana::at_key(cref(xs), hana::int_c<2>);
+
+ BOOST_HANA_RUNTIME_CHECK(ca == 9);
+ BOOST_HANA_RUNTIME_CHECK(cb == '9');
+ BOOST_HANA_RUNTIME_CHECK(cc == 9.9);
+ }
+
+ // using operator[]
+ {
+ auto xs = hana::make_map(
+ hana::make_pair(hana::int_c<0>, 0),
+ hana::make_pair(hana::int_c<1>, '1'),
+ hana::make_pair(hana::int_c<2>, 2.2)
+ );
+
+ BOOST_HANA_RUNTIME_CHECK(xs[hana::int_c<0>] == 0);
+ BOOST_HANA_RUNTIME_CHECK(xs[hana::int_c<1>] == '1');
+ BOOST_HANA_RUNTIME_CHECK(xs[hana::int_c<2>] == 2.2);
+
+ xs[hana::int_c<0>] = 9;
+ xs[hana::int_c<1>] = '9';
+ xs[hana::int_c<2>] = 9.9;
+
+ BOOST_HANA_RUNTIME_CHECK(xs[hana::int_c<0>] == 9);
+ BOOST_HANA_RUNTIME_CHECK(xs[hana::int_c<1>] == '9');
+ BOOST_HANA_RUNTIME_CHECK(xs[hana::int_c<2>] == 9.9);
+ }
+
+ // Make sure we return a rvalue-reference from a temporary map
+ // (https://github.com/boostorg/hana/issues/90)
+ {
+ auto xs = hana::make_map(
+ hana::make_pair(hana::int_c<0>, 0),
+ hana::make_pair(hana::int_c<1>, '1'),
+ hana::make_pair(hana::int_c<2>, 2.2)
+ );
+
+ char&& c = hana::at_key(std::move(xs), hana::int_c<1>);
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(xs, hana::int_c<1>) == '1');
+ c = '9';
+ BOOST_HANA_RUNTIME_CHECK(hana::at_key(xs, hana::int_c<1>) == '9');
+ }
+}
diff --git a/src/boost/libs/hana/test/map/at_key.stackoverflow.cpp b/src/boost/libs/hana/test/map/at_key.stackoverflow.cpp
new file mode 100644
index 000000000..7f71799a3
--- /dev/null
+++ b/src/boost/libs/hana/test/map/at_key.stackoverflow.cpp
@@ -0,0 +1,38 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/at_key.hpp>
+#include <boost/hana/fold_left.hpp>
+#include <boost/hana/integral_constant.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/pair.hpp>
+#include <boost/hana/range.hpp>
+namespace hana = boost::hana;
+
+
+//
+// Make sure that http://stackoverflow.com/q/32702383/627587 works.
+//
+
+auto at = [](auto& map, auto key) -> auto& {
+ return map[key];
+};
+
+template <typename Map, typename Keys>
+auto& traverse(Map& map, Keys const& keys){
+ return hana::fold_left(keys, map, at);
+}
+
+int main() {
+ auto xs = hana::make_map(hana::make_pair(hana::int_c<0>,
+ hana::make_map(hana::make_pair(hana::int_c<1>,
+ hana::make_map(hana::make_pair(hana::int_c<2>,
+ hana::make_map(hana::make_pair(hana::int_c<3>, 10))))))));
+
+ int& i = traverse(xs, hana::range_c<int, 0, 4>);
+ BOOST_HANA_RUNTIME_CHECK(i == 10);
+ i = 99;
+ BOOST_HANA_RUNTIME_CHECK(traverse(xs, hana::range_c<int, 0, 4>) == 99);
+}
diff --git a/src/boost/libs/hana/test/map/cnstr.copy.cpp b/src/boost/libs/hana/test/map/cnstr.copy.cpp
new file mode 100644
index 000000000..881de02bb
--- /dev/null
+++ b/src/boost/libs/hana/test/map/cnstr.copy.cpp
@@ -0,0 +1,114 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/bool.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/fwd/hash.hpp>
+#include <boost/hana/integral_constant.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/type.hpp>
+
+#include <string>
+#include <type_traits>
+namespace hana = boost::hana;
+
+
+struct NoCopy {
+ NoCopy() = default;
+ NoCopy(NoCopy const&) = delete;
+ friend auto operator==(NoCopy const&, NoCopy const&) { return hana::true_c; }
+ friend auto operator!=(NoCopy const&, NoCopy const&) { return hana::false_c; }
+};
+
+// Note: It is also useful to check with a non-empty class, because that
+// triggers different instantiations due to EBO.
+struct NoCopy_nonempty {
+ NoCopy_nonempty() = default;
+ NoCopy_nonempty(NoCopy_nonempty const&) = delete;
+ int i;
+ friend auto operator==(NoCopy_nonempty const&, NoCopy_nonempty const&) { return hana::true_c; }
+ friend auto operator!=(NoCopy_nonempty const&, NoCopy_nonempty const&) { return hana::false_c; }
+};
+
+namespace boost { namespace hana {
+ template <>
+ struct hash_impl<NoCopy> {
+ static constexpr auto apply(NoCopy const&)
+ { return hana::type_c<NoCopy>; };
+ };
+
+ template <>
+ struct hash_impl<NoCopy_nonempty> {
+ static constexpr auto apply(NoCopy_nonempty const&)
+ { return hana::type_c<NoCopy_nonempty>; };
+ };
+}}
+
+
+int main() {
+ {
+ auto t0 = hana::make_map();
+ auto t_implicit = t0;
+ auto t_explicit(t0);
+
+ (void)t_explicit;
+ (void)t_implicit;
+ }
+ {
+ auto t0 = hana::make_map(hana::make_pair(hana::int_c<2>, hana::int_c<20>));
+ auto t_implicit = t0;
+ auto t_explicit(t0);
+
+ (void)t_implicit;
+ (void)t_explicit;
+ }
+ {
+ auto t0 = hana::make_map(hana::make_pair(hana::int_c<2>, hana::int_c<20>),
+ hana::make_pair(hana::int_c<3>, hana::int_c<30>));
+ auto t_implicit = t0;
+ auto t_explicit(t0);
+
+ (void)t_implicit;
+ (void)t_explicit;
+ }
+ {
+ auto t0 = hana::make_map(hana::make_pair(hana::int_c<2>, hana::int_c<20>),
+ hana::make_pair(hana::int_c<3>, hana::int_c<30>),
+ hana::make_pair(hana::type_c<void>, hana::type_c<void*>));
+ auto t_implicit = t0;
+ auto t_explicit(t0);
+
+ (void)t_implicit;
+ (void)t_explicit;
+ }
+ {
+ constexpr auto t0 = hana::make_map(
+ hana::make_pair(hana::int_c<2>, hana::int_c<20>),
+ hana::make_pair(hana::int_c<3>, hana::int_c<30>),
+ hana::make_pair(hana::type_c<void>, hana::type_c<void*>));
+ constexpr auto t_implicit = t0;
+ constexpr auto t_explicit(t0);
+
+ (void)t_implicit;
+ (void)t_explicit;
+ }
+ {
+ auto t0 = hana::make_map(hana::make_pair(hana::int_c<2>, std::string{"abcdef"}));
+ auto copy = t0;
+ BOOST_HANA_RUNTIME_CHECK(
+ copy == hana::make_map(hana::make_pair(hana::int_c<2>, std::string{"abcdef"}))
+ );
+ }
+
+ {
+ using Map1 = hana::map<hana::pair<NoCopy, NoCopy>>;
+ Map1 map1; (void)map1;
+ static_assert(!std::is_copy_constructible<Map1>::value, "");
+
+ using Map2 = hana::map<hana::pair<NoCopy_nonempty, NoCopy_nonempty>>;
+ Map2 map2; (void)map2;
+ static_assert(!std::is_copy_constructible<Map2>::value, "");
+ }
+}
diff --git a/src/boost/libs/hana/test/map/cnstr.default.cpp b/src/boost/libs/hana/test/map/cnstr.default.cpp
new file mode 100644
index 000000000..cd1320c8f
--- /dev/null
+++ b/src/boost/libs/hana/test/map/cnstr.default.cpp
@@ -0,0 +1,74 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/bool.hpp>
+#include <boost/hana/fwd/hash.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/pair.hpp>
+#include <boost/hana/type.hpp>
+
+#include <type_traits>
+namespace hana = boost::hana;
+
+
+struct NoDefault {
+ NoDefault() = delete;
+ NoDefault(NoDefault const&) = default;
+ constexpr explicit NoDefault(int) { }
+};
+
+auto operator==(NoDefault const&, NoDefault const&) { return hana::true_c; }
+auto operator!=(NoDefault const&, NoDefault const&) { return hana::false_c; }
+
+// Note: It is also useful to check with a non-empty class, because that
+// triggers different instantiations due to EBO.
+struct NoDefault_nonempty {
+ NoDefault_nonempty() = delete;
+ NoDefault_nonempty(NoDefault_nonempty const&) = default;
+ constexpr explicit NoDefault_nonempty(int k) : i(k) { }
+ int i;
+};
+
+auto operator==(NoDefault_nonempty const&, NoDefault_nonempty const&) { return hana::true_c; }
+auto operator!=(NoDefault_nonempty const&, NoDefault_nonempty const&) { return hana::false_c; }
+
+struct Default {
+ Default() = default;
+ Default(Default const&) = default;
+ constexpr explicit Default(int) { }
+};
+
+auto operator==(Default const&, Default const&) { return hana::true_c; }
+auto operator!=(Default const&, Default const&) { return hana::false_c; }
+
+namespace boost { namespace hana {
+ template <>
+ struct hash_impl<NoDefault> {
+ static constexpr auto apply(NoDefault const&)
+ { return hana::type_c<NoDefault>; };
+ };
+
+ template <>
+ struct hash_impl<NoDefault_nonempty> {
+ static constexpr auto apply(NoDefault_nonempty const&)
+ { return hana::type_c<NoDefault_nonempty>; };
+ };
+
+ template <>
+ struct hash_impl<Default> {
+ static constexpr auto apply(Default const&)
+ { return hana::type_c<Default>; };
+ };
+}}
+
+int main() {
+ auto map1 = hana::make_map(hana::make_pair(Default(1), Default(1)));
+ static_assert(std::is_default_constructible<decltype(map1)>::value, "");
+
+ auto map2 = hana::make_map(hana::make_pair(NoDefault(1), NoDefault(1)));
+ static_assert(!std::is_default_constructible<decltype(map2)>::value, "");
+
+ auto map3 = hana::make_map(hana::make_pair(NoDefault_nonempty(1), NoDefault_nonempty(1)));
+ static_assert(!std::is_default_constructible<decltype(map3)>::value, "");
+}
diff --git a/src/boost/libs/hana/test/map/cnstr.move.cpp b/src/boost/libs/hana/test/map/cnstr.move.cpp
new file mode 100644
index 000000000..c6f9dca55
--- /dev/null
+++ b/src/boost/libs/hana/test/map/cnstr.move.cpp
@@ -0,0 +1,123 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/bool.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/fwd/hash.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/pair.hpp>
+#include <boost/hana/type.hpp>
+
+#include <support/constexpr_move_only.hpp>
+#include <support/tracked_move_only.hpp>
+
+#include <string>
+#include <type_traits>
+#include <utility>
+namespace hana = boost::hana;
+
+
+constexpr bool in_constexpr_context() {
+ auto t0 = hana::make_map(
+ hana::make_pair(ConstexprMoveOnly<2>{}, ConstexprMoveOnly<20>{}),
+ hana::make_pair(ConstexprMoveOnly<3>{}, ConstexprMoveOnly<30>{}));
+ auto t_implicit = std::move(t0);
+ auto t_explicit(std::move(t_implicit));
+
+ (void)t_implicit;
+ (void)t_explicit;
+ return true;
+}
+
+static_assert(in_constexpr_context(), "");
+
+
+struct NoMove {
+ NoMove() = default;
+ NoMove(NoMove const&) = delete;
+ NoMove(NoMove&&) = delete;
+ friend auto operator==(NoMove const&, NoMove const&) { return hana::true_c; }
+ friend auto operator!=(NoMove const&, NoMove const&) { return hana::false_c; }
+};
+
+// Note: It is also useful to check with a non-empty class, because that
+// triggers different instantiations due to EBO.
+struct NoMove_nonempty {
+ NoMove_nonempty() = default;
+ NoMove_nonempty(NoMove_nonempty const&) = delete;
+ NoMove_nonempty(NoMove_nonempty&&) = delete;
+ int i;
+ friend auto operator==(NoMove_nonempty const&, NoMove_nonempty const&) { return hana::true_c; }
+ friend auto operator!=(NoMove_nonempty const&, NoMove_nonempty const&) { return hana::false_c; }
+};
+
+namespace boost { namespace hana {
+ template <>
+ struct hash_impl<NoMove> {
+ static constexpr auto apply(NoMove const&)
+ { return hana::type_c<NoMove>; };
+ };
+
+ template <>
+ struct hash_impl<NoMove_nonempty> {
+ static constexpr auto apply(NoMove_nonempty const&)
+ { return hana::type_c<NoMove_nonempty>; };
+ };
+}}
+
+int main() {
+ {
+ auto t0 = hana::make_map();
+ auto t_implicit = std::move(t0);
+ auto t_explicit(std::move(t_implicit));
+
+ (void)t_explicit;
+ (void)t_implicit;
+ }
+ {
+ auto t0 = hana::make_map(hana::make_pair(TrackedMoveOnly<1>{}, TrackedMoveOnly<10>{}));
+ auto t_implicit = std::move(t0);
+ auto t_explicit(std::move(t_implicit));
+
+ (void)t_implicit;
+ (void)t_explicit;
+ }
+ {
+ auto t0 = hana::make_map(hana::make_pair(TrackedMoveOnly<1>{}, TrackedMoveOnly<10>{}),
+ hana::make_pair(TrackedMoveOnly<2>{}, TrackedMoveOnly<20>{}));
+ auto t_implicit = std::move(t0);
+ auto t_explicit(std::move(t_implicit));
+
+ (void)t_implicit;
+ (void)t_explicit;
+ }
+ {
+ auto t0 = hana::make_map(hana::make_pair(TrackedMoveOnly<1>{}, TrackedMoveOnly<10>{}),
+ hana::make_pair(TrackedMoveOnly<2>{}, TrackedMoveOnly<20>{}),
+ hana::make_pair(TrackedMoveOnly<3>{}, TrackedMoveOnly<30>{}));
+ auto t_implicit = std::move(t0);
+ auto t_explicit(std::move(t_implicit));
+
+ (void)t_implicit;
+ (void)t_explicit;
+ }
+ {
+ auto t0 = hana::make_map(hana::make_pair(hana::int_c<2>, std::string{"abcdef"}));
+ auto moved = std::move(t0);
+ BOOST_HANA_RUNTIME_CHECK(
+ moved == hana::make_map(hana::make_pair(hana::int_c<2>, std::string{"abcdef"}))
+ );
+ }
+
+ {
+ using Map1 = hana::map<hana::pair<NoMove, NoMove>>;
+ Map1 map1; (void)map1;
+ static_assert(!std::is_move_constructible<Map1>::value, "");
+
+ using Map2 = hana::map<hana::pair<NoMove_nonempty, NoMove_nonempty>>;
+ Map2 map2; (void)map2;
+ static_assert(!std::is_move_constructible<Map2>::value, "");
+ }
+}
diff --git a/src/boost/libs/hana/test/map/cnstr.trap.cpp b/src/boost/libs/hana/test/map/cnstr.trap.cpp
new file mode 100644
index 000000000..b9ce84e62
--- /dev/null
+++ b/src/boost/libs/hana/test/map/cnstr.trap.cpp
@@ -0,0 +1,72 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/bool.hpp>
+#include <boost/hana/detail/wrong.hpp>
+#include <boost/hana/fwd/hash.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/pair.hpp>
+#include <boost/hana/type.hpp>
+
+#include <utility>
+namespace hana = boost::hana;
+
+
+// This test makes sure that we do not instantiate rogue constructors when
+// doing copies and moves
+
+template <int i>
+struct Trap {
+ Trap() = default;
+ Trap(Trap const&) = default;
+#ifndef BOOST_HANA_WORKAROUND_MSVC_MULTIPLECTOR_106654
+ Trap(Trap&) = default;
+#endif
+ Trap(Trap&&) = default;
+
+ template <typename X>
+ Trap(X&&) {
+ static_assert(hana::detail::wrong<X>{},
+ "this constructor must not be instantiated");
+ }
+};
+
+template <int i, int j>
+constexpr auto operator==(Trap<i> const&, Trap<j> const&)
+{ return hana::bool_c<i == j>; }
+
+template <int i, int j>
+constexpr auto operator!=(Trap<i> const&, Trap<j> const&)
+{ return hana::bool_c<i != j>; }
+
+namespace boost { namespace hana {
+ template <int i>
+ struct hash_impl<Trap<i>> {
+ static constexpr auto apply(Trap<i> const&)
+ { return hana::type_c<Trap<i>>; };
+ };
+}}
+
+int main() {
+ {
+ auto expr = hana::make_map(
+ hana::make_pair(Trap<0>{}, Trap<0>{})
+ );
+ auto implicit_copy = expr;
+ decltype(expr) explicit_copy(expr);
+
+ (void)implicit_copy;
+ (void)explicit_copy;
+ }
+ {
+ auto expr = hana::make_map(
+ hana::make_pair(Trap<0>{}, Trap<0>{})
+ );
+ auto implicit_move = std::move(expr);
+ decltype(expr) explicit_move(std::move(implicit_move));
+
+ (void)implicit_move;
+ (void)explicit_move;
+ }
+}
diff --git a/src/boost/libs/hana/test/map/cnstr.variadic.cpp b/src/boost/libs/hana/test/map/cnstr.variadic.cpp
new file mode 100644
index 000000000..8143d2cfb
--- /dev/null
+++ b/src/boost/libs/hana/test/map/cnstr.variadic.cpp
@@ -0,0 +1,186 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/at_key.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/pair.hpp>
+
+#include <laws/base.hpp>
+#include <support/constexpr_move_only.hpp>
+#include <support/minimal_product.hpp>
+#include <support/tracked_move_only.hpp>
+
+#include <string>
+#include <vector>
+namespace hana = boost::hana;
+
+
+template <int i>
+using pair = ::product_t<hana::test::ct_eq<i>, hana::test::ct_eq<-i>>;
+
+// Check with move-only literal types.
+constexpr bool in_constexpr_context() {
+ hana::map<hana::pair<ConstexprMoveOnly<2>, ConstexprMoveOnly<20>>,
+ hana::pair<ConstexprMoveOnly<3>, ConstexprMoveOnly<30>>> map{
+ hana::make_pair(ConstexprMoveOnly<2>{}, ConstexprMoveOnly<20>{}),
+ hana::make_pair(ConstexprMoveOnly<3>{}, ConstexprMoveOnly<30>{})
+ };
+ (void)map;
+ return true;
+}
+
+static_assert(in_constexpr_context(), "");
+
+int main() {
+ // Basic check with non trivial runtime state
+ {
+ std::vector<std::string> v{"Hello", "world", "!"};
+
+ hana::map<
+ hana::pair<hana::test::ct_eq<1>, std::string>,
+ hana::pair<hana::test::ct_eq<2>, std::vector<std::string>>
+ > map{
+ hana::make_pair(hana::test::ct_eq<1>{}, std::string{"Hello world!"}),
+ hana::make_pair(hana::test::ct_eq<2>{}, v)
+ };
+
+ BOOST_HANA_RUNTIME_CHECK(
+ hana::at_key(map, hana::test::ct_eq<1>{}) == std::string{"Hello world!"}
+ );
+
+ BOOST_HANA_RUNTIME_CHECK(
+ hana::at_key(map, hana::test::ct_eq<2>{}) == v
+ );
+ }
+
+ {
+ hana::map<> map{};
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ map,
+ hana::make_map()
+ ));
+ }
+
+ {
+ hana::map<pair<0>> map{pair<0>{}};
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ map,
+ hana::make_map(pair<0>{})
+ ));
+ }
+
+ {
+ hana::map<pair<0>, pair<1>> map{pair<0>{}, pair<1>{}};
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ map,
+ hana::make_map(pair<0>{}, pair<1>{})
+ ));
+ }
+
+ {
+ hana::map<pair<0>, pair<1>, pair<2>> map{pair<0>{}, pair<1>{}, pair<2>{}};
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ map,
+ hana::make_map(pair<0>{}, pair<1>{}, pair<2>{})
+ ));
+ }
+
+ {
+ hana::map<pair<0>, pair<1>, pair<2>, pair<3>> map{
+ pair<0>{}, pair<1>{}, pair<2>{}, pair<3>{}
+ };
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ map,
+ hana::make_map(pair<0>{}, pair<1>{}, pair<2>{}, pair<3>{})
+ ));
+ }
+
+ {
+ hana::map<pair<0>, pair<1>, pair<2>, pair<3>, pair<4>> map{
+ pair<0>{}, pair<1>{}, pair<2>{}, pair<3>{}, pair<4>{}
+ };
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ map,
+ hana::make_map(pair<0>{}, pair<1>{}, pair<2>{}, pair<3>{}, pair<4>{})
+ ));
+ }
+
+ {
+ hana::map<pair<0>, pair<1>, pair<2>, pair<3>, pair<4>, pair<5>> map{
+ pair<0>{}, pair<1>{}, pair<2>{}, pair<3>{}, pair<4>{}, pair<5>{}
+ };
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ map,
+ hana::make_map(pair<0>{}, pair<1>{}, pair<2>{}, pair<3>{}, pair<4>{}, pair<5>{})
+ ));
+ }
+
+ // Use parenthesis syntax instead of braces
+ {
+ hana::map<> map = hana::map<>();
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ map,
+ hana::make_map()
+ ));
+ }
+
+ {
+ hana::map<pair<0>> map(
+ pair<0>{}
+ );
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ map,
+ hana::make_map(pair<0>{})
+ ));
+ }
+
+ {
+ hana::map<pair<0>, pair<1>> map(
+ pair<0>{}, pair<1>{}
+ );
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ map,
+ hana::make_map(pair<0>{}, pair<1>{})
+ ));
+ }
+
+ {
+ hana::map<pair<0>, pair<1>, pair<2>> map(
+ pair<0>{}, pair<1>{}, pair<2>{}
+ );
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ map,
+ hana::make_map(pair<0>{}, pair<1>{}, pair<2>{})
+ ));
+ }
+
+ {
+ hana::map<pair<0>, pair<1>, pair<2>, pair<3>> map(
+ pair<0>{}, pair<1>{}, pair<2>{}, pair<3>{}
+ );
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ map,
+ hana::make_map(pair<0>{}, pair<1>{}, pair<2>{}, pair<3>{})
+ ));
+ }
+
+ // Check with move-only types
+ {
+ hana::map<hana::pair<TrackedMoveOnly<1>, TrackedMoveOnly<10>>,
+ hana::pair<TrackedMoveOnly<2>, TrackedMoveOnly<20>>> map{
+ hana::make_pair(TrackedMoveOnly<1>{}, TrackedMoveOnly<10>{}),
+ hana::make_pair(TrackedMoveOnly<2>{}, TrackedMoveOnly<20>{})
+ };
+ }
+
+ // The following used to fail when we did not constrain the
+ // constructor properly:
+ {
+ hana::map<pair<1>> map{};
+ hana::test::_injection<0> f{};
+ auto x = f(map);
+ }
+}
diff --git a/src/boost/libs/hana/test/map/contains.cpp b/src/boost/libs/hana/test/map/contains.cpp
new file mode 100644
index 000000000..901d0a666
--- /dev/null
+++ b/src/boost/libs/hana/test/map/contains.cpp
@@ -0,0 +1,117 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/contains.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/not.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::contains(
+ hana::make_map(),
+ key<0>()
+ )));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::contains(
+ hana::make_map(),
+ key<1>()
+ )));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::make_map(p<0,0>()),
+ key<0>()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::contains(
+ hana::make_map(p<0,0>()),
+ key<1>()
+ )));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::contains(
+ hana::make_map(p<0,0>()),
+ key<2>()
+ )));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>()),
+ key<0>()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>()),
+ key<1>()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>()),
+ key<2>()
+ )));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>(), p<2,2>()),
+ key<0>()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>(), p<2,2>()),
+ key<1>()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>(), p<2,2>()),
+ key<2>()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>(), p<2,2>()),
+ key<3>()
+ )));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>(), p<2,2>(), p<3,3>(), p<6,6>(), p<8,8>()),
+ key<0>()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>(), p<2,2>(), p<3,3>(), p<6,6>(), p<8,8>()),
+ key<1>()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>(), p<2,2>(), p<3,3>(), p<6,6>(), p<8,8>()),
+ key<2>()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>(), p<2,2>(), p<3,3>(), p<6,6>(), p<8,8>()),
+ key<3>()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>(), p<2,2>(), p<3,3>(), p<6,6>(), p<8,8>()),
+ key<4>()
+ )));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>(), p<2,2>(), p<3,3>(), p<6,6>(), p<8,8>()),
+ key<5>()
+ )));
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>(), p<2,2>(), p<3,3>(), p<6,6>(), p<8,8>()),
+ key<6>()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>(), p<2,2>(), p<3,3>(), p<6,6>(), p<8,8>()),
+ key<7>()
+ )));
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>(), p<2,2>(), p<3,3>(), p<6,6>(), p<8,8>()),
+ key<8>()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::contains(
+ hana::make_map(p<0,0>(), p<1,1>(), p<2,2>(), p<3,3>(), p<6,6>(), p<8,8>()),
+ key<9>()
+ )));
+}
diff --git a/src/boost/libs/hana/test/map/difference.cpp b/src/boost/libs/hana/test/map/difference.cpp
new file mode 100644
index 000000000..5d1b4f450
--- /dev/null
+++ b/src/boost/libs/hana/test/map/difference.cpp
@@ -0,0 +1,106 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/difference.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/map.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::difference(
+ hana::make_map(),
+ hana::make_map()
+ ),
+ hana::make_map()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::difference(
+ hana::make_map(p<1, 1>()),
+ hana::make_map()
+ ),
+ hana::make_map(p<1, 1>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::difference(
+ hana::make_map(p<1, 1>()),
+ hana::make_map(p<2, 2>())
+ ),
+ hana::make_map(p<1, 1>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::difference(
+ hana::make_map(p<1, 1>()),
+ hana::make_map(p<1, 2>())
+ ),
+ hana::make_map()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::difference(
+ hana::make_map(p<1, 1>(),
+ p<2, 2>(),
+ p<3, 3>()),
+ hana::make_map(p<2, 2>(),
+ p<4, 4>())
+ ),
+ hana::make_map(p<1, 1>(),
+ p<3, 3>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::difference(
+ hana::make_map(p<1, 1>(),
+ p<2, 2>()),
+ hana::make_map(p<2, 3>(),
+ p<1, 4>())
+ ),
+ hana::make_map()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::difference(
+ hana::make_map(p<1, 1>(),
+ p<2, 2>(),
+ p<3, 3>(),
+ p<4, 4>(),
+ p<5, 5>(),
+ p<6, 6>(),
+ p<7, 7>(),
+ p<8, 8>(),
+ p<9, 9>(),
+ p<10, 10>()),
+ hana::make_map(p<0, 2>(),
+ p<2, 4>(),
+ p<3, 6>(),
+ p<4, 8>(),
+ p<5, 10>(),
+ p<20, 30>())
+ ),
+ hana::make_map(p<1, 1>(),
+ p<6, 6>(),
+ p<7, 7>(),
+ p<8, 8>(),
+ p<9, 9>(),
+ p<10, 10>())
+ ));
+
+}
diff --git a/src/boost/libs/hana/test/map/equal.cpp b/src/boost/libs/hana/test/map/equal.cpp
new file mode 100644
index 000000000..c12be4e47
--- /dev/null
+++ b/src/boost/libs/hana/test/map/equal.cpp
@@ -0,0 +1,97 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/not.hpp>
+#include <boost/hana/not_equal.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::make_map(),
+ hana::make_map()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(
+ hana::make_map(p<1, 1>()),
+ hana::make_map()
+ )));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(
+ hana::make_map(),
+ hana::make_map(p<1, 1>())
+ )));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::make_map(p<1, 1>()),
+ hana::make_map(p<1, 1>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(
+ hana::make_map(p<1, 1>()),
+ hana::make_map(p<1, 2>())
+ )));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(
+ hana::make_map(p<1, 1>()),
+ hana::make_map(p<2, 1>())
+ )));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(
+ hana::make_map(p<1, 1>()),
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ )));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::make_map(p<1, 1>(), p<2, 2>()),
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::make_map(p<1, 1>(), p<2, 2>()),
+ hana::make_map(p<2, 2>(), p<1, 1>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(
+ hana::make_map(p<1, 1>(), p<2, 2>()),
+ hana::make_map(p<9, 1>(), p<2, 2>()))
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(
+ hana::make_map(p<1, 1>(), p<2, 2>()),
+ hana::make_map(p<1, 9>(), p<2, 2>()))
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(
+ hana::make_map(p<1, 1>(), p<2, 2>()),
+ hana::make_map(p<1, 1>(), p<9, 2>()))
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(
+ hana::make_map(p<1, 1>(), p<2, 2>()),
+ hana::make_map(p<1, 1>(), p<2, 9>()))
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(
+ hana::make_map(p<1, 1>(), p<2, 2>()),
+ hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>()))
+ ));
+
+ // operators
+ BOOST_HANA_CONSTANT_CHECK(
+ hana::make_map(p<2, 2>(), p<1, 1>())
+ ==
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ );
+
+ BOOST_HANA_CONSTANT_CHECK(
+ hana::make_map(p<1, 1>())
+ !=
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ );
+}
diff --git a/src/boost/libs/hana/test/map/erase_key.cpp b/src/boost/libs/hana/test/map/erase_key.cpp
new file mode 100644
index 000000000..ddea439d1
--- /dev/null
+++ b/src/boost/libs/hana/test/map/erase_key.cpp
@@ -0,0 +1,70 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/erase_key.hpp>
+#include <boost/hana/map.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+struct undefined { };
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_map(), undefined{}),
+ hana::make_map()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_map(p<1, 1>()), key<1>()),
+ hana::make_map()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_map(p<1, 1>()), key<99>()),
+ hana::make_map(p<1, 1>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_map(p<1, 1>(), p<2, 2>()), key<99>()),
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_map(p<1, 1>(), p<2, 2>()), key<1>()),
+ hana::make_map(p<2, 2>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_map(p<1, 1>(), p<2, 2>()), key<2>()),
+ hana::make_map(p<1, 1>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>()), key<99>()),
+ hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>()), key<1>()),
+ hana::make_map(p<2, 2>(), p<3, 3>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>()), key<2>()),
+ hana::make_map(p<1, 1>(), p<3, 3>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::erase_key(hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>()), key<3>()),
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ ));
+}
diff --git a/src/boost/libs/hana/test/map/find_if.cpp b/src/boost/libs/hana/test/map/find_if.cpp
new file mode 100644
index 000000000..93579dfca
--- /dev/null
+++ b/src/boost/libs/hana/test/map/find_if.cpp
@@ -0,0 +1,52 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/find_if.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/optional.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::find_if(hana::make_map(), hana::equal.to(key<1>())),
+ hana::nothing
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::find_if(hana::make_map(p<1, 1>()), hana::equal.to(key<1>())),
+ hana::just(val<1>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::find_if(hana::make_map(p<1, 1>()), hana::equal.to(key<2>())),
+ hana::nothing
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::find_if(hana::make_map(p<1, 1>(), p<2, 2>()), hana::equal.to(key<1>())),
+ hana::just(val<1>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::find_if(hana::make_map(p<1, 1>(), p<2, 2>()), hana::equal.to(key<2>())),
+ hana::just(val<2>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::find_if(hana::make_map(p<1, 1>(), p<2, 2>()), hana::equal.to(key<3>())),
+ hana::nothing
+ ));
+}
diff --git a/src/boost/libs/hana/test/map/fold_left.cpp b/src/boost/libs/hana/test/map/fold_left.cpp
new file mode 100644
index 000000000..558120c9a
--- /dev/null
+++ b/src/boost/libs/hana/test/map/fold_left.cpp
@@ -0,0 +1,58 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/contains.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/fold_left.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/permutations.hpp>
+#include <boost/hana/transform.hpp>
+
+#include <laws/base.hpp>
+#include <support/seq.hpp>
+#include <support/minimal_product.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+struct undefined { };
+
+int main() {
+ auto sequence = ::seq;
+
+ // Use pointers to work around a Clang ICE
+ hana::test::_injection<0> f{};
+ auto* fp = &f;
+
+ hana::test::ct_eq<999> state{};
+ auto* statep = &state;
+
+ auto check = [=](auto ...pairs) {
+ auto possible_results = hana::transform(hana::permutations(sequence(pairs...)),
+ [=](auto xs) {
+ return hana::fold_left(xs, *statep, *fp);
+ }
+ );
+
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ possible_results,
+ hana::fold_left(hana::make_map(pairs...), state, f)
+ ));
+ };
+
+ check();
+ check(p<1, 1>());
+ check(p<1, 1>(), p<2, 2>());
+ check(p<1, 1>(), p<2, 2>(), p<3, 3>());
+ check(p<1, 1>(), p<2, 2>(), p<3, 3>(), p<4, 4>());
+}
diff --git a/src/boost/libs/hana/test/map/fold_right.cpp b/src/boost/libs/hana/test/map/fold_right.cpp
new file mode 100644
index 000000000..2ff88d899
--- /dev/null
+++ b/src/boost/libs/hana/test/map/fold_right.cpp
@@ -0,0 +1,58 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/contains.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/fold_right.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/permutations.hpp>
+#include <boost/hana/transform.hpp>
+
+#include <laws/base.hpp>
+#include <support/seq.hpp>
+#include <support/minimal_product.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+struct undefined { };
+
+int main() {
+ auto sequence = ::seq;
+
+ // Use pointers to work around a Clang ICE
+ hana::test::_injection<0> f{};
+ auto* fp = &f;
+
+ hana::test::ct_eq<999> state{};
+ auto* statep = &state;
+
+ auto check = [=](auto ...pairs) {
+ auto possible_results = hana::transform(hana::permutations(sequence(pairs...)),
+ [=](auto xs) {
+ return hana::fold_right(xs, *statep, *fp);
+ }
+ );
+
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ possible_results,
+ hana::fold_right(hana::make_map(pairs...), state, f)
+ ));
+ };
+
+ check();
+ check(p<1, 1>());
+ check(p<1, 1>(), p<2, 2>());
+ check(p<1, 1>(), p<2, 2>(), p<3, 3>());
+ check(p<1, 1>(), p<2, 2>(), p<3, 3>(), p<4, 4>());
+}
diff --git a/src/boost/libs/hana/test/map/insert.cpp b/src/boost/libs/hana/test/map/insert.cpp
new file mode 100644
index 000000000..fa8329b96
--- /dev/null
+++ b/src/boost/libs/hana/test/map/insert.cpp
@@ -0,0 +1,68 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/insert.hpp>
+#include <boost/hana/map.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_map(), p<1, 1>()),
+ hana::make_map(p<1, 1>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_map(p<1, 1>()), p<1, 99>()),
+ hana::make_map(p<1, 1>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_map(p<1, 1>()), p<2, 2>()),
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_map(p<1, 1>(), p<2, 2>()), p<1, 99>()),
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_map(p<1, 1>(), p<2, 2>()), p<2, 99>()),
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_map(p<1, 1>(), p<2, 2>()), p<3, 3>()),
+ hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>()), p<1, 99>()),
+ hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>()), p<2, 99>()),
+ hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>()), p<3, 99>()),
+ hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::insert(hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>()), p<4, 4>()),
+ hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>(), p<4, 4>())
+ ));
+}
diff --git a/src/boost/libs/hana/test/map/intersection.cpp b/src/boost/libs/hana/test/map/intersection.cpp
new file mode 100644
index 000000000..7e092ec04
--- /dev/null
+++ b/src/boost/libs/hana/test/map/intersection.cpp
@@ -0,0 +1,99 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/intersection.hpp>
+#include <boost/hana/map.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_map(),
+ hana::make_map()
+ ),
+ hana::make_map()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_map(p<1, 1>()),
+ hana::make_map()
+ ),
+ hana::make_map()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_map(),
+ hana::make_map(p<1, 1>())
+ ),
+ hana::make_map()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_map(p<1, 1>()),
+ hana::make_map(p<1, 2>())
+ ),
+ hana::make_map(p<1, 1>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_map(
+ p<1, 2>(),
+ p<2, 3>()),
+ hana::make_map(
+ p<1, 3>(),
+ p<2, 4>(),
+ p<3, 5>())
+ ),
+ hana::make_map(
+ p<1, 2>(),
+ p<2, 3>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_map(
+ p<1, 3>(),
+ p<2, 4>(),
+ p<3, 5>()),
+ hana::make_map(
+ p<1, 2>(),
+ p<2, 3>())
+ ),
+ hana::make_map(
+ p<1, 3>(),
+ p<2, 4>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::intersection(
+ hana::make_map(
+ p<1, 100>(),
+ p<2, 200>()),
+ hana::make_map(
+ p<3, 300>(),
+ p<4, 400>())
+ ),
+ hana::make_map()
+ ));
+
+}
diff --git a/src/boost/libs/hana/test/map/is_subset.cpp b/src/boost/libs/hana/test/map/is_subset.cpp
new file mode 100644
index 000000000..3ac5da1df
--- /dev/null
+++ b/src/boost/libs/hana/test/map/is_subset.cpp
@@ -0,0 +1,51 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/is_subset.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/not.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::is_subset(
+ hana::make_map(),
+ hana::make_map()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::is_subset(
+ hana::make_map(),
+ hana::make_map(p<1, 1>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::is_subset(
+ hana::make_map(),
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::is_subset(
+ hana::make_map(p<1, 1>()),
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::is_subset(
+ hana::make_map(p<2, 2>(), p<1, 1>()),
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_subset(
+ hana::make_map(p<3, 3>(), p<1, 1>()),
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ )));
+}
diff --git a/src/boost/libs/hana/test/map/keys.cpp b/src/boost/libs/hana/test/map/keys.cpp
new file mode 100644
index 000000000..8c54cb9a1
--- /dev/null
+++ b/src/boost/libs/hana/test/map/keys.cpp
@@ -0,0 +1,49 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/contains.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/keys.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/permutations.hpp>
+
+#include <laws/base.hpp>
+#include <support/seq.hpp>
+#include <support/minimal_product.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+int main() {
+ constexpr auto list = ::seq;
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::keys(hana::make_map()),
+ list()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::keys(hana::make_map(p<1, 1>())),
+ list(key<1>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::permutations(list(key<1>(), key<2>())),
+ hana::keys(hana::make_map(p<1, 1>(), p<2, 2>()))
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::permutations(list(key<1>(), key<2>(), key<3>())),
+ hana::keys(hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>()))
+ ));
+}
diff --git a/src/boost/libs/hana/test/map/laws.cpp b/src/boost/libs/hana/test/map/laws.cpp
new file mode 100644
index 000000000..c3a0d6709
--- /dev/null
+++ b/src/boost/libs/hana/test/map/laws.cpp
@@ -0,0 +1,37 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/map.hpp>
+#include <boost/hana/tuple.hpp>
+
+#include <laws/base.hpp>
+#include <laws/comparable.hpp>
+#include <laws/foldable.hpp>
+#include <laws/searchable.hpp>
+#include <support/minimal_product.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+int main() {
+ auto maps = hana::make_tuple(
+ hana::make_map(),
+ hana::make_map(p<1, 1>()),
+ hana::make_map(p<1, 2>()),
+ hana::make_map(p<1, 1>(), p<2, 2>()),
+ hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>())
+ );
+
+ hana::test::TestComparable<hana::map_tag>{maps};
+ hana::test::TestSearchable<hana::map_tag>{maps, hana::make_tuple(key<1>(), key<4>())};
+ hana::test::TestFoldable<hana::map_tag>{maps};
+}
diff --git a/src/boost/libs/hana/test/map/map.cpp b/src/boost/libs/hana/test/map/map.cpp
new file mode 100644
index 000000000..bbaceadcd
--- /dev/null
+++ b/src/boost/libs/hana/test/map/map.cpp
@@ -0,0 +1,33 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/map.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+#include <type_traits>
+#include <utility>
+namespace hana = boost::hana;
+
+
+template <typename ...Pairs>
+struct check_map {
+ static_assert(std::is_same<
+ hana::map<Pairs...>,
+ decltype(hana::make_map(std::declval<Pairs>()...))
+ >{}, "");
+};
+
+template <int i>
+using pair = ::product_t<hana::test::ct_eq<i>, hana::test::ct_eq<-i>>;
+
+template struct check_map<>;
+template struct check_map<pair<1>>;
+template struct check_map<pair<1>, pair<2>>;
+template struct check_map<pair<1>, pair<2>, pair<3>>;
+template struct check_map<pair<1>, pair<2>, pair<3>, pair<4>>;
+template struct check_map<pair<1>, pair<2>, pair<3>, pair<4>, pair<5>>;
+template struct check_map<pair<1>, pair<2>, pair<3>, pair<4>, pair<5>, pair<6>>;
+
+int main() { }
diff --git a/src/boost/libs/hana/test/map/symmetric_difference.cpp b/src/boost/libs/hana/test/map/symmetric_difference.cpp
new file mode 100644
index 000000000..9fc8c77f0
--- /dev/null
+++ b/src/boost/libs/hana/test/map/symmetric_difference.cpp
@@ -0,0 +1,80 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/symmetric_difference.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+namespace hana = boost::hana;
+using hana::test::ct_eq;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::symmetric_difference(
+ hana::make_map(),
+ hana::make_map()
+ ),
+ hana::make_map()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::symmetric_difference(
+ hana::make_map(p<1, 1>()),
+ hana::make_map(p<1, 1>())
+ ),
+ hana::make_map()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::symmetric_difference(
+ hana::make_map(p<1, 2>()),
+ hana::make_map(p<2, 4>())
+ ),
+ hana::make_map(p<1, 2>(),
+ p<2, 4>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::symmetric_difference(
+ hana::make_map(p<1, 2>(),
+ p<2, 22>()),
+ hana::make_map(p<2, 4>(),
+ p<3, 33>())
+ ),
+ hana::make_map(p<1, 2>(),
+ p<3, 33>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::symmetric_difference(
+ hana::make_map(p<1, 2>(),
+ p<2, 22>(),
+ p<3, 33>(),
+ p<5, 55>(),
+ p<8, 88>()),
+ hana::make_map(p<2, 4>(),
+ p<3, 33>(),
+ p<4, 44>(),
+ p<9, 99>())
+ ),
+ hana::make_map(p<1, 2>(),
+ p<5, 55>(),
+ p<8, 88>(),
+ p<4, 44>(),
+ p<9, 99>())
+ ));
+}
diff --git a/src/boost/libs/hana/test/map/to.cpp b/src/boost/libs/hana/test/map/to.cpp
new file mode 100644
index 000000000..b1cea4c2e
--- /dev/null
+++ b/src/boost/libs/hana/test/map/to.cpp
@@ -0,0 +1,92 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/contains.hpp>
+#include <boost/hana/core/to.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/permutations.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+#include <support/seq.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+int main() {
+ constexpr auto foldable = ::seq;
+ auto sequence = ::seq;
+
+ // Foldable -> Map
+ {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to_map(foldable()),
+ hana::make_map()
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to_map(foldable(p<1, 1>())),
+ hana::make_map(p<1, 1>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to_map(foldable(p<1, 1>(), p<2, 2>())),
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to_map(foldable(p<1, 1>(), p<2, 2>(), p<3, 3>())),
+ hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>())
+ ));
+
+ // with duplicates
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to_map(foldable(p<1, 1>(), p<1, 99>())),
+ hana::make_map(p<1, 1>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to_map(foldable(p<1, 1>(), p<2, 2>(), p<1, 99>())),
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to_map(foldable(p<1, 1>(), p<2, 2>(), p<1, 99>(), p<2, 99>())),
+ hana::make_map(p<1, 1>(), p<2, 2>())
+ ));
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to_map(foldable(p<1, 1>(), p<2, 2>(), p<1, 99>(), p<2, 99>(), p<3, 3>())),
+ hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>())
+ ));
+ }
+
+ // Map -> Sequence
+ {
+ auto check = [=](auto ...xs) {
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::permutations(sequence(xs...)),
+ hana::to<::Seq>(hana::make_map(xs...))
+ ));
+ };
+
+ check();
+ check(p<1, 1>());
+ check(p<1, 1>(), p<2, 2>());
+ check(p<1, 1>(), p<2, 2>(), p<3, 3>());
+ check(p<1, 1>(), p<2, 2>(), p<3, 3>(), p<4, 4>());
+ }
+
+ // to_map == to<map_tag>
+ {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::to_map(foldable(p<1, 1>(), p<2, 2>(), p<1, 99>(), p<2, 99>(), p<3, 3>())),
+ hana::to<hana::map_tag>(foldable(p<1, 1>(), p<2, 2>(), p<1, 99>(), p<2, 99>(), p<3, 3>()))
+ ));
+ }
+}
diff --git a/src/boost/libs/hana/test/map/union.cpp b/src/boost/libs/hana/test/map/union.cpp
new file mode 100644
index 000000000..dfae6ea0e
--- /dev/null
+++ b/src/boost/libs/hana/test/map/union.cpp
@@ -0,0 +1,82 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/union.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+int main() {
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::union_(
+ hana::make_map(),
+ hana::make_map()
+ ),
+ hana::make_map()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::union_(
+ hana::make_map(
+ p<1, 1>()
+ ),
+ hana::make_map()
+ ),
+ hana::make_map(p<1, 1>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::union_(
+ hana::make_map(),
+ hana::make_map(p<1, 1>())
+ ),
+ hana::make_map(p<1, 1>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::union_(
+ hana::make_map(p<1, 1>()),
+ hana::make_map(p<1, 1>())
+ ),
+ hana::make_map(p<1, 1>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::union_(
+ hana::make_map(p<1, 2>()),
+ hana::make_map(p<1, 3>())
+ ),
+ hana::make_map(p<1, 3>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::union_(
+ hana::make_map(p<1, 10>(),
+ p<2, 20>(),
+ p<3, 30>()),
+ hana::make_map(p<4, 40>(),
+ p<5, 50>(),
+ p<1, 100>())
+ ),
+ hana::make_map(p<2, 20>(),
+ p<3, 30>(),
+ p<4, 40>(),
+ p<5, 50>(),
+ p<1, 100>())
+ ));
+}
diff --git a/src/boost/libs/hana/test/map/unpack.cpp b/src/boost/libs/hana/test/map/unpack.cpp
new file mode 100644
index 000000000..63db677aa
--- /dev/null
+++ b/src/boost/libs/hana/test/map/unpack.cpp
@@ -0,0 +1,50 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/contains.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/unpack.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/permutations.hpp>
+#include <boost/hana/transform.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+#include <support/seq.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+struct undefined { };
+
+int main() {
+ auto sequence = ::seq;
+ hana::test::_injection<0> f{};
+
+ auto check = [=](auto ...pairs) {
+ auto possible_results = hana::transform(hana::permutations(sequence(pairs...)),
+ [=](auto xs) { return hana::unpack(xs, f); }
+ );
+
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ possible_results,
+ hana::unpack(hana::make_map(pairs...), f)
+ ));
+ };
+
+ check();
+ check(p<1, 1>());
+ check(p<1, 1>(), p<2, 2>());
+ check(p<1, 1>(), p<2, 2>(), p<3, 3>());
+ check(p<1, 1>(), p<2, 2>(), p<3, 3>(), p<4, 4>());
+}
diff --git a/src/boost/libs/hana/test/map/values.cpp b/src/boost/libs/hana/test/map/values.cpp
new file mode 100644
index 000000000..08082c187
--- /dev/null
+++ b/src/boost/libs/hana/test/map/values.cpp
@@ -0,0 +1,48 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/contains.hpp>
+#include <boost/hana/equal.hpp>
+#include <boost/hana/map.hpp>
+#include <boost/hana/permutations.hpp>
+
+#include <laws/base.hpp>
+#include <support/minimal_product.hpp>
+#include <support/seq.hpp>
+namespace hana = boost::hana;
+
+
+template <int i>
+auto key() { return hana::test::ct_eq<i>{}; }
+
+template <int i>
+auto val() { return hana::test::ct_eq<-i>{}; }
+
+template <int i, int j>
+auto p() { return ::minimal_product(key<i>(), val<j>()); }
+
+int main() {
+ constexpr auto list = ::seq;
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::values(hana::make_map()),
+ list()
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::equal(
+ hana::values(hana::make_map(p<1, 1>())),
+ list(val<1>())
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::permutations(list(val<1>(), val<2>())),
+ hana::values(hana::make_map(p<1, 1>(), p<2, 2>()))
+ ));
+
+ BOOST_HANA_CONSTANT_CHECK(hana::contains(
+ hana::permutations(list(val<1>(), val<2>(), val<3>())),
+ hana::values(hana::make_map(p<1, 1>(), p<2, 2>(), p<3, 3>()))
+ ));
+}