Automatic Differentiation
 
Loading...
Searching...
No Matches
ref_type.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_META_REF_TYPE_HPP
2#define STAN_MATH_PRIM_META_REF_TYPE_HPP
3
10#include <type_traits>
11
12namespace stan {
13
25template <bool Condition, typename T, typename = void>
27 using type = std::conditional_t<std::is_rvalue_reference<T>::value,
28 std::remove_reference_t<T>, const T&>;
29};
30
31template <bool Condition, typename T>
33 Condition, T,
37 = std::conditional_t<std::is_rvalue_reference<T>::value,
38 std::remove_reference_t<T>, const T&>;
39 using T_dec = std::decay_t<decltype(std::declval<T>().derived())>;
40
41 using type = std::conditional_t<
42 Eigen::internal::traits<Eigen::Ref<std::decay_t<T_plain>>>::
43 template match<T_dec>::MatchAtCompileTime
44 || !Condition,
46};
47
48template <bool Condition, typename T>
49struct ref_type_if<Condition, T, require_arena_matrix_t<T>> {
50 using type =
52};
53
54template <typename T>
56
57template <bool Condition, typename T>
59
60template <typename T>
62 typename ref_type_if<!is_constant<T>::value, T>::type;
63
64} // namespace stan
65
66#endif
require_t< is_arena_matrix< std::decay_t< T > > > require_arena_matrix_t
Require type satisfies is_arena_matrix.
std::integral_constant< bool, B > bool_constant
Alias for structs used for wraps a static constant of bool.
typename ref_type_if<!is_constant< T >::value, T >::type ref_type_if_not_constant_t
Definition ref_type.hpp:62
typename plain_type< T >::type plain_type_t
typename ref_type_if< Condition, T >::type ref_type_if_t
Definition ref_type.hpp:58
typename ref_type_if< true, T >::type ref_type_t
Definition ref_type.hpp:55
std::enable_if_t< math::conjunction< Checks... >::value > require_all_t
If all conditions are true, template is enabled Returns a type void if all conditions are true and ot...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9
Defines a static member named value which is defined to be true if the type is arena_matrix<T>
Check if type derives from EigenBase
Definition is_eigen.hpp:21
std::conditional_t< Eigen::internal::traits< Eigen::Ref< std::decay_t< T_plain > > >::template match< T_dec >::MatchAtCompileTime||!Condition, T_optionally_ref, T_plain > type
Definition ref_type.hpp:45
std::conditional_t< std::is_rvalue_reference< T >::value, std::remove_reference_t< T >, const T & > T_optionally_ref
Definition ref_type.hpp:38
typename ref_type_if< Condition, typename std::decay_t< T >::Base >::type type
Definition ref_type.hpp:51
std::conditional_t< std::is_rvalue_reference< T >::value, std::remove_reference_t< T >, const T & > type
Definition ref_type.hpp:28
If the condition is true determines appropriate type for assigning expression of given type to,...
Definition ref_type.hpp:26