]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/_include/laws/product.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / hana / test / _include / laws / product.hpp
1 // Copyright Louis Dionne 2013-2016
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4
5 #ifndef BOOST_HANA_TEST_LAWS_PRODUCT_HPP
6 #define BOOST_HANA_TEST_LAWS_PRODUCT_HPP
7
8 #include <boost/hana/assert.hpp>
9 #include <boost/hana/concept/product.hpp>
10 #include <boost/hana/core/make.hpp>
11 #include <boost/hana/core/when.hpp>
12 #include <boost/hana/equal.hpp>
13 #include <boost/hana/first.hpp>
14 #include <boost/hana/second.hpp>
15
16 #include <laws/base.hpp>
17
18
19 namespace boost { namespace hana { namespace test {
20 template <typename P, typename = when<true>>
21 struct TestProduct : TestProduct<P, laws> {
22 using TestProduct<P, laws>::TestProduct;
23 };
24
25 template <typename P>
26 struct TestProduct<P, laws> {
27 template <typename Elements>
28 TestProduct(Elements elements) {
29 foreach2(elements, [](auto x, auto y) {
30 static_assert(Product<decltype(hana::make<P>(x, y))>::value, "");
31
32 BOOST_HANA_CHECK(hana::equal(
33 hana::first(hana::make<P>(x, y)),
34 x
35 ));
36
37 BOOST_HANA_CHECK(hana::equal(
38 hana::second(hana::make<P>(x, y)),
39 y
40 ));
41 });
42 }
43 };
44 }}} // end namespace boost::hana::test
45
46 #endif // !BOOST_HANA_TEST_LAWS_PRODUCT_HPP