]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/hana/example/optional/sfinae_friendly_metafunctions.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / optional / sfinae_friendly_metafunctions.cpp
index 72db231d5ca54e64bb30f4d9738c937da1d97394..392154b39e6820dd80ed39ba4db8a19bed94ad85 100644 (file)
@@ -1,8 +1,9 @@
-// Copyright Louis Dionne 2013-2016
+// 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/not.hpp>
 #include <boost/hana/optional.hpp>
 #include <boost/hana/traits.hpp>
@@ -24,14 +25,20 @@ struct has_type<T, void_t<typename T::type>>
     : std::true_type
 { };
 
-auto common_type_impl = hana::sfinae([](auto t, auto u) -> decltype(hana::type_c<
+auto common_type_impl = hana::sfinae([](auto t, auto u) -> hana::type<
     decltype(true ? hana::traits::declval(t) : hana::traits::declval(u))
->) { return {}; });
+> { return {}; });
 
 template <typename T, typename U>
-using common_type2 = decltype(common_type_impl(hana::type_c<T>, hana::type_c<U>));
+using common_type = decltype(common_type_impl(hana::type_c<T>, hana::type_c<U>));
 
-static_assert(!has_type<common_type2<int, int*>>{}, "");
-static_assert(std::is_same<common_type2<int, float>::type, float>{}, "");
+BOOST_HANA_CONSTANT_CHECK(
+  common_type_impl(hana::type_c<int>, hana::type_c<float>)
+    ==
+  hana::just(hana::type_c<float>)
+);
+
+static_assert(!has_type<common_type<int, int*>>{}, "");
+static_assert(std::is_same<common_type<int, float>::type, float>{}, "");
 
 int main() { }