Insert into an STL queue using std::copy

Unfortunately std::queue ‘adapts’ the function known as push_back to just push which means that the standard back_insert_iterator doesn’t work. Probably the simplest way (albeit conceptually ugly) is to adapt the container adapter with a short lived container adapter adapter[sic] (eugh!) that lives as long as the back insert iterator. template<class T> class QueueAdapter { public: … Read more