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 to the held object. |
|
Mutable pointer to the held object. |
|
Base value type. |
Member Functions
Name |
Description |
|
Constructors |
|
Destructor. |
Assignment operators |
|
Dereference operators |
|
Member access operators |
|
Return true if the object has been moved‐from and is disengaged. |
Friends
| Name | Description |
|---|---|
nullable_traits<T> defines how to treat a T as “nullable” without an external engaged bit. |
Non-Member Functions
Name |
Description |
Compares two polymorphic objects that have visit functions |
|
Dynamic cast returning const reference; asserts on failure. |
|
Dynamic cast returning reference; asserts on failure. |
|
Dynamic cast pointer; returns nullptr when pp is null. |
|
Dynamic cast pointer; returns nullptr when pp is null (const). |
|
Dynamic cast returning pointer or nullptr. |
|
Dynamic cast returning pointer or nullptr (const overload). |
|
Dynamic cast if pointer is non‐null and engaged, else nullptr (const). |
|
Dynamic cast if pointer is non‐null and engaged, else nullptr. |
|
Return the inner type. |
|
Return the inner type. |
|
Return the innermost type (mutable overload). |
|
Return the innermost type. |
|
Return true if the polymorphic object holds a value of type To. |
|
Return true if pointer is non‐null and referent is of type To. |
|
Compare polymorphic template arguments. |
|
Compare two polymorphic names by visitor dispatch. |
|
Compare polymorphic template parameters. |
|
Three‐way comparison of two polymorphic objects. |
|
Compare two polymorphic types by visitor dispatch. |
|
Equality for two polymorphic types. |
|
Equality comparison of two polymorphic objects. |
|
Equality for two polymorphic names. |
|
Equality for polymorphic template arguments. |
|
Equality helper for polymorphic template parameters. |
|
Determine if the inline is empty |
|
Determine if the inline is empty |
|
Removes leading whitespace from the inline element. |
|
Removes leading whitespace from the block. |
|
Three‐way comparison between polymorphic block wrappers. |
|
Three‐way comparison for polymorphic inline elements. |
|
Equality delegates to the three‐way comparison. |
|
Equality delegates to the three‐way comparison. |
|
Removes trailing whitespace from the block. |
|
Removes trailing whitespace from the inline element. |
|
Removes leading and trailing whitespace from the block. |
|
Removes leading and trailing whitespace from the inline element. |
Created with MrDocs