blob: 0eceba41fa0a3caf71452a89c24e0d157a812eab [file] [log] [blame]
Brian Silvermanfad8f552018-08-04 23:36:19 -07001//////////////////////////////////////////////////////////////////////////////
2//
3// (C) Copyright Ion Gaztanaga 2013-2013. Distributed under the Boost
4// Software License, Version 1.0. (See accompanying file
5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6//
7// See http://www.boost.org/libs/container for documentation.
8//
9//////////////////////////////////////////////////////////////////////////////
10#include <boost/container/detail/config_begin.hpp>
11#include <boost/container/detail/workaround.hpp>
12//[doc_extended_allocators
13#include <boost/container/vector.hpp>
14#include <boost/container/flat_set.hpp>
15#include <boost/container/list.hpp>
16#include <boost/container/set.hpp>
17
18//"allocator" is a general purpose allocator that can reallocate
19//memory, something useful for vector and flat associative containers
20#include <boost/container/allocator.hpp>
21
22//"adaptive_pool" is a node allocator, specially suited for
23//node-based containers
24#include <boost/container/adaptive_pool.hpp>
25
26int main ()
27{
28 using namespace boost::container;
29
30 //A vector that can reallocate memory to implement faster insertions
31 vector<int, allocator<int> > extended_alloc_vector;
32
33 //A flat set that can reallocate memory to implement faster insertions
34 flat_set<int, std::less<int>, allocator<int> > extended_alloc_flat_set;
35
36 //A list that can manages nodes to implement faster
37 //range insertions and deletions
38 list<int, adaptive_pool<int> > extended_alloc_list;
39
40 //A set that can recycle nodes to implement faster
41 //range insertions and deletions
42 set<int, std::less<int>, adaptive_pool<int> > extended_alloc_set;
43
44 //Now user them as always
45 extended_alloc_vector.push_back(0);
46 extended_alloc_flat_set.insert(0);
47 extended_alloc_list.push_back(0);
48 extended_alloc_set.insert(0);
49
50 //...
51 return 0;
52}
53//]
54#include <boost/container/detail/config_end.hpp>