Expression Templates Library (ETL)
Classes | Typedefs | Functions
expression_helpers.hpp File Reference

Contains internal helpers to build expressions. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  etl::detail::wrap_scalar_value_t_impl< T >
 

Typedefs

template<typename T >
using etl::detail::build_type = std::conditional_t< is_etl_value< T >, const std::decay_t< T > &, std::decay_t< T > >
 Helper to build the type for a sub expression. More...
 
template<typename T >
using etl::detail::build_identity_type = std::conditional_t< is_etl_value< T >, std::conditional_t< std::is_const_v< std::remove_reference_t< T > >, const std::decay_t< T > &, std::decay_t< T > & >, std::decay_t< T > >
 Helper to build the identity type for a sub expression. More...
 
template<typename T >
using etl::detail::wrap_scalar_t = std::conditional_t< etl::is_etl_expr< T >, T, etl::scalar< std::decay_t< T > >>
 Wraps a type either into a scalar or keep the ETL expression.
 
template<typename H , typename T >
using etl::detail::smart_wrap_scalar_t = std::conditional_t< etl::is_etl_expr< T >, T, etl::scalar< etl::value_t< H > >>
 Wraps a type either into a scalar or keep the ETL expression. More...
 
template<typename T >
using etl::detail::wrap_scalar_value_t = typename wrap_scalar_value_t_impl< T >::type
 Extract the value type of the given type taking scalar into account.
 
template<typename LE , typename RE , template< typename > typename OP>
using etl::detail::left_binary_helper = binary_expr< value_t< LE >, build_type< LE >, OP< value_t< LE > >, build_type< RE > >
 Helper to create a binary expr with left typing.
 
template<typename LE , typename RE , typename OP >
using etl::detail::left_binary_helper_op = binary_expr< value_t< LE >, build_type< LE >, OP, build_type< RE > >
 Helper to create a binary expr with left typing and a direct operation.
 
template<typename LE , typename RE , typename OP >
using etl::detail::left_binary_helper_op_scalar = binary_expr< wrap_scalar_value_t< LE >, build_type< wrap_scalar_t< LE > >, OP, build_type< smart_wrap_scalar_t< LE, RE > >>
 Helper to create a binary expr with left typing and a direct operation.
 
template<typename LE , typename RE , template< typename > typename OP>
using etl::detail::right_binary_helper = binary_expr< value_t< RE >, build_type< LE >, OP< value_t< RE > >, build_type< RE > >
 Helper to create a binary expr with right typing.
 
template<typename LE , typename RE , typename OP >
using etl::detail::right_binary_helper_op = binary_expr< value_t< RE >, build_type< LE >, OP, build_type< RE > >
 Helper to create a binary expr with right typing and a direct operation.
 
template<typename LE , typename RE , template< typename > typename OP>
using etl::detail::bool_left_binary_helper = binary_expr< bool, build_type< LE >, OP< value_t< LE > >, build_type< RE > >
 Helper to create a binary expr with left typing.
 
template<typename LE , typename RE , template< typename > typename OP>
using etl::detail::bool_right_binary_helper = binary_expr< bool, build_type< LE >, OP< value_t< RE > >, build_type< RE > >
 Helper to create a binary expr with right typing.
 
template<typename LE , typename RE , template< typename > typename OP>
using etl::detail::bool_left_binary_helper_scalar = binary_expr< bool, build_type< wrap_scalar_t< LE > >, OP< wrap_scalar_value_t< LE > >, build_type< wrap_scalar_t< RE > >>
 Helper to create a binary expr with left typing.
 
template<typename E , template< typename > typename OP>
using etl::detail::unary_helper = unary_expr< value_t< E >, build_type< E >, OP< value_t< E > >>
 Helper to create an unary expression.
 
template<typename E , typename OP >
using etl::detail::identity_helper = unary_expr< value_t< E >, OP, identity_op >
 Helper to create an identity unary expression.
 
template<typename E , typename OP >
using etl::detail::virtual_helper = unary_expr< E, OP, transform_op >
 Helper to create a virtual unary expression.
 
template<typename E , template< typename > typename OP>
using etl::detail::stable_transform_helper = unary_expr< value_t< E >, OP< build_type< E > >, transform_op >
 Helper to create a stable transform unary expression.
 
template<typename LE , typename RE , template< typename, typename > typename OP>
using etl::detail::stable_transform_binary_helper = unary_expr< value_t< LE >, OP< build_type< LE >, build_type< RE > >, transform_op >
 Helper to create a stable binary transform unary expression.
 

Functions

template<typename T >
 etl::detail::requires (etl_expr< T >) struct wrap_scalar_value_t_impl< T >
 Extract the value type of the given type taking scalar into account. More...
 
template<typename T >
 etl::detail::requires (!etl_expr< T >) struct wrap_scalar_value_t_impl< T >
 Extract the value type of the given type taking scalar into account. More...
 
template<typename T >
decltype(auto) etl::detail::wrap_scalar (T &&value) requires(etl_expr< T >)
 Transform a scalar value into an etl::scalar. More...
 
template<typename T >
etl::scalar< std::decay_t< T > > etl::detail::wrap_scalar (T &&value) requires(!etl_expr< T >)
 Transform a scalar value into an etl::scalar. More...
 
template<typename Hint , typename T >
decltype(auto) etl::detail::smart_wrap_scalar (T &&value)
 Transform a scalar value into an etl::scalar. More...
 
template<typename E , template< typename > typename OP, typename... Args>
auto etl::detail::make_transform_expr (Args &&... args)
 Make a stable unary transform unary expression. More...
 
template<typename E , typename OP , typename... Args>
auto etl::detail::make_stateful_unary_expr (Args &&... args)
 Make a stable unary transform unary expression for a stateful op. More...
 

Detailed Description

Contains internal helpers to build expressions.

Typedef Documentation

◆ build_identity_type

template<typename T >
using etl::detail::build_identity_type = typedef std::conditional_t<is_etl_value<T>, std::conditional_t<std::is_const_v<std::remove_reference_t<T> >, const std::decay_t<T>&, std::decay_t<T>&>, std::decay_t<T> >

Helper to build the identity type for a sub expression.

This means a reference for a value type (preserving constness) and a copy for another expression.

◆ build_type

template<typename T >
using etl::detail::build_type = typedef std::conditional_t<is_etl_value<T>, const std::decay_t<T>&, std::decay_t<T> >

Helper to build the type for a sub expression.

This means a reference for a value type and a copy for another expression.

◆ smart_wrap_scalar_t

template<typename H , typename T >
using etl::detail::smart_wrap_scalar_t = typedef std::conditional_t<etl::is_etl_expr<T>, T, etl::scalar<etl::value_t<H> >>

Wraps a type either into a scalar or keep the ETL expression.

If the type is not an ETL expression, we use the type of the hint in order to create the correct scalar type.

Function Documentation

◆ make_stateful_unary_expr()

template<typename E , typename OP , typename... Args>
auto etl::detail::make_stateful_unary_expr ( Args &&...  args)

Make a stable unary transform unary expression for a stateful op.

Parameters
argsArguments to be forward to the op.

◆ make_transform_expr()

template<typename E , template< typename > typename OP, typename... Args>
auto etl::detail::make_transform_expr ( Args &&...  args)

Make a stable unary transform unary expression.

Parameters
argsArguments to be forward to the op.

◆ requires() [1/2]

template<typename T >
etl::detail::requires ( etl_expr< T >  )

Extract the value type of the given type taking scalar into account.

The resulting type of the traits.

◆ requires() [2/2]

template<typename T >
etl::detail::requires ( !etl_expr< T >  )

Extract the value type of the given type taking scalar into account.

The resulting type of the traits.

◆ smart_wrap_scalar()

template<typename Hint , typename T >
decltype(auto) etl::detail::smart_wrap_scalar ( T &&  value)

Transform a scalar value into an etl::scalar.

Parameters
valueThe value to wraps
Returns
an etl::scalar or a forwarded expression

◆ wrap_scalar() [1/2]

template<typename T >
decltype(auto) etl::detail::wrap_scalar ( T &&  value)

Transform a scalar value into an etl::scalar.

Parameters
valueThe value to wraps
Returns
an etl::scalar or a forwarded expression

◆ wrap_scalar() [2/2]

template<typename T >
etl::scalar<std::decay_t<T> > etl::detail::wrap_scalar ( T &&  value)

Transform a scalar value into an etl::scalar.

Parameters
valueThe value to wraps
Returns
an etl::scalar or a forwarded expression