Stan Math Library  2.20.0
reverse mode automatic differentiation
out_of_range.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_ERR_OUT_OF_RANGE_HPP
2 #define STAN_MATH_PRIM_SCAL_ERR_OUT_OF_RANGE_HPP
3 
5 #include <typeinfo>
6 #include <sstream>
7 #include <stdexcept>
8 
9 namespace stan {
10 namespace math {
11 
27 inline void out_of_range(const char* function, int max, int index,
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; "
32  << "expecting index to be between " << stan::error_index::value
33  << " and " << stan::error_index::value - 1 + max << msg1 << msg2;
34  throw std::out_of_range(message.str());
35 }
36 
37 } // namespace math
38 } // namespace stan
39 #endif
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.
int max(const std::vector< int > &x)
Returns the maximum coefficient in the specified column vector.
Definition: max.hpp:21

     [ Stan Home Page ] © 2011–2018, Stan Development Team.