Shortcuts

Template Struct Dimension

Struct Documentation

template<size_t Value>
struct ripple::Dimension

Defines a class to represent a dimension, where the value is known at compile time, but can also be evaluated at runtime as a size type.

The class should be used through the aliases when a single dimension must be specified to make code more readible:

// Not clear, what is 0?
do_something(container, 0);

// More clear, intention of x dimension application is known at call site.
do_something(container, dimx());

The other use case is when used with unrolled_for, where is can be used more generically in a constexpr context:

unrolled_for<num_dimensions>([] (auto dim_value) {
  // Compile time dimension can be used here:
  do_something(container, Dimension<dim_value>{});
});

or explicitly made constexpr (this can improve access performance):

unrolled_for<num_dimensions>([] (auto dim_value) {
  constexpr auto dim = dim_value;

  // Access the dim element of a container:
  auto v = container[dim];

  // Use in a template type:
  auto block = block_with_cx_padding<dim>(...);
});

Template Parameters
  • Value: The value of the dimension.

Public Functions

constexpr operator size_t() const

Overload of operator size_t to convert a dimension to a size_t.

Return

The value of the dimension.

Public Static Attributes

constexpr size_t value = Value

Returns the value of the dimension.

Docs

Access comprehensive developer documentation for Ripple

View Docs

Tutorials

Get tutorials to help with understand all features

View Tutorials

Examples

Find examples to help get started

View Examples