• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //////////////////////////////////////////////////////////////////////////////
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 //[doc_custom_deque
11 #include <boost/container/deque.hpp>
12 #include <boost/static_assert.hpp>
13 
14 //Make sure assertions are active
15 #ifdef NDEBUG
16 #undef NDEBUG
17 #endif
18 #include <cassert>
19 
main()20 int main ()
21 {
22    using namespace boost::container;
23 
24    //This option specifies the desired block size for deque
25    typedef deque_options< block_size<128u> >::type block_128_option_t;
26 
27    //This deque will allocate blocks of 128 elements
28    typedef deque<int, void, block_128_option_t > block_128_deque_t;
29    assert(block_128_deque_t::get_block_size() == 128u);
30 
31    //This option specifies the maximum block size for deque
32    //in bytes
33    typedef deque_options< block_bytes<1024u> >::type block_1024_bytes_option_t;
34 
35    //This deque will allocate blocks of 1024 bytes
36    typedef deque<int, void, block_1024_bytes_option_t > block_1024_bytes_deque_t;
37    assert(block_1024_bytes_deque_t::get_block_size() == 1024u/sizeof(int));
38 
39    return 0;
40 }
41 //]
42