Is there a standard way to access the underlying container of stack
, queue
, priority_queue
?
I found a method called : _Get_container()
in VS2008
implementation of stack
and queue
, but no one for priority_queue
! I think it is not standard anyway.
Also, I know it is a silly question! where can I find official documentation of the standard library ?
Just for clarification, I wasn't trying to mess up with the underlying container. All what I was trying to do is this :
template <class Container>
std::ostream& printOneValueContainer(std::ostream& outputstream, Container& container)
{
Container::const_iterator beg = container.begin();
outputstream << "[";
while(beg != container.end())
{
outputstream << " " << *beg++;
}
outputstream << " ]";
return outputstream;
}
// stack, queue
template
< class Type
, template<class Type, class Container = std::deque<Type> > class Adapter
>
std::ostream& operator<<(std::ostream& outputstream, const Adapter<Type>& adapter)
{
return printOneValueContainer(outputstream, adapter._Get_container());
}
.
.
.
std::stack<int> iStack;
.
.
std::cout << iStack << std::endl;
I hope you see that _Get_container()
is not standard, and there is no one for priority_queue
in VS2008
implementation.