CPPConsole
Loading...
Searching...
No Matches
template.hpp
Go to the documentation of this file.
1#ifndef __CPP_CONSOLE_TEMPLATE_HPP__
2#define __CPP_CONSOLE_TEMPLATE_HPP__
3
7#include <string>
8#include <utility>
9namespace console {
16template <typename T>
17struct iterable {
18 template <class V>
19 static long check(...);
20 template <class V>
21 static char check(int, typename V::const_iterator = T().end());
22
23 enum { is = sizeof(check<T>(0)) == sizeof(char) };
24};
25
32template <typename T>
33struct is_map {
34 template <typename V>
35 static auto check(int)
36 -> decltype(std::declval<
37 V&>()[std::declval<const typename V::key_type&>()],
38 std::true_type{});
39
40 template <typename V>
41 static std::false_type check(...);
42
43 enum { is = decltype(check<T>(0))::value };
44};
45
46template <typename T>
48 : std::integral_constant<bool, !std::is_same_v<T, std::string>> {};
49} // namespace console
50
51#endif
Namespace Containing all console commands.
Definition ansi.hpp:16
Template for a map-like data type. Matches things like map and unordered_map.
Definition template.hpp:33
static auto check(int) -> decltype(std::declval< V & >()[std::declval< const typename V::key_type & >()], std::true_type{})
static std::false_type check(...)
@ is
Definition template.hpp:43
Definition template.hpp:48
Template for a iterable data type. Matches things like vector, deque, map, etc.
Definition template.hpp:17
@ is
Definition template.hpp:23
static char check(int, typename V::const_iterator=T().end())
static long check(...)