| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
4 #include <stan/math/prim/scal/meta/error_index.hpp>
5 #include <typeinfo>
6 #include <string>
7 #include <sstream>
8 #include <stdexcept>
9
10 namespace stan {
11 namespace math {
12
31 inline void out_of_range(const char* function,
32 const int max,
33 const int index,
34 const char* msg1 = "",
35 const char* msg2 = "") {
36 std::ostringstream message;
37
38 message << function << ": accessing element out of range. "
39 << "index " << index << " out of range; "
40 << "expecting index to be between "
41 << stan::error_index::value << " and "
42 << stan::error_index::value - 1 + max
43 << msg1
44 << msg2;
45
46 throw std::out_of_range(message.str());
47 }
48
49 }
50 }
51 #endif
stan
Definition: log_sum_exp.hpp:8
stan::error_index::value
Definition: error_index.hpp:7
stan::math::out_of_range
void out_of_range(const char *function, const int max, const int index, const char *msg1="", const char *msg2="")
Throw an out_of_range exception with a consistently formatted message.
Definition: out_of_range.hpp:31
stan::math::max
int max(const std::vector< int > &x)
Returns the maximum coefficient in the specified column vector.
Definition: max.hpp:22
error_index.hpp

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