All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
check_positive_size.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_SCAL_ERR_CHECK_POSITIVE_SIZE_HPP
#define STAN_MATH_PRIM_SCAL_ERR_CHECK_POSITIVE_SIZE_HPP
#include <stan/math/prim/scal/err/invalid_argument.hpp>
#include <sstream>
#include <string>
namespace stan {
namespace math {
inline bool check_positive_size(const char* function,
const char* name,
const char* expr,
const int size) {
if (size <= 0) {
std::stringstream msg;
msg << "; dimension size expression = " << expr;
std::string msg_str(msg.str());
invalid_argument(function, name, size,
"must have a positive size, but is ",
msg_str.c_str());
}
return true;
}
}
}
#endif
stan::math::check_positive_size
bool check_positive_size(const char *function, const char *name, const char *expr, const int size)
Return true if size is positive.
Definition: check_positive_size.hpp:23
invalid_argument.hpp
stan::math::invalid_argument
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.
Definition: invalid_argument.hpp:31
stan::math::size
int size(const std::vector< T > &x)
Return the size of the specified standard vector.
Definition: size.hpp:17

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