Distributed Ranges
Loading...
Searching...
No Matches
tuple_utils.hpp
1// SPDX-FileCopyrightText: Intel Corporation
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#pragma once
6
7namespace dr::__detail {
8
9auto tuple_transform(auto tuple, auto op) {
10 auto transform = [op](auto &&...items) {
11 return std::make_tuple(op(items)...);
12 };
13 return std::apply(transform, tuple);
14}
15
16auto tie_transform(auto tuple, auto op) {
17 auto transform = [op]<typename... Items>(Items &&...items) {
18 return std::tie(op(std::forward<Items>(items))...);
19 };
20 return std::apply(transform, tuple);
21}
22
23auto tuple_foreach(auto tuple, auto op) {
24 auto transform = [op](auto... items) { (op(items), ...); };
25 std::apply(transform, tuple);
26}
27
28} // namespace dr::__detail