--- title: "constant" --- {{< callout type="info">}} Header: `constants.h` Since: `TBC` {{< /callout >}} A helper class for templates that require constants and classes that declare value and value_type members. The class allows constants to be wrapped in a template that defines value and value_type. This can be particularly useful in recursively defined templates where the value is defined as either a constant or a further invocation of the template. **Example** Take the example of `etl::sqrt`. ```cpp template struct sqrt { typedef typename etl::conditional<((I * I) < VALUE), etl::sqrt, etl::constant >::type type; enum value_type { value = type::value }; }; ``` ```cpp // Stop condition. template struct sqrt { enum value_type { value = I }; }; ``` `etl::conditional` will select one of the two types based on the boolean template parameter. The types are expected to have a value member. This is achieved for the constant by wrapping it in `etl::constant`.