Automatic Differentiation
 
Loading...
Searching...
No Matches
make_iter_name.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_ERR_MAKE_ITER_NAME_HPP
2#define STAN_MATH_PRIM_ERR_MAKE_ITER_NAME_HPP
3
6#include <string>
7
8namespace stan {
9namespace math {
10namespace internal {
11
12inline constexpr auto construct_idx() noexcept { return ""; }
13
14template <typename... Idxs>
15inline auto construct_idx(size_t i, Idxs... idxs) {
16 if (sizeof...(Idxs) > 0) {
17 return std::to_string(i + stan::error_index::value) + ", "
18 + construct_idx(idxs...);
19 } else {
20 return std::to_string(i + stan::error_index::value);
21 }
22}
23
24inline auto make_iter_name(const char* name) { return std::string(name); }
25
32template <typename... Idxs>
33inline auto make_iter_name(const char* name, Idxs... idxs) {
34 return (std::string(name) + "[" + construct_idx(idxs...) + "]");
35}
36} // namespace internal
37} // namespace math
38} // namespace stan
39
40#endif
constexpr auto construct_idx() noexcept
auto make_iter_name(const char *name)
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...