1 #ifndef STAN_MATH_PRIM_SCAL_ERR_CHECK_LESS_HPP
2 #define STAN_MATH_PRIM_SCAL_ERR_CHECK_LESS_HPP
16 template <
typename T_y,
typename T_high,
bool is_vec>
18 static bool check(
const char*
function,
23 VectorView<const T_high> high_vec(high);
24 for (
size_t n = 0; n <
length(high); n++) {
25 if (!(y < high_vec[n])) {
26 std::stringstream msg;
27 msg <<
", but must be less than ";
29 std::string msg_str(msg.str());
31 "is ", msg_str.c_str());
38 template <
typename T_y,
typename T_high>
39 struct less<T_y, T_high, true> {
40 static bool check(
const char*
function,
45 VectorView<const T_high> high_vec(high);
46 for (
size_t n = 0; n <
length(y); n++) {
48 std::stringstream msg;
49 msg <<
", but must be less than ";
51 std::string msg_str(msg.str());
53 "is ", msg_str.c_str());
80 template <
typename T_y,
typename T_high>
85 return less<T_y, T_high, is_vector_like<T_y>::value>
86 ::check(
function, name, y, high);
bool check_less(const char *function, const char *name, const T_y &y, const T_high &high)
Return true if y is strictly less than high.
size_t length(const std::vector< T > &x)
void domain_error_vec(const char *function, const char *name, const T &y, const size_t i, const char *msg1, const char *msg2)
Throw a domain error with a consistently formatted message.
T get(const std::vector< T > &x, size_t n)
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.