I have this struct:
struct MyStruct
{
MyStruct(const Wrapper &wrapper, /*...*/) :
wrapper(std::cref(wrapper)), /*...*/ {}
std::reference_wrapper<Wrapper const> wrapper;
/*...*/
};
However, now I want to use a tbb::concurrent_bounded_queue<MyStruct>
, which is not possible since MyStruct
doesn't have a default constructor. But I don't know how to define it since wrapper
must be initialized somehow. Is there any solution for this (apart from using raw pointers)?
tbb
error (where FindAffineShapeArgs
is MyStruct
here):
/usr/include/tbb/concurrent_queue.h(453): error: no default constructor exists for class "FindAffineShapeArgs"
T value;
^
detected during:
instantiation of "void tbb::concurrent_bounded_queue<T, A>::clear() [with T=FindAffineShapeArgs, A=tbb::cache_aligned_allocator<FindAffineShapeArgs>]" at line 446
instantiation of "tbb::concurrent_bounded_queue<T, A>::~concurrent_bounded_queue() [with T=FindAffineShapeArgs, A=tbb::cache_aligned_allocator<FindAffineShapeArgs>]" at line 272 of "/home/luca/Dropbox/HKUST/CloudCache/cloudcache/CloudCache/Descriptors/hesaff/pyramid.cpp"