n_extent_generator
To facilitate simpler and clearer
creation of
n_extent_t
objects.
Syntax
template<typename... TypeListT>
class n_extent_generator;
namespace {
// Instance of generator object
n_extent_generator<> n_extent;
}
Description
The generator object provides recursively constructing operators [] for
fixed<>
,
aligned<>
, and
integer
values allowing building of an
n_extent_t
<…> instance, one dimension at a time.
The main purpose is to allow a usage syntax that is similar to C
multi-dimensional array definition:
Compare the following examples, instantiating three
n_extent_t
instances. and using the generator object to
instantiate equivalent instances.
n_extent_t<int, int> ext1(height, width);
n_extent_t<int, aligned<128>> ext2(height, width);
n_extent_t<fixed<1080>, fixed<1920>> ext3(1080_fixed, 1920_fixed);
auto ext1 = n_extent[height][width];
auto ext2 = n_extent[height][aligned<128>(width)];
auto ext3 = n_extent[1080_fixed][1920_fixed];
Class Hierarchy
It is expected that
n_extent_generator
< … > not be directly used as a
data member or parameter, instead only n_extent_t
<...> from which it is derived. The generator object
n_extent
can be automatically downcast any place expecting an
n_extent_t<…>
.
The following table provides the template arguments for
n_extent_generator
Template Argument
| Description
|
---|---|
| Comma separated list of types, where the number
of types provided controls how many dimensions the generator currently
represent. Each type in the list identifies how the size of the corresponding
dimension is to be represented. The order of the dimensions is the same order
as C++ subscripts declaring a multi-dimensional array – from leftmost to
rightmost.
Requirements : Type is
int ,
fixed<NumberT> , or
aligned<AlignmentT> .
|
The following table provides information on the types
defined as members of
n_extent_generator
in addition to those inherited from
n_extent_t
.
Member Type
| Description
|
---|---|
| Type value that the any chained [] operator
calls have produced.
|
The following table provides information on the members
of
n_extent_generator
in addition to those inherited from
n_extent_t
Member
| Description
|
---|---|
| Requirements: TypeListT is empty
Effects: Construct generator with no extents specified
|
| Effects: Construct generator copying any extent values from
a_other
|
| Requirements: a_size >= 0
Returns: n_extent_generator<…> with additional
rightmost integer based extent.
|
| Requirements: a_size >= 0
Returns: n_extent_generator<…> with additional
rightmost fixed<NumberT> extent.
|
| Requirements: a_size >= 0
Returns: n_extent_generator<…> with additional
rightmost aligned<AlignmentT> based extent.
|
| Returns: n_extent_t<…> with the correct types and
values of the multi-dimensional extents aggregated by the generator.
|