Automatic Differentiation
 
Loading...
Searching...
No Matches
stan::ref_type_if< Condition, T, typename > Struct Template Reference

Detailed Description

template<bool Condition, typename T, typename = void>
struct stan::ref_type_if< Condition, T, typename >

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

Template Parameters
Ttype 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 & >
 

The documentation for this struct was generated from the following file: