20#include <forward_list>
22#include <unordered_set>
24#include <unordered_map>
27#include "sparta/utils/Enum.hpp"
31 #if __cplusplus == 201103L
47 struct all_unsigned<> :
public std::true_type {};
53 template<
typename Head,
typename... Tail>
54 struct all_unsigned<Head, Tail...> {
55 static constexpr bool value {std::is_unsigned<typename std::decay<Head>::type>::value and
56 all_unsigned<Tail...>::value};
73 struct all_signed<> :
public std::true_type {};
79 template<
typename Head,
typename... Tail>
80 struct all_signed<Head, Tail...> {
81 static constexpr bool value {std::is_signed<typename std::decay<Head>::type>::value and
82 all_signed<Tail...>::value};
90 template<
typename... Args>
91 struct all_same_sign {
92 static constexpr bool value {all_signed<Args...>::value or all_unsigned<Args...>::value};
102 template<
typename...>
103 struct all_are_integral;
109 struct all_are_integral<> :
public std::true_type {};
115 template<
typename Head,
typename... Tail>
116 struct all_are_integral<Head, Tail...> {
117 static constexpr bool value {std::is_integral<typename std::decay<Head>::type>::value and
118 all_are_integral<Tail...>::value};
123 template<
bool B,
typename T =
void>
124 using enable_if_t =
typename std::enable_if<B, T>::type;
129 using decay_t =
typename std::decay<T>::type;
134 using underlying_type_t =
typename std::underlying_type<T>::type;
137 #elif __cplusplus > 201103L
140 template<
bool B,
typename T =
void>
141 using enable_if_t =
typename std::enable_if_t<B, T>;
146 using decay_t =
typename std::decay_t<T>;
151 using underlying_type_t =
typename std::underlying_type_t<T>;
160 template<
typename...>
184 template<
typename T,
typename Head,
typename... Tail>
186 static constexpr bool value {std::is_same<T, Head>::value or
matches_any<T, Tail...>::value};
345 template<
typename T, std::
size_t N>
348 template<
typename... Args>
351 template<
typename... Args>
354 template<
typename... Args>
357 template<
typename... Args>
360 template<
typename... Args>
363 template<
typename... Args>
366 template<
typename... Args>
369 template<
typename... Args>
372 template<
typename... Args>
375 template<
typename... Args>
378 template<
typename... Args>
381 template<
typename... Args>
384 template<
typename... Args>
387 template<
typename... Args>
390 template<
typename... Args>
393 template <
typename T>
395 static constexpr bool value =
403 template<
typename... Args>
405 static constexpr std::size_t value =
sizeof...(Args);
408 template<
typename...>
411 template<
typename Head,
typename... Tail>
414 template<
typename Tail>
419 template<
typename... Args>
428 template<std::size_t,
typename...>
442 template<std::size_t N,
typename T,
typename... Args>
447 template<std::size_t N,
typename... Args>
460 template<std::size_t...>
466 template<
int N, std::size_t... S>
473 template<std::size_t... S>
478 template<std::size_t... Args>
489 template<
typename R,
typename... Ts>
492 template<
typename R,
typename... Ts>
493 struct return_type<std::function<R (Ts...)> const> {
using type = R; };
495 template<
typename R,
typename T,
typename... Ts>
496 struct return_type<std::function<R (Ts...)> T:: *> {
using type = R; };
498 template<
typename R,
typename T,
typename... Ts>
499 struct return_type<std::function<R (Ts...)> const T:: *> {
using type = R; };
501 template<
typename R,
typename T,
typename... Ts>
502 struct return_type<std::function<R (Ts...)> T:: * const &> {
using type = R; };
504 template<
typename R,
typename T,
typename... Ts>
505 struct return_type<std::function<R (Ts...)> const T:: * const> {
using type = R; };
507 template<
typename R,
typename... Ts>
510 template<
typename R,
typename... Ts>
513 template<
typename R,
typename T>
516 template<
typename R,
typename T>
519 template<
typename R,
typename T>
520 struct return_type<std::shared_ptr<R> (T:: *)() const> {
using type = R; };
522 template<
typename R,
typename T>
523 struct return_type<std::shared_ptr<R> & (T:: *)() const> {
using type = R; };
525 template<
typename R,
typename T>
528 template<
typename R,
typename T>
529 struct return_type<R & (T:: *
const)()
const> {
using type = R; };
531 template<
typename R,
typename T>
532 struct return_type<std::shared_ptr<R> (T:: * const)() const> {
using type = R; };
534 template<
typename R,
typename T>
535 struct return_type<std::shared_ptr<R> & (T:: * const)() const> {
using type = R; };
537 template<
typename R,
typename T>
538 struct return_type<R (T:: * const &)() const> {
using type = R; };
540 template<
typename R,
typename T>
541 struct return_type<R & (T:: *
const &)()
const> {
using type = R; };
543 template<
typename R,
typename T>
544 struct return_type<std::shared_ptr<R> (T:: * const &)() const> {
using type = R; };
546 template<
typename R,
typename T>
547 struct return_type<std::shared_ptr<R> & (T:: * const &)() const> {
using type = R; };
561 struct is_bool<bool> :
public std::true_type {};
564 struct is_bool<bool &> :
public std::true_type {};
567 struct is_bool<bool const &> :
public std::true_type {};
570 struct is_bool<bool const> :
public std::true_type {};
582 template<
typename T,
typename U>
583 struct is_pair<std::pair<T, U>> :
public std::true_type{} ;
585 template<
typename T,
typename U>
586 struct is_pair<std::pair<T, U> &> :
public std::true_type {};
588 template<
typename T,
typename U>
589 struct is_pair<std::pair<T, U> const &> :
public std::true_type {};
591 template<
typename T,
typename U>
592 struct is_pair<std::pair<T, U> const> :
public std::true_type {};
601 struct is_string<std::string> :
public std::true_type {};
604 struct is_string<std::string &> :
public std::true_type {};
607 struct is_string<std::string const &> :
public std::true_type {};
610 struct is_string<std::string const> :
public std::true_type {};
Macros for handling exponential backoff.