Rename Tuple -> Pair.

This is to make way for a new `Tuple` class that mimics `std::tuple`,
but can be reliably used on device and with aligned Eigen types.

The existing Tuple has very few references, and is actually an
analogue of `std::pair`.
This commit is contained in:
Antonio Sanchez
2021-08-26 12:25:31 -07:00
committed by Rasmus Munk Larsen
parent 3d4ba855e0
commit 74da2e6821
6 changed files with 117 additions and 115 deletions

View File

@@ -207,9 +207,11 @@ template<> struct PacketType<const half, const SyclDevice>: PacketType<half, Syc
#endif
#endif
// Tuple mimics std::pair but works on e.g. nvcc.
template <typename U, typename V> struct Tuple {
// Pair mimics std::pair but works on e.g. nvcc.
template <typename U, typename V> struct Pair {
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
U first;
V second;
@@ -217,13 +219,13 @@ template <typename U, typename V> struct Tuple {
typedef V second_type;
EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Tuple() : first(), second() {}
Pair() : first(), second() {}
EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Tuple(const U& f, const V& s) : first(f), second(s) {}
Pair(const U& f, const V& s) : first(f), second(s) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void swap(Tuple& rhs) {
void swap(Pair& rhs) {
using numext::swap;
swap(first, rhs.first);
swap(second, rhs.second);
@@ -232,13 +234,13 @@ template <typename U, typename V> struct Tuple {
template <typename U, typename V>
EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
bool operator==(const Tuple<U, V>& x, const Tuple<U, V>& y) {
bool operator==(const Pair<U, V>& x, const Pair<U, V>& y) {
return (x.first == y.first && x.second == y.second);
}
template <typename U, typename V>
EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
bool operator!=(const Tuple<U, V>& x, const Tuple<U, V>& y) {
bool operator!=(const Pair<U, V>& x, const Pair<U, V>& y) {
return !(x == y);
}