1#ifndef STAN_MATH_PRIM_ERR_OUT_OF_RANGE_HPP
2#define STAN_MATH_PRIM_ERR_OUT_OF_RANGE_HPP
28 const char* msg1 =
"",
const char* msg2 =
"") {
29 std::ostringstream message;
30 message << function <<
": accessing element out of range. "
31 <<
"index " << index <<
" out of range; ";
34 message <<
"container is empty and cannot be indexed" << msg1 << msg2;
39 throw std::out_of_range(message.str());
auto max(T1 x, T2 y)
Returns the maximum value of the two specified scalar arguments.
void out_of_range(const char *function, int max, int index, const char *msg1="", const char *msg2="")
Throw an out_of_range exception with a consistently formatted message.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...