1212namespace stan {
1313namespace math {
1414
15-
1615namespace internal {
1716
1817template <template <typename ...> class Filter , typename T>
@@ -28,8 +27,9 @@ struct inspect_tuple<Filter, std::tuple<Types...>> {
2827
2928template <template <typename ...> class Filter , typename T, typename ... VecArgs>
3029struct inspect_tuple <Filter, std::vector<T, VecArgs...>> {
31- static constexpr bool value = Filter<std::vector<T, VecArgs...>>::value
32- || inspect_tuple<Filter, std::decay_t <T>>::value;
30+ static constexpr bool value
31+ = Filter<std::vector<T, VecArgs...>>::value
32+ || inspect_tuple<Filter, std::decay_t <T>>::value;
3333};
3434
3535/* *
@@ -40,7 +40,8 @@ struct inspect_tuple<Filter, std::vector<T, VecArgs...>> {
4040 * @tparam T type to check
4141 */
4242template <template <typename ...> class Filter , typename T>
43- inline constexpr bool inspect_tuple_v = internal::inspect_tuple<Filter, std::decay_t <T>>::value;
43+ inline constexpr bool inspect_tuple_v
44+ = internal::inspect_tuple<Filter, std::decay_t <T>>::value;
4445
4546/* *
4647 * Filter a tuple and apply a functor to each element that passes the filter.
@@ -49,8 +50,9 @@ inline constexpr bool inspect_tuple_v = internal::inspect_tuple<Filter, std::dec
4950 * Note that this function automatically inspects into tuples and
5051 * `std::vector<T>::value_type`'s. The `filter_map` will recursively apply
5152 * itself to inner containers as long as it sees a tuple in type type.
52- * So for instance if your type is a `tuple<vector<tuple<vector<vector<double>>>>`
53- * your functor `f` must support operationg on `vector<vector<double>>` types.
53+ * So for instance if your type is a
54+ * `tuple<vector<tuple<vector<vector<double>>>>` your functor `f` must support
55+ * operationg on `vector<vector<double>>` types.
5456 * @tparam Filter a struct that accepts one template parameter and has a static
5557 * constexpr bool member named value that is true if the type should be
5658 * included in the output tuple.
@@ -93,11 +95,11 @@ inline constexpr decltype(auto) filter_map(F&& f, T&& x) {
9395 return ret;
9496 }
9597 } else if constexpr (is_std_vector_v<T>) {
96- /* 3 cases for vectors
97- * 1. value_type is a tuple
98- * 2. value_type is a scalar or Eigen matrix
99- * 3. value_type is a std::vector which can hold either (1) or (2)
100- */
98+ /* 3 cases for vectors
99+ * 1. value_type is a tuple
100+ * 2. value_type is a scalar or Eigen matrix
101+ * 3. value_type is a std::vector which can hold either (1) or (2)
102+ */
101103 if constexpr (contains_tuple<T>::value) {
102104 std::vector<decltype (filter_map<Filter, true >(f, x[0 ]))> ret;
103105 for (size_t i = 0 ; i < x.size (); ++i) {
@@ -116,16 +118,14 @@ inline constexpr decltype(auto) filter_map(F&& f, T&& x) {
116118 if constexpr (InVector) {
117119 return std::forward<F>(f)(std::forward<T>(x));
118120 } else {
119- return make_holder_tuple (
120- std::forward<F>(f)(std::forward<T>(x)));
121+ return make_holder_tuple (std::forward<F>(f)(std::forward<T>(x)));
121122 }
122123 }
123124 } else {
124125 if constexpr (InVector) {
125126 return std::forward<F>(f)(std::forward<T>(x));
126127 } else {
127- return make_holder_tuple (
128- std::forward<F>(f)(std::forward<T>(x)));
128+ return make_holder_tuple (std::forward<F>(f)(std::forward<T>(x)));
129129 }
130130 }
131131 } else {
0 commit comments