Loading [MathJax]/extensions/TeX/AMSsymbols.js
Automatic Differentiation
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
make_holder_tuple.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUNCTOR_MAKE_HOLDER_TUPLE_HPP
2#define STAN_MATH_PRIM_FUNCTOR_MAKE_HOLDER_TUPLE_HPP
3
6#include <functional>
7#include <tuple>
8#include <utility>
9
10namespace stan {
11namespace math {
12namespace internal {
13
28template <typename T>
29struct deduce_cvr {
30 using type
31 = std::conditional_t<std::is_rvalue_reference_v<T>, std::decay_t<T>, T&&>;
32};
33
34template <typename T>
36} // namespace internal
65template <typename... Types>
66inline constexpr auto make_holder_tuple(Types&&... args) {
67 if constexpr (sizeof...(Types) == 0) {
68 return std::tuple<>{};
69 } else {
70 return std::tuple<internal::deduce_cvr_t<Types&&>...>{
71 std::forward<Types>(args)...};
72 }
73}
74} // namespace math
75} // namespace stan
76#endif
typename deduce_cvr< T >::type deduce_cvr_t
constexpr auto make_holder_tuple(Types &&... args)
Holds ownership of rvalues and forwards lvalues into a tuple.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
std::conditional_t< std::is_rvalue_reference_v< T >, std::decay_t< T >, T && > type
Helper template to deduce the correct type for tuple elements.