• 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 "minimal.hpp"
6 
7 #include <boost/hana/concept/constant.hpp>
8 #include <boost/hana/value.hpp>
9 namespace hana = boost::hana;
10 
11 
12 // Make sure we really satisfy Constant.
13 static_assert(hana::Constant<minimal_constant<int, 0>>::value, "");
14 static_assert(hana::Constant<minimal_constant<int, 1>>::value, "");
15 static_assert(hana::Constant<minimal_constant<int, 2>>::value, "");
16 static_assert(hana::Constant<minimal_constant<int, 3>>::value, "");
17 
18 // Make sure we can use hana::value<> properly.
19 static_assert(hana::value<minimal_constant<int, 0>>() == 0, "");
20 static_assert(hana::value<minimal_constant<int, 1>>() == 1, "");
21 static_assert(hana::value<minimal_constant<int, 2>>() == 2, "");
22 static_assert(hana::value<minimal_constant<int, 3>>() == 3, "");
23 
24 // Check the equivalence between `value(...)` and `value<decltype(...)>()`.
25 static_assert(hana::value(minimal_constant<int, 0>{}) == hana::value<minimal_constant<int, 0>>(), "");
26 static_assert(hana::value(minimal_constant<int, 1>{}) == hana::value<minimal_constant<int, 1>>(), "");
27 static_assert(hana::value(minimal_constant<int, 2>{}) == hana::value<minimal_constant<int, 2>>(), "");
28 static_assert(hana::value(minimal_constant<int, 3>{}) == hana::value<minimal_constant<int, 3>>(), "");
29 
30 
main()31 int main() { }
32