1 #ifndef STAN_MATH_PRIM_SCAL_ERR_CHECK_SIZE_MATCH_HPP
2 #define STAN_MATH_PRIM_SCAL_ERR_CHECK_SIZE_MATCH_HPP
4 #include <boost/type_traits/common_type.hpp>
29 template <
typename T_size1,
typename T_size2>
35 if (
likely(i == static_cast<T_size1>(j)))
38 std::ostringstream msg;
40 << name_j <<
" (" << j <<
") must match in size";
41 std::string msg_str(msg.str());
43 "(", msg_str.c_str());
66 template <
typename T_size1,
typename T_size2>
74 if (
likely(i == static_cast<T_size1>(j)))
76 std::ostringstream updated_name;
77 updated_name << expr_i << name_i;
78 std::string updated_name_str(updated_name.str());
79 std::ostringstream msg;
82 <<
" (" << j <<
") must match in size";
83 std::string msg_str(msg.str());
85 "(", msg_str.c_str());
void invalid_argument(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw an invalid_argument exception with a consistently formatted message.
bool check_size_match(const char *function, const char *name_i, T_size1 i, const char *name_j, T_size2 j)
Return true if the provided sizes match.