|
VLink
2.0.0
A high-performance communication middleware
|
Compile-time type-trait helpers used across the VLink codebase. More...
#include <atomic>#include <memory>#include <type_traits>Go to the source code of this file.
Namespaces | |
| vlink | |
| vlink::Traits | |
| Collection of compile-time type-trait helpers for VLink. | |
Macros | |
| #define | VLINK_HAS_MEMBER(T, member) vlink::Traits::has_member<T>([](auto&& obj) -> decltype((void)(obj.member), 0) { return 0; }) |
| Macro Definitions. More... | |
Compile-time type-trait helpers used across the VLink codebase.
vlink::Traits collects a small set of self-contained template meta-functions that extend the C++ standard <type_traits>. Every helper follows the standard pattern of either inheriting from std::true_type / std::false_type or returning a bool from a constexpr function. The macro VLINK_HAS_MEMBER ties into has_member to detect named data or function members at compile time.
Trait reference:
| Helper | What it detects |
|---|---|
EmptyType | An empty tag type used as a no-op placeholder. |
ExpectFalse<T> | Always std::false_type; used for dependent static_assert. |
Callable<T> | T can be invoked with no arguments. |
Assignable<OT,T> | OT can be assigned a value of type T. |
EqualityComparable | OT supports operator== with T. |
GreaterComparable | OT supports both operator< and operator> with T. |
Operatorable<OT,T> | OT supports stream insertion and extraction with T. |
IsAtomic<T> | T is a std::atomic specialisation. |
IsSharedPtr<T> | T is a std::shared_ptr (or derived) specialisation. |
RemoveSharedPtr<T> | Removes a single std::shared_ptr wrapper from T. |
has_member<T>(f) | Compile-time member-access probe used by VLINK_HAS_MEMBER. |
is_non_char_ptr<T>() | T decays to a pointer other than char*. |
is_integer<T>() | T is an integer excluding bool and the char variants. |
is_floating<T>() | T is a floating-point type. |
| #define VLINK_HAS_MEMBER | ( | T, | |
| member | |||
| ) | vlink::Traits::has_member<T>([](auto&& obj) -> decltype((void)(obj.member), 0) { return 0; }) |
Macro Definitions.
Compile-time check that T has an accessible member named member.
Expands to a constexpr boolean expression. Use call syntax (member()) to probe for a member function rather than a data member. Internally delegates to vlink::Traits::has_member.
| T | Type to inspect. |
| member | Member name (or member() for a callable probe). |