• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright Louis Dionne 2013-2017
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 #include <boost/hana/assert.hpp>
6 #include <boost/hana/concept/struct.hpp>
7 #include <boost/hana/equal.hpp>
8 #include <boost/hana/members.hpp>
9 
10 #include "minimal_struct.hpp"
11 #include <laws/base.hpp>
12 #include <support/seq.hpp>
13 namespace hana = boost::hana;
14 using hana::test::ct_eq;
15 
16 
17 struct MoveOnly {
18     MoveOnly()                           = default;
19     MoveOnly(MoveOnly&&)                 = default;
20     MoveOnly(MoveOnly const&)            = delete;
21     MoveOnly& operator=(MoveOnly&&)      = default;
22     MoveOnly& operator=(MoveOnly const&) = delete;
23 };
24 
main()25 int main() {
26     BOOST_HANA_CONSTANT_CHECK(hana::equal(
27         hana::members(obj()),
28         ::seq()
29     ));
30 
31     BOOST_HANA_CONSTANT_CHECK(hana::equal(
32         hana::members(obj(ct_eq<0>{})),
33         ::seq(ct_eq<0>{})
34     ));
35 
36     BOOST_HANA_CONSTANT_CHECK(hana::equal(
37         hana::members(obj(ct_eq<0>{}, ct_eq<1>{})),
38         ::seq(ct_eq<0>{}, ct_eq<1>{})
39     ));
40 
41     BOOST_HANA_CONSTANT_CHECK(hana::equal(
42         hana::members(obj(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})),
43         ::seq(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})
44     ));
45 
46     // make sure it works with move only types
47     auto z1 = hana::members(obj(MoveOnly{}));
48     auto z2 = hana::members(obj(MoveOnly{}, MoveOnly{}));
49     (void)z1;
50     (void)z2;
51 }
52