问题
I have a list of objects stored in a list that represent chunks of read-only memory for threads to use. each chunk object has an atomic that acts as a reference count, pretty simple.
I have a problem though, std::list<Type> apparently needs a copy constructor for Type?, and having an std::atomic as a member of Type deletes the default copy constructor of the chunk object's class. I'm pretty sure a list isn't allowed to copy or move it's elements around whatsoever in memory, so why would it require that constructor?
Anywho, the question, how might I have a list of objects containing std::atomic? The atomic cannot change address, I have no interest in copying or moving it, so it seems I need to use something other than std::list?
来源:https://stackoverflow.com/questions/53963721/creating-a-list-of-objects-containing-stdatomic