Automatic Differentiation
 
Loading...
Searching...
No Matches
to_ref.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_TO_REF_HPP
2#define STAN_MATH_PRIM_FUN_TO_REF_HPP
3
5
6namespace stan {
7namespace math {
8
16template <typename T>
17inline ref_type_t<T&&> to_ref(T&& a) {
18 return std::forward<T>(a);
19}
20
28template <bool Cond, typename T, std::enable_if_t<!Cond>* = nullptr>
29inline T to_ref_if(T&& a) {
30 return std::forward<T>(a);
31}
32
42template <bool Cond, typename T, std::enable_if_t<Cond>* = nullptr>
44 return std::forward<T>(a);
45}
46
47} // namespace math
48} // namespace stan
49#endif
T to_ref_if(T &&a)
No-op that should be optimized away.
Definition to_ref.hpp:29
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
Definition to_ref.hpp:17
typename ref_type_if< true, T >::type ref_type_t
Definition ref_type.hpp:55
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...