// 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 #include // for std::true_type, std::false_type and std::is_aggregate #if defined(BOOST_USE_MODULES) // TODO: fix for BOOST_USE_MODULES int main() {} #else namespace boost { namespace pfr { struct boost_fusion_tag; struct boost_json_tag; }} struct Aggregate {}; using Nonaggregate = int; #if defined(__cpp_lib_is_aggregate) static_assert(std::is_aggregate::value && !std::is_aggregate::value, ""); #endif using Reflectable = short; struct Nonrefrectable {}; using ReflectableBoostFusion = short; struct NonrefrectableBoostFusion {}; using ReflectableBoostJson = short; 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 {}; }} #if BOOST_PFR_ENABLE_IMPLICIT_REFLECTION template void assert_reflectable() { static_assert(boost::pfr::is_implicitly_reflectable_v, ""); static_assert(boost::pfr::is_implicitly_reflectable_v, ""); static_assert(boost::pfr::is_implicitly_reflectable_v, ""); static_assert(boost::pfr::is_implicitly_reflectable_v, ""); } template void assert_non_reflectable() { static_assert(!boost::pfr::is_implicitly_reflectable_v, ""); static_assert(!boost::pfr::is_implicitly_reflectable_v, ""); static_assert(!boost::pfr::is_implicitly_reflectable_v, ""); static_assert(!boost::pfr::is_implicitly_reflectable_v, ""); } #endif // #if BOOST_PFR_ENABLE_IMPLICIT_REFLECTION int main() { #if BOOST_PFR_ENABLE_IMPLICIT_REFLECTION std::cout << "Implicit reflection is available in this platform.." << std::endl; { using tag = boost::pfr::boost_json_tag; assert_reflectable(); assert_non_reflectable(); assert_reflectable(); assert_non_reflectable(); assert_reflectable(); assert_non_reflectable(); } { using tag = boost::pfr::boost_fusion_tag; assert_reflectable(); assert_non_reflectable(); assert_reflectable(); assert_non_reflectable(); assert_reflectable(); assert_non_reflectable(); } #endif // #if BOOST_PFR_ENABLE_IMPLICIT_REFLECTION } #endif