mirror of
https://github.com/boostorg/ptr_container.git
synced 2026-02-23 16:02:10 +00:00
*** empty log message ***
[SVN r27749]
This commit is contained in:
25
test/stack_example.cpp
Executable file
25
test/stack_example.cpp
Executable file
@@ -0,0 +1,25 @@
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <stack>
|
||||
|
||||
typedef std::stack< int*,boost::ptr_vector<int> > stack_type;
|
||||
|
||||
int main()
|
||||
{
|
||||
stack_type s;
|
||||
s.push( new int(1) );
|
||||
s.push( new int(2) );
|
||||
s.push( new int(3) );
|
||||
s.push( new int(4) );
|
||||
s.push( new int(5) );
|
||||
|
||||
//
|
||||
// Won't work since stack uses cont::value_type in the interface.
|
||||
// Hence will require special adapter...if only containers
|
||||
// would use reference as return types and value_type as
|
||||
// argument types
|
||||
//
|
||||
BOOST_ASSERT( s.top() == 5 );
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user