dune-common  2.7.1
Classes | Typedefs | Functions | Variables
Dune::Std Namespace Reference

Namespace for features backported from new C++ standards. More...

Classes

struct  identity
 A function object type whose operator() returns its argument unchanged. More...
 
struct  nullopt_t
 
struct  in_place_t
 
class  bad_optional_access
 
class  optional
 
class  to_false_type
 template mapping a type to std::false_type More...
 
class  to_true_type
 template mapping a type to std::true_type More...
 
struct  is_callable
 Traits class to check if function is callable. More...
 
struct  is_callable< F(Args...), R >
 Traits class to check if function is callable. More...
 
struct  is_invocable
 Traits class to check if function is invocable. More...
 
struct  is_invocable_r
 Traits class to check if function is invocable and the return type is compatible. More...
 
struct  nonesuch
 Type representing a lookup failure by std::detected_or and friends. More...
 
struct  conjunction
 forms the logical conjunction of the type traits B... More...
 
struct  conjunction<>
 
struct  conjunction< B >
 
struct  conjunction< B1, Bn... >
 
struct  disjunction
 forms the logical disjunction of the type traits B... More...
 
struct  disjunction<>
 
struct  disjunction< B >
 
struct  disjunction< B1, Bn... >
 
struct  negation
 forms the logical negation of the type traits B... More...
 
struct  variant_size
 
struct  variant_size< variant< T... > >
 
struct  monostate
 Trial default constructible class. More...
 

Typedefs

template<bool value>
using 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 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 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 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 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 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 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<typename... T>
using index_sequence_for = make_index_sequence< typename Dune::SizeOf< T... >{}>
 Create index_sequence from 0 to sizeof...(T)-1. More...
 
template<typename ... T>
using variant = Impl::variant_< T... >
 Incomplete re-implementation of C++17's std::variant. More...
 

Functions

template<class F , class ArgTuple >
decltype(auto) 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)> make_array (const Args &... args)
 Create and initialize an array. More...
 
template<class T >
static constexpr bool operator== (const optional< T > &lhs, const optional< T > &rhs)
 
template<class T >
static constexpr bool operator< (const optional< T > &lhs, const optional< T > &rhs)
 
template<class T >
static constexpr bool operator== (const optional< T > &lhs, nullopt_t) noexcept
 
template<class T >
static constexpr bool operator== (nullopt_t, const optional< T > &rhs) noexcept
 
template<class T >
static constexpr bool operator< (const optional< T > &lhs, nullopt_t) noexcept
 
template<class T >
static constexpr bool operator< (nullopt_t, const optional< T > &rhs) noexcept
 
template<class T >
static constexpr bool operator== (const optional< T > &lhs, const T &rhs)
 
template<class T >
static constexpr bool operator== (const T &lhs, const optional< T > &rhs)
 
template<class T >
static constexpr bool operator< (const optional< T > &lhs, const T &rhs)
 
template<class T >
static constexpr bool operator< (const T &lhs, const optional< T > &rhs)
 
template<class T >
static constexpr optional< typename std::decay< T >::type > make_optional (T &&value)
 
template<size_t N, typename... T>
auto & get (variant< T... > &var)
 
template<size_t N, typename... T>
const auto & get (const variant< T... > &var)
 
template<typename F , typename... T>
decltype(auto) visit (F &&visitor, variant< T... > &var)
 
template<typename F , typename... T>
decltype(auto) visit (F &&visitor, const variant< T... > &var)
 
template<typename Tp , typename ... T>
const auto * get_if (const variant< T... > *var)
 
template<typename Tp , typename ... T>
auto * get_if (variant< T... > *var)
 
template<typename Tp , typename ... T>
constexpr bool holds_alternative (const variant< T... > &var)
 
constexpr bool operator< (monostate, monostate) noexcept
 
constexpr bool operator> (monostate, monostate) noexcept
 
constexpr bool operator<= (monostate, monostate) noexcept
 
constexpr bool operator>= (monostate, monostate) noexcept
 
constexpr bool operator== (monostate, monostate) noexcept
 
constexpr bool operator!= (monostate, monostate) noexcept
 

Variables

template<template< typename... > class Op, typename... Args>
constexpr bool 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 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 is_detected_convertible_v = is_detected_convertible<Target,Op,Args...>::value
 Convenient access to the result value of is_detected_convertible. More...
 
template<typename T >
constexpr std::size_t variant_size_v = variant_size<T>::value
 

Detailed Description

Namespace for features backported from new C++ standards.

The namespace Dune::Std contains library features of new C++ standards and technical specifications backported to older compilers. Most features are detected and pulled into this namespace from the standard library if your compiler has native support. If it doesn't, we provide a fallback implementation on a best-effort basis.

Typedef Documentation

◆ index_sequence_for

template<typename... T>
using Dune::Std::index_sequence_for = typedef make_index_sequence<typename Dune::SizeOf<T...>{}>

Create index_sequence from 0 to sizeof...(T)-1.

This should do the same as std::index_sequence_for. But due to a bug in the sizeof... operator this may produce wrong results with clang<3.8.

As a workaround we provide our own implementation that avoids this bug even if the std:: version exists.

This implemenation can be dropped, once we require a minimum clang version that has this bug fixed (i.e. >=3.8).

◆ variant

template<typename ... T>
using Dune::Std::variant = typedef Impl::variant_<T...>

Incomplete re-implementation of C++17's std::variant.

Function Documentation

◆ get() [1/2]

template<size_t N, typename... T>
const auto & Dune::Std::get ( const variant< T... > &  var)

◆ get() [2/2]

template<size_t N, typename... T>
auto & Dune::Std::get ( variant< T... > &  var)

◆ get_if() [1/2]

template<typename Tp , typename ... T>
const auto * Dune::Std::get_if ( const variant< T... > *  var)

◆ get_if() [2/2]

template<typename Tp , typename ... T>
auto * Dune::Std::get_if ( variant< T... > *  var)

◆ holds_alternative()

template<typename Tp , typename ... T>
constexpr bool Dune::Std::holds_alternative ( const variant< T... > &  var)
constexpr

◆ make_optional()

template<class T >
static constexpr optional< typename std::decay< T >::type > Dune::Std::make_optional ( T &&  value)
inlinestaticconstexpr

◆ operator!=()

constexpr bool Dune::Std::operator!= ( monostate  ,
monostate   
)
constexprnoexcept

◆ operator<() [1/6]

template<class T >
static constexpr bool Dune::Std::operator< ( const optional< T > &  lhs,
const optional< T > &  rhs 
)
inlinestaticconstexpr

◆ operator<() [2/6]

template<class T >
static constexpr bool Dune::Std::operator< ( const optional< T > &  lhs,
const T &  rhs 
)
inlinestaticconstexpr

◆ operator<() [3/6]

template<class T >
static constexpr bool Dune::Std::operator< ( const optional< T > &  lhs,
nullopt_t   
)
inlinestaticconstexprnoexcept

◆ operator<() [4/6]

template<class T >
static constexpr bool Dune::Std::operator< ( const T &  lhs,
const optional< T > &  rhs 
)
inlinestaticconstexpr

◆ operator<() [5/6]

constexpr bool Dune::Std::operator< ( monostate  ,
monostate   
)
constexprnoexcept

◆ operator<() [6/6]

template<class T >
static constexpr bool Dune::Std::operator< ( nullopt_t  ,
const optional< T > &  rhs 
)
inlinestaticconstexprnoexcept

◆ operator<=()

constexpr bool Dune::Std::operator<= ( monostate  ,
monostate   
)
constexprnoexcept

◆ operator==() [1/6]

template<class T >
static constexpr bool Dune::Std::operator== ( const optional< T > &  lhs,
const optional< T > &  rhs 
)
inlinestaticconstexpr

◆ operator==() [2/6]

template<class T >
static constexpr bool Dune::Std::operator== ( const optional< T > &  lhs,
const T &  rhs 
)
inlinestaticconstexpr

◆ operator==() [3/6]

template<class T >
static constexpr bool Dune::Std::operator== ( const optional< T > &  lhs,
nullopt_t   
)
inlinestaticconstexprnoexcept

◆ operator==() [4/6]

template<class T >
static constexpr bool Dune::Std::operator== ( const T &  lhs,
const optional< T > &  rhs 
)
inlinestaticconstexpr

◆ operator==() [5/6]

constexpr bool Dune::Std::operator== ( monostate  ,
monostate   
)
constexprnoexcept

◆ operator==() [6/6]

template<class T >
static constexpr bool Dune::Std::operator== ( nullopt_t  ,
const optional< T > &  rhs 
)
inlinestaticconstexprnoexcept

◆ operator>()

constexpr bool Dune::Std::operator> ( monostate  ,
monostate   
)
constexprnoexcept

◆ operator>=()

constexpr bool Dune::Std::operator>= ( monostate  ,
monostate   
)
constexprnoexcept

◆ visit() [1/2]

template<typename F , typename... T>
decltype(auto) Dune::Std::visit ( F &&  visitor,
const variant< T... > &  var 
)

◆ visit() [2/2]

template<typename F , typename... T>
decltype(auto) Dune::Std::visit ( F &&  visitor,
variant< T... > &  var 
)

Variable Documentation

◆ variant_size_v

template<typename T >
constexpr std::size_t Dune::Std::variant_size_v = variant_size<T>::value
constexpr