UniRec 3.3.2
Loading...
Searching...
No Matches
unirecTypeTraits.hpp
Go to the documentation of this file.
1
9#pragma once
10
11#include <string>
12#include <string_view>
13#include <type_traits>
14
15namespace Nemea {
16
17// NOLINTBEGIN
18
25template<typename T>
26struct is_string : std::false_type {};
27
28template<>
29struct is_string<std::string> : std::true_type {};
30
31template<>
32struct is_string<std::string_view> : std::true_type {};
33
34template<typename T>
36
44template<typename T>
45struct add_const {
46 using type = T;
47};
48
49template<typename T>
50struct add_const<T*> {
51 using type = const T*;
52};
53
54template<typename T>
55struct add_const<T&> {
56 using type = const T&;
57};
58
59template<typename T>
61
62// NOLINTEND
63
64} // namespace Nemea
typename add_const< T >::type add_const_t
constexpr bool is_string_v
A type trait that adds const to a given type if it is a pointer or a reference.
A type trait that checks if a given type is a string type.