Define SEQUANT_DEPRECATED_MEMBER¶
Defined in File deprecated_member.hpp
Define Documentation¶
-
SEQUANT_DEPRECATED_MEMBER(Name, Msg, ...)¶
Declares a deprecated data member of an aggregate:
Name, of a type (namedName##_deprecated_t, derived from DeprecatedMember<Type>) that holds aTypein itsvalueand whose one converting constructor is[[deprecated(Msg)]], so that{.Name = x}is diagnosed withMsgwhere it is written and the aggregate is otherwise untouched by the deprecation:struct Options { SEQUANT_DESIGNATED_INIT_ONLY; std::shared_ptr<const Registry> basis_registry = nullptr; /// @deprecated use basis_registry SEQUANT_DEPRECATED_MEMBER(space_registry, "use basis_registry", std::shared_ptr<const Registry>); }; // reading the alias: options.space_registry.value
Note
the member’s default member initializer is
{}; a designated initializer that gives it a value, and nothing else, is what warns, so{.Name = nullptr}warns even wherenullptris the default: the spelling is what is deprecatedNote
the member is the declared type, not a
Type: code that read the member as aTypereadsName.valueinstead; the converting constructor never takes the declared type itself, so copying or moving the member is not a use of the deprecated spelling- Parameters:
Name – the member’s name
Msg – the deprecation message, a string literal
... – the member’s type: a non-const, default-constructible object type (variadic, so that it may contain commas)