mrdocs::dom::LazyArrayImpl
Lazy array implementation
Synopsis
Declared in <mrdocs/Dom/LazyArray.hpp>
template<
std::ranges::random_access_range R,
class Context = /* implementation-defined */>
requires HasValueFrom<std::ranges::range_value_t<R>, Context> ||
(std::invocable<Context, std::ranges::range_value_t<R>> &&
HasStandaloneValueFrom<std::invoke_result_t<Context, std::ranges::range_value_t<R>>>)
class LazyArrayImpl
: public ArrayImpl
Types
Name |
Description |
An unsigned integral type used for indexes and sizes. |
|
The type of an element. |
Member Functions
Name |
Description |
|
Constructors |
|
Destructor |
|
Append an element to the end of the array. |
|
Return the i‐th element, without bounds checking. |
|
Set the i‐th element, without bounds checking. |
|
|
|
Return the type key of the implementation. |
Description
This array type is used to define a dom::Array whose members are evaluated on demand as they are accessed.
Each member can goes through a transform function before being returned as a Value so that all types can be converted to dom::Value.
The underlying representation of the array is a range from where the elements are extracted. Elements in this range should be convertible to dom::Value.
This class is typically useful for implementing arrays that are expensive and have recursive dependencies, as these recursive dependencies can also be deferred.
Unlike a LazyObjectImpl, which contains an overlay object, this implementation is read‐only. The set
and emplace_back
methods are not implemented.
Created with MrDocs