mirror of
https://github.com/boostorg/compute.git
synced 2026-01-26 18:32:48 +00:00
Add operator= for vectors with different allocator
Now code: `vector<T> a(context); vector<T, OtherAlloc> b(context); a = b;` works.
This commit is contained in:
@@ -252,6 +252,17 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class OtherAlloc>
|
||||
vector& operator=(const vector<T, OtherAlloc> &other)
|
||||
{
|
||||
command_queue queue = default_queue();
|
||||
resize(other.size(), queue);
|
||||
::boost::compute::copy(other.begin(), other.end(), begin(), queue);
|
||||
queue.finish();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class OtherAlloc>
|
||||
vector& operator=(const std::vector<T, OtherAlloc> &vector)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user