|
commons 0.1.5
Header-only C++23 library of common/shared types for the C++ libraries
|
Strong-typed identifier: a Repr value tagged with a phantom Tag.
More...
#include <id.hpp>
Public Member Functions | |
| Id ()=delete | |
Default-construct the underlying Repr when it is itself default-initializable; otherwise the constructor is deleted (the constrained-defaulted pattern keeps Id usable in containers that require value-initialization). | |
| template<class U > requires std::constructible_from<Repr, U&&> && (!std::is_same_v<std::remove_cvref_t<U>, Id>) | |
| Id (U &&u) | |
Forward into the underlying Repr. | |
| Id (std::string_view sv) | |
Convenience for StringId<Tag>: build directly from a string_view. | |
Strong-typed identifier: a Repr value tagged with a phantom Tag.
Two Ids with different tags are unrelated types even when the underlying representation is identical.
|
inlineexplicit |
Forward into the underlying Repr.
Explicit so that an Id is never silently constructed from a raw value.