Go to the source code of this file.
|
| template<typename T > |
| using | VdfByValueOrConstRef = typename std::conditional_t< std::is_pointer_v< T >||Vdf_AndTypeIsSmall< T, std::is_arithmetic_v< T > >||Vdf_AndTypeIsSmall< T, std::is_enum_v< T > >, T, const T & > |
| | Template that evaluates to either T or const T & depending on whether T best be passed as value or const reference.
|
| |
◆ VdfByValueOrConstRef
| using VdfByValueOrConstRef = typename std::conditional_t< std::is_pointer_v<T> || Vdf_AndTypeIsSmall<T, std::is_arithmetic_v<T> > || Vdf_AndTypeIsSmall<T, std::is_enum_v<T> >, T, const T &> |
Template that evaluates to either T or const T & depending on whether T best be passed as value or const reference.
The heuristic here is as follows:
T if T is a ptr, arithmetic type, or enum, and also <= size of a ptr
const T & in all other cases
Note that this heuristic is a best guess given a generic type T, but if the type is known the call site may be able to make a more informed decision on how to pass parameters and return values without the use of this facility.
Definition at line 104 of file traits.h.
◆ Vdf_AndTypeIsSmall
| constexpr bool Vdf_AndTypeIsSmall = false |
|
constexpr |
◆ Vdf_AndTypeIsSmall< T, true >
| constexpr bool Vdf_AndTypeIsSmall< T, true > = sizeof(T) <= sizeof(void*) |
|
constexpr |
◆ Vdf_IsEqualityComparableHelper
| constexpr bool Vdf_IsEqualityComparableHelper = false |
|
constexpr |
◆ VdfIsEqualityComparable
| constexpr bool VdfIsEqualityComparable |
|
constexpr |
Initial value:=
Vdf_IsEqualityComparableHelper<T>
Variable template that returns true if equality comparison is a valid operation for type T.
For compound types, specializations must be provided along the lines of the following example:
template <typename T>
constexpr bool VdfIsEqualityComparable<ContainerType<T>> =
VdfIsEqualityComparable<T>;
Definition at line 49 of file traits.h.