]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/ptr_container/test/tut34.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / ptr_container / test / tut34.cpp
1 //
2 // Boost.Pointer Container
3 //
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)
8 //
9 // For more information, see http://www.boost.org/libs/ptr_container/
10 //
11
12 #include <boost/ptr_container/ptr_sequence_adapter.hpp>
13 #include <vector>
14 #include <boost/ptr_container/ptr_map_adapter.hpp>
15 #include <map>
16
17 template< class T >
18 struct my_ptr_vector :
19 public boost::ptr_sequence_adapter< std::vector<T*> >
20 {
21
22 };
23
24
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>
28 {
29 explicit my_map( const Pred& pred = Pred(),
30 const Allocator& alloc = Allocator() )
31 { }
32 };
33
34 #include <string>
35 struct Foo {};
36
37 typedef boost::ptr_map_adapter< my_map<std::string,Foo*> > foo_map;
38
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> >
41 {
42
43 };
44
45 typedef my_ptr_map<std::string,Foo> foo_map2;
46
47
48 int main()
49 {
50
51 my_ptr_vector<Foo> vec;
52 vec.push_back( new Foo );
53 foo_map m1;
54 foo_map2 m2;
55 std::string s("");
56 m1.insert( s, new Foo );
57 m2.insert( s, new Foo );
58
59
60 }
61