Dune Core Modules (2.7.1)

C++ utilities and backports

Standard library features backported from newer C++ versions or technical specifications and DUNE-specific utilities. More...

Files

file  keywords.hh
 Definitions of several macros that conditionally make C++ syntax available.
 
file  proxymemberaccess.hh
 infrastructure for supporting operator->() on both references and proxies
 

Classes

class  Dune::IteratorRange< Iterator >
 Simple range between a begin and an end iterator. More...
 
struct  Dune::Std::is_callable< D, R >
 Traits class to check if function is callable. More...
 
struct  Dune::Std::is_callable< F(Args...), R >
 Traits class to check if function is callable. More...
 
struct  Dune::Std::is_invocable< F, Args >
 Traits class to check if function is invocable. More...
 
struct  Dune::Std::is_invocable_r< R, F, Args >
 Traits class to check if function is invocable and the return type is compatible. More...
 
struct  Dune::Std::nonesuch
 Type representing a lookup failure by std::detected_or and friends. More...
 
struct  Dune::Std::conjunction< B >
 forms the logical conjunction of the type traits B... More...
 
struct  Dune::Std::disjunction< B >
 forms the logical disjunction of the type traits B... More...
 
struct  Dune::Std::negation< B >
 forms the logical negation of the type traits B... More...
 
struct  Dune::Empty
 Just an empty class. More...
 
struct  Dune::IsInteroperable< T1, T2 >
 Checks whether two types are interoperable. More...
 
struct  Dune::EnableIfInterOperable< T1, T2, Type >
 Enable typedef if two types are interoperable. More...
 
struct  Dune::AlwaysFalse< T >
 template which always yields a false value More...
 
struct  Dune::AlwaysTrue< T >
 template which always yields a true value More...
 
struct  Dune::IsNumber< T >
 Whether this type acts as a scalar in the context of (hierarchically blocked) containers. More...
 
struct  Dune::HasNaN< T >
 Whether this type has a value of NaN. More...
 
struct  Dune::has_nan< T >
 Whether this type has a value of NaN. More...
 
struct  Dune::IsIndexable< T, I >
 Type trait to determine whether an instance of T has an operator[](I), i.e. whether it can be indexed with an index of type I. More...
 
struct  Dune::is_indexable< T, I >
 
struct  Dune::IsIterable< T, typename >
 typetrait to check that a class has begin() and end() members More...
 
struct  Dune::is_range< T, typename >
 typetrait to check that a class has begin() and end() members More...
 
struct  Dune::IsTuple< T >
 Check if T is a std::tuple<...> More...
 
struct  Dune::IsTupleOrDerived< T >
 Check if T derived from a std::tuple<...> More...
 
struct  Dune::IsIntegralConstant< T >
 Check if T is an std::integral_constant<I, i> More...
 
struct  Dune::SizeOf< T >
 Compute size of variadic type list. More...
 
struct  Dune::IntegerSequenceEntry< IntegerSequence, index >
 Get entry of std::integer_sequence. More...
 
struct  Dune::AutonomousValueType< T >
 Type free of internal references that T can be converted to. More...
 
struct  Dune::AutonomousValueType< T & >
 Specialization to remove lvalue references. More...
 
struct  Dune::AutonomousValueType< T && >
 Specialization to remove rvalue references. More...
 
struct  Dune::AutonomousValueType< const T >
 Specialization to remove const qualifiers. More...
 
struct  Dune::AutonomousValueType< volatile T >
 Specialization to remove volatile qualifiers. More...
 
struct  Dune::AutonomousValueType< std::vector< bool >::reference >
 Specialization for the proxies of vector<bool> More...
 
struct  Dune::AutonomousValueType< volatile const T >
 Specialization to remove both const and volatile qualifiers. More...
 
class  Dune::Std::to_false_type< T >
 template mapping a type to std::false_type More...
 
class  Dune::Std::to_true_type< T >
 template mapping a type to std::true_type More...
 

Macros

#define DUNE_ASSERT_AND_RETURN(C, X)   (!(C) ? throw [&](){assert(!#C);return 0;}() : 0), X
 Asserts a condition and return on success in constexpr context. More...
 
#define DUNE_DEPRECATED
 Mark some entity as deprecated. More...
 
#define DUNE_DEPRECATED_MSG(text)   DUNE_DEPRECATED
 Mark some entity as deprecated. More...
 
#define DUNE_NO_DEPRECATED_BEGIN   ...
 Ignore deprecation warnings (start) More...
 
#define DUNE_NO_DEPRECATED_END   ...
 Ignore deprecation warnings (end) More...
 
#define DUNE_UNUSED
 A macro for marking variables that the compiler mistakenly flags as unused, which sometimes happens due to templates.
 
#define DUNE_UNUSED_PARAMETER(parm)   static_cast<void>(parm)
 A macro to mark intentionally unused function parameters with.
 

Typedefs

template<bool value>
using Dune::Std::bool_constant = std::integral_constant< bool, value >
 A template alias for std::integral_constant<bool, value> More...
 
template<typename Default , template< typename... > class Op, typename... Args>
using Dune::Std::detected_or = Impl::detector< Default, void, Op, Args... >
 Detects whether Op<Args...> is valid and makes the result available. More...
 
template<template< typename... > class Op, typename... Args>
using Dune::Std::is_detected = typename detected_or< nonesuch, Op, Args... >::value_t
 Detects whether Op<Args...> is valid. More...
 
template<template< typename... > class Op, typename... Args>
using Dune::Std::detected_t = typename detected_or< nonesuch, Op, Args... >::type
 Returns Op<Args...> if that is valid; otherwise returns nonesuch. More...
 
template<typename Default , template< typename... > class Op, typename... Args>
using Dune::Std::detected_or_t = typename detected_or< Default, Op, Args... >::type
 Returns Op<Args...> if that is valid; otherwise returns the fallback type Default. More...
 
template<typename Expected , template< typename... > class Op, typename... Args>
using Dune::Std::is_detected_exact = std::is_same< Expected, detected_t< Op, Args... > >
 Checks whether Op<Args...> is Expected without causing an error if Op<Args...> is invalid. More...
 
template<typename Target , template< typename... > class Op, typename... Args>
using Dune::Std::is_detected_convertible = std::is_convertible< Target, detected_t< Op, Args... > >
 Checks whether Op<Args...> is convertible to Target without causing an error if Op<Args...> is invalid. More...
 
template<class... Types>
using Dune::void_t = typename Impl::voider< Types... >::type
 Is void for all valid input types (see N3911). The workhorse for C++11 SFINAE-techniques.
 
template<class Type >
using Dune::field_t = typename FieldTraits< Type >::field_type
 Convenient access to FieldTraits<Type>::field_type.
 
template<class Type >
using Dune::real_t = typename FieldTraits< Type >::real_type
 Convenient access to FieldTraits<Type>::real_type.
 
template<class T >
using Dune::AutonomousValue = typename AutonomousValueType< T >::type
 Type free of internal references that T can be converted to. More...
 

Functions

template<class... F>
auto Dune::overload (F &&... f)
 Create an overload set. More...
 
template<class... F>
auto Dune::orderedOverload (F &&... f)
 Create an ordered overload set. More...
 
template<typename T >
pointer_or_proxy_holder Dune::handle_proxy_member_access (T &&t)
 Transparent support for providing member access to both lvalues and rvalues (temporary proxies). More...
 
template<class F , class ArgTuple >
decltype(auto) Dune::Std::apply (F &&f, ArgTuple &&args)
 Apply function with arguments given as tuple. More...
 
template<typename... Args>
std::array< typename std::common_type< Args... >::type, sizeof...(Args)> Dune::Std::make_array (const Args &... args)
 Create and initialize an array. More...
 
template<class T , T... t, std::size_t index>
constexpr auto Dune::integerSequenceEntry (std::integer_sequence< T, t... >, std::integral_constant< std::size_t, index > i)
 Get entry of std::integer_sequence. More...
 
template<class T >
constexpr AutonomousValue< T > Dune::autoCopy (T &&v)
 Autonomous copy of an expression's value for use in auto type deduction. More...
 

Variables

template<template< typename... > class Op, typename... Args>
constexpr bool Dune::Std::is_detected_v = is_detected<Op,Args...>::value
 Detects whether Op<Args...> is valid and makes the result available as a value. More...
 
template<typename Expected , template< typename... > class Op, typename... Args>
constexpr bool Dune::Std::is_detected_exact_v = is_detected_exact<Expected,Op,Args...>::value
 Convenient access to the result value of is_detected_exact. More...
 
template<typename Target , template< typename... > class Op, typename... Args>
constexpr bool Dune::Std::is_detected_convertible_v = is_detected_convertible<Target,Op,Args...>::value
 Convenient access to the result value of is_detected_convertible. More...
 

Detailed Description

Standard library features backported from newer C++ versions or technical specifications and DUNE-specific utilities.

Macro Definition Documentation

◆ DUNE_ASSERT_AND_RETURN

#define DUNE_ASSERT_AND_RETURN (   C,
 
)    (!(C) ? throw [&](){assert(!#C);return 0;}() : 0), X

Asserts a condition and return on success in constexpr context.

The macro DUNE_ASSERT_AND_RETURN can be used as expression in the return statement of a constexpr function to have assert() and constexpr at the same time. It first uses assert for the condition given by the first argument and then returns the value of the second argument.

◆ DUNE_DEPRECATED

#define DUNE_DEPRECATED

Mark some entity as deprecated.

Definition of the DUNE_DEPRECATED macro for the case that config.h is not available.

This is a preprocessor define which can be used to mark functions, typedefs, enums and other stuff deprecated. If something is marked deprecated, users are advised to migrate to the new interface, since it will probably be removed in the next release of Dune.

DUNE_DEPRECATED currently works with g++ and clang++. For other compilers it will be defined empty. This way the user will not get any deprecation warning, but at least his code still compiles (well, until the next Dune release, that is).

Here are some examples how to mark different stuff deprecated:

  • Classes
    class DUNE_DEPRECATED Class {}; // 1)
    class Class {} DUNE_DEPRECATED; // 2)
    #define DUNE_DEPRECATED
    Mark some entity as deprecated.
    Definition: deprecated.hh:84
    Both forms do not work properly with g++-4.1: no deprecation warning will be given, although the code still compiles. 1) should be preferred over 2) since 2) does not work with clang++-1.1 (again, no warning given but code still compiles, works with clang++-3.1)
  • Template classes
    template<class T>
    class DUNE_DEPRECATED Class {}; // 1)
    template<class T>
    class Class {} DUNE_DEPRECATED; // 2)
    This works works with g++ >=4.3 only; g++-4.1 and clang++ compile the code without warning in both cases. Furthermore, the warning is only triggered when copying an object of that template class, neither making a typedef nor simply creating such an object emit the warning. It is thus recommended that some essential class member be marked deprecated as well, if possible.
  • Member constants
    template<typename T> struct Class {
    static const int c0 DUNE_DEPRECATED = 0;
    static const int DUNE_DEPRECATED c1 = 1;
    };
    Works with g++-4.1, g++ >=4.3 and clang++3.1. No warning but clean compile with clang++-1.1.
  • Member enumerators
    template<typename T> struct Class {
    enum enumeration { enumerator = 0 };
    };
    No form of deprecation is known that does not trigger an error on most compilers.
  • Member functions
    template<typename T> struct Class {
    void frob() DUNE_DEPRECATED {}
    }; // 1)
    template<typename T> struct Class {
    void DUNE_DEPRECATED frob() {}
    }; // 2)
    template<typename T> struct Class {
    DUNE_DEPRECATED void frob() {}
    }; // 3)
    With g++ only 2) emits a warning for templated member functions.

◆ DUNE_DEPRECATED_MSG

#define DUNE_DEPRECATED_MSG (   text)    DUNE_DEPRECATED

Mark some entity as deprecated.

This is a preprocessor define which can be used to mark functions, typedefs, enums and other stuff deprecated and to also specify a hint what replaces the given functionality. If something is marked deprecated, users are advised to migrate to the new interface, since it will probably be removed in the next release of Dune.

DUNE_DEPRECATED_MSG currently works only for compilers which support the attribute attribute((deprecated("message")). For other compilers it will be defined empty. This way the user will not get any deprecation warning, but at least his code still compiles (well, until the next Dune release, that is).

Here are some examples how to mark different stuff deprecated:

  • Classes
    class DUNE_DEPRECATED_MSG("In the future, please use 'Glass'") Class {}; // 1)
    class Class {} DUNE_DEPRECATED_MSG("In the future, please use 'Glass'"); // 2)
    #define DUNE_DEPRECATED_MSG(text)
    Mark some entity as deprecated.
    Definition: deprecated.hh:169
    For both forms, deprecation warnings and the additional hint "In the future, please use 'Glass'" will be printed on compilers which support it (e.g. G++ >= 4.5.0, clang++ >= 1.1). For compilers which support deprecating but do not take an additional hint (e.g. G++ < 4.5.0), only the deprecation warning is printed, and finally compilers which do not support deprecation of code won't print anything, but the code will still compile. 1) should be preferred over 2) since 2) does not work with clang++-1.1 (again, no warning will be given but code still compiles)
  • Template classes
    template<class T>
    class DUNE_DEPRECATED_MSG("In the future, please use 'Glass'") Class {}; // 1)
    template<class T>
    class Class {} DUNE_DEPRECATED_MSG("In the future, please use 'Glass'"); // 2)
    This works works with g++ >= 4.5, clang++ until at least version 1.1 will compile the code without warning in both cases. Furthermore, the warning is only triggered when copying an object of that template class, neither making a typedef nor simply creating such an object emit the warning. It is thus recommended that some essential class member be marked deprecated as well, if possible.
  • Member constants
    template<typename T> struct Class {
    static const int c0 DUNE_DEPRECATED_MSG("c2 is the new hype") = 0;
    static const int DUNE_DEPRECATED_MSG("c2 is the new hype") c1 = 1;
    };
    Works without printing the hint on g++-4.1, g++-4.3, g++-4.4 and fully on g++ >= 4.5. Works for clang++-3.1. No warning but clean compile with clang++-1.1.
  • Member enumerators
    template<typename T> struct Class {
    enum enumeration { enumerator = 0 };
    };
    No form of deprecation is known that does not trigger an error on most compilers.
  • Member functions
    template<typename T> struct Class {
    void frob() DUNE_DEPRECATED_MSG("use frog") {}
    }; // 1)
    template<typename T> struct Class {
    void DUNE_DEPRECATED_MSG("use frog") frob() {}
    }; // 2)
    template<typename T> struct Class {
    DUNE_DEPRECATED_MSG("use frog") void frob() {}
    }; // 3)
    With g++ only 2) emits a warning for templated member functions.

◆ DUNE_NO_DEPRECATED_BEGIN

#define DUNE_NO_DEPRECATED_BEGIN   ...

Ignore deprecation warnings (start)

This macro can be used together with DUNE_NO_DEPRECATED_END to mark a block in which deprecation warnings are ignored. This can be useful for implementations of deprecated methods that call other deprecated methods or for testing deprecated methods in the testsuite.

some_deprecated_function();
another_deprecated_function();
#define DUNE_NO_DEPRECATED_END
Ignore deprecation warnings (end)
Definition: deprecated.hh:198
#define DUNE_NO_DEPRECATED_BEGIN
Ignore deprecation warnings (start)
Definition: deprecated.hh:192
Warning
This macro must always be used together with DUNE_NO_DEPRECATED_END

◆ DUNE_NO_DEPRECATED_END

#define DUNE_NO_DEPRECATED_END   ...

Ignore deprecation warnings (end)

Warning
This macro must always be used together with DUNE_NO_DEPRECATED_BEGIN

Typedef Documentation

◆ AutonomousValue

template<class T >
using Dune::AutonomousValue = typedef typename AutonomousValueType<T>::type

Type free of internal references that T can be converted to.

Specialize AutonomousValueType to add your own mapping. Use autoCopy() to convert an expression of type T to AutonomousValue<T>.

This type alias determines a type that T can be converted to, but that will be free of references to other objects that it does not manage. In practice it will act like std::decay_t, but in addition to removing references it will also determine the types that proxies stand in for, and the types that expression templates will evaluate to.

"Free of references" means that the converted object will always be valid and does not alias any other objects directly or indirectly. The "other objects that it does not manage" restriction means that the converted object may still contain internal references, but they must be to resources that it manages itself. So, an std::vector would be an autonomous value even though it contains internal references to the storage for the elements since it manages that storage itself.

Note
For pointers, iterators, and the like the "value" for the purpose of AutonomousValue is considered to be the identity of the pointed-to object, so that object should not be cloned. But then you should hopefully never need an autonomous value for those anyway...

◆ bool_constant

template<bool value>
using Dune::Std::bool_constant = typedef std::integral_constant<bool, value>

A template alias for std::integral_constant<bool, value>

Template Parameters
valueBoolean value to encode as std::integral_constant<bool, value>

◆ detected_or

template<typename Default , template< typename... > class Op, typename... Args>
using Dune::Std::detected_or = typedef Impl::detector<Default,void,Op,Args...>

Detects whether Op<Args...> is valid and makes the result available.

This alias template is an alias for an unspecified class type with two nested typedefs value_t and type. It can be used to detect whether the meta function call Op<Args...> is valid and access the result of the call by inspecting the returned type, which is defined as follows:

  • If Op<Args...> can be instantiated, value_t is an alias for std::true_type and type is an alias for Op<Args...>.
  • If Op<Args...> is invalid, value_t is an alias for std::false_type and type is an alias for Default.

This can be used to safely extract a nested typedef from a type T that might not define the typedef:

struct A { using size_type = int ; };
struct B;
template<typename T>
using SizeType = typename T::size_type;
// this extracts the nested typedef for int
using st_a = typename detected_or<std::size_t,SizeType,A>::type;
// as there is no nested typedef in B, this yields std::size_t
using st_b = typename detected_or<std::size_t,SizeType,B>::type;
Note
This functionality is part of the C++ library fundamentals TS v2 and might or might not became part of C++2a.

◆ detected_or_t

template<typename Default , template< typename... > class Op, typename... Args>
using Dune::Std::detected_or_t = typedef typename detected_or<Default,Op,Args...>::type

Returns Op<Args...> if that is valid; otherwise returns the fallback type Default.

This alias template can be used to instantiate Op<Args...> in a context that is not SFINAE-safe by appropriately wrapping the instantiation and automatically falling back to Default if instantiation fails.

Note
This functionality is part of the C++ library fundamentals TS v2 and might or might not became part of C++2a.

◆ detected_t

template<template< typename... > class Op, typename... Args>
using Dune::Std::detected_t = typedef typename detected_or<nonesuch,Op,Args...>::type

Returns Op<Args...> if that is valid; otherwise returns nonesuch.

This alias template can be used to instantiate Op<Args...> in a context that is not SFINAE-safe by appropriately wrapping the instantiation. If instantiation fails, the marker type nonesuch is returned instead.

Note
This functionality is part of the C++ library fundamentals TS v2 and might or might not became part of C++2a.

◆ is_detected

template<template< typename... > class Op, typename... Args>
using Dune::Std::is_detected = typedef typename detected_or<nonesuch,Op,Args...>::value_t

Detects whether Op<Args...> is valid.

This alias template checks whether Op<Args...> can be instantiated. It is equivalent to typename detected_or<nonesuch,Op,Args...>::value_t.

Note
This functionality is part of the C++ library fundamentals TS v2 and might or might not became part of C++2a.

◆ is_detected_convertible

template<typename Target , template< typename... > class Op, typename... Args>
using Dune::Std::is_detected_convertible = typedef std::is_convertible<Target,detected_t<Op,Args...> >

Checks whether Op<Args...> is convertible to Target without causing an error if Op<Args...> is invalid.

Note
This functionality is part of the C++ library fundamentals TS v2 and might or might not became part of C++2a.

◆ is_detected_exact

template<typename Expected , template< typename... > class Op, typename... Args>
using Dune::Std::is_detected_exact = typedef std::is_same<Expected,detected_t<Op,Args...> >

Checks whether Op<Args...> is Expected without causing an error if Op<Args...> is invalid.

Note
This functionality is part of the C++ library fundamentals TS v2 and might or might not became part of C++2a.

Function Documentation

◆ apply()

template<class F , class ArgTuple >
decltype(auto) Dune::Std::apply ( F &&  f,
ArgTuple &&  args 
)

◆ autoCopy()

template<class T >
constexpr AutonomousValue<T> Dune::autoCopy ( T &&  v)
constexpr

Autonomous copy of an expression's value for use in auto type deduction.

This function is an unproxyfier or an expression evaluator or a fancy cast to ensure an expression can be used in auto type deduction. It ensures two things:

  1. The return value is a prvalue,
  2. the returned value is self-sufficient, or "autonomous".

The latter means that there will be no references into other objects (like containers) which are not guaranteed to be kept alive during the lifetime of the returned value.

An example usage would be

{c++}
std::vector<bool> bitvector{24};
auto value = autoCopy(bitvector[23]);
bitvector.resize(42);
// value still valid
constexpr AutonomousValue< T > autoCopy(T &&v)
Autonomous copy of an expression's value for use in auto type deduction.
Definition: typetraits.hh:723

Since vector<bool> may use proxies, auto value = bitvector[23]; would mean that the type of value is such a proxy. The proxy keeps internal references into the vector, and thus can be invalidated by anything that modifies the vector – such as a later call to resize(). autoCopy() lets you work around that problem by copying the value referenced by the proxy and converting it to a bool.

Another example would be an automatic differentiation library that lets you track the operations in a computation, and later ask for derivatives. Imagine that your operation involves a parameter function, and you want to use that function both with plain types and with automatic differentiation types. You might write the parameter function as follows:

{c++}
template<class NumberType>
auto param(NumberType v)
{
return 2*v;
}

If the automatic differentiation library is Adept, this would lead to use-after-end-of-life-bugs. The reason is that for efficiency reasons Adept does not immidiately evaluate the expression, but instead it constructs an expression object that records the kind of expression and references to the operands. The expression object is only evaluated when it is assigned to an object of some number type – which will only happen after the operands (v and the temporary object representing 2) have gone out of scope and been destroyed. Basically, Adept was invented before auto and rvalue-references were a thing.

This can be handled with autoCopy():

{c++}
template<class NumberType>
auto param(NumberType v)
{
return autoCopy(2*v);
}

Of course, autoCopy() needs to be taught about the expression objects of Adept for this to work.

autoCopy() will by default simply return the argument as a prvalue of the same type with cv-qualifiers removed. This involves one or more copy/move operation, so it will only work with types that are in fact copyable. And it will incur one copy if the compiler cannot use a move, such as when the type of the expression is a std::array or a FieldMatrix. (Any second copy that may semantically be necessary will be elided.)

To teach autoCopy() about a particular proxy type, specialize Dune::AutonomousValueType.

Note
Do not overload Dune::autoCopy() directly. It is meant to be found by unqualified or qualified lookup, not by ADL. There is little guarantee that your overload will be declared before the definition of internal Dune functions that use autoCopy(). They would need the lazy binding provided by ADL to find your overload, but they will probably use unqualified lookup.

◆ handle_proxy_member_access()

template<typename T >
pointer_or_proxy_holder Dune::handle_proxy_member_access ( T &&  t)

Transparent support for providing member access to both lvalues and rvalues (temporary proxies).

If an iterator facade (like entity iterators) wants to allow the embedded implementation to return either an (internally stored) reference or a temporary object and expose these two behaviors to enable performance optimizations, operator->() needs special handling: If the implementation returns a reference, operator->() in the facade can simply return the address of the referenced object, but if the returned object is a temporary, we need to capture and store it in a helper object to make sure it outlives the member access. This function transparently supports both variants. It should be used like this:

class iterator
{
...
decltype(handle_proxy_member_access(implementation.dereference()))
operator->() const
{
return handle_proxy_member_access(implementation.dereference());
}
...
};
pointer_or_proxy_holder handle_proxy_member_access(T &&t)
Transparent support for providing member access to both lvalues and rvalues (temporary proxies).
Note
This function exploits the special type deduction rules for unqualified rvalue references to distinguish between lvalues and rvalues and thus needs to be passed the object returned by the implementation.

◆ integerSequenceEntry()

template<class T , T... t, std::size_t index>
constexpr auto Dune::integerSequenceEntry ( std::integer_sequence< T, t... >  ,
std::integral_constant< std::size_t, index >  i 
)
constexpr

Get entry of std::integer_sequence.

Parameters
seqAn object of type std::integer_sequence<...>
iIndex
Returns
The i-th entry of the integer_sequence encoded as std::integral_constant<std::size_t, entry>.

◆ make_array()

template<typename... Args>
std::array<typename std::common_type<Args...>::type, sizeof...(Args)> Dune::Std::make_array ( const Args &...  args)

Create and initialize an array.

Note
This method is a somewhat limited dune-specific version of make_array() as proposed for C++17 (see N4391, accepted May 2015). The differences are that this version should never be used with expliclitly given template arguments, or with std::reference_wrapper<...> arguments, and we do not give a diagnostic when anyone happens to do that.

◆ orderedOverload()

template<class... F>
auto Dune::orderedOverload ( F &&...  f)

Create an ordered overload set.

Template Parameters
FList of function object types
Parameters
fList of function objects

This returns an object that contains all operator() implementations of the passed functions. All those are available when calling operator() of the returned object.

In contrast to overload() these overloads are ordered in the sense that the first matching overload for the given arguments is selected and later ones are ignored. Hence such a call is never ambiguous.

Notice that the passed function objects are stored by value and must be copy-constructible.

On gcc 5 and gcc 6 mixing templated overloads (i.e. using auto-parameter) and non-templated ones may not compile if both they are captureless lambdas. The problem can be avoided by capturing a dummy value.

◆ overload()

template<class... F>
auto Dune::overload ( F &&...  f)

Create an overload set.

Template Parameters
FList of function object types
Parameters
fList of function objects

This returns an object that contains all operator() implementations of the passed functions. All those are available when calling operator() of the returned object.

The returned object derives from those implementations such that it contains all operator() implementations in its overload set. When calling operator() this will select the best overload. If multiple overload are equally good this will lead to ambiguity.

Notice that the passed function objects are stored by value and must be copy-constructible.

On gcc 5 and gcc 6 mixing templated overloads (i.e. using auto-parameter) and non-templated ones may not compile if both they are captureless lambdas. The problem can be avoided by capturing a dummy value.

Variable Documentation

◆ is_detected_convertible_v

template<typename Target , template< typename... > class Op, typename... Args>
constexpr bool Dune::Std::is_detected_convertible_v = is_detected_convertible<Target,Op,Args...>::value
constexpr

Convenient access to the result value of is_detected_convertible.

Note
This functionality is part of the C++ library fundamentals TS v2 and might or might not became part of C++2a.

◆ is_detected_exact_v

template<typename Expected , template< typename... > class Op, typename... Args>
constexpr bool Dune::Std::is_detected_exact_v = is_detected_exact<Expected,Op,Args...>::value
constexpr

Convenient access to the result value of is_detected_exact.

Note
This functionality is part of the C++ library fundamentals TS v2 and might or might not became part of C++2a.

◆ is_detected_v

template<template< typename... > class Op, typename... Args>
constexpr bool Dune::Std::is_detected_v = is_detected<Op,Args...>::value
constexpr

Detects whether Op<Args...> is valid and makes the result available as a value.

This constexpr variable checks whether Op<Args...> can be instantiated. It is equivalent to is_detected<Op,Args...>::value.

Note
This functionality is part of the C++ library fundamentals TS v2 and might or might not became part of C++2a.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Apr 23, 22:30, 2024)