Stan  1.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
validate_nonzero_size.hpp
Go to the documentation of this file.
1 #ifndef __STAN__MATH__MATRIX__VALIDATE_NONZERO_SIZE_HPP__
2 #define __STAN__MATH__MATRIX__VALIDATE_NONZERO_SIZE_HPP__
3 
4 #include <sstream>
5 #include <stdexcept>
6 
7 namespace stan {
8  namespace math {
9 
10  template <typename T>
11  inline void validate_nonzero_size(const T& x, const char* msg) {
12  if (x.size() > 0) return;
13  std::stringstream ss;
14  ss << "require non-zero size for " << msg
15  << "found size=" << x.size();
16  throw std::domain_error(ss.str());
17  }
18 
19  }
20 }
21 #endif

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