-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
e308cc0
commit 6233f08
Showing
8 changed files
with
266 additions
and
89 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
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
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,26 @@ | ||
/* | ||
* Copyright Carlos BRITO PACHECO 2021 - 2022. | ||
* Distributed under the Boost Software License, Version 1.0. | ||
* (See accompanying file LICENSE or copy at | ||
* https://www.boost.org/LICENSE_1_0.txt) | ||
*/ | ||
#ifndef RODIN_UTILITY_EXTRACT_H | ||
#define RODIN_UTILITY_EXTRACT_H | ||
|
||
#include "Rodin/Tuple.h" | ||
|
||
namespace Rodin::Utility | ||
{ | ||
template <class ...> | ||
struct Extract; | ||
|
||
template <class T, class ... Ts> | ||
struct Extract<Tuple<T, Ts...>> | ||
{ | ||
template <template <class> class Extractor> | ||
using Type = Tuple<typename Extractor<T>::Type, typename Extractor<Ts>::Type...>; | ||
}; | ||
} | ||
|
||
#endif | ||
|
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
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,50 @@ | ||
/* | ||
* Copyright Carlos BRITO PACHECO 2021 - 2022. | ||
* Distributed under the Boost Software License, Version 1.0. | ||
* (See accompanying file LICENSE or copy at | ||
* https://www.boost.org/LICENSE_1_0.txt) | ||
*/ | ||
#ifndef RODIN_UTILITY_PRODUCT_H | ||
#define RODIN_UTILITY_PRODUCT_H | ||
|
||
#include "Rodin/Tuple.h" | ||
|
||
namespace Rodin::Utility | ||
{ | ||
template <class ...> | ||
struct Product; | ||
|
||
template <class H1, class H2, class ... Hs, class ... Gs> | ||
struct Product<Tuple<H1, H2, Hs...>, Tuple<Gs...>> | ||
{ | ||
template <template <class, class> class Pair> | ||
using Type = | ||
decltype( | ||
std::declval<Tuple<Pair<H1, Gs>...>>().concatenate( | ||
std::declval<Tuple<Pair<H2, Gs>...>>()).concatenate( | ||
std::declval<typename Product<Tuple<Hs...>, Tuple<Gs...>>::template Type<Pair>>())); | ||
}; | ||
|
||
template <class H, class ... Gs> | ||
struct Product<Tuple<H>, Tuple<Gs...>> | ||
{ | ||
template <template <class, class> class Pair> | ||
using Type = Tuple<Pair<H, Gs>...>; | ||
}; | ||
|
||
template <class ... Gs> | ||
struct Product<Tuple<>, Tuple<Gs...>> | ||
{ | ||
using Type = Tuple<>; | ||
}; | ||
|
||
template <class ... Gs> | ||
struct Product<Tuple<Gs...>, Tuple<>> | ||
{ | ||
using Type = Tuple<>; | ||
}; | ||
} | ||
|
||
#endif | ||
|
||
|
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
Oops, something went wrong.