Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
check_nonzero_size.hpp
Go to the documentation of this file.
1 #ifndef STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_NONZERO_SIZE_HPP
2 #define STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_NONZERO_SIZE_HPP
3 
4 #include <string>
5 #include <typeinfo>
6 
9 #include <stan/meta/traits.hpp>
10 
11 namespace stan {
12 
13  namespace math {
14 
32  template <typename T_y, typename T_result>
33  inline bool check_nonzero_size(const char* function,
34  const T_y& y,
35  const char* name,
36  T_result* result) {
37  typedef typename index_type<T_y>::type size_t;
38  if (y.size() > 0)
39  return true;
40 
41  return dom_err(function, size_t(),
42  name, " has size %1%, but must have a non-zero size","",
43  result);
44  }
45 
46  }
47 }
48 #endif
bool dom_err(const char *function, const T &y, const char *name, const char *error_msg, const T_msg error_msg2, T_result *result)
Definition: dom_err.hpp:36
Primary template class for the metaprogram to compute the index type of a container.
Definition: index_type.hpp:21
bool check_nonzero_size(const char *function, const T_y &y, const char *name, T_result *result)
Return true if the specified matrix/vector is of non-zero size.

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