Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-17 08:39:06

0001 /* Copyright 2022-2023 Christian Mazakas.
0002  * Copyright 2024 Braden Ganetsky.
0003  * Copyright 2025 Joaquin M Lopez Munoz.
0004  * Distributed under the Boost Software License, Version 1.0.
0005  * (See accompanying file LICENSE_1_0.txt or copy at
0006  * http://www.boost.org/LICENSE_1_0.txt)
0007  *
0008  * See https://www.boost.org/libs/bloom for library home page.
0009  */
0010 
0011 #ifndef BOOST_BLOOM_DETAIL_TYPE_TRAITS_HPP
0012 #define BOOST_BLOOM_DETAIL_TYPE_TRAITS_HPP
0013 
0014 #include <boost/config.hpp>
0015 #include <boost/type_traits/make_void.hpp>
0016 #include <cstddef>
0017 #include <iterator>
0018 #include <type_traits>
0019 #include <utility>
0020 
0021 namespace boost{
0022 namespace bloom{
0023 namespace detail{
0024 namespace is_nothrow_swappable_helper_detail{
0025 
0026 using std::swap;
0027 
0028 template<typename T,typename=void>
0029 struct is_nothrow_swappable_helper
0030 {
0031   constexpr static bool value=false;
0032 };
0033 
0034 template <typename T>
0035 struct is_nothrow_swappable_helper<
0036   T,
0037   boost::void_t<decltype(swap(std::declval<T&>(),std::declval<T&>()))>
0038 >
0039 {
0040   constexpr static bool value=
0041     noexcept(swap(std::declval<T&>(),std::declval<T&>()));
0042 };
0043 
0044 } /* namespace is_nothrow_swappable_helper_detail */
0045 
0046 template <class T>
0047 struct is_nothrow_swappable:std::integral_constant<
0048   bool,
0049   is_nothrow_swappable_helper_detail::is_nothrow_swappable_helper<T>::value
0050 >{};
0051 
0052 #define BOOST_BLOOM_STATIC_ASSERT_IS_NOTHROW_SWAPPABLE(T) \
0053 static_assert(                                            \
0054   boost::bloom::detail::is_nothrow_swappable< T >::value, \
0055   #T " must be nothrow swappable")
0056 
0057 template<typename T>
0058 struct is_cv_unqualified_object:std::integral_constant<
0059   bool,
0060   !std::is_const<T>::value&&
0061   !std::is_volatile<T>::value&&
0062   !std::is_function<T>::value&&
0063   !std::is_reference<T>::value&&
0064   !std::is_void<T>::value
0065 >{};
0066 
0067 #define BOOST_BLOOM_STATIC_ASSERT_IS_CV_UNQUALIFIED_OBJECT(T) \
0068 static_assert(                                                \
0069   boost::bloom::detail::is_cv_unqualified_object< T >::value, \
0070   #T " must be a cv-unqualified object type")
0071 
0072 template<typename T>
0073 struct remove_cvref
0074 {
0075   using type=
0076     typename std::remove_cv<typename std::remove_reference<T>::type>::type;
0077 };
0078 
0079 template<typename T>
0080 using remove_cvref_t=typename remove_cvref<T>::type;
0081 
0082 template<typename T,typename=void>
0083 struct is_transparent:std::false_type{};
0084 
0085 template<typename T>
0086 struct is_transparent<T,void_t<typename T::is_transparent>>:std::true_type{};
0087 
0088 template<typename T,class Q=void>
0089 using enable_if_transparent_t=
0090   typename std::enable_if<is_transparent<T>::value,Q>::type;
0091 
0092 template<typename T>
0093 struct is_integral_or_extended_integral:std::is_integral<T>{};
0094 template<typename T>
0095 struct is_unsigned_or_extended_unsigned:std::is_unsigned<T>{};
0096 
0097 #if defined(__SIZEOF_INT128__)
0098 
0099 #if defined(BOOST_GCC)
0100 #pragma GCC diagnostic push
0101 #pragma GCC diagnostic ignored "-Wpedantic"
0102 #endif
0103 
0104 template<>
0105 struct is_integral_or_extended_integral<__int128>:std::true_type{};
0106 template<>
0107 struct is_integral_or_extended_integral<unsigned __int128>:std::true_type{};
0108 template<>
0109 struct is_unsigned_or_extended_unsigned<unsigned __int128>:std::true_type{};
0110 
0111 #if defined(BOOST_GCC)
0112 #pragma GCC diagnostic pop
0113 #endif
0114 
0115 #endif
0116 
0117 template<typename T>
0118 struct is_unsigned_integral_or_extended_unsigned_integral:
0119   std::integral_constant<
0120     bool,
0121     is_integral_or_extended_integral<T>::value&&
0122     is_unsigned_or_extended_unsigned<T>::value
0123   >
0124 {};
0125 
0126 template<typename T,template <typename...> class Trait>
0127 struct is_array_of:std::false_type{};
0128 
0129 template<typename T,std::size_t N,template <typename...> class Trait>
0130 struct is_array_of<T[N],Trait>:Trait<T>{};
0131 
0132 template<typename T> struct array_size:
0133   std::integral_constant<std::size_t,0>{};
0134 template<typename T,std::size_t N> struct array_size<T[N]>:
0135   std::integral_constant<std::size_t,N>{};
0136 
0137 template<std::size_t N>
0138 struct is_power_of_two:std::integral_constant<bool,(N!=0)&&((N&(N-1))==0)>{};
0139 
0140 #if defined(BOOST_NO_CXX20_HDR_CONCEPTS)
0141 template<typename Iterator>
0142 using is_forward_iterator=std::is_base_of<
0143   std::forward_iterator_tag,
0144   typename std::iterator_traits<Iterator>::iterator_category
0145 >;
0146 #else
0147 template<typename Iterator>
0148 using is_forward_iterator=std::integral_constant<
0149   bool,
0150   std::forward_iterator<Iterator>
0151 >;
0152 #endif
0153 
0154 #define BOOST_BLOOM_STATIC_ASSERT_IS_FORWARD_ITERATOR(Iterator) \
0155 static_assert(                                                  \
0156   boost::bloom::detail::is_forward_iterator< Iterator >::value, \
0157   #Iterator " must be a forward iterator")
0158 
0159 } /* namespace detail */
0160 } /* namespace bloom */
0161 } /* namespace boost */
0162 
0163 #endif