SOFA API  f37305c1
Open source framework for multi-physics simuation
sofa::type::trait Namespace Reference

Classes

struct  is_container
 Detect if a type T has iterator/const iterator function. More...
 
struct  is_specialization_of
 Trait to check if a type T is a specialization of a given template class Template. More...
 
struct  is_specialization_of< Template< Args... >, Template >
 Partial specialization for the case where T is an instance of Template<Args...>. More...
 

Variables

template<typename T >
concept is_fixed_array
 Detect if a type T has iterator/const iterator function, operator[](size_t) and defines a static size. More...
 
template<typename T , template< typename... > class Template>
constexpr bool is_specialization_of_v = is_specialization_of<T, Template>::value
 Helper variable template to simplify the syntax for checking if T is a specialization of Template. More...
 
template<typename T >
concept is_vector
 Detect if a type T has iterator/const iterator function, operator[](size_t) and is dynamically resizable (resize function) More...
 

Variable Documentation

◆ is_fixed_array

template<typename T >
concept sofa::type::trait::is_fixed_array
Initial value:
= requires(std::remove_cv_t<T> t, const std::remove_cv_t<T> ct)
{
T::static_size;
{t.begin()} -> std::convertible_to<typename T::iterator>;
{t.end()} -> std::convertible_to<typename T::iterator>;
{ct.begin()} -> std::convertible_to<typename T::const_iterator>;
{ct.end()} -> std::convertible_to<typename T::const_iterator>;
{ t[0] } -> std::convertible_to<typename T::value_type>;
}
requires(!CanTypeRebind< _T< A >, _OtherType >) struct Rebind< _T< A >
Specialization for types that do NOT have a nested rebind_to member. In this implementation,...

Detect if a type T has iterator/const iterator function, operator[](size_t) and defines a static size.

◆ is_specialization_of_v

template<typename T , template< typename... > class Template>
constexpr bool sofa::type::trait::is_specialization_of_v = is_specialization_of<T, Template>::value
inlineconstexpr

Helper variable template to simplify the syntax for checking if T is a specialization of Template.

This variable template provides a cleaner and more concise way to use the is_specialization_of trait. Instead of writing is_specialization_of<T, Template>::value, you can use is_specialization_of_v<T, Template>.

Template Parameters
TThe type to be checked.
TemplateThe template class to check against.
See also
is_specialization_of

◆ is_vector

template<typename T >
concept sofa::type::trait::is_vector
Initial value:
= requires(std::remove_cv_t<T> t, const std::remove_cv_t<T> ct)
{
{t.begin()} -> std::convertible_to<typename T::iterator>;
{t.end()} -> std::convertible_to<typename T::iterator>;
{ct.begin()} -> std::convertible_to<typename T::const_iterator>;
{ct.end()} -> std::convertible_to<typename T::const_iterator>;
{ t[0] } -> std::convertible_to<typename T::value_type>;
t.resize(1);
}

Detect if a type T has iterator/const iterator function, operator[](size_t) and is dynamically resizable (resize function)