open62541pp 0.16.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
traits.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <type_traits>
4
5namespace opcua::detail {
6
7template <typename... Ts>
8struct Overload : Ts... {
9 using Ts::operator()...;
10};
11
12template <typename... Ts>
13Overload(Ts...) -> Overload<Ts...>;
14
15template <typename...>
16struct AlwaysFalse : std::false_type {};
17
18template <typename T, typename... Ts>
19using IsOneOf = std::disjunction<std::is_same<T, Ts>...>;
20
21/// Derive member type from member pointer
22template <typename T>
24
25template <typename C, typename T>
26struct MemberType<T C::*> {
27 using type = T;
28};
29
30template <typename T>
32
33template <typename T, typename = void>
34struct IsContiguousContainer : std::false_type {};
35
36template <typename T>
38 T,
39 std::void_t<
40 decltype(std::declval<T>().data()),
41 decltype(std::declval<T>().size()),
42 decltype(std::declval<T>().begin()),
43 decltype(std::declval<T>().end())>> : std::true_type {
44 using value_type = bool;
45 // detect vector<bool>::data() void return type
46 static constexpr bool value = std::is_pointer_v<decltype(std::declval<T>().data())>;
47 using type = std::bool_constant<value>;
48};
49
50template <typename T>
52 : std::conjunction<
53 std::is_same<
54 decltype(std::declval<T>().begin()),
55 typename std::remove_reference_t<T>::iterator>,
56 std::is_same<
57 decltype(std::declval<T>().end()),
58 typename std::remove_reference_t<T>::iterator>,
59 std::negation<std::is_same<
60 typename std::remove_reference_t<T>::iterator,
61 typename std::remove_reference_t<T>::const_iterator>>> {};
62
63} // namespace opcua::detail
Overload(Ts...) -> Overload< Ts... >
std::disjunction< std::is_same< T, Ts >... > IsOneOf
Definition traits.hpp:19
typename MemberType< T >::type MemberTypeT
Definition traits.hpp:31
Derive member type from member pointer.
Definition traits.hpp:23