2
0
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:
Jakub Szuppe
2016-07-16 15:11:34 +02:00
parent 8ae5cc9117
commit fb641de7cc

View File

@@ -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)
{