| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
29 template <typename T>
30 inline void domain_error(const char* function, const char* name,
31 const T& y, const char* msg1, const char* msg2) {
32 std::ostringstream message;
33 // hack to remove -Waddress, -Wnonnull-compare warnings from GCC 6
34 const T* y_ptr = &y;
35 message << function << ": " << name << " " << msg1 << (*y_ptr) << msg2;
36 throw std::domain_error(message.str());
37 }
38
55 template <typename T>
56 inline void domain_error(const char* function, const char* name,
57 const T& y, const char* msg1) {
58 domain_error(function, name, y, msg1, "");
59 }
60
61 }
62 }
63 #endif
stan
Definition: log_sum_exp.hpp:8
stan::math::domain_error
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.
Definition: domain_error.hpp:30
stan::math::domain_error
void domain_error(const char *function, const char *name, const T &y, const char *msg1)
Throw a domain error with a consistently formatted message.
Definition: domain_error.hpp:56

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