![]() |
Stan Math Library
5.1.0
Automatic Differentiation
|
|
inlineconstexpr |
Filter a tuple and apply a functor to each element that passes the filter.
Filter
must have a static constexpr bool member named value
that is true if the type should be included in the output tuple. Note that this function automatically inspects into tuples and std::vector<T>::value_type
's. The filter_map
will recursively apply itself to inner containers as long as it sees a tuple in type type. So for instance if your type is a tuple<vector<tuple<vector<vector<double>>>>
your functor f
must support operationg on vector<vector<double>>
types. Filter | a struct that accepts one template parameter and has a static constexpr bool member named value that is true if the type should be included in the output tuple. |
InVector | For internal use. If true then we assume we are inside of a std::vector and the return type should not be wrapped in a tuple. |
InTuple | For internal use. If true then we assume we are inside of a tuple and any subtuples should be double wrapped so that tuple_concat produces a tuple for this element. |
F | Type of functor |
T | Any type |
f | functor callable |
x | Any type |
If we are in at this stage, we want tuple_concat to return a tuple here So we return a tuple(tuple()) so that tuple_cat concats the first layer of tuple. For example, if our input is a tuple(double, tuple(double, vec<double>)) with an identity filter we want tuple_concat to return a tuple(double, tuple(double, vec<double>)). Without the double tuple we would get back a tuple(double, double, vec<double>).
Definition at line 73 of file filter_map.hpp.