| 265 | // Maps each element to generate a new tree with the same shape. |
| 266 | template <typename U> |
| 267 | ShapeTree<U> Map(const std::function<U(const T&)>& func) { |
| 268 | ShapeTree<U> result(shape_storage_); |
| 269 | ForEachElement([&](const ShapeIndex& index, const T& t) { |
| 270 | *result.mutable_element(index) = func(t); |
| 271 | }); |
| 272 | return result; |
| 273 | } |
| 274 | |
| 275 | template <typename U> |
| 276 | ShapeTree<U> Map(const std::function<U(T*)>& func) { |
nothing calls this directly
no test coverage detected