#include <apibase.h>
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 |
using type = typename std::conditional< value , T, typename std::add_lvalue_reference<typename std::add_const<T>:: type >:: type >:: type |
The result type.
|