Developer Guide and Reference

Contents

n_bounds_generator

Facilitates simple creation of n_bounds_t objects.
#include <sdlt/n_bounds.h>

Syntax

template<typename... TypeListT> class n_bounds_generator; namespace { // Instance of generator object n_bounds_generator<> n_bounds; }
Description
The generator object provides recursively constructing operators [] for bounds_t<LowerT, UpperT> values allowing building of a n_bounds_t<…> instance one dimension at a time. Its main purpose is to allow a usage syntax that is similar to C multi-dimensional array definition:
Compare creating two n_bounds_t instances:
n_bounds_t<bounds_t<fixed<540>, fixed<1080>>, bounds_t<fixed<960>, fixed<1920>>> bounds1(bounds_t<540_fixed,1080_fixed>(), bounds_t<960_fixed, 1920_fixed>)); n_bounds_t<bounds_t<int, int>, bounds_t<int, int>> bounds2(bounds_t<int, int>(540,960), bounds_t<int, int>(960, 1920));
and the equivalent instances using the generator objects and factory functions
auto bounds1 = n_bounds[bounds(540_fixed, 1080_fixed)] [bounds(960_fixed, 1920_fixed)]; auto bounds2 = n_bounds[bounds(540, 1080)] [bounds(960, 1920)];
or alternatively using the operator() with n_index_t and n_extent_t generator objects
auto bounds1 = n_bounds(n_index[540_fixed][960_fixed], n_extent[540_fixed][960_fixed]); auto bounds2 = n_bounds(n_index[540][960], n_extent[540][960]);
Class Hierarchy
It is expected that n_bounds_generator<…> not be directly used as a data member or parameter, instead only n_bounds_t<...> from which it is derived. The generator object n_bounds can be automatically downcast any place expecting a n_bounds_t<…>.
The following table provides information on the template arguments for n_bounds_generator
Template Argument
Description
typename... TypeListT
Comma separated list of types, where the number of types provided controls how many dimensions there are. Each type in the list identifies how the bounds 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: types in the list be bounds_t<LowerT, UpperT>
The following table provides information on the types defined as members of n_bounds_generator in addition to those inherited from n_bounds_t