tagval 0.2.0
Modern C++23 header-only library of tagged values (open/closed enumerations with metadata)
Loading...
Searching...
No Matches
open_ended.hpp File Reference

OpenEnded base — same in-class declaration shape as ClosedEnded (TAGVAL_ENTRY + using values_t = tagval::Values<...>) but additionally accepts plugin entries declared at namespace scope with TAGVAL_EXTERN_ENTRY, which register into OpenEndedRegistry<Owner> at static-init. More...

#include <tagval/base.hpp>
#include <tagval/entry.hpp>
#include <tagval/error.hpp>
#include <tagval/openended_registry.hpp>
#include <tagval/values.hpp>
#include <commons/fixed_string.hpp>
#include <concepts>
#include <expected>
#include <ranges>
#include <string>
#include <string_view>
+ Include dependency graph for open_ended.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  tagval::OpenEnded< Id, Derived >
 CRTP base for tag-value kinds whose values are partly compile-time (Derived::values_t) and partly contributed by plugins via TAGVAL_EXTERN_ENTRY. More...
 

Namespaces

namespace  tagval
 
namespace  tagval::detail
 

Concepts

concept  tagval::detail::HasValuesT
 

Detailed Description

OpenEnded base — same in-class declaration shape as ClosedEnded (TAGVAL_ENTRY + using values_t = tagval::Values<...>) but additionally accepts plugin entries declared at namespace scope with TAGVAL_EXTERN_ENTRY, which register into OpenEndedRegistry<Owner> at static-init.

Required Derived shape:

  • Derives from tagval::OpenEnded<"id", Derived>.
  • Optionally declares using values_t = tagval::Values<...> — the compile-time portion of the value set.
  • May contribute extern entries via TAGVAL_EXTERN_ENTRY[_AS] at namespace scope.

Storage model: every entry contributes a pointer to a pinned tagval::metadata_v<E> constant. OpenEndedRegistry<Derived> stores these pointers (not copies); handles point at the same pinned record everywhere, so pointer equality matches across value<E>(), of(code), and try_of(code) regardless of which translation unit produced the entry.