Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dom_err_vec.hpp
Go to the documentation of this file.
1 #ifndef STAN__MATH__ERROR_HANDLING__DOM_ERR_VEC_HPP
2 #define STAN__MATH__ERROR_HANDLING__DOM_ERR_VEC_HPP
3 
4 #include <typeinfo>
5 #ifdef BOOST_MSVC
6 # pragma warning(push) // Quiet warnings in boost/format.hpp
7 # pragma warning(disable: 4996) // _SCL_SECURE_NO_DEPRECATE
8 # pragma warning(disable: 4512) // assignment operator could not be generated.
9 // And warnings in error handling:
10 # pragma warning(disable: 4702) // unreachable code
11 // Note that this only occurs when the compiler can deduce code is unreachable,
12 // for example when policy macros are used to ignore errors rather than throw.
13 #endif
14 
15 #include <sstream>
16 #include <stdexcept>
17 
18 #include <boost/format.hpp>
19 
22 #include <stan/meta/traits.hpp>
23 
24 namespace stan {
25 
26  namespace math {
27 
28 
29  // currently ignoring T_result
30  template <typename T,
31  typename T_result,
32  typename T_msg>
33  inline bool dom_err_vec(const size_t i,
34  const char* function,
35  const T& y,
36  const char* name,
37  const char* error_msg,
38  const T_msg error_msg2,
39  T_result* result) {
40  std::ostringstream msg_o;
41  msg_o << name << "[" << stan::error_index::value + i << "] "
42  << error_msg << error_msg2;
43 
44  std::string msg;
45  msg += (boost::format(function)
46  % typeid(typename value_type<T>::type).name()).str();
47  msg += ": ";
48  msg += msg_o.str();
49 
50  throw std::domain_error((boost::format(msg)
51  % stan::get(y,i)).str());
52  return false;
53  }
54 
55  }
56 }
57 #endif
bool dom_err_vec(const size_t i, const char *function, const T &y, const char *name, const char *error_msg, const T_msg error_msg2, T_result *result)
Definition: dom_err_vec.hpp:33
T get(const T &x, size_t n)
Definition: traits.hpp:143
Primary template class for metaprogram to compute the type of values stored in a container.
Definition: value_type.hpp:21

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