StormByte C++ Library 0.0.9999
StormByte is a comprehensive, cross-platform C++ library aimed at easing system programming, configuration management, logging, and database handling tasks. This library provides a unified API that abstracts away the complexities and inconsistencies of different platforms (Windows, Linux).
Loading...
Searching...
No Matches
type_traits.hxx
1#pragma once
2
3#include <optional>
4#include <type_traits>
5
13namespace StormByte {
20 template<typename T, typename _ = void>
21 struct is_container : std::false_type {};
22
27 template<typename T>
28 struct is_container<T, std::void_t<decltype(std::declval<T>().begin()), decltype(std::declval<T>().end()), typename T::value_type>> : std::true_type {};
29
36 template<typename T, typename _ = void>
37 struct is_optional : std::false_type {};
38
43 template<typename T>
44 struct is_optional<T, std::void_t<typename T::value_type>>
45 : std::is_same<T, std::optional<typename T::value_type>> {};
46
53 template<typename T, typename _ = void>
54 struct is_pair : std::false_type {};
55
60 template<typename T>
61 struct is_pair<T, std::void_t<
62 decltype(std::declval<T>().first),
63 decltype(std::declval<T>().second)
64 >> : std::true_type {};
65
70 template <typename T>
71 struct is_reference {
72 static constexpr bool value = std::is_reference_v<T>;
73 };
74}
Main namespace for the StormByte library.
std::conditional_t< is_reference< T >::value, std::expected< std::reference_wrapper< std::remove_reference_t< T > >, std::shared_ptr< E > >, std::expected< T, std::shared_ptr< E > > > Expected
Expected type with support for reference types.
Definition expected.hxx:32
Type trait to check if a type is a container.
Definition type_traits.hxx:21
Type trait to check if a type is an optional.
Definition type_traits.hxx:37
Type trait to check if a type is a pair.
Definition type_traits.hxx:54
Type traits for checking if a type is a reference.
Definition type_traits.hxx:71