dune-common  2.5-git
Namespaces | Classes | Typedefs | Functions
Dune::Std Namespace Reference

Namespaces

 Imp
 
 Impl
 

Classes

class  integer_sequence
 an implementation of std::integer_sequence as introduced in C++14 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  MakeUniqueHelper
 
struct  MakeUniqueHelper< T[]>
 
struct  MakeUniqueHelper< T[N]>
 
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...
 

Typedefs

template<bool value>
using bool_constant = std::integral_constant< bool, value >
 A template alias for std::integral_constant<bool, value> More...
 
template<std::size_t... Ints>
using index_sequence = integer_sequence< std::size_t, Ints... >
 std::index_sequence as introduced in C++14 More...
 
template<typename T , T n>
using make_integer_sequence = typename impl::_make_integer_sequence< T, 0, n >::type
 
template<std::size_t n>
using make_index_sequence = make_integer_sequence< std::size_t, n >
 
template<typename... T>
using index_sequence_for = make_index_sequence< typename Dune::SizeOf< T... >{}>
 Create index_sequence from 0 to sizeof...(T)-1. 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<typename T , typename... Args>
MakeUniqueHelper< T >::NonArrayUniquePtr make_unique (Args &&... args)
 Implementation of std::make_unique to be introduced in C++14. More...
 
template<typename T >
MakeUniqueHelper< T >::UnknownBoundArrayUniquePtr make_unique (size_t n)
 Implementation of std::make_unique to be introduced in C++14. More...
 
template<typename T , typename ... Args>
MakeUniqueHelper< T >::KnownBoundArrayUniquePtr make_unique (Args &&... args)=delete
 Implementation of std::make_unique to be introduced in C++14. More...
 

Typedef Documentation

§ 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>

§ index_sequence

template<std::size_t... Ints>
using Dune::Std::index_sequence = typedef integer_sequence< std::size_t, Ints... >

std::index_sequence as introduced in C++14

Template Parameters
...Intsa non-type parameter pack

§ 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).

§ make_index_sequence

template<std::size_t n>
using Dune::Std::make_index_sequence = typedef make_integer_sequence<std::size_t,n>

§ make_integer_sequence

template<typename T , T n>
using Dune::Std::make_integer_sequence = typedef typename impl::_make_integer_sequence<T,0,n>::type

Function Documentation

§ apply()

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

Apply function with arguments given as tuple.

Parameters
fA callable object
argsTuple of arguments

This will call the function with arguments generated by unpacking the tuple.

§ 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.

§ make_unique() [1/3]

template<typename T , typename... Args>
MakeUniqueHelper<T>::NonArrayUniquePtr Dune::Std::make_unique ( Args &&...  args)
delete

Implementation of std::make_unique to be introduced in C++14.

Template Parameters
TNonarray type of object to be constructed
...ArgsParameter types for constructor of T
Parameters
argsArguments to be passed to constructor of T

This fallback implementation using perfect forwarding as proposed by Herb Sutter in http://herbsutter.com/gotw/_102/

§ make_unique() [2/3]

template<typename T >
MakeUniqueHelper<T>::UnknownBoundArrayUniquePtr Dune::Std::make_unique ( size_t  n)

Implementation of std::make_unique to be introduced in C++14.

Template Parameters
TArray type of unknown bound
Parameters
nSize of array to allocate

§ make_unique() [3/3]

template<typename T , typename ... Args>
MakeUniqueHelper<T>::KnownBoundArrayUniquePtr Dune::Std::make_unique ( Args &&...  args)
delete

Implementation of std::make_unique to be introduced in C++14.

Template Parameters
TArray type of known bound
ArgsDummy arguments

This is deleted, since, according to the standard this should not participate in overload resolution

Parameters
argsDummy arguments
Template Parameters
TNonarray type of object to be constructed
...ArgsParameter types for constructor of T
Parameters
argsArguments to be passed to constructor of T

This fallback implementation using perfect forwarding as proposed by Herb Sutter in http://herbsutter.com/gotw/_102/