In C++, std::basic_iostream
's copy- and move-assignment operators are protected (for reasons I don't really understand). This seems to leave me without many ways of managing a collection of iostream
objects, short of manually allocating them on the heap, storing a list of pointers, and writing a destructor that cleans them up.
Am I missing some trick that would let me allocate them inside of, say, a std::vector
?
Of course I suppose I could inherit and just promote the protected operator to public, but that seems like a whole mess.
Bonus question: Why are these methods is the move-assignment operator protected in the first place?