Skip to content

Commit 82ce1d1

Browse files
committed
move is_tuple back to stan::math namespace
1 parent 35bd764 commit 82ce1d1

6 files changed

Lines changed: 10 additions & 27 deletions

File tree

stan/math/prim/fun/promote_scalar.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#define STAN_MATH_PRIM_FUN_PROMOTE_SCALAR_HPP
33

44
#include <stan/math/prim/fun/Eigen.hpp>
5-
#include <stan/math/prim/meta.hpp>
65
#include <stan/math/prim/functor/apply.hpp>
6+
#include <stan/math/prim/meta.hpp>
77
#include <vector>
88
#include <tuple>
99
#include <type_traits>

stan/math/prim/meta/contains_tuple.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace stan {
77
namespace internal {
88
template <typename T>
99
struct contains_tuple_impl {
10-
static constexpr bool value = stan::is_tuple_v<T>;
10+
static constexpr bool value = stan::math::is_tuple_v<T>;
1111
};
1212

1313
template <typename T, typename... VecArgs>

stan/math/prim/meta/is_tuple.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <type_traits>
77

88
namespace stan {
9+
namespace math {
910
namespace internal {
1011

1112
template <typename... Types>
@@ -20,7 +21,6 @@ struct is_tuple : internal::is_tuple_impl<std::decay_t<T>> {};
2021

2122
template <typename T>
2223
constexpr bool is_tuple_v = is_tuple<T>::value;
23-
2424
/*! \ingroup require_std */
2525
/*! \defgroup tuple_types tuple */
2626
/*! \addtogroup tuple_types */
@@ -47,6 +47,7 @@ template <typename... Types>
4747
using require_all_not_tuple_t
4848
= require_all_not_t<is_tuple<std::decay_t<Types>>...>;
4949
/*! @} */
50+
}
5051

5152
} // namespace stan
5253

stan/math/rev/meta/arena_type.hpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,6 @@ struct arena_type_impl<
4949
using type = plain_type_t<T>;
5050
};
5151

52-
template <typename T, typename = void>
53-
struct arena_tuple_impl {};
54-
55-
template <typename T>
56-
struct arena_tuple_impl<T, stan::require_not_tuple_t<T>> {
57-
using type = typename internal::arena_type_impl<std::decay_t<T>>::type;
58-
};
59-
60-
template <typename... Types>
61-
struct arena_tuple_impl<std::tuple<Types...>> {
62-
using type = std::tuple<
63-
typename internal::arena_tuple_impl<std::decay_t<Types>>::type...>;
64-
};
65-
6652
} // namespace internal
6753

6854
/**
@@ -73,10 +59,6 @@ struct arena_tuple_impl<std::tuple<Types...>> {
7359
template <typename T>
7460
using arena_t = typename internal::arena_type_impl<std::decay_t<T>>::type;
7561

76-
template <typename T>
77-
using arena_tuple_t =
78-
typename internal::arena_tuple_impl<std::decay_t<T>>::type;
79-
8062
} // namespace stan
8163

8264
#endif

test/unit/math/mix/util.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ inline double get_val(T&& x) {
3030
*/
3131
template <typename F, typename... Types>
3232
inline void recursive_for_each(F&& f, Types&&... args) {
33-
if constexpr (std::conjunction_v<stan::is_tuple<Types>...>) {
33+
if constexpr (std::conjunction_v<stan::math::is_tuple<Types>...>) {
3434
stan::math::for_each(
3535
[&f](auto&&... args_i) { recursive_for_each(f, args_i...); }, args...);
3636
} else {

test/unit/math/prim/meta/is_tuple_test.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
#include <vector>
55

66
TEST(MathMetaPrim, is_tuple) {
7-
EXPECT_TRUE((stan::is_tuple<std::tuple<double>>::value));
8-
EXPECT_TRUE((stan::is_tuple<std::tuple<double>&>::value));
9-
EXPECT_TRUE((stan::is_tuple<std::tuple<double>&&>::value));
10-
EXPECT_FALSE((stan::is_tuple<double>::value));
11-
EXPECT_FALSE((stan::is_tuple<std::vector<double>>::value));
7+
EXPECT_TRUE((stan::math::is_tuple<std::tuple<double>>::value));
8+
EXPECT_TRUE((stan::math::is_tuple<std::tuple<double>&>::value));
9+
EXPECT_TRUE((stan::math::is_tuple<std::tuple<double>&&>::value));
10+
EXPECT_FALSE((stan::math::is_tuple<double>::value));
11+
EXPECT_FALSE((stan::math::is_tuple<std::vector<double>>::value));
1212
}

0 commit comments

Comments
 (0)