Skip to content

Commit

Permalink
Support conversion between different clad::array instantiations
Browse files Browse the repository at this point in the history
  • Loading branch information
PetroZarytskyi committed Nov 17, 2024
1 parent 0bf8e21 commit c8e867c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/clad/Differentiator/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ template <typename T> class array {

CUDA_HOST_DEVICE array(const array<T>& arr) : array(arr.m_arr, arr.m_size) {}

template <typename U>
CUDA_HOST_DEVICE array(const array<U>& arr)
: m_arr(new T[arr.size()]), m_size(arr.size()) {
(*this) = arr;
}

CUDA_HOST_DEVICE array(std::size_t size, const clad::array<T>& arr)
: m_arr(new T[size]), m_size(size) {
for (std::size_t i = 0; i < size; ++i)
Expand Down

0 comments on commit c8e867c

Please sign in to comment.