1 #ifndef STAN_MATH_PRIM_FUN_SIZE_ZERO_HPP 2 #define STAN_MATH_PRIM_FUN_SIZE_ZERO_HPP 3 4 #include <stan/math/prim/meta.hpp> 5 #include <utility> 6 7 namespace stan { 8 namespace math { 9 10 /** 11 * Returns 1 if input is of length 0, returns 0 12 * otherwise 13 * 14 * @param x argument 15 * @return 0 or 1 16 */ 17 template <typename T> size_zero(const T & x)18inline bool size_zero(const T& x) { 19 return !size(x); 20 } 21 22 /** 23 * Returns 1 if any inputs are of length 0, returns 0 24 * otherwise 25 * 26 * @param x first argument 27 * @param xs parameter pack of remaining arguments to forward to function 28 * @return 0 or 1 29 */ 30 template <typename T, typename... Ts> size_zero(const T & x,const Ts &...xs)31inline bool size_zero(const T& x, const Ts&... xs) { 32 return (size_zero(x) || size_zero(xs...)); 33 } 34 } // namespace math 35 } // namespace stan 36 37 #endif 38