ByValueParam< T > Class Template Reference

#include <apibase.h>

Detailed Description

template<typename T>
class maxon::ByValueParam< T >

This type trait yields T as its result type if T is a scalar type or a C++ reference type, otherwise const T&. It can be used for the declaration of parameters of template functions to avoid the inefficient use of const T& for scalar values. For the following function

template <typename T> void Func(typename ByValueParam<T>::type value);
static const Bool value
Definition: apibase.h:1398
typename std::conditional< value, T, typename std::add_lvalue_reference< typename std::add_const< T >::type >::type >::type type
The result type.
Definition: apibase.h:1399

a scalar value such as an Int is passed by value to Func, while a class value such as a Vector is passed as a const-reference const Vector&.

Public Types

using type = typename std::conditional< value, T, typename std::add_lvalue_reference< typename std::add_const< T >::type >::type >::type
 

Static Public Attributes

static const Bool value
 

Member Typedef Documentation

◆ type

using type = typename std::conditional<value, T, typename std::add_lvalue_reference<typename std::add_const<T>::type>::type>::type

The result type.

Member Data Documentation

◆ value

const Bool value
static