Stan Math Library  2.20.0
reverse mode automatic differentiation
size_zero.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_SIZE_ZERO_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_SIZE_ZERO_HPP
3 
5 #include <utility>
6 
7 namespace stan {
8 namespace math {
9 
17 template <typename T>
18 inline bool size_zero(T& x) {
19  return !length(x);
20 }
21 
30 template <typename T, typename... Ts>
31 inline bool size_zero(T& x, Ts&&... xs) {
32  return (size_zero(x) || size_zero(std::forward<Ts>(xs)...));
33 }
34 } // namespace math
35 } // namespace stan
36 
37 #endif
size_t length(const std::vector< T > &x)
Returns the length of the provided std::vector.
Definition: length.hpp:16
bool size_zero(T &x)
Returns 1 if input is of length 0, returns 0 otherwise.
Definition: size_zero.hpp:18

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