bounds_d Template Function
Provides a consistent way to determine
the bounds of a dimension for a multi-dimensional object.
#include
<sdlt/n_extent.h>
Syntax
template<int DimensionT, typename ObjT>
auto bounds_d(const ObjT &a_obj)
Description
Consistent way to determine the bounds of a dimension for a
multi-dimensional object. Can avoid extracting an entire n_bounds_t<…>
when only the extent of a single dimension is needed.
Template Argument
| Description
|
---|---|
| 0 based index starting at the leftmost dimension indicating which
n-dimensions to query the bounds of.
Requirements: DimensionT >=0 and DimensionT < ObjT::rank
|
| The type of n-dimensional object from which to retrieve the
extent.
Requirements: ObtT is one of:
n_container<…>
n_bounds_t<…>
n_bounds_generator<…>
n_container<…>::accessor
n_container<…>::const_accessor
or any sectioned or translated accessor.
|
Returns:
The correctly typed bounds_t<LowerT, UpperT>
corresponding to the requested DimensionT of a_obj.
Example:
template <typename VolumeT>
void foo(const VolumeT & a_volume)
{
auto bounds_z = bounds_d<0>(volume);
auto bounds_y = bounds_d<1>(volume);
auto bounds_x = bounds_d<2>(volume);
for(auto z : bounds_z)
for(auto y : bounds_y)
for(auto x : bounds_x) {
// …
}
}