Stan Math Library
5.0.0
Automatic Differentiation
|
If the condition is true determines appropriate type for assigning expression of given type to, to evaluate expensive expressions, but not make a copy if T involves no calculations.
This works similarly as Eigen::Ref
. It also handles rvalue references, so it can be used with perfect forwarding. If the condition is false the expression will never be evaluated.
Warning: if a variable of this type could be assigned a rvalue, make sure template parameter T
is of correct reference type (rvalue).
T | type to determine reference for |
Definition at line 26 of file ref_type.hpp.
#include <ref_type.hpp>
Public Types | |
using | type = std::conditional_t< std::is_rvalue_reference< T >::value, std::remove_reference_t< T >, const T & > |