Automatic Differentiation
 
Loading...
Searching...
No Matches
throw_domain_error.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_ERR_THROW_DOMAIN_ERROR_HPP
2#define STAN_MATH_PRIM_ERR_THROW_DOMAIN_ERROR_HPP
3
5#include <sstream>
6#include <stdexcept>
7
8namespace stan {
9namespace math {
10
25template <typename T>
26inline void throw_domain_error(const char* function, const char* name,
27 const T& y, const char* msg1, const char* msg2) {
28 std::ostringstream message;
29 // hack to remove -Waddress, -Wnonnull-compare warnings from GCC 6
30 const T* y_ptr = &y;
31 message << function << ": " << name << " " << msg1 << (*y_ptr) << msg2;
32 throw std::domain_error(message.str());
33}
34
48template <typename T>
49inline void throw_domain_error(const char* function, const char* name,
50 const T& y, const char* msg1) {
51 throw_domain_error(function, name, y, msg1, "");
52}
53
54} // namespace math
55} // namespace stan
56#endif
void throw_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.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9