mrdocs::Polymorphic

A polymorphic value-type.

Synopsis

Declared in <mrdocs/ADT/Polymorphic.hpp>

template<class T>
class Polymorphic;

Description

This class supports polymorphic objects with value-like semantics.

It implements a tweaked version of std::polymorphic, based on the reference implementation for P3019R14. Differences are: It implements comparison operators with a very project-specific design. Fixed allocator, not parametrizable. No initializer_list constructor.

Deep copies

To copy polymorphic objects, the class uses the copy constructor of the owned derived-type object when copying to another value. Similarly, to allow the correct destruction of derived objects, it uses the destructor of the owned derived-type object in the destructor.

Type Aliases

NameDescription
const_pointer Const pointer to the held object.
pointer Mutable pointer to the held object.
value_type Base value type.

Member Functions

NameDescription
Polymorphic [constructor]Constructors
~Polymorphic [destructor]Destructor.
operator= Assignment operators
operator* Dereference operators
operator-> Member access operators
valueless_after_move Return true if the object has been moved-from and is disengaged.

Friends

NameDescription
mrdocs::swap
mrdocs::nullable_traitsnullable_traits<T> defines how to treat a T as “nullable” without an external engaged bit.

Non-Member Functions

NameDescription
CompareDerivedCompares two polymorphic objects that have visit functions
castDynamic cast returning reference; asserts on failure.
castDynamic cast returning const reference; asserts on failure.
cast_or_nullDynamic cast pointer; returns nullptr when pp is null.
cast_or_nullDynamic cast pointer; returns nullptr when pp is null (const).
dyn_castDynamic cast returning pointer or nullptr.
dyn_castDynamic cast returning pointer or nullptr (const overload).
dyn_cast_or_nullDynamic cast if pointer is non-null and engaged, else nullptr.
dyn_cast_or_nullDynamic cast if pointer is non-null and engaged, else nullptr (const).
innerTypeReturn the inner type.
innerTypeReturn the inner type.
innermostTypeReturn the innermost type (mutable overload).
innermostTypeReturn the innermost type.
isaReturn true if the polymorphic object holds a value of type To.
isa_or_nullReturn true if pointer is non-null and referent is of type To.
operator<=>Compare polymorphic template arguments.
operator<=>Compare two polymorphic names by visitor dispatch.
operator<=>Compare two polymorphic attributes by visitor dispatch.
operator<=>Compare polymorphic template parameters.
operator<=>Compare two polymorphic types by visitor dispatch.
operator<=>Three-way comparison of two polymorphic objects.
operator==Equality for two polymorphic attributes.
operator==Equality for two polymorphic types.
operator==Equality comparison of two polymorphic objects.
operator==Equality for two polymorphic names.
operator==Equality for polymorphic template arguments.
operator==Equality helper for polymorphic template parameters.
doc::isEmptyDetermine if the inline is empty
doc::isEmptyDetermine if the inline is empty
doc::ltrimRemoves leading whitespace from the inline element.
doc::ltrimRemoves leading whitespace from the block.
doc::operator<=>Three-way comparison between polymorphic block wrappers.
doc::operator<=>Three-way comparison for polymorphic inline elements.
doc::operator==Equality delegates to the three-way comparison.
doc::operator==Equality delegates to the three-way comparison.
doc::rtrimRemoves trailing whitespace from the block.
doc::rtrimRemoves trailing whitespace from the inline element.
doc::trimRemoves leading and trailing whitespace from the block.
doc::trimRemoves leading and trailing whitespace from the inline element.