Recently I was trying to make an intrusive list (like boost's or elt's) work with std::queue
.
std:queue<T>
has two options for push
which end up calling though to push_back
on the underlying list impl:
void push( const value_type& value );
void push( value_type&& value );
Neither of these make much sense for intrusive lists of T
. We have to modify T
too insert it so the const
would be a lie and we definitely don't want to move it into list since the whole point of an intrusive list is that it doesn't own the elements. Reasonably then the intrusive lists I've seen only implement void push_back(value_type& value);
.
I realise std::queue
doesn't buy me anything I couldn't do with manual application of push_back
/pop_front
...but at this point I'm morbidly curious if it's possible. Is there some C++ magic I'm missing?