c++ - custom allocator using move for vector of thread -


I am currently learning about concurrency in C ++ and they have come using vector yarn, which I Believe that it will be possible in C ++ 0x. However, my current compiler does not appear in the implementation of carefully-aware containers and therefore errors have arisen because std :: thread :: thread (const std :: thread & amp;) is destroyed That is, I can only use the move maker / step assignment with std :: thread .

Am I thinking that by writing a custom allocation to this issue

  zero MyAllocator :: construct (Pointer P, reference val) / * using the driver Should there be non-contact reference for Val? * / {New ((* Zero *) p) T (STD :: move (val)); } {New (Zero *) P} (Val)  

} instead of

   

? Or some other changes on this topic (probably using MyAllocator :: Construction surcharge).

NB: This is primarily intended to work around for a short-term educational exercise and to work around to work well. Threads in containers In this context, only the MyAllocator < / Code> However, please point me to any library for which it can be implemented, so I can strike one around the source.

itemprop = "text">

If your compiler does not provide a step-awareness std :: vector Code> std :: vector & lt; Std :: thread & gt; / Code> is based on copying the whole C ++ 03 vector interface rather than just providing a custom allocation: push_back () elements in copies; resize () initiates the empty elements with a copy element passed as the second parameter (even if it is the default value of T ()) ); resize () , reserved () , enter () , erase () and push_back ()

std :: thread


Comments