Contains templates useful for type manipulation.
More...
#include "LvArrayConfig.hpp"
#include "Macros.hpp"
#include <camp/camp.hpp>
#include <initializer_list>
#include <utility>
Go to the source code of this file.
|
#define | IS_VALID_EXPRESSION(NAME, T, ...) |
| Macro that expands to a static constexpr bool with one template argument which is true only if the expression is valid. More...
|
|
#define | IS_VALID_EXPRESSION_2(NAME, T, U, ...) |
| Macro that expands to a static constexpr bool with two template arguments which is true only if the expression is valid. More...
|
|
#define | HAS_MEMBER_FUNCTION_NO_RTYPE(NAME, ...) IS_VALID_EXPRESSION( HasMemberFunction_ ## NAME, CLASS, std::declval< CLASS & >().NAME( __VA_ARGS__ ) ) |
| Macro that expands to a static constexpr bool templated on a type that is only true when the type has a method NAME which takes the given arguments. The name of the boolean variable is HasMemberFunction_ ## NAME . More...
|
|
#define | HAS_MEMBER_TYPE(NAME) IS_VALID_EXPRESSION( HasMemberType_ ## NAME, CLASS, std::declval< typename CLASS::NAME >() ) |
| Macro that expands to a static constexpr bool templated on a type that is only true when the type has a nested type (or type alias) called NAME . The name of the boolean variable is HasMemberType_ ## NAME . More...
|
|
#define | HAS_STATIC_MEMBER(NAME) IS_VALID_EXPRESSION( HasStaticMember_ ## NAME, CLASS, std::enable_if_t< !std::is_member_pointer< decltype( &CLASS::NAME ) >::value, bool >{} ) |
| Macro that expands to a static constexpr bool templated on a type that is only true when the type has a static member called NAME . The name of the boolean variable is HasStaticMember_ ## NAME . More...
|
|
|
template<typename F > |
constexpr void | LvArray::typeManipulation::forEachArg (F &&f) |
| The recursive base case where no argument is provided. More...
|
|
template<typename F , typename ARG , typename ... ARGS> |
constexpr void | LvArray::typeManipulation::forEachArg (F &&f, ARG &&arg, ARGS &&... args) |
| Call the f with arg and then again with each argument in args . More...
|
|
| LvArray::typeManipulation::HAS_MEMBER_FUNCTION_NO_RTYPE (toView,) |
| Defines a template static constexpr bool HasMemberFunction_toView that is true if CLASS has a method toView() . More...
|
|
| LvArray::typeManipulation::HAS_MEMBER_FUNCTION_NO_RTYPE (toViewConstSizes,) |
| Defines a template static constexpr bool HasMemberFunction_toViewConstSizes that is true if CLASS has a method toView() . More...
|
|
| LvArray::typeManipulation::HAS_MEMBER_FUNCTION_NO_RTYPE (toViewConst,) |
| Defines a template static constexpr bool HasMemberFunction_toViewConst that is true if CLASS has a method toViewConst() . More...
|
|
| LvArray::typeManipulation::HAS_MEMBER_FUNCTION_NO_RTYPE (toNestedView,) |
| Defines a template static constexpr bool HasMemberFunction_toNestedView that is true if CLASS has a method toNestedView() . More...
|
|
| LvArray::typeManipulation::HAS_MEMBER_FUNCTION_NO_RTYPE (toNestedViewConst,) |
| Defines a template static constexpr bool HasMemberFunction_toNestedViewConst that is true if CLASS has a method toNestedViewConst() . More...
|
|
template<camp::idx_t... INDICES> |
constexpr camp::idx_t | LvArray::typeManipulation::getDimension (camp::idx_seq< INDICES... >) |
|
template<camp::idx_t... INDICES> |
constexpr camp::idx_t | LvArray::typeManipulation::getStrideOneDimension (camp::idx_seq< INDICES... >) |
|
template<typename PERMUTATION > |
constexpr bool | LvArray::typeManipulation::isValidPermutation (PERMUTATION) |
|
template<camp::idx_t... INDICES> |
constexpr CArray< camp::idx_t, sizeof...(INDICES) > | LvArray::typeManipulation::asArray (camp::idx_seq< INDICES... >) |
|
Contains templates useful for type manipulation.
Definition in file typeManipulation.hpp.
◆ HAS_MEMBER_FUNCTION_NO_RTYPE
#define HAS_MEMBER_FUNCTION_NO_RTYPE |
( |
|
NAME, |
|
|
|
... |
|
) |
| IS_VALID_EXPRESSION( HasMemberFunction_ ## NAME, CLASS, std::declval< CLASS & >().NAME( __VA_ARGS__ ) ) |
Macro that expands to a static constexpr bool templated on a type that is only true when the type has a method NAME
which takes the given arguments. The name of the boolean variable is HasMemberFunction_ ## NAME
.
- Parameters
-
NAME | The name of the method to look for. |
- Note
- The remaining macro arguments is the argument list to call the method with.
-
The class type is available through the name CLASS.
Definition at line 79 of file typeManipulation.hpp.
◆ HAS_MEMBER_TYPE
#define HAS_MEMBER_TYPE |
( |
|
NAME | ) |
IS_VALID_EXPRESSION( HasMemberType_ ## NAME, CLASS, std::declval< typename CLASS::NAME >() ) |
Macro that expands to a static constexpr bool templated on a type that is only true when the type has a nested type (or type alias) called NAME
. The name of the boolean variable is HasMemberType_ ## NAME
.
- Parameters
-
NAME | The name of the type to look for. |
Definition at line 88 of file typeManipulation.hpp.
◆ HAS_STATIC_MEMBER
#define HAS_STATIC_MEMBER |
( |
|
NAME | ) |
IS_VALID_EXPRESSION( HasStaticMember_ ## NAME, CLASS, std::enable_if_t< !std::is_member_pointer< decltype( &CLASS::NAME ) >::value, bool >{} ) |
Macro that expands to a static constexpr bool templated on a type that is only true when the type has a static member called NAME
. The name of the boolean variable is HasStaticMember_ ## NAME
.
- Parameters
-
NAME | The name of the variable to look for. |
Definition at line 97 of file typeManipulation.hpp.
◆ IS_VALID_EXPRESSION
#define IS_VALID_EXPRESSION |
( |
|
NAME, |
|
|
|
T, |
|
|
|
... |
|
) |
| |
Value:template< typename _T > \
struct NAME ## _impl \
{ \
private: \
template< typename T > static constexpr auto test( int )->decltype( __VA_ARGS__, bool() ) \
{ return true; } \
template< typename T > static constexpr auto test( ... )->bool \
{ return false; } \
public: \
static constexpr bool value = test< _T >( 0 ); \
}; \
template< typename T > \
static constexpr bool NAME = NAME ## _impl< T >::value
Macro that expands to a static constexpr bool with one template argument which is true only if the expression is valid.
- Parameters
-
NAME | The name to give the boolean variable. |
T | Name of the template argument in the expression. |
- Note
- The remaining macro arguments consist of the expresion to check for validity.
Definition at line 33 of file typeManipulation.hpp.
◆ IS_VALID_EXPRESSION_2
#define IS_VALID_EXPRESSION_2 |
( |
|
NAME, |
|
|
|
T, |
|
|
|
U, |
|
|
|
... |
|
) |
| |
Value:template< typename _T, typename _U > \
struct NAME ## _impl \
{ \
private: \
template< typename T, typename U > static constexpr auto test( int )->decltype( __VA_ARGS__, bool() ) \
{ return true; } \
template< typename T, typename U > static constexpr auto test( ... )->bool \
{ return false; } \
public: \
static constexpr bool value = test< _T, _U >( 0 ); \
}; \
template< typename T, typename U > \
static constexpr bool NAME = NAME ## _impl< T, U >::value
Macro that expands to a static constexpr bool with two template arguments which is true only if the expression is valid.
- Parameters
-
NAME | The name to give the boolean variable. |
T | Name of the first template argument in the expression. |
U | Name of the second template argument in the expression. |
- Note
- The remaining macro arguments consist of the expresion to check for validity.
Definition at line 56 of file typeManipulation.hpp.