Construct from a subset of Extent.
This constructor takes a variadic list of Extent for each shape's dimension. If the amount of value passed is less than the specified Order of the kwk::shape type, all outermost missing extent are set to 1.
Unless specified by a type settings, values are stored inside an instance of kwk::shape as std::int32_t.
kwk::shape exposes different behavior depending on the way its descriptor is defined and its constructor parameter are defined.
Numerical extents
kwk::shape supports numerical Extent in both type definition and parameters. A numerical Extent is used to specify that a given Axis has no specific semantic.
Numerical Extent can be:
- An instance of kwk::_: When used in the kwk::shape type, this means the corresponding Axis has to be specified in the constructor. If used as a value, this means the corresponding Axis will be initialized with its default value (0 or any static value if specified).
- An integral value: When used in the kwk::shape type, this means the corresponding Axis value is fixed at compile-time. If used as a value, it will fill the corresponding Axis. If the runtime value passed as an initialiser is not equal to the static size, the behavior is undefined. Static size parameters has no impact on the kwk::shape object size.
- A type specifier: When used in the kwk::shape type, this forces the storage type of the corresponding Axis. The value still needs to be specified at runtime.
Example
Named extents
kwk::shape supports named Extent in both type definition and parameters. A named Extent is used to specify that a given named Axis has a specific semantic and that the ordering of the named Axis is important.
Named Extent can be:
- Used Directly: If all Extent type are named, they behave as named parameter and can be passed in any order. If they are mixed with other kind of Extent or passed a regular integral value, they must be ordered as required.
- Used with a static size: A named Extent can be suffixed by a call to the subscript operator with an integral value. This signify that this Axis as a size known at compile-time. Such Extent can then be initialized by kwk::_ or an integral value of the same value. If the runtime value passed as an initialiser is not equal to the static size, the behavior is undefined. Static size parameters has no impact on the kwk::shape object size.
- Used with a type specifier :A named Extent can be suffixed by a call to the subscript operator with a type settings (either kwk::as or a pre-defined one). The associated value has to be specified at runtime but will be stored as the chosen type.
Example
- Parameters
-