// Copyright (c) 2022 Denis Mikhailov // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include // for std::true_type, std::false_type namespace boost { namespace pfr { struct boost_fusion_tag; struct boost_json_tag; }} struct Reflectable {}; struct Nonrefrectable {}; struct Unknown {}; struct ReflectableBoostFusion {}; struct NonrefrectableBoostFusion {}; struct ReflectableBoostJson {}; struct NonrefrectableBoostJson {}; namespace boost { namespace pfr { template struct is_reflectable : std::true_type {}; template struct is_reflectable : std::false_type {}; template<> struct is_reflectable : std::true_type {}; template<> struct is_reflectable : std::false_type {}; template<> struct is_reflectable : std::true_type {}; template<> struct is_reflectable : std::false_type {}; }} namespace helpers { template constexpr decltype(boost::pfr::is_reflectable::value) is_reflectability_known(long) { return true; } template constexpr bool is_reflectability_known(int) { return false; } } template void assert_reflectable_impl() { static_assert(helpers::is_reflectability_known(1L), ""); static_assert(boost::pfr::is_reflectable::value, ""); } template void assert_non_reflectable_impl() { static_assert(helpers::is_reflectability_known(1L), ""); static_assert(!boost::pfr::is_reflectable::value, ""); } template void assert_unknown_impl() { static_assert(!helpers::is_reflectability_known(1L), ""); } template void assert_reflectable() { assert_reflectable_impl(); assert_reflectable_impl(); assert_reflectable_impl(); assert_reflectable_impl(); } template void assert_non_reflectable() { assert_non_reflectable_impl(); assert_non_reflectable_impl(); assert_non_reflectable_impl(); assert_non_reflectable_impl(); } template void assert_unknown() { assert_unknown_impl(); assert_unknown_impl(); assert_unknown_impl(); assert_unknown_impl(); } int main() { { using tag = boost::pfr::boost_json_tag; assert_reflectable(); assert_non_reflectable(); assert_unknown(); assert_unknown(); assert_unknown(); assert_reflectable(); assert_non_reflectable(); } { using tag = boost::pfr::boost_fusion_tag; assert_reflectable(); assert_non_reflectable(); assert_unknown(); assert_reflectable(); assert_non_reflectable(); assert_unknown(); assert_unknown(); } }