Autoware.Auto
autoware::common::type_traits Namespace Reference

Classes

struct  conjunction
 A class to compute a conjunction over given traits. More...
 
struct  conjunction< TraitT >
 A conjunction of another type shall derive from that type. More...
 
struct  conjunction< TraitT, TraitsTs... >
 
struct  index
 Find an index of a type in a tuple. More...
 
struct  index< HeadT, std::tuple< HeadT, Tail... > >
 Specialization for a tuple that starts with the HeadT type. End of recursion. More...
 
struct  index< QueryT, std::tuple< HeadT, Tail... > >
 Specialization for a tuple with a type different to QueryT that calls the recursive step. More...
 

Functions

template<std::size_t I = 0UL, typename Callable , typename ... TypesT>
COMMON_PUBLIC std::enable_if_t< I==sizeof...(TypesT)> visit (std::tuple< TypesT... > &, Callable)
 Visit every element in a tuple. More...
 
template<std::size_t I = 0UL, typename Callable , typename ... TypesT>
COMMON_PUBLIC std::enable_if_t< I==sizeof...(TypesT)> visit (const std::tuple< TypesT... > &, Callable)
 Same as the previous specialization but for const tuple. More...
 
template<std::size_t I = 0UL, typename Callable , typename ... TypesT>
COMMON_PUBLIC std::enable_if_t< I !=sizeof...(TypesT)> visit (std::tuple< TypesT... > &tuple, Callable callable)
 Visit every element in a tuple. More...
 
template<std::size_t I = 0UL, typename Callable , typename ... TypesT>
COMMON_PUBLIC std::enable_if_t< I !=sizeof...(TypesT)> visit (const std::tuple< TypesT... > &tuple, Callable callable)
 Same as the previous specialization but for const tuple. More...
 

Function Documentation

◆ visit() [1/4]

template<std::size_t I = 0UL, typename Callable , typename ... TypesT>
COMMON_PUBLIC std::enable_if_t<I == sizeof...(TypesT)> autoware::common::type_traits::visit ( std::tuple< TypesT... > &  ,
Callable   
)
inline

Visit every element in a tuple.

This specialization indicates the end of the recursive tuple traversal.

Template Parameters
ICurrent index.
CallableCallable type, usually a lambda with one auto input parameter.
TypesTTypes in the tuple.
Returns
Does not return anything. Capture variables in a lambda to return any values.

◆ visit() [2/4]

template<std::size_t I = 0UL, typename Callable , typename ... TypesT>
COMMON_PUBLIC std::enable_if_t<I == sizeof...(TypesT)> autoware::common::type_traits::visit ( const std::tuple< TypesT... > &  ,
Callable   
)
inline

Same as the previous specialization but for const tuple.

◆ visit() [3/4]

template<std::size_t I = 0UL, typename Callable , typename ... TypesT>
COMMON_PUBLIC std::enable_if_t<I != sizeof...(TypesT)> autoware::common::type_traits::visit ( std::tuple< TypesT... > &  tuple,
Callable  callable 
)
inline

Visit every element in a tuple.

This specialization is used to apply the callable to an element of a tuple and recursively call this function on the next one.

Parameters
tupleThe tuple instance
[in]callableA callable, usually a lambda with one auto input parameter.
Template Parameters
ICurrent index.
CallableCallable type, usually a lambda with one auto input parameter.
TypesTTypes in the tuple.
Returns
Does not return anything. Capture variables in a lambda to return any values.

◆ visit() [4/4]

template<std::size_t I = 0UL, typename Callable , typename ... TypesT>
COMMON_PUBLIC std::enable_if_t<I != sizeof...(TypesT)> autoware::common::type_traits::visit ( const std::tuple< TypesT... > &  tuple,
Callable  callable 
)
inline

Same as the previous specialization but for const tuple.