/* Copyright 2023 Christian Mazakas. * Copyright 2023 Joaquin M Lopez Munoz. * 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) * * See https://www.boost.org/libs/unordered for library home page. */ #ifndef BOOST_UNORDERED_DETAIL_CONCURRENT_STATIC_ASSERTS_HPP #define BOOST_UNORDERED_DETAIL_CONCURRENT_STATIC_ASSERTS_HPP #include #include #include #include #include #include #define BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE(F) \ static_assert(boost::unordered::detail::is_invocable::value, \ "The provided Callable must be invocable with value_type&"); #define BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F) \ static_assert( \ boost::unordered::detail::is_invocable::value, \ "The provided Callable must be invocable with value_type const&"); #if BOOST_CXX_VERSION >= 202002L #define BOOST_UNORDERED_STATIC_ASSERT_EXEC_POLICY(P) \ static_assert(!std::is_base_of::value, \ "ExecPolicy must be sequenced."); \ static_assert( \ !std::is_base_of::value, \ "ExecPolicy must be sequenced."); #else #define BOOST_UNORDERED_STATIC_ASSERT_EXEC_POLICY(P) \ static_assert(!std::is_base_of::value, \ "ExecPolicy must be sequenced."); #endif #define BOOST_UNORDERED_DETAIL_COMMA , #define BOOST_UNORDERED_DETAIL_LAST_ARG(Arg, Args) \ mp11::mp_back > #define BOOST_UNORDERED_STATIC_ASSERT_LAST_ARG_INVOCABLE(Arg, Args) \ BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE( \ BOOST_UNORDERED_DETAIL_LAST_ARG(Arg, Args)) #define BOOST_UNORDERED_STATIC_ASSERT_LAST_ARG_CONST_INVOCABLE(Arg, Args) \ BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE( \ BOOST_UNORDERED_DETAIL_LAST_ARG(Arg, Args)) namespace boost { namespace unordered { namespace detail { template struct is_invocable : std::is_constructible, std::reference_wrapper::type> > { }; } // namespace detail } // namespace unordered } // namespace boost #if defined(BOOST_NO_CXX20_HDR_CONCEPTS) #define BOOST_UNORDERED_STATIC_ASSERT_FWD_ITERATOR(Iterator) \ static_assert( \ std::is_base_of< \ std::forward_iterator_tag, \ typename std::iterator_traits::iterator_category>::value, \ "The provided iterator must be at least forward"); #else #define BOOST_UNORDERED_STATIC_ASSERT_FWD_ITERATOR(Iterator) \ static_assert(std::forward_iterator, \ "The provided iterator must be at least forward"); #endif #define BOOST_UNORDERED_STATIC_ASSERT_KEY_COMPATIBLE_ITERATOR(Iterator) \ static_assert( \ std::is_same< \ typename std::iterator_traits::value_type, \ key_type>::value || \ detail::are_transparent< \ typename std::iterator_traits::value_type, \ hasher, key_equal>::value, \ "The provided iterator must dereference to a compatible key value"); #define BOOST_UNORDERED_STATIC_ASSERT_BULK_VISIT_ITERATOR(Iterator) \ BOOST_UNORDERED_STATIC_ASSERT_FWD_ITERATOR(Iterator) \ BOOST_UNORDERED_STATIC_ASSERT_KEY_COMPATIBLE_ITERATOR(Iterator) #endif // BOOST_UNORDERED_DETAIL_CONCURRENT_STATIC_ASSERTS_HPP