ByValueParam< T > Class Template Reference 系统

#include <apibase.h>

详细描述

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 );

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 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
maxon::ByValueParam::type
typename std::conditional< value, T, typename std::add_lvalue_reference< typename std::add_const< T >::type >::type >::type type
The result type.
定义: apibase.h:1371
maxon::ByValueParam::value
static const Bool value
定义: apibase.h:1370