-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit replaces the Thrust tuple and pair types from the traccc core library, as this dependency on Thrust is causing a lot of build headaches. Since we use the Thrust dependencies very sparsely in core, it is easier to remove them than to try to work around them.
- Loading branch information
1 parent
8db2c76
commit 3e2f11b
Showing
4 changed files
with
112 additions
and
8 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,20 @@ | ||
/** TRACCC library, part of the ACTS project (R&D line) | ||
* | ||
* (c) 2025 CERN for the benefit of the ACTS project | ||
* | ||
* Mozilla Public License Version 2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
namespace traccc { | ||
template <typename T1, typename T2> | ||
struct pair { | ||
public: | ||
using first_type = T1; | ||
using second_type = T2; | ||
|
||
T1 first; | ||
T2 second; | ||
}; | ||
} // namespace traccc |
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,88 @@ | ||
/** TRACCC library, part of the ACTS project (R&D line) | ||
* | ||
* (c) 2025 CERN for the benefit of the ACTS project | ||
* | ||
* Mozilla Public License Version 2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <type_traits> | ||
#include <utility> | ||
|
||
#include "traccc/definitions/qualifiers.hpp" | ||
|
||
namespace traccc { | ||
|
||
template <typename... Ts> | ||
struct tuple {}; | ||
|
||
template <typename T, typename... Ts> | ||
struct tuple<T, Ts...> { | ||
|
||
TRACCC_HOST_DEVICE constexpr tuple(){}; | ||
|
||
constexpr tuple(const tuple &o) requires( | ||
std::is_copy_constructible_v<T> && | ||
(std::is_copy_constructible_v<Ts> && ...)) = default; | ||
|
||
template <typename U, typename... Us> | ||
requires std::is_constructible_v<T, U &&> | ||
&&std::is_constructible_v<tuple<Ts...>, Us &&...> | ||
TRACCC_HOST_DEVICE explicit constexpr tuple( | ||
const tuple<U, Us...> &o) | ||
: v(o.v), r(o.r) {} | ||
|
||
constexpr tuple(tuple &&o) noexcept | ||
requires(std::is_move_constructible_v<T> && | ||
(std::is_move_constructible_v<Ts> && ...)) = default; | ||
|
||
template <typename U, typename... Us> | ||
requires std::is_constructible_v<T, U &&> | ||
&&std::is_constructible_v<tuple<Ts...>, Us &&...> | ||
TRACCC_HOST_DEVICE explicit constexpr tuple(tuple<U, Us...> &&o) | ||
: v(std::move(o.v)), r(std::move(o.r)) {} | ||
|
||
template <typename U, typename... Us> | ||
requires std::is_constructible_v<T, U &&> | ||
&&std::is_constructible_v<tuple<Ts...>, Us &&...> && | ||
(!(std::is_same_v<tuple, U> || | ||
(std::is_same_v<tuple, Us> || ...))) TRACCC_HOST_DEVICE | ||
explicit constexpr tuple(U &&_v, Us &&... _r) | ||
: v(std::forward<U>(_v)), | ||
r(std::forward<Us>(_r)...) {} | ||
|
||
constexpr ~tuple() noexcept = default; | ||
|
||
constexpr tuple &operator=(const tuple &other) requires( | ||
std::is_copy_assignable_v<T> && | ||
(std::is_copy_assignable_v<Ts> && ...)) = default; | ||
|
||
template <typename U, typename... Us> | ||
TRACCC_HOST_DEVICE constexpr tuple & | ||
operator=(const tuple<U, Us...> &other) requires( | ||
std::is_assignable_v<T &, const U &> && | ||
(std::is_assignable_v<Ts &, const Us &> && ...)) { | ||
v = other.v; | ||
r = other.r; | ||
return *this; | ||
} | ||
|
||
constexpr tuple &operator=(tuple &&other) noexcept | ||
requires(std::is_move_assignable_v<T> && | ||
(std::is_move_assignable_v<Ts> && ...)) = default; | ||
|
||
template <typename U, typename... Us> | ||
TRACCC_HOST_DEVICE constexpr tuple &operator=( | ||
tuple<U, Us...> &&other) requires(std::is_assignable_v<T &, U> && | ||
(std::is_assignable_v<Ts &, Us> && | ||
...)) { | ||
v = std::move(other.v); | ||
r = std::move(other.r); | ||
return *this; | ||
} | ||
|
||
T v; | ||
tuple<Ts...> r; | ||
}; | ||
} // namespace traccc |