Stan Math Library  2.8.0
reverse mode automatic differentiation
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
domain_error.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_ERR_DOMAIN_ERROR_HPP
2 #define STAN_MATH_PRIM_SCAL_ERR_DOMAIN_ERROR_HPP
3 
4 #include <typeinfo>
5 #include <string>
6 #include <sstream>
7 #include <stdexcept>
8 
9 namespace stan {
10  namespace math {
11 
31  template <typename T>
32  inline void domain_error(const char* function,
33  const char* name,
34  const T& y,
35  const char* msg1,
36  const char* msg2) {
37  std::ostringstream message;
38 
39  message << function << ": "
40  << name << " "
41  << msg1
42  << y
43  << msg2;
44 
45  throw std::domain_error(message.str());
46  }
47 
66  template <typename T>
67  inline void domain_error(const char* function,
68  const char* name,
69  const T& y,
70  const char* msg1) {
71  domain_error(function, name, y, msg1, "");
72  }
73 
74  }
75 }
76 #endif
void domain_error(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw a domain error with a consistently formatted message.
void domain_error(const char *function, const char *name, const T &y, const char *msg1)
Throw a domain error with a consistently formatted message.

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