/* Copyright 2022-2023 Christian Mazakas. * Copyright 2024 Braden Ganetsky. * Copyright 2025 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/bloom for library home page. */ #ifndef BOOST_BLOOM_DETAIL_TYPE_TRAITS_HPP #define BOOST_BLOOM_DETAIL_TYPE_TRAITS_HPP #include #include #include #include #include #include namespace boost{ namespace bloom{ namespace detail{ namespace is_nothrow_swappable_helper_detail{ using std::swap; template struct is_nothrow_swappable_helper { constexpr static bool value=false; }; template struct is_nothrow_swappable_helper< T, boost::void_t(),std::declval()))> > { constexpr static bool value= noexcept(swap(std::declval(),std::declval())); }; } /* namespace is_nothrow_swappable_helper_detail */ template struct is_nothrow_swappable:std::integral_constant< bool, is_nothrow_swappable_helper_detail::is_nothrow_swappable_helper::value >{}; #define BOOST_BLOOM_STATIC_ASSERT_IS_NOTHROW_SWAPPABLE(T) \ static_assert( \ boost::bloom::detail::is_nothrow_swappable< T >::value, \ #T " must be nothrow swappable") template struct is_cv_unqualified_object:std::integral_constant< bool, !std::is_const::value&& !std::is_volatile::value&& !std::is_function::value&& !std::is_reference::value&& !std::is_void::value >{}; #define BOOST_BLOOM_STATIC_ASSERT_IS_CV_UNQUALIFIED_OBJECT(T) \ static_assert( \ boost::bloom::detail::is_cv_unqualified_object< T >::value, \ #T " must be a cv-unqualified object type") template struct remove_cvref { using type= typename std::remove_cv::type>::type; }; template using remove_cvref_t=typename remove_cvref::type; template struct is_transparent:std::false_type{}; template struct is_transparent>:std::true_type{}; template using enable_if_transparent_t= typename std::enable_if::value,Q>::type; template struct is_integral_or_extended_integral:std::is_integral{}; template struct is_unsigned_or_extended_unsigned:std::is_unsigned{}; #if defined(__SIZEOF_INT128__) #if defined(BOOST_GCC) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" #endif template<> struct is_integral_or_extended_integral<__int128>:std::true_type{}; template<> struct is_integral_or_extended_integral:std::true_type{}; template<> struct is_unsigned_or_extended_unsigned:std::true_type{}; #if defined(BOOST_GCC) #pragma GCC diagnostic pop #endif #endif template struct is_unsigned_integral_or_extended_unsigned_integral: std::integral_constant< bool, is_integral_or_extended_integral::value&& is_unsigned_or_extended_unsigned::value > {}; template class Trait> struct is_array_of:std::false_type{}; template class Trait> struct is_array_of:Trait{}; template struct array_size: std::integral_constant{}; template struct array_size: std::integral_constant{}; template struct is_power_of_two:std::integral_constant{}; #if defined(BOOST_NO_CXX20_HDR_CONCEPTS) template using is_forward_iterator=std::is_base_of< std::forward_iterator_tag, typename std::iterator_traits::iterator_category >; #else template using is_forward_iterator=std::integral_constant< bool, std::forward_iterator >; #endif #define BOOST_BLOOM_STATIC_ASSERT_IS_FORWARD_ITERATOR(Iterator) \ static_assert( \ boost::bloom::detail::is_forward_iterator< Iterator >::value, \ #Iterator " must be a forward iterator") } /* namespace detail */ } /* namespace bloom */ } /* namespace boost */ #endif