]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/ptr_container/test/tut34.cpp
2 // Boost.Pointer Container
4 // Copyright Thorsten Ottosen 2003-2005. Use, modification and
5 // distribution is subject to the Boost Software License, Version
6 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // For more information, see http://www.boost.org/libs/ptr_container/
12 #include <boost/ptr_container/ptr_sequence_adapter.hpp>
14 #include <boost/ptr_container/ptr_map_adapter.hpp>
18 struct my_ptr_vector
:
19 public boost::ptr_sequence_adapter
< std::vector
<T
*> >
25 template< class Key
, class T
, class Pred
= std::less
<Key
>,
26 class Allocator
= std::allocator
< std::pair
<const Key
, T
> > >
27 struct my_map
: public std::map
<Key
,T
,Pred
,Allocator
>
29 explicit my_map( const Pred
& pred
= Pred(),
30 const Allocator
& alloc
= Allocator() )
37 typedef boost::ptr_map_adapter
< my_map
<std::string
,Foo
*> > foo_map
;
39 template< class Key
, class T
, class Pred
= std::less
<Key
> >
40 struct my_ptr_map
: public boost::ptr_map_adapter
< std::map
<Key
,T
*,Pred
> >
45 typedef my_ptr_map
<std::string
,Foo
> foo_map2
;
51 my_ptr_vector
<Foo
> vec
;
52 vec
.push_back( new Foo
);
56 m1
.insert( s
, new Foo
);
57 m2
.insert( s
, new Foo
);