Stan Math Library  2.20.0
reverse mode automatic differentiation
invalid_argument_vec.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_ERR_INVALID_ARGUMENT_VEC_HPP
2 #define STAN_MATH_PRIM_SCAL_ERR_INVALID_ARGUMENT_VEC_HPP
3 
6 #include <sstream>
7 #include <string>
8 
9 namespace stan {
10 namespace math {
11 
31 template <typename T>
32 inline void invalid_argument_vec(const char* function, const char* name,
33  const T& y, size_t i, const char* msg1,
34  const char* msg2) {
35  std::ostringstream vec_name_stream;
36  vec_name_stream << name << "[" << stan::error_index::value + i << "]";
37  std::string vec_name(vec_name_stream.str());
38  invalid_argument(function, vec_name.c_str(), stan::get(y, i), msg1, msg2);
39 }
40 
59 template <typename T>
60 inline void invalid_argument_vec(const char* function, const char* name,
61  const T& y, size_t i, const char* msg) {
62  invalid_argument_vec(function, name, y, i, msg, "");
63 }
64 
65 } // namespace math
66 } // namespace stan
67 #endif
void invalid_argument_vec(const char *function, const char *name, const T &y, size_t i, const char *msg1, const char *msg2)
Throw an invalid argument exception with a consistently formatted message.
void invalid_argument(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw an invalid_argument exception with a consistently formatted message.
T get(const std::vector< T > &x, size_t n)
Returns the n-th element of the provided std::vector.
Definition: get.hpp:16

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