Basic Type traits in DuMux
More...
Basic Type traits in DuMux
|
template<typename Expression > |
constexpr auto | Dumux::isValid (const Expression &t) |
| A function that creates a test functor to do class member introspection at compile time. More...
|
|
◆ isValid()
template<typename Expression >
constexpr auto Dumux::isValid |
( |
const Expression & |
t | ) |
|
|
constexpr |
A function that creates a test functor to do class member introspection at compile time.
- Returns
- a functor that returns true if the expression is valid with a given type / object Usage: If you want to test if a class has the member function resize(std::size_t) create a test functor
auto hasResize =
isValid([](
auto&& c) ->
decltype(c.resize(std::size_t(1))) {}; });
constexpr auto isValid(const Expression &t)
A function that creates a test functor to do class member introspection at compile time.
Definition: isvalid.hh:93
- Note
- hasResize can be constexpr in C++17 which allows lambdas in constexpr functions The you can use the test in compile time expressions
template<class T>
auto otherFunc(const T& t)
-> typename std::enable_if_t<!decltype(hasResize(myvector))::value, double>
{ return 4.0; }