Home » U++ Library support » U++ Core » AsyncWork<Vector<T>> fails due to lack of copy-constructor
AsyncWork<Vector<T>> fails due to lack of copy-constructor [message #52894] |
Mon, 06 January 2020 15:38 |
piotr5
Messages: 107 Registered: November 2005
|
Experienced Member |
|
|
I created AsyncWork<Vector<char>> and when I make use of the Get() member compiler complains Vector only has move-constructor.
is this a bug? CoWork.h reads:
template <class Ret>
class AsyncWork {
template <class Ret2>
struct Imp {
CoWork co;
Ret2 ret;
...
const Ret2& Get() { return ret; }
};
...
Ret Get() { ASSERT(imp); imp->co.Finish(); return imp->Get(); }
it's strange there is a 2nd template parameter for this class inside of AsyncWork.
sounds more like it was meant to be:
Ret ret;
...
Ret2 Get() { return ret; }
and then use "Imp<const Ret&> imp;" in case Ret has copy-constructor?
or maybe rewrite to use if constexpr?
is there a speed-gain from using the copy-constructor?
I doubt there is one for Vector as return-type...
or did I make a mistake and AsyncWork is not for this kind of usage?
should I rewrite my code to use Thread?
|
|
|
Goto Forum:
Current Time: Fri Apr 19 17:06:23 CEST 2024
Total time taken to generate the page: 1.10921 seconds
|