File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9595#include < stan/math/prim/meta/is_eigen_matrix.hpp>
9696#include < stan/math/prim/meta/is_eigen_matrix_base.hpp>
9797#include < stan/math/prim/meta/is_eigen_sparse_base.hpp>
98+ #include < stan/math/prim/meta/is_floating_point.hpp>
9899#include < stan/math/prim/meta/is_fvar.hpp>
100+ #include < stan/math/prim/meta/is_integral.hpp>
99101#include < stan/math/prim/meta/is_kernel_expression.hpp>
100102#include < stan/math/prim/meta/is_matrix_cl.hpp>
101103#include < stan/math/prim/meta/is_matrix.hpp>
128130#include < stan/math/prim/meta/scalar_type.hpp>
129131#include < stan/math/prim/meta/seq_view.hpp>
130132#include < stan/math/prim/meta/static_select.hpp>
133+ #include < stan/math/prim/meta/tuple_elt.hpp>
131134#include < stan/math/prim/meta/value_type.hpp>
132135#include < stan/math/prim/meta/void_t.hpp>
133136#include < stan/math/prim/meta/StdVectorBuilder.hpp>
Original file line number Diff line number Diff line change 1+ #ifndef STAN_MATH_PRIM_META_IS_FLOATING_POINT_HPP
2+ #define STAN_MATH_PRIM_META_IS_FLOATING_POINT_HPP
3+
4+ #include < type_traits>
5+
6+ namespace stan {
7+
8+ /* *
9+ * Checks if decayed type is a floating point type
10+ * @tparam The type to check
11+ * @ingroup type_trait
12+ */
13+ template <typename T>
14+ using is_floating_point = std::is_floating_point<std::decay_t <T>>;
15+
16+ template <typename T>
17+ inline constexpr bool is_floating_point_v = is_floating_point<T>::value;
18+
19+ template <typename ... Types>
20+ inline constexpr bool is_all_floating_point_v
21+ = (is_floating_point_v<Types> && ...);
22+
23+ template <typename ... Types>
24+ inline constexpr bool is_any_floating_point_v
25+ = (is_floating_point_v<Types> || ...);
26+
27+ } // namespace stan
28+
29+ #endif
Original file line number Diff line number Diff line change 1+ #ifndef STAN_MATH_PRIM_META_IS_INTEGRAL_HPP
2+ #define STAN_MATH_PRIM_META_IS_INTEGRAL_HPP
3+
4+ #include < type_traits>
5+
6+ namespace stan {
7+
8+ /* *
9+ * Checks if decayed type is integral
10+ * @tparam The type to check
11+ * @ingroup type_trait
12+ */
13+ template <typename T>
14+ using is_integral = std::is_integral<std::decay_t <T>>;
15+
16+ template <typename T>
17+ inline constexpr bool is_integral_v = is_integral<T>::value;
18+
19+ template <typename ... Types>
20+ inline constexpr bool is_all_integral_v = (is_integral_v<Types> && ...);
21+
22+ template <typename ... Types>
23+ inline constexpr bool is_any_integral_v = (is_integral_v<Types> || ...);
24+
25+ } // namespace stan
26+
27+ #endif
Original file line number Diff line number Diff line change 11#ifndef STAN_MATH_PRIM_META_IS_TUPLE_HPP
22#define STAN_MATH_PRIM_META_IS_TUPLE_HPP
33
4+ #include < cstddef>
45#include < stan/math/prim/meta/require_helpers.hpp>
56#include < tuple>
67#include < type_traits>
@@ -49,6 +50,26 @@ using require_all_not_tuple_t
4950/* ! @} */
5051} // namespace math
5152
53+ template <typename T>
54+ using is_tuple = math::is_tuple<T>;
55+
56+ template <typename T>
57+ inline constexpr bool is_tuple_v = math::is_tuple_v<T>;
58+
59+ /* *
60+ * Checks both that T is a tuple and that its size is N
61+ * @tparam T type to retrieve the element from
62+ * @tparam N expected size
63+ * @ingroup type_trait
64+ */
65+ template <typename T, std::size_t N>
66+ struct is_tuple_of_size
67+ : std::bool_constant<is_tuple_v<T>
68+ && std::tuple_size_v<std::decay_t <T>> == N> {};
69+
70+ template <typename T, std::size_t N>
71+ inline constexpr bool is_tuple_of_size_v = is_tuple_of_size<T, N>::value;
72+
5273} // namespace stan
5374
5475#endif
Original file line number Diff line number Diff line change 1+ #ifndef STAN_MATH_PRIM_META_IS_TUPLE_ELT_HPP
2+ #define STAN_MATH_PRIM_META_IS_TUPLE_ELT_HPP
3+
4+ #include < type_traits>
5+ #include < cstddef>
6+ #include < tuple>
7+
8+ namespace stan {
9+
10+ /* *
11+ * Equivalent to std::tuple_element but returns void if N is out of range
12+ * to avoid a static assertion failure in libstdc++.
13+ * @tparam N index of the element to retrieve
14+ * @tparam T type to retrieve the element from
15+ * @ingroup type_trait
16+ */
17+ template <std::size_t N, typename T, typename = void >
18+ struct tuple_element {
19+ using type = void ;
20+ };
21+
22+ template <std::size_t N, typename T>
23+ struct tuple_element <
24+ N, T, std::enable_if_t <(N < std::tuple_size_v<std::decay_t <T>>)>> {
25+ using type = std::tuple_element_t <N, std::decay_t <T>>;
26+ };
27+
28+ template <std::size_t N, typename T>
29+ using tuple_element_t = typename tuple_element<N, T>::type;
30+ } // namespace stan
31+
32+ #endif
You can’t perform that action at this time.
0 commit comments