|
tagval 0.2.0
Modern C++23 header-only library of tagged values (open/closed enumerations with metadata)
|
Program-wide index of every kind that opted in via TAGVAL_REGISTER_KIND. More...
#include <kind_registry.hpp>
Static Public Member Functions | |
| template<typename T > requires detail::TagValKind<T> | |
| static void | register_kind () |
| Register a kind. | |
| static std::span< const KindView > | all () noexcept |
| All registered kinds, in registration order. | |
| static auto | all_closed () noexcept |
| Lazy filter view over the registered kinds that selects closed-ended kinds only. | |
| static auto | all_open () noexcept |
| Lazy filter view over the registered kinds that selects open-ended kinds only. | |
| static const KindView * | find (const std::string_view kind_id) noexcept |
| Find a kind by id. | |
Program-wide index of every kind that opted in via TAGVAL_REGISTER_KIND.
All methods are noexcept readers except register_kind, which mutates shared storage and is only safe to call during static-init.
|
inlinestatic |
Register a kind.
Idempotent on kind_id — calling twice (e.g. the macro appears in two TUs that both end up in the binary) is a no-op on the second call.
|
inlinestaticnoexcept |
All registered kinds, in registration order.
|
inlinestaticnoexcept |
Lazy filter view over the registered kinds that selects closed-ended kinds only.
The result is a view; iterating it after a static-init registration that happened later in program startup is fine, since the view re-reads the underlying storage on each iteration.
|
inlinestaticnoexcept |
Lazy filter view over the registered kinds that selects open-ended kinds only.
|
inlinestaticnoexcept |
Find a kind by id.
Returns nullptr if no kind with that id has been registered.