sdlt::bounds Template Function
Factory function provided for creation
of bounds_t objects.
#include
<sdlt/bounds.h>
Syntax
template<typename LowerT, typename UpperT>
auto bounds(LowerT a_lower, UpperT a_upper)
Description
In order to make creation of objects of bounds_t cleaner
the factory function bounds is provided. It basically enables LowerT and UpperT
to be deduced from the arguments passed into it.
Template Argument
| Description
|
---|---|
| Type of lower bound.
Requirements: type is int, or fixed<NumberT>, or
aligned<AlignmentT>
|
| Type of upper bound.
Requirements: type is int, or fixed<NumberT>, or
aligned<AlignmentT>
|
Returns:
The correctly typed bounds_t<LowerT, UpperT>
corresponding to types of a_lower and a_upper passed to the factory function.
Example:
Compare two ways of instantiating a bounds:
bounds_t<fixed<0>, aligned<16>> my_bounds1(0_fixed, aligned<16>(upper))
auto my_bounds2 = bounds_t<fixed<0>, aligned<16>>(0_fixed, aligned<16>(upper))
With the factory function:
auto my_bounds = bounds(0_fixed, aligned<16>(upper))