30 #ifndef TINS_TYPE_TRAITS_H 31 #define TINS_TYPE_TRAITS_H 34 #include <tins/cxxstd.h> 36 #include <type_traits> 46 template<
bool,
typename T =
void>
52 struct enable_if<false, T> {
62 struct is_unsigned_integral {
63 static const bool value =
false;
67 struct is_unsigned_integral<uint8_t> {
68 static const bool value =
true;
72 struct is_unsigned_integral<uint16_t> {
73 static const bool value =
true;
77 struct is_unsigned_integral<uint32_t> {
78 static const bool value =
true;
82 struct is_unsigned_integral<uint64_t> {
83 static const bool value =
true;
86 #if TINS_IS_CXX11 && !defined(_MSC_VER) 89 template <
typename T,
typename P,
typename=
void>
90 struct accepts_type : std::false_type { };
92 template <
typename T,
typename P>
93 struct accepts_type<T, P,
94 typename
std::enable_if<
95 std::is_same< decltype( std::declval<T>()(std::declval<P>()) ), bool>::value
97 > : std::true_type { };
100 template <
typename Functor,
typename Packet>
101 bool invoke_loop_cb(Functor& f, Packet& p,
102 typename std::enable_if<accepts_type<Functor, Packet>::value,
bool>::type* = 0) {
103 return f(std::move(p));
106 template <
typename Functor,
typename Packet>
107 bool invoke_loop_cb(Functor& f, Packet& p,
108 typename std::enable_if<!accepts_type<Functor, Packet>::value && accepts_type<Functor, Packet&>::value,
bool>::type* = 0) {
112 template <
typename Functor,
typename Packet>
113 bool invoke_loop_cb(Functor& f, Packet& p,
114 typename std::enable_if<!accepts_type<Functor, Packet>::value && !accepts_type<Functor, Packet&>::value,
bool>::type* = 0) {
127 #endif // TINS_TYPE_TRAITS_H Definition: hw_address.h:456
The Tins namespace.
Definition: address_range.h:38