-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b87cb9
commit 84da4b5
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#pragma once | ||
|
||
#include <riw/tuple/tuple_pair.hpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
#include <tuple> | ||
#include <utility> | ||
|
||
namespace riw { | ||
namespace detail { | ||
template <class... Ts, class... Us, std::size_t... Is> | ||
constexpr inline auto tuple_pair_impl(const std::tuple<Ts...> &t1, const std::tuple<Us...> &t2, | ||
std::index_sequence<Is...>) { | ||
return std::make_tuple(std::make_pair(std::get<Is>(t1), std::get<Is>(t2))...); | ||
} | ||
} // namespace detail | ||
|
||
template <class... Ts, class... Us> | ||
constexpr inline auto tuple_pair(const std::tuple<Ts...> &t1, const std::tuple<Us...> &t2) { | ||
static_assert(sizeof...(Ts) == sizeof...(Us), "Tuples must have the same number of elements"); | ||
return detail::tuple_pair_impl(t1, t2, std::index_sequence_for<Ts...>{}); | ||
} | ||
} // namespace riw |