diff --git a/example/doc_custom_deque.cpp b/example/doc_custom_deque.cpp index fbb6c9b..deaff02 100644 --- a/example/doc_custom_deque.cpp +++ b/example/doc_custom_deque.cpp @@ -20,6 +20,10 @@ int main () { using namespace boost::container; +//-------------------------------------------- +// 'stored_size' option +//-------------------------------------------- + //This option specifies that a deque that will use "unsigned char" as //the type to store capacity or size internally. typedef deque_options< stored_size >::type size_option_t; @@ -43,6 +47,10 @@ int main () assert(exception_thrown == true); +//-------------------------------------------- +// 'block_size' option +//-------------------------------------------- + //This option specifies the desired block size for deque typedef deque_options< block_size<128u> >::type block_128_option_t; @@ -50,6 +58,10 @@ int main () typedef deque block_128_deque_t; assert(block_128_deque_t::get_block_size() == 128u); +//-------------------------------------------- +// 'block_bytes' option +//-------------------------------------------- + //This option specifies the maximum block size for deque //in bytes typedef deque_options< block_bytes<1024u> >::type block_1024_bytes_option_t; diff --git a/example/doc_custom_devector.cpp b/example/doc_custom_devector.cpp index 31b7597..65a6c4d 100644 --- a/example/doc_custom_devector.cpp +++ b/example/doc_custom_devector.cpp @@ -20,9 +20,10 @@ int main () { using namespace boost::container; - //////////////////////////////////////////////// - // 'stored_size' option - //////////////////////////////////////////////// +//-------------------------------------------- +// 'stored_size' option +//-------------------------------------------- + //Specify that a devector will use "unsigned char" as the type to store size/capacity typedef devector_options< stored_size >::type size_option_t; @@ -43,9 +44,10 @@ int main () //=catch(...){ exception_thrown = true; } assert(exception_thrown == true); - //////////////////////////////////////////////// - // 'growth_factor' option - //////////////////////////////////////////////// +//-------------------------------------------- +// 'growth_factor' option +//-------------------------------------------- + //Specify that a devector will increase its capacity 50% when reallocating typedef devector_options< growth_factor >::type growth_50_option_t; @@ -58,9 +60,9 @@ int main () growth_50_dv.push_back(1); assert(growth_50_dv.capacity() == old_cap*3/2); - //////////////////////////////////////////////// - // 'relocate_on' option - //////////////////////////////////////////////// +//-------------------------------------------- +// 'relocate_on' option +//-------------------------------------------- //Specifies that a devector will not reallocate but relocate elements if the free space //at one end is exhausted and the total load factor is below the 66% threshold. diff --git a/example/doc_custom_small_vector.cpp b/example/doc_custom_small_vector.cpp index 60a9e4e..ed897c3 100644 --- a/example/doc_custom_small_vector.cpp +++ b/example/doc_custom_small_vector.cpp @@ -20,6 +20,10 @@ int main () { using namespace boost::container; +//-------------------------------------------- +// 'inplace_alignment' option +//-------------------------------------------- + //This option specifies the desired alignment for the internal value_type typedef small_vector_options< inplace_alignment<16u> >::type alignment_16_option_t; @@ -27,6 +31,9 @@ int main () small_vector sv; assert(((std::size_t)sv.data() % 16u) == 0); +//-------------------------------------------- +// 'growth_factor' option +//-------------------------------------------- //This option specifies that a vector will increase its capacity 50% //each time the previous capacity was exhausted. @@ -41,6 +48,10 @@ int main () growth_50_vector.push_back(1); assert(growth_50_vector.capacity() == old_cap*3/2); +//-------------------------------------------- +// 'stored_size' option +//-------------------------------------------- + //This option specifies that a vector that will use "unsigned char" as //the type to store capacity or size internally. typedef small_vector_options< stored_size >::type size_option_t; diff --git a/example/doc_custom_static_vector.cpp b/example/doc_custom_static_vector.cpp index 0317a8a..a63b8a3 100644 --- a/example/doc_custom_static_vector.cpp +++ b/example/doc_custom_static_vector.cpp @@ -20,6 +20,10 @@ int main () { using namespace boost::container; +//-------------------------------------------- +// 'inplace_alignment' option +//-------------------------------------------- + //This option specifies the desired alignment for value_type typedef static_vector_options< inplace_alignment<16u> >::type alignment_16_option_t; @@ -27,12 +31,20 @@ int main () static_vector sv; assert(((std::size_t)sv.data() % 16u) == 0); +//-------------------------------------------- +// 'throw_on_overflow' option +//-------------------------------------------- + //This static_vector won't throw on overflow, for maximum performance typedef static_vector_options< throw_on_overflow >::type no_throw_options_t; //Create static_vector with no throw on overflow static_vector sv2; +//-------------------------------------------- +// 'stored_size' option +//-------------------------------------------- + //This options specifies that internal `size()` can be represented by an unsigned char //instead of the default `std::size_t`. typedef static_vector_options< stored_size >::type stored_size_uchar_t; diff --git a/example/doc_custom_tree.cpp b/example/doc_custom_tree.cpp index 170d3b7..4959ec1 100644 --- a/example/doc_custom_tree.cpp +++ b/example/doc_custom_tree.cpp @@ -21,46 +21,49 @@ int main () using namespace boost::container; //First define several options - // + +//-------------------------------------------- +// 'tree_type' option +//-------------------------------------------- //This option specifies an AVL tree based associative container typedef tree_assoc_options< tree_type >::type AVLTree; + //This option specifies an Splay tree based associative container + typedef tree_assoc_options< tree_type >::type SplayTree; + + //Splay tree based multiset container + typedef multiset, new_allocator, SplayTree> SplayMultiset; + + //AVLTree based set container + typedef set, new_allocator, AVLTree> AvlSet; + + AvlSet avl_set; + avl_set.insert(0); + assert(avl_set.find(0) != avl_set.end()); + + SplayMultiset splay_mset; + splay_mset.insert(2); + splay_mset.insert(2); + assert(splay_mset.count(2) == 2); + +//-------------------------------------------- +// 'optimize_size' option +//-------------------------------------------- + //This option specifies an AVL tree based associative container //disabling node size optimization. typedef tree_assoc_options< tree_type , optimize_size >::type AVLTreeNoSizeOpt; - //This option specifies an Splay tree based associative container - typedef tree_assoc_options< tree_type >::type SplayTree; - - //Now define new tree-based associative containers - // - - //AVLTree based set container - typedef set, new_allocator, AVLTree> AvlSet; - //AVLTree based set container without size optimization typedef set, new_allocator, AVLTreeNoSizeOpt> AvlSetNoSizeOpt; - //Splay tree based multiset container - typedef multiset, new_allocator, SplayTree> SplayMultiset; - - //Use them - // - AvlSet avl_set; - avl_set.insert(0); - assert(avl_set.find(0) != avl_set.end()); - AvlSetNoSizeOpt avl_set_no_szopt; avl_set_no_szopt.insert(1); avl_set_no_szopt.insert(1); assert(avl_set_no_szopt.count(1) == 1); - SplayMultiset splay_mset; - splay_mset.insert(2); - splay_mset.insert(2); - assert(splay_mset.count(2) == 2); return 0; } //] diff --git a/example/doc_custom_vector.cpp b/example/doc_custom_vector.cpp index ef7371c..cb4e8a0 100644 --- a/example/doc_custom_vector.cpp +++ b/example/doc_custom_vector.cpp @@ -20,6 +20,10 @@ int main () { using namespace boost::container; +//-------------------------------------------- +// 'stored_size' option +//-------------------------------------------- + //This option specifies that a vector that will use "unsigned char" as //the type to store capacity or size internally. typedef vector_options< stored_size >::type size_option_t; @@ -43,6 +47,10 @@ int main () assert(exception_thrown == true); +//-------------------------------------------- +// 'growth_factor' option +//-------------------------------------------- + //This option specifies that a vector will increase its capacity 50% //each time the previous capacity was exhausted. typedef vector_options< growth_factor >::type growth_50_option_t;