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.

Types

Name

Description

const_pointer

Const pointer to the held object.

pointer

Mutable pointer to the held object.

value_type

Base value type.

Member Functions

Name

Description

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

Name Description

mrdocs::swap

mrdocs::nullable_traits

nullable_traits<T> defines how to treat a T as “nullable” without an external engaged bit.

Non-Member Functions

Name

Description

CompareDerived

Compares two polymorphic objects that have visit functions

cast

Dynamic cast returning const reference; asserts on failure.

cast

Dynamic cast returning reference; asserts on failure.

cast_or_null

Dynamic cast pointer; returns nullptr when pp is null.

cast_or_null

Dynamic cast pointer; returns nullptr when pp is null (const).

dyn_cast

Dynamic cast returning pointer or nullptr.

dyn_cast

Dynamic cast returning pointer or nullptr (const overload).

dyn_cast_or_null

Dynamic cast if pointer is non‐null and engaged, else nullptr (const).

dyn_cast_or_null

Dynamic cast if pointer is non‐null and engaged, else nullptr.

innerType

Return the inner type.

innerType

Return the inner type.

innermostType

Return the innermost type (mutable overload).

innermostType

Return the innermost type.

isa

Return true if the polymorphic object holds a value of type To.

isa_or_null

Return 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 polymorphic template parameters.

operator<=>

Three‐way comparison of two polymorphic objects.

operator<=>

Compare two polymorphic types by visitor dispatch.

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::isEmpty

Determine if the inline is empty

doc::isEmpty

Determine if the inline is empty

doc::ltrim

Removes leading whitespace from the inline element.

doc::ltrim

Removes 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::rtrim

Removes trailing whitespace from the block.

doc::rtrim

Removes trailing whitespace from the inline element.

doc::trim

Removes leading and trailing whitespace from the block.

doc::trim

Removes leading and trailing whitespace from the inline element.

Created with MrDocs