All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
out_of_range.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_SCAL_ERR_OUT_OF_RANGE_HPP
#define STAN_MATH_PRIM_SCAL_ERR_OUT_OF_RANGE_HPP
#include <stan/math/prim/scal/meta/error_index.hpp>
#include <typeinfo>
#include <string>
#include <sstream>
#include <stdexcept>
namespace stan {
namespace math {
inline void out_of_range(const char* function,
const int max,
const int index,
const char* msg1 = "",
const char* msg2 = "") {
std::ostringstream message;
message << function << ": accessing element out of range. "
<< "index " << index << " out of range; "
<< "expecting index to be between "
<< stan::error_index::value << " and "
<< stan::error_index::value - 1 + max
<< msg1
<< msg2;
throw std::out_of_range(message.str());
}
}
}
#endif
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:30
stan::math::max
int max(const std::vector< int > &x)
Returns the maximum coefficient in the specified column vector.
Definition: max.hpp:21
error_index.hpp

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