21 #include <type_traits> 71 template <
typename T,
typename... Ts>
82 template <
typename T,
typename... Ts>
87 template <
typename T,
typename Less>
90 return less(v, lo) ? lo : less(hi, v) ? hi :
v;
99 template <
typename T,
typename =
void>
102 template <
typename T>
105 typename
std::enable_if<std::is_floating_point<T>::value>
::type> {
107 return t < static_cast<T>(0) ? -t : t;
111 template <
typename T>
114 typename
std::enable_if<
115 std::is_integral<T>::value && !std::is_same<T, bool>::value &&
116 std::is_unsigned<T>::value>
::type> {
122 template <
typename T>
125 typename
std::enable_if<
126 std::is_integral<T>::value && !std::is_same<T, bool>::value &&
127 std::is_signed<T>::value>
::type> {
134 template <
typename T>
141 template <
typename T>
146 template <
typename T>
148 return l2 +
T(
T(1) << l2 < t ? 1 : 0);
151 template <
typename T>
157 template <
typename T>
162 template <
typename T>
167 template <
typename T>
171 : ((t + (t <
T(0) ?
T(0) : round -
T(1))) /
round) * round;
174 template <
typename T>
180 (exp % 2 ? base :
T(1));
187 template <
typename T>
189 using U = std::make_unsigned_t<T>;
194 template <
typename U>
195 constexpr std::size_t
199 s / 2, a + s *
bool((u >> a) % (U(1) << s) == U(0)), u);
207 template <
typename T>
209 using U = std::make_unsigned_t<T>;
210 using size = std::integral_constant<std::size_t, sizeof(T) * 4>;
216 template <
typename T>
218 using L = std::numeric_limits<T>;
219 using M = std::intmax_t;
222 "Integral type too large!");
228 sizeof(
T) <
sizeof(
M)
239 template <
typename T>
241 using L = std::numeric_limits<T>;
242 using M = std::intmax_t;
245 "Integral type too large!");
253 sizeof(
T) <
sizeof(
M)
256 (a < 0) == (b < 0) ? a - b :
301 template <
typename Dst,
typename Src>
306 "constexpr_clamp_cast can only cast into integral type (up to 64bit)");
308 using L = std::numeric_limits<Dst>;
316 sizeof(Src) <=
sizeof(Dst) ? Dst(src) :
327 sizeof(Src) <=
sizeof(Dst) ? Dst(src) :
335 sizeof(Src) <
sizeof(Dst) ? Dst(src) :
355 template <
typename D,
typename S>
357 return src < sl ? dl : (src > su ? du :
D(src));
361 template <
typename Dst,
typename Src>
366 "constexpr_clamp_cast can only cast into integral type (up to 64bit)");
368 using L = std::numeric_limits<Dst>;
374 (src != src) ? Dst(0) :
378 sizeof(Src) >
sizeof(Dst) ?
384 sizeof(Src) <
sizeof(Dst) ? (
constexpr std::size_t constexpr_find_first_set(T t)
constexpr std::size_t constexpr_find_last_set(T const t)
constexpr float kClampCastUpperBoundFloatToInt32F
constexpr T constexpr_add_overflow_clamped(T a, T b)
constexpr std::enable_if< std::is_integral< Src >::value, Dst >::type constexpr_clamp_cast(Src src)
static constexpr std::make_unsigned< T >::type go(T t)
constexpr double kClampCastUpperBoundDoubleToInt64F
constexpr T constexpr_log2_(T a, T e)
constexpr To round(std::chrono::duration< Rep, Period > const &d)
constexpr T constexpr_min(T a)
constexpr T constexpr_log2(T t)
—— Concurrent Priority Queue Implementation ——
constexpr bool operator()(T const &a, T const &b) const
constexpr bool operator()(T const &a, T const &b) const
constexpr std::size_t constexpr_find_first_set_(std::size_t s, std::size_t a, U const u)
constexpr T constexpr_max(T a)
constexpr auto constexpr_abs(T t) -> decltype(detail::constexpr_abs_helper< T >::go(t))
constexpr float kClampCastUpperBoundFloatToUInt32F
constexpr auto size(C const &c) -> decltype(c.size())
constexpr T constexpr_pow(T base, std::size_t exp)
constexpr float kClampCastLowerBoundFloatToInt32F
constexpr bool operator()(T const &a, T const &b) const
constexpr T constexpr_square_(T t)
constexpr T constexpr_sub_overflow_clamped(T a, T b)
constexpr T constexpr_log2_ceil_(T l2, T t)
constexpr D constexpr_clamp_cast_helper(S src, S sl, S su, D dl, D du)
constexpr double kClampCastLowerBoundDoubleToInt64F
static const char *const value
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
constexpr T constexpr_log2_ceil(T t)
constexpr T const & constexpr_clamp(T const &v, T const &lo, T const &hi, Less less)
constexpr bool operator()(T const &a, T const &b) const
static constexpr T go(T t)
constexpr bool operator()(T const &a, T const &b) const
constexpr T constexpr_ceil(T t, T round)
constexpr double kClampCastUpperBoundDoubleToUInt64F
static constexpr T go(T t)
constexpr bool operator()(T const &a, T const &b) const