Automatic Differentiation
 
Loading...
Searching...
No Matches
static_select.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_META_STATIC_SELECT_HPP
2#define STAN_MATH_PRIM_META_STATIC_SELECT_HPP
3
4#include <type_traits>
5#include <utility>
6
7namespace stan {
8namespace math {
9
22template <bool Condition, typename T1, typename T2,
23 std::enable_if_t<Condition>* = nullptr>
24T1 static_select(T1&& a, T2&& b) {
25 return std::forward<T1>(a);
26}
27
28template <bool Condition, typename T1, typename T2,
29 std::enable_if_t<!Condition>* = nullptr>
30T2 static_select(T1&& a, T2&& b) {
31 return std::forward<T2>(b);
32}
33
34} // namespace math
35} // namespace stan
36
37#endif // STATIC_SELECT_HPP
T1 static_select(T1 &&a, T2 &&b)
Returns one of the arguments that can be of different type, depending on the compile time condition.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...