Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84958 - in sandbox/tree_node: boost boost/detail boost/detail/metafunction boost/tree_node boost/tree_node/algorithm boost/tree_node/balancer boost/tree_node/container boost/tree_node/intrinsic boost/tree_node/iterator boost/tree_node/key boost/tree_node/selector boost/tree_node/traits boost/typeof boost/typeof/boost boost/typeof/boost/tree_node boost/typeof/boost/tree_node/balancer boost/typeof/boost/tree_node/container boost/typeof/boost/tree_node/iterator boost/typeof/boost/tree_node/key boost/typeof/boost/tree_node/selector libs/tree_node/doc libs/tree_node/doc/html libs/tree_node/doc/html/tree_node libs/tree_node/doc/html/tree_node/concepts libs/tree_node/doc/html/tree_node/reference libs/tree_node/example libs/tree_node/test
From: sponage_at_[hidden]
Date: 2013-07-06 13:58:15


Author: expaler
Date: 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013)
New Revision: 84958
URL: http://svn.boost.org/trac/boost/changeset/84958

Log:
Updated Boost.TreeNode to 0.5

Added:
   sandbox/tree_node/boost/detail/
   sandbox/tree_node/boost/detail/base_pointee.hpp (contents, props changed)
   sandbox/tree_node/boost/detail/metafunction/
   sandbox/tree_node/boost/detail/metafunction/container_iterator.hpp (contents, props changed)
   sandbox/tree_node/boost/detail/metafunction/container_pointer.hpp (contents, props changed)
   sandbox/tree_node/boost/detail/metafunction/container_reverse_iterator.hpp (contents, props changed)
   sandbox/tree_node/boost/detail/metafunction/has_first_type.hpp (contents, props changed)
   sandbox/tree_node/boost/detail/metafunction/has_second_type.hpp (contents, props changed)
   sandbox/tree_node/boost/detail/metafunction/has_super_t.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/algorithm/
   sandbox/tree_node/boost/tree_node/algorithm/advance_binary.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/algorithm/binary_descendant.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/algorithm/binary_descendant_at_index.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/algorithm/binary_index_of.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/algorithm/binary_lower_bound.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/algorithm/binary_upper_bound.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/algorithm/cartesian_sort.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/associative_node.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/associative_node_fwd.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/balancer/
   sandbox/tree_node/boost/tree_node/balancer/adelson_velskii_landis.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/balancer/bayer_mccreight.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/balancer/null.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/balancer/red_black.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/base.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/binary_node.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/binary_node_fwd.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/container/binode.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/container/binode_associative.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/container/binode_associative_fwd.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/container/binode_fwd.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/intrinsic/
   sandbox/tree_node/boost/tree_node/intrinsic/at_key.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/intrinsic/get_keys.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/intrinsic/get_properties.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/intrinsic/has_key.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/intrinsic/value_at_key.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/iterator/
   sandbox/tree_node/boost/tree_node/iterator/breadth_first.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/iterator/breadth_first_descendant.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/iterator/depth_first.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/iterator/depth_first_descendant.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/iterator/dereference.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/iterator/in_order.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/iterator/post_order.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/iterator/post_order_descendant.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/iterator/pre_order.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/iterator/pre_order_descendant.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/key/
   sandbox/tree_node/boost/tree_node/key/accumulation.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/key/count.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/key/data.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/key/height.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/key/position.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/key/red_black_flag.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/nary_node.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/nary_node_fwd.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/preprocessor.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/selector/
   sandbox/tree_node/boost/tree_node/selector/compare.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/selector/compare_fwd.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/traits/
   sandbox/tree_node/boost/tree_node/traits/binary_node.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/traits/binary_node_fwd.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/traits/red_black_node.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/traits/red_black_node_fwd.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/traversal_state.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/with_accumulation.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/with_accumulation_fwd.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/with_count.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/with_count_fwd.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/with_height.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/with_height_fwd.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/with_position.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/with_position_fwd.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/with_red_black_flag.hpp (contents, props changed)
   sandbox/tree_node/boost/tree_node/with_red_black_flag_fwd.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/
   sandbox/tree_node/boost/typeof/boost/
   sandbox/tree_node/boost/typeof/boost/tree_node/
   sandbox/tree_node/boost/typeof/boost/tree_node/associative_node.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/balancer/
   sandbox/tree_node/boost/typeof/boost/tree_node/balancer/adelson_velskii_landis.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/balancer/null.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/balancer/red_black.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/binary_node.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/container/
   sandbox/tree_node/boost/typeof/boost/tree_node/container/binode.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/container/binode_associative.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/iterator/
   sandbox/tree_node/boost/typeof/boost/tree_node/iterator/breadth_first.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/iterator/breadth_first_descendant.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/iterator/depth_first.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/iterator/depth_first_descendant.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/iterator/in_order.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/iterator/post_order.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/iterator/post_order_descendant.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/iterator/pre_order.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/iterator/pre_order_descendant.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/key/
   sandbox/tree_node/boost/typeof/boost/tree_node/key/accumulation.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/key/count.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/key/data.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/key/height.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/key/position.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/key/red_black_flag.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/nary_node.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/selector/
   sandbox/tree_node/boost/typeof/boost/tree_node/selector/compare.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/traversal_state.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/with_accumulation.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/with_count.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/with_height.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/with_position.hpp (contents, props changed)
   sandbox/tree_node/boost/typeof/boost/tree_node/with_red_black_flag.hpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/
   sandbox/tree_node/libs/tree_node/doc/Jamroot (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/changelog.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_assoc_tree_node.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_base_tree_node.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_base_type_generator.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_binary_tree_node.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_copyable_tree_node.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_descendant_iterator.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_full_iterator.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_indexable_container.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_indexable_iterator.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_iterator.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_movable_tree_node.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_nary_tree_node.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_node_type_generator.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_non_assoc_tree_node.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_rvrsible_tree_node.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concept_tree_node.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/concepts.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/
   sandbox/tree_node/libs/tree_node/doc/html/index.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/changelog.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/associative_tree_node.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/base_tree_node.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/base_type_generator.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/binary_tree_node.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/copyable_tree_node.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/full_tree_node_iterator.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/indexable_container.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/indexable_iterator.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/movable_tree_node.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/nary_tree_node.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/node_type_generator.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/non_assoc_tree_node.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/reversible_tree_node.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/tree_node.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/tree_node_desc_iterator.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/concepts/tree_node_iterator.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/accumulation_key.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/advance_binary.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/assoc_cont_derived_body.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/assoc_node_base_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/associative_node.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/associative_node_base.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/associative_node_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/at_key.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/avl_balancer.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/binary_descendant.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/binary_descendant_at_index.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/binary_index_of.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/binary_lower_bound.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/binary_node.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/binary_node_base.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/binary_node_base_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/binary_node_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/binary_upper_bound.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/binode_assoc_container.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/binode_container.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/binode_map.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/binode_multimap.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/binode_multiset.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/binode_set.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/breadth_first_desc_iter.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/breadth_first_iterator.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/can_use_fusion.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/can_use_fusion_with_typeof.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/cartesian_sort.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/cartesian_sort_range.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/compare_selector.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/container_derived_body.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/copyable_and_movable.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/count_key.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/data_key.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/depth_first_desc_iter.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/depth_first_iterator.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/dereference_iterator.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/emplace_ctor_fwd_decl.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/emplace_ctor_inline_def.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/emplace_ctor_inline_hdr.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/emplace_ctor_w_alloc_f_dcl.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/emplace_ctor_w_alloc_i_def.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/emplace_ctor_w_alloc_i_hdr.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/get_keys.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/get_properties.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/has_key.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/height_key.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/in_order_iterator.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/nary_node.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/nary_node_base.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/nary_node_base_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/nary_node_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/null_balancer.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/position_key.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/post_order_desc_iter.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/post_order_iterator.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/pre_order_desc_iter.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/pre_order_iterator.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/red_black_balancer.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/red_black_flag_key.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/traversal_state.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/tree_node_base.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/value_at_key.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_accumulation.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_accumulation_base.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_accumulation_base_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_accumulation_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_count.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_count_base.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_count_base_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_count_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_height.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_height_base.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_height_base_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_height_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_position.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_position_base.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_position_base_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_position_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_rb_flag.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_rb_flag_base.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_rb_flag_base_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/html/tree_node/reference/with_rb_flag_gen.html (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_accumulation_key.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_advance_binary.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_assoc_cont_derived_body.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_assoc_node_base_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_associative_node.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_associative_node_base.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_associative_node_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_at_key.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_avl_balancer.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_bin_descendant_at_index.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_binary_descendant.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_binary_index_of.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_binary_lower_bound.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_binary_node.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_binary_node_base.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_binary_node_base_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_binary_node_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_binary_upper_bound.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_binode_assoc_container.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_binode_container.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_binode_map.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_binode_multimap.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_binode_multiset.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_binode_set.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_breadth_first_desc_iter.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_breadth_first_iterator.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_can_use_fusion.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_can_use_fusion_w_typeof.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_cartesian_sort.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_cartesian_sort_range.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_compare_selector.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_container_derived_body.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_copyable_and_movable.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_count_key.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_data_key.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_depth_first_desc_iter.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_depth_first_iterator.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_dereference_iterator.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_empl_ctor_w_allc_f_decl.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_empl_ctor_w_allc_il_def.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_empl_ctor_w_allc_il_hdr.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_emplace_ctor_fwd_decl.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_emplace_ctor_inline_def.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_emplace_ctor_inline_hdr.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_get_keys.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_get_properties.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_has_key.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_height_key.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_in_order_iterator.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_nary_node.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_nary_node_base.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_nary_node_base_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_nary_node_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_null_balancer.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_position_key.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_post_order_desc_iter.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_post_order_iterator.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_pre_order_desc_iter.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_pre_order_iterator.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_red_black_balancer.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_red_black_flag_key.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_traversal_state.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_tree_node_base.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_value_at_key.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_accum_base_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_accumulation.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_accumulation_base.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_accumulation_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_count.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_count_base.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_count_base_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_count_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_height.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_height_base.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_height_base_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_height_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_position.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_position_base.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_position_base_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_position_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_rb_flag.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_rb_flag_base.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_rb_flag_base_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/ref_with_rb_flag_gen.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/reference.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/doc/tree_node.qbk (contents, props changed)
   sandbox/tree_node/libs/tree_node/example/assoc_iterator_functions.hpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/example/associative_node.cpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/example/binary_node.cpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/example/iterator_functions.hpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/example/match_predicate.hpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/example/nary_node.cpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/example/output_functions.hpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/example/output_preamble.cpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/example/output_preamble.hpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/example/output_tabs.cpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/example/output_tabs.hpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/example/type_definitions.hpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/test/associative_node.cpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/test/avl_tree.hpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/test/binary_node.cpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/test/binode_container.cpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/test/binode_map.cpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/test/binode_set.cpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/test/cartesian_sort.cpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/test/container_functions.hpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/test/inverted_index.cpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/test/iterator_functions.hpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/test/nary_node.cpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/test/red_black_tree.hpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/test/sequence.hpp (contents, props changed)
   sandbox/tree_node/libs/tree_node/test/type_definitions.hpp (contents, props changed)

Added: sandbox/tree_node/boost/detail/base_pointee.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/detail/base_pointee.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,46 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DETAIL_BASE_POINTEE_HPP_INCLUDED
+#define BOOST_DETAIL_BASE_POINTEE_HPP_INCLUDED
+
+namespace boost { namespace detail {
+
+ template <typename Derived>
+ struct base_pointee
+ {
+ typedef Derived const* const_pointer;
+ typedef Derived* pointer;
+
+ const_pointer get_derived() const;
+
+ pointer get_derived();
+
+ protected:
+ ~base_pointee();
+ };
+
+ template <typename Derived>
+ inline typename base_pointee<Derived>::const_pointer
+ base_pointee<Derived>::get_derived() const
+ {
+ return static_cast<const_pointer>(this);
+ }
+
+ template <typename Derived>
+ inline typename base_pointee<Derived>::pointer
+ base_pointee<Derived>::get_derived()
+ {
+ return static_cast<pointer>(this);
+ }
+
+ template <typename Derived>
+ base_pointee<Derived>::~base_pointee()
+ {
+ }
+}} // namespace boost::detail
+
+#endif // BOOST_DETAIL_BASE_POINTEE_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/detail/metafunction/container_iterator.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/detail/metafunction/container_iterator.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,35 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DETAIL_METAFUNCTION_CONTAINER_ITERATOR_HPP_INCLUDED
+#define BOOST_DETAIL_METAFUNCTION_CONTAINER_ITERATOR_HPP_INCLUDED
+
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+
+namespace boost { namespace detail { namespace metafunction {
+
+ template <typename T>
+ struct container_iterator
+ {
+ private:
+ typedef typename ::std::tr1::remove_const<T>::type
+ C;
+
+ public:
+ typedef typename ::boost::mpl::if_<
+ ::std::tr1::is_const<T>
+ , typename C::const_iterator
+ , typename C::iterator
+ >::type
+ type;
+
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,container_iterator,(T))
+ };
+}}} // namespace boost::detail::metafunction
+
+#endif // BOOST_DETAIL_METAFUNCTION_CONTAINER_ITERATOR_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/detail/metafunction/container_pointer.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/detail/metafunction/container_pointer.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,35 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DETAIL_METAFUNCTION_CONTAINER_POINTER_HPP_INCLUDED
+#define BOOST_DETAIL_METAFUNCTION_CONTAINER_POINTER_HPP_INCLUDED
+
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+
+namespace boost { namespace detail { namespace metafunction {
+
+ template <typename T>
+ struct container_pointer
+ {
+ private:
+ typedef typename ::std::tr1::remove_const<T>::type
+ C;
+
+ public:
+ typedef typename ::boost::mpl::if_<
+ ::std::tr1::is_const<T>
+ , typename C::const_pointer
+ , typename C::pointer
+ >::type
+ type;
+
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,container_pointer,(T))
+ };
+}}} // namespace boost::detail::metafunction
+
+#endif // BOOST_DETAIL_METAFUNCTION_CONTAINER_POINTER_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/detail/metafunction/container_reverse_iterator.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/detail/metafunction/container_reverse_iterator.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,73 @@
+// Copyright (C) 2012-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DETAIL_METAFUNCTION_CONTAINER_REVERSE_ITERATOR_HPP_INCLUDED
+#define BOOST_DETAIL_METAFUNCTION_CONTAINER_REVERSE_ITERATOR_HPP_INCLUDED
+
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/detail/metafunction/has_reverse_iterator.hpp>
+#include <boost/detail/metafunction/is_bidirectional_iterator.hpp>
+
+namespace boost { namespace detail { namespace metafunction {
+
+ template <typename C>
+ struct container_reverse_iterator_check_1
+ : ::boost::mpl::if_<
+ ::std::tr1::is_void<typename C::reverse_iterator>
+ , ::boost::mpl::false_
+ , ::boost::mpl::true_
+ >::type
+ {
+ };
+
+ template <typename C>
+ struct container_reverse_iterator_check_2
+ : is_bidirectional_iterator<typename C::reverse_iterator>
+ {
+ };
+
+ template <typename C, typename IsConst>
+ struct container_reverse_iterator_impl
+ : ::boost::mpl::if_<
+ IsConst
+ , typename C::const_reverse_iterator
+ , typename C::reverse_iterator
+ >
+ {
+ };
+
+ template <typename T>
+ struct container_reverse_iterator
+ {
+ private:
+ typedef typename ::std::tr1::remove_const<T>::type
+ C;
+
+ public:
+ typedef typename ::boost::mpl::eval_if<
+ typename ::boost::mpl::eval_if<
+ typename has_reverse_iterator<C>::type
+ , ::boost::mpl::eval_if<
+ container_reverse_iterator_check_1<C>
+ , container_reverse_iterator_check_2<C>
+ , ::boost::mpl::false_
+ >
+ , ::boost::mpl::false_
+ >::type
+ , container_reverse_iterator_impl<C,::std::tr1::is_const<T> >
+ , ::boost::mpl::identity<void>
+ >::type
+ type;
+
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,container_reverse_iterator,(T))
+ };
+}}} // namespace boost::detail::metafunction
+
+#endif // BOOST_DETAIL_METAFUNCTION_CONTAINER_REVERSE_ITERATOR_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/detail/metafunction/has_first_type.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/detail/metafunction/has_first_type.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,19 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DETAIL_METAFUNCTION_HAS_FIRST_TYPE_HPP_INCLUDED
+#define BOOST_DETAIL_METAFUNCTION_HAS_FIRST_TYPE_HPP_INCLUDED
+
+#include <boost/mpl/has_xxx.hpp>
+
+namespace boost { namespace detail { namespace metafunction {
+
+ // The has_first_type metafunction will determine whether or not
+ // the specified type has a nested 'first_type' type definition.
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(first_type)
+}}} // namespace boost::detail::metafunction
+
+#endif // BOOST_DETAIL_METAFUNCTION_HAS_FIRST_TYPE_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/detail/metafunction/has_second_type.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/detail/metafunction/has_second_type.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,19 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DETAIL_METAFUNCTION_HAS_SECOND_TYPE_HPP_INCLUDED
+#define BOOST_DETAIL_METAFUNCTION_HAS_SECOND_TYPE_HPP_INCLUDED
+
+#include <boost/mpl/has_xxx.hpp>
+
+namespace boost { namespace detail { namespace metafunction {
+
+ // The has_second_argument_type metafunction will determine whether or not
+ // the specified type has a nested 'second_type' type definition.
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(second_type)
+}}} // namespace boost::detail::metafunction
+
+#endif // BOOST_DETAIL_METAFUNCTION_HAS_SECOND_TYPE_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/detail/metafunction/has_super_t.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/detail/metafunction/has_super_t.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,19 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DETAIL_METAFUNCTION_HAS_SUPER_T_HPP_INCLUDED
+#define BOOST_DETAIL_METAFUNCTION_HAS_SUPER_T_HPP_INCLUDED
+
+#include <boost/mpl/has_xxx.hpp>
+
+namespace boost { namespace detail { namespace metafunction {
+
+ // The has_super_t metafunction will determine whether or not
+ // the specified type has a nested 'super_t' type definition.
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(super_t)
+}}} // namespace boost::detail::metafunction
+
+#endif // BOOST_DETAIL_METAFUNCTION_HAS_SUPER_T_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,61 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_HPP_INCLUDED
+#define BOOST_TREE_NODE_HPP_INCLUDED
+
+#include <boost/typeof/boost/tree_node/key/data.hpp>
+#include <boost/typeof/boost/tree_node/key/count.hpp>
+#include <boost/typeof/boost/tree_node/key/height.hpp>
+#include <boost/typeof/boost/tree_node/key/position.hpp>
+#include <boost/typeof/boost/tree_node/key/red_black_flag.hpp>
+#include <boost/tree_node/intrinsic/has_key.hpp>
+#include <boost/tree_node/intrinsic/get_keys.hpp>
+#include <boost/tree_node/intrinsic/at_key.hpp>
+#include <boost/tree_node/intrinsic/value_at_key.hpp>
+#include <boost/tree_node/algorithm/advance_binary.hpp>
+#include <boost/tree_node/algorithm/binary_index_of.hpp>
+#include <boost/tree_node/algorithm/binary_descendant.hpp>
+#include <boost/tree_node/algorithm/binary_descendant_at_index.hpp>
+#include <boost/tree_node/algorithm/binary_lower_bound.hpp>
+#include <boost/tree_node/algorithm/binary_upper_bound.hpp>
+#include <boost/tree_node/algorithm/cartesian_sort.hpp>
+#include <boost/typeof/boost/tree_node/selector/compare.hpp>
+#include <boost/typeof/boost/tree_node/traversal_state.hpp>
+#include <boost/tree_node/iterator/dereference.hpp>
+#include <boost/typeof/boost/tree_node/iterator/breadth_first.hpp>
+#include <boost/typeof/boost/tree_node/iterator/breadth_first_descendant.hpp>
+#include <boost/typeof/boost/tree_node/iterator/pre_order.hpp>
+#include <boost/typeof/boost/tree_node/iterator/pre_order_descendant.hpp>
+#include <boost/typeof/boost/tree_node/iterator/post_order.hpp>
+#include <boost/typeof/boost/tree_node/iterator/post_order_descendant.hpp>
+#include <boost/typeof/boost/tree_node/iterator/in_order.hpp>
+#include <boost/typeof/boost/tree_node/iterator/depth_first.hpp>
+#include <boost/typeof/boost/tree_node/iterator/depth_first_descendant.hpp>
+#include <boost/tree_node/base.hpp>
+#include <boost/tree_node/preprocessor.hpp>
+#include <boost/tree_node/traits/binary_node.hpp>
+#include <boost/typeof/boost/tree_node/binary_node.hpp>
+#include <boost/typeof/boost/tree_node/nary_node.hpp>
+#include <boost/typeof/boost/tree_node/associative_node.hpp>
+#include <boost/typeof/boost/tree_node/with_count.hpp>
+#include <boost/typeof/boost/tree_node/with_height.hpp>
+#include <boost/typeof/boost/tree_node/with_position.hpp>
+#include <boost/tree_node/traits/red_black_node.hpp>
+#include <boost/typeof/boost/tree_node/with_red_black_flag.hpp>
+#include <boost/typeof/boost/tree_node/balancer/null.hpp>
+#include <boost/typeof/boost/tree_node/balancer/red_black.hpp>
+#include <boost/typeof/boost/tree_node/balancer/adelson_velskii_landis.hpp>
+#include <boost/typeof/boost/tree_node/container/binode.hpp>
+#include <boost/typeof/boost/tree_node/container/binode_associative.hpp>
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+#include <boost/typeof/boost/tree_node/key/accumulation.hpp>
+#include <boost/tree_node/intrinsic/get_properties.hpp>
+#include <boost/typeof/boost/tree_node/with_accumulation.hpp>
+#endif
+
+#endif // BOOST_TREE_NODE_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/algorithm/advance_binary.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/algorithm/advance_binary.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,242 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ALGORITHM_ADVANCE_BINARY_HPP
+#define BOOST_TREE_NODE_ALGORITHM_ADVANCE_BINARY_HPP
+
+//[reference__tree_node__advance_binary
+namespace boost { namespace tree_node {
+
+ template <typename NodePointer, typename Difference>
+ NodePointer
+ advance_binary(
+ NodePointer node_ptr
+ , Difference difference
+ , NodePointer const& root_ptr
+ );
+
+ template <typename NodePointer, typename Difference>
+ NodePointer advance_binary(NodePointer node_ptr, Difference difference);
+}} // namespace boost::tree_node
+//]
+
+#include <boost/config.hpp>
+
+#if !defined BOOST_NO_CXX11_NULLPTR
+#include <cstddef>
+#endif
+
+#include <boost/utility/value_init.hpp>
+#include <boost/tree_node/key/count.hpp>
+#include <boost/assert.hpp>
+
+namespace boost { namespace tree_node {
+
+ template <typename NodePointer, typename Difference>
+ NodePointer
+ advance_binary(
+ NodePointer node_ptr
+ , Difference difference
+ , NodePointer const& root_ptr
+ )
+ {
+ static Difference const zero_difference = ::boost::initialized_value;
+
+#if defined BOOST_NO_CXX11_NULLPTR
+ for (
+ NodePointer child_ptr = ::boost::initialized_value;
+ difference;
+ child_ptr = ::boost::initialized_value
+ )
+#else
+ for (NodePointer child_ptr = nullptr; difference; child_ptr = nullptr)
+#endif
+ {
+ if (difference < zero_difference)
+ {
+ if ((child_ptr = node_ptr->get_left_child_ptr()))
+ {
+ if (-(++difference) < get(*child_ptr, count_key()))
+ {
+ node_ptr = child_ptr;
+
+ if ((child_ptr = node_ptr->get_right_child_ptr()))
+ {
+ difference += get(*child_ptr, count_key());
+ }
+
+ continue;
+ }
+
+ if (node_ptr == root_ptr)
+ {
+ BOOST_ASSERT_MSG(
+ -difference == get(*child_ptr, count_key())
+ , "Result out of bounds."
+ );
+#if defined BOOST_NO_CXX11_NULLPTR
+ node_ptr = ::boost::initialized_value;
+#else
+ node_ptr = nullptr;
+#endif
+ break;
+ }
+
+ child_ptr = node_ptr;
+
+ if (!(node_ptr = node_ptr->get_parent_ptr()))
+ {
+ BOOST_ASSERT_MSG(
+ -difference == get(*child_ptr, count_key())
+ , "Result out of bounds."
+ );
+ break;
+ }
+
+ --difference;
+ }
+ else // if (!node_ptr->get_left_child_ptr())
+ {
+ if (node_ptr == root_ptr)
+ {
+ BOOST_ASSERT_MSG(
+ !++difference
+ , "Result out of bounds."
+ );
+#if defined BOOST_NO_CXX11_NULLPTR
+ node_ptr = ::boost::initialized_value;
+#else
+ node_ptr = nullptr;
+#endif
+ break;
+ }
+
+ child_ptr = node_ptr;
+
+ if (!(node_ptr = node_ptr->get_parent_ptr()))
+ {
+ BOOST_ASSERT_MSG(
+ !++difference
+ , "Result out of bounds."
+ );
+ break;
+ }
+ }
+ }
+ else // if (zero_difference < difference)
+ {
+ if ((child_ptr = node_ptr->get_right_child_ptr()))
+ {
+ if (--difference < get(*child_ptr, count_key()))
+ {
+ node_ptr = child_ptr;
+
+ if ((child_ptr = node_ptr->get_left_child_ptr()))
+ {
+ difference -= get(*child_ptr, count_key());
+ }
+
+ continue;
+ }
+
+ if (node_ptr == root_ptr)
+ {
+ BOOST_ASSERT_MSG(
+ difference == get(*child_ptr, count_key())
+ , "Result out of bounds."
+ );
+#if defined BOOST_NO_CXX11_NULLPTR
+ node_ptr = ::boost::initialized_value;
+#else
+ node_ptr = nullptr;
+#endif
+ break;
+ }
+
+ child_ptr = node_ptr;
+
+ if (!(node_ptr = node_ptr->get_parent_ptr()))
+ {
+ BOOST_ASSERT_MSG(
+ difference == get(*child_ptr, count_key())
+ , "Result out of bounds."
+ );
+ break;
+ }
+
+ ++difference;
+ }
+ else // if (!node_ptr->get_right_child_ptr())
+ {
+ if (node_ptr == root_ptr)
+ {
+ BOOST_ASSERT_MSG(
+ !--difference
+ , "Result out of bounds."
+ );
+#if defined BOOST_NO_CXX11_NULLPTR
+ node_ptr = ::boost::initialized_value;
+#else
+ node_ptr = nullptr;
+#endif
+ break;
+ }
+
+ child_ptr = node_ptr;
+
+ if (!(node_ptr = node_ptr->get_parent_ptr()))
+ {
+ BOOST_ASSERT_MSG(
+ !--difference
+ , "Result out of bounds."
+ );
+ break;
+ }
+ }
+ }
+
+ if (child_ptr == node_ptr->get_left_child_ptr())
+ {
+ --difference;
+
+ if (child_ptr->get_right_child_ptr())
+ {
+ difference -= get(
+ *child_ptr->get_right_child_ptr()
+ , count_key()
+ );
+ }
+ }
+ else // if (child_ptr == node_ptr->get_right_child_ptr())
+ {
+ ++difference;
+
+ if (child_ptr->get_left_child_ptr())
+ {
+ difference += get(
+ *child_ptr->get_left_child_ptr()
+ , count_key()
+ );
+ }
+ }
+ }
+
+ return node_ptr;
+ }
+
+ template <typename NodePointer, typename Difference>
+ inline NodePointer
+ advance_binary(NodePointer node_ptr, Difference difference)
+ {
+#if defined BOOST_NO_CXX11_NULLPTR
+ return advance_binary(node_ptr, difference, 0);
+#else
+ return advance_binary(node_ptr, difference, nullptr);
+#endif
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ALGORITHM_ADVANCE_BINARY_HPP
+

Added: sandbox/tree_node/boost/tree_node/algorithm/binary_descendant.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/algorithm/binary_descendant.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,53 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ALGORITHM_BINARY_DESCENDANT_HPP
+#define BOOST_TREE_NODE_ALGORITHM_BINARY_DESCENDANT_HPP
+
+//[reference__tree_node__binary_descendant
+namespace boost { namespace tree_node {
+
+ template <typename NodePointer, typename Value, typename Compare>
+ NodePointer
+ binary_descendant(
+ NodePointer node_ptr
+ , Value const& value
+ , Compare const& compare
+ );
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename NodePointer, typename Value, typename Compare>
+ NodePointer
+ binary_descendant(
+ NodePointer node_ptr
+ , Value const& value
+ , Compare const& compare
+ )
+ {
+ while (node_ptr)
+ {
+ if (compare(value, *node_ptr))
+ {
+ node_ptr = node_ptr->get_left_child_ptr();
+ }
+ else if (compare(*node_ptr, value))
+ {
+ node_ptr = node_ptr->get_right_child_ptr();
+ }
+ else
+ {
+ return node_ptr;
+ }
+ }
+
+ return node_ptr;
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ALGORITHM_BINARY_DESCENDANT_HPP
+

Added: sandbox/tree_node/boost/tree_node/algorithm/binary_descendant_at_index.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/algorithm/binary_descendant_at_index.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,76 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ALGORITHM_BINARY_DESCENDANT_AT_INDEX_HPP
+#define BOOST_TREE_NODE_ALGORITHM_BINARY_DESCENDANT_AT_INDEX_HPP
+
+//[reference__tree_node__binary_descendant_at_index
+namespace boost { namespace tree_node {
+
+ template <typename NodePointer, typename Index>
+ NodePointer binary_descendant_at_index(NodePointer node_ptr, Index index);
+}} // namespace boost::tree_node
+//]
+
+#include <boost/tree_node/key/count.hpp>
+#include <boost/assert.hpp>
+
+namespace boost { namespace tree_node {
+
+ template <typename NodePointer, typename Index>
+ NodePointer binary_descendant_at_index(NodePointer node_ptr, Index index)
+ {
+ for (NodePointer child_ptr;;)
+ {
+ if ((child_ptr = node_ptr->get_left_child_ptr()))
+ {
+ Index const count = get(*child_ptr, count_key());
+
+ if (index < count)
+ {
+ node_ptr = child_ptr;
+ }
+ else if (count < index)
+ {
+ BOOST_ASSERT_MSG(
+ node_ptr->get_right_child_ptr()
+ , "Check modifier methods or with_count adaptor."
+ );
+ index -= count + 1;
+ node_ptr = node_ptr->get_right_child_ptr();
+ }
+ else
+ {
+ break;
+ }
+ }
+ else if ((child_ptr = node_ptr->get_right_child_ptr()))
+ {
+ if (index)
+ {
+ --index;
+ node_ptr = child_ptr;
+ }
+ else
+ {
+ break;
+ }
+ }
+ else
+ {
+ BOOST_ASSERT_MSG(
+ !index
+ , "Check modifier methods or with_count adaptor."
+ );
+ break;
+ }
+ }
+
+ return node_ptr;
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ALGORITHM_BINARY_DESCENDANT_AT_INDEX_HPP
+

Added: sandbox/tree_node/boost/tree_node/algorithm/binary_index_of.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/algorithm/binary_index_of.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,103 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ALGORITHM_BINARY_INDEX_OF_HPP
+#define BOOST_TREE_NODE_ALGORITHM_BINARY_INDEX_OF_HPP
+
+//[reference__tree_node__binary_index_of
+namespace boost { namespace tree_node {
+
+ template <typename NodePointer, typename Value>
+ Value
+ binary_index_of(
+ NodePointer node_ptr
+ , Value offset
+ , NodePointer const& root_ptr
+ );
+
+ template <typename NodePointer, typename Value>
+ Value binary_index_of(NodePointer node_ptr, Value offset);
+}} // namespace boost::tree_node
+//]
+
+#include <boost/config.hpp>
+
+#if !defined BOOST_NO_CXX11_NULLPTR
+#include <cstddef>
+#endif
+
+#include <boost/tree_node/key/count.hpp>
+
+namespace boost { namespace tree_node {
+
+ template <typename NodePointer, typename Value>
+ Value
+ binary_index_of(
+ NodePointer node_ptr
+ , Value offset
+ , NodePointer const& root_ptr
+ )
+ {
+ NodePointer child_ptr = node_ptr->get_left_child_ptr();
+
+ if (child_ptr)
+ {
+ offset += get(*child_ptr, count_key());
+ }
+
+ if (root_ptr)
+ {
+ while (node_ptr != root_ptr)
+ {
+ child_ptr = node_ptr;
+ node_ptr = node_ptr->get_parent_ptr();
+
+ if (child_ptr == node_ptr->get_right_child_ptr())
+ {
+ ++offset;
+
+ if ((child_ptr = node_ptr->get_left_child_ptr()))
+ {
+ offset += get(*child_ptr, count_key());
+ }
+ }
+ }
+ }
+ else
+ {
+ for (
+ child_ptr = node_ptr;
+ (node_ptr = node_ptr->get_parent_ptr());
+ child_ptr = node_ptr
+ )
+ {
+ if (child_ptr == node_ptr->get_right_child_ptr())
+ {
+ ++offset;
+
+ if ((child_ptr = node_ptr->get_left_child_ptr()))
+ {
+ offset += get(*child_ptr, count_key());
+ }
+ }
+ }
+ }
+
+ return offset;
+ }
+
+ template <typename NodePointer, typename Value>
+ inline Value binary_index_of(NodePointer node_ptr, Value offset)
+ {
+#if defined BOOST_NO_CXX11_NULLPTR
+ return binary_index_of(node_ptr, offset, 0);
+#else
+ return binary_index_of(node_ptr, offset, nullptr);
+#endif
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ALGORITHM_BINARY_INDEX_OF_HPP
+

Added: sandbox/tree_node/boost/tree_node/algorithm/binary_lower_bound.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/algorithm/binary_lower_bound.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,54 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ALGORITHM_BINARY_LOWER_BOUND_HPP
+#define BOOST_TREE_NODE_ALGORITHM_BINARY_LOWER_BOUND_HPP
+
+#include <boost/utility/value_init.hpp>
+
+//[reference__tree_node__binary_lower_bound
+namespace boost { namespace tree_node {
+
+ template <typename NodePointer, typename Value, typename Compare>
+ NodePointer
+ binary_lower_bound(
+ NodePointer node_ptr
+ , Value const& value
+ , Compare const& compare
+ );
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename NodePointer, typename Value, typename Compare>
+ NodePointer
+ binary_lower_bound(
+ NodePointer node_ptr
+ , Value const& value
+ , Compare const& compare
+ )
+ {
+ NodePointer result = ::boost::initialized_value;
+
+ while (node_ptr)
+ {
+ if (compare(*node_ptr, value))
+ {
+ node_ptr = node_ptr->get_right_child_ptr();
+ }
+ else
+ {
+ result = node_ptr;
+ node_ptr = node_ptr->get_left_child_ptr();
+ }
+ }
+
+ return result;
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ALGORITHM_BINARY_LOWER_BOUND_HPP
+

Added: sandbox/tree_node/boost/tree_node/algorithm/binary_upper_bound.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/algorithm/binary_upper_bound.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,54 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ALGORITHM_BINARY_UPPER_BOUND_HPP
+#define BOOST_TREE_NODE_ALGORITHM_BINARY_UPPER_BOUND_HPP
+
+#include <boost/utility/value_init.hpp>
+
+//[reference__tree_node__binary_upper_bound
+namespace boost { namespace tree_node {
+
+ template <typename NodePointer, typename Value, typename Compare>
+ NodePointer
+ binary_upper_bound(
+ NodePointer node_ptr
+ , Value const& value
+ , Compare const& compare
+ );
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename NodePointer, typename Value, typename Compare>
+ NodePointer
+ binary_upper_bound(
+ NodePointer node_ptr
+ , Value const& value
+ , Compare const& compare
+ )
+ {
+ NodePointer result = ::boost::initialized_value;
+
+ while (node_ptr)
+ {
+ if (compare(value, *node_ptr))
+ {
+ node_ptr = node_ptr->get_left_child_ptr();
+ }
+ else
+ {
+ result = node_ptr;
+ node_ptr = node_ptr->get_right_child_ptr();
+ }
+ }
+
+ return result;
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ALGORITHM_BINARY_UPPER_BOUND_HPP
+

Added: sandbox/tree_node/boost/tree_node/algorithm/cartesian_sort.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/algorithm/cartesian_sort.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,239 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ALGORITHM_CARTESIAN_SORT_HPP
+#define BOOST_TREE_NODE_ALGORITHM_CARTESIAN_SORT_HPP
+
+#include <iterator>
+#include <functional>
+#include <algorithm>
+#include <boost/iterator/iterator_traits.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/range.hpp>
+#include <boost/bind.hpp>
+#include <boost/utility/equivalence_function.hpp>
+#include <boost/container_gen/selectors.hpp>
+#include <boost/tree_node/binary_node.hpp>
+#include <boost/tree_node/key/data.hpp>
+#include <boost/tree_node/intrinsic/at_key.hpp>
+#include <boost/tree_node/iterator/in_order.hpp>
+#include <boost/tree_node/selector/compare.hpp>
+#include <boost/assert.hpp>
+
+#if defined BOOST_TREE_NODE_ALGORITHM_CARTESIAN_SORT_USE_BREADTH_FIRST
+#include <boost/tree_node/iterator/breadth_first.hpp>
+#else
+#include <boost/tree_node/iterator/breadth_first_descendant.hpp>
+#endif
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <boost/container/allocator_traits.hpp>
+#endif
+
+//[reference__cartesian_sort
+namespace boost { namespace tree_node {
+
+ template <typename Iterator, typename Compare>
+ void
+ cartesian_sort(
+ Iterator itr_begin
+ , Iterator itr_end
+ , Compare compare
+ );
+
+ template <typename Iterator>
+ void cartesian_sort(Iterator itr_begin, Iterator itr_end);
+}} // namespace boost::tree_node
+//]
+
+//[reference__cartesian_sort_range
+namespace boost { namespace tree_node {
+
+ template <typename Range, typename Compare>
+ Range& cartesian_sort_range(Range& r, Compare compare);
+
+ template <typename Range>
+ Range& cartesian_sort_range(Range& r);
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ //[impl__cartesian_sort__build_tree
+ template <typename Iterator, typename Compare>
+ void
+ cartesian_sort(
+ Iterator itr_begin
+ , Iterator itr_end
+ , Compare compare
+ )
+ {
+ if (itr_begin == itr_end) return;
+
+ typedef typename ::boost::iterator_value<Iterator>::type Value;
+ typedef ::boost::tree_node::binary_node<Value> Node;
+ typedef typename Node::traits::allocator Alloc;
+
+ Alloc allocator;
+//<-
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ typename Node::pointer root_ptr = allocator.allocate(1);
+
+ allocator.construct(root_ptr, *itr_begin);
+#else
+//->
+ typename Node::pointer root_ptr = ::boost::container::allocator_traits<
+ Alloc
+ >::allocate(allocator, 1);
+
+ ::boost::container::allocator_traits<
+ Alloc
+ >::construct(allocator, root_ptr, *itr_begin);
+//<-
+#endif
+//->
+
+ typename Node::pointer right_ptr = root_ptr;
+ typename Node::pointer ancestor_ptr;
+
+ for (Iterator itr = itr_begin; ++itr != itr_end;)
+ {
+ if (compare(*itr, get(*root_ptr, data_key())))
+ {
+ right_ptr = root_ptr = root_ptr->emplace_parent_of_left(*itr);
+ }
+ else if (!compare(*itr, get(*right_ptr, data_key())))
+ {
+ right_ptr = &*right_ptr->emplace_right(*itr);
+ }
+ else
+ {
+ for (
+ ancestor_ptr = right_ptr;
+ ancestor_ptr->get_parent_ptr() && compare(
+ *itr
+ , get(*ancestor_ptr->get_parent_ptr(), data_key())
+ );
+ ancestor_ptr = ancestor_ptr->get_parent_ptr()
+ )
+ {
+ }
+
+ BOOST_ASSERT(!!ancestor_ptr->get_parent_ptr());
+ right_ptr = ancestor_ptr->emplace_parent_of_left(*itr);
+ }
+ }
+ //]
+
+ //[impl__cartesian_sort__check_in_order_symmetry_with_input_range
+ BOOST_ASSERT(
+ ::std::equal(
+ itr_begin
+ , itr_end
+ , ::boost::make_transform_iterator(
+ make_in_order_iterator(*root_ptr)
+ , at_key<data_key>()
+ )
+ , ::boost::make_equivalence_function(compare)
+ )
+ );
+ //]
+
+#if defined BOOST_TREE_NODE_ALGORITHM_CARTESIAN_SORT_USE_BREADTH_FIRST
+ //[impl__cartesian_sort__breadth_first_iterate_with_priority
+ for (
+ breadth_first_iterator<
+ Node const
+ , ::boost::std_heap_selector< ::boost::tree_node::compareS>
+ > itr(
+ *root_ptr
+ , ::boost::bind(compare, ::boost::arg<2>(), ::boost::arg<1>())
+ );
+ itr;
+ ++itr
+ )
+ {
+ BOOST_ASSERT(itr_begin != itr_end);
+ *itr_begin = get(*itr, data_key());
+ ++itr_begin;
+ }
+ //]
+#else // !defined BOOST_TREE_NODE_ALGORITHM_CARTESIAN_SORT_USE_BREADTH_FIRST
+ //[impl__cartesian_sort__breadth_first_descendant_iterate_with_priority
+ *itr_begin = get(*root_ptr, data_key());
+ ++itr_begin;
+
+ for (
+ breadth_first_descendant_iterator<
+ Node const
+ , ::boost::std_heap_selector< ::boost::tree_node::compareS>
+ > itr(
+ *root_ptr
+ , ::boost::bind(compare, ::boost::arg<2>(), ::boost::arg<1>())
+ );
+ itr;
+ ++itr
+ )
+ {
+ BOOST_ASSERT(itr_begin != itr_end);
+ *itr_begin = get(*itr, data_key());
+ ++itr_begin;
+ }
+ //]
+#endif // BOOST_TREE_NODE_ALGORITHM_CARTESIAN_SORT_USE_BREADTH_FIRST
+
+ //[impl__cartesian_sort__cleanup
+ BOOST_ASSERT(itr_begin == itr_end);
+//<-
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ allocator.destroy(root_ptr);
+ allocator.deallocate(root_ptr, 1);
+#else
+//->
+ ::boost::container::allocator_traits<
+ Alloc
+ >::destroy(allocator, root_ptr);
+ ::boost::container::allocator_traits<
+ Alloc
+ >::deallocate(allocator, root_ptr, 1);
+//<-
+#endif
+//->
+ }
+ //]
+
+ template <typename Iterator>
+ inline void cartesian_sort(Iterator itr_begin, Iterator itr_end)
+ {
+ cartesian_sort(
+ itr_begin
+ , itr_end
+ , ::std::less<typename ::boost::iterator_value<Iterator>::type>()
+ );
+ }
+
+ template <typename Range, typename Compare>
+ inline Range& cartesian_sort_range(Range& r, Compare compare)
+ {
+ cartesian_sort(::boost::begin(r), ::boost::end(r), compare);
+ return r;
+ }
+
+ template <typename Range>
+ inline Range& cartesian_sort_range(Range& r)
+ {
+ return cartesian_sort_range(
+ r
+ , ::std::less<
+ typename ::boost::iterator_value<
+ typename ::boost::range_iterator<Range>::type
+ >::type
+ >()
+ );
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ALGORITHM_CARTESIAN_SORT_HPP
+

Added: sandbox/tree_node/boost/tree_node/associative_node.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/associative_node.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,2133 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ASSOCIATIVE_NODE_HPP_INCLUDED
+#define BOOST_TREE_NODE_ASSOCIATIVE_NODE_HPP_INCLUDED
+
+#include <utility>
+#include <boost/mpl/assert.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/range/iterator_range.hpp>
+#include <boost/utility/get_iterator_value_second.hpp>
+#include <boost/container_gen/container_gen.hpp>
+#include <boost/container_gen/emplace_assoc_function_gen.hpp>
+#include <boost/container_gen/is_associative_selector.hpp>
+#include <boost/container_gen/is_recursive_selector.hpp>
+#include <boost/container_gen/is_ptr_selector.hpp>
+#include <boost/container_gen/has_stable_iters_selector.hpp>
+#include <boost/tree_node/preprocessor.hpp>
+#include <boost/tree_node/base.hpp>
+#include <boost/tree_node/associative_node_fwd.hpp>
+#include <boost/tree_node/intrinsic/has_key.hpp>
+#include <boost/tree_node/intrinsic/get_keys.hpp>
+#include <boost/tree_node/iterator/dereference.hpp>
+#include <boost/tree_node/iterator/post_order_descendant.hpp>
+#include <boost/tree_node/iterator/depth_first_descendant.hpp>
+#include <boost/tree_node/iterator/depth_first.hpp>
+#include <boost/detail/metafunction/container_reverse_iterator.hpp>
+#include <boost/detail/metafunction/is_random_access_iterator.hpp>
+#include <boost/assert.hpp>
+
+#include <boost/tree_node/_detail/config_begin.hpp>
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <boost/type_traits/is_pod.hpp>
+#include <boost/move/move.hpp>
+
+namespace boost {
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ struct is_POD<
+ ::boost::tree_node::associative_node_base<Derived,Key,Data,Selector>
+ > : ::boost::false_type
+ {
+ };
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ struct is_pod<
+ ::boost::tree_node::associative_node_base<Derived,Key,Data,Selector>
+ > : ::boost::false_type
+ {
+ };
+} // namespace boost
+#endif // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/transform_view.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/iterator/key_of.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/support/category_of.hpp>
+
+namespace boost { namespace tree_node { namespace result_of {
+
+ template <
+ typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ , typename FusionKey
+ >
+ struct has_key_impl<
+ associative_node_base<Derived,Key,Data,Selector>
+ , FusionKey
+ > : ::boost::mpl::eval_if<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::has_key<Data,FusionKey>
+ , ::std::tr1::is_same<FusionKey,data_key>
+ >::type
+ {
+ };
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ struct get_keys_impl<
+ associative_node_base<Derived,Key,Data,Selector>
+ > : ::boost::mpl::eval_if<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::transform_view<
+ Data
+ , ::boost::fusion::result_of::key_of< ::boost::mpl::_>
+ >
+ , ::boost::mpl::vector1<data_key>
+ >
+ {
+ };
+}}} // namespace boost::tree_node::result_of
+#endif // defined BOOST_TREE_NODE_CAN_USE_FUSION
+
+namespace boost { namespace tree_node {
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ class associative_node_base
+ : public
+ //[reference__associative_node_base__bases
+ tree_node_base<Derived>
+ //]
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ , public data_key
+#endif
+ , private ::boost::noncopyable
+ {
+ BOOST_MPL_ASSERT((::boost::is_associative_selector<Selector>));
+ BOOST_MPL_ASSERT((::boost::is_recursive_selector<Selector>));
+
+ //[reference__associative_node_base__children
+ typedef typename ::boost::container_gen<Selector,Key,Derived>::type
+ children;
+ //]
+
+ public:
+ //[reference__associative_node_base__super_t
+ typedef tree_node_base<Derived> super_t;
+ //]
+
+ //[reference__associative_node_base__pointer
+ typedef typename super_t::pointer pointer;
+ //]
+
+ //[reference__associative_node_base__const_pointer
+ typedef typename super_t::const_pointer const_pointer;
+ //]
+
+ //[reference__associative_node_base__iterator
+ typedef typename children::iterator iterator;
+ //]
+
+ //[reference__associative_node_base__const_iterator
+ typedef typename children::const_iterator const_iterator;
+ //]
+
+ typedef typename ::boost::detail::metafunction
+ ::container_reverse_iterator<children>::type
+ reverse_iterator;
+ typedef typename ::boost::detail::metafunction
+ ::container_reverse_iterator<children const>::type
+ const_reverse_iterator;
+
+ //[reference__associative_node_base__size_type
+ typedef typename children::size_type size_type;
+ //]
+
+ //[reference__associative_node_base__traits
+ struct traits
+ {
+ typedef Key
+ key_type;
+ typedef Data
+ data_type;
+ typedef typename ::boost::mpl::if_<
+ ::boost::is_ptr_selector<Selector>
+ , ::boost::iterator_range<iterator>
+ , ::std::pair<iterator,iterator>
+ >::type
+ iterator_range;
+ typedef typename ::boost::mpl::if_<
+ ::boost::is_ptr_selector<Selector>
+ , ::boost::iterator_range<const_iterator>
+ , ::std::pair<const_iterator,const_iterator>
+ >::type
+ const_iterator_range;
+ typedef typename children::allocator_type
+ allocator;
+ typedef allocator const&
+ allocator_reference;
+ };
+ //]
+
+ private:
+ struct _clone_transform_function
+ {
+ typedef ::std::pair<
+ typename traits::key_type const&
+ , typename traits::data_type const&
+ >
+ result_type;
+
+ template <typename Pair>
+ result_type operator()(Pair const& p) const;
+ };
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ struct _move_transform_function
+ {
+ typedef ::std::pair<
+ typename traits::key_type const&
+ , BOOST_RV_REF(typename traits::data_type)
+ >
+ result_type;
+
+ template <typename Pair>
+ result_type operator()(Pair& p) const;
+ };
+#endif
+
+ children _children;
+ typename traits::data_type _data;
+ pointer _parent;
+
+ protected:
+ //[reference__associative_node_base__derived_copy_ctor
+ associative_node_base(Derived const& copy);
+ //]
+
+ //[reference__associative_node_base__derived_copy_ctor_w_allocator
+ associative_node_base(
+ Derived const& copy
+ , typename traits::allocator_reference allocator
+ );
+ //]
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ BOOST_PP_FOR(
+ ((0), associative_node_base)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED_WITH_DATA
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC_WITH_DATA
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_FWD_DECL
+ )
+
+ BOOST_PP_FOR(
+ ((0), associative_node_base)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED_WITH_DATA
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC_WITH_DATA
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_W_ALLOC_FWD_DECL
+ )
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ associative_node_base(BOOST_RV_REF(Derived) source);
+
+ associative_node_base(
+ BOOST_RV_REF(Derived) source
+ , typename traits::allocator_reference allocator
+ );
+
+#if defined BOOST_CONTAINER_PERFECT_FORWARDING
+ //[reference__associative_node_base__emplacement_ctor
+ template <typename ...Args>
+ explicit associative_node_base(Args&& ...args);
+ //]
+
+ //[reference__associative_node_base__emplacement_ctor_w_allocator
+ template <typename ...Args>
+ explicit associative_node_base(
+ ::boost::container::allocator_arg_t
+ , typename traits::allocator_reference allocator
+ , Args&& ...args
+ );
+ //]
+#else // !defined BOOST_CONTAINER_PERFECT_FORWARDING
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_FWD_DECL
+ , associative_node_base
+ )
+
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_W_ALLOC_FWD_DECL
+ , associative_node_base
+ )
+#endif // BOOST_CONTAINER_PERFECT_FORWARDING
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ ~associative_node_base();
+
+ //[reference__associative_node_base__clone_descendants
+ void clone_descendants(Derived const& copy);
+ //]
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ //[reference__associative_node_base__copy_assign
+ void copy_assign(Derived const& copy);
+ //]
+#else
+ void move_descendants(BOOST_RV_REF(Derived) source);
+
+ void copy_assign(BOOST_COPY_ASSIGN_REF(Derived) copy);
+
+ void move_assign(BOOST_RV_REF(Derived) source);
+#endif
+
+ //[reference__associative_node_base__on_post_assign
+ void on_post_assign();
+ //]
+
+ public:
+ //[reference__associative_node_base__data_key_value_operator__const
+ typename traits::data_type const& operator[](data_key const&) const;
+ //]
+
+ //[reference__associative_node_base__data_key_value_operator
+ typename traits::data_type& operator[](data_key const&);
+ //]
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+ //[reference__associative_node_base__key_value_operator__const
+ template <typename FusionKey>
+ typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ associative_node_base<Derived,Key,Data,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<Data const,FusionKey>
+ >::type
+ operator[](FusionKey const&) const;
+ //]
+
+ //[reference__associative_node_base__key_value_operator
+ template <typename FusionKey>
+ typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ associative_node_base<Derived,Key,Data,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<Data,FusionKey>
+ >::type
+ operator[](FusionKey const&);
+ //]
+#endif // defined BOOST_TREE_NODE_CAN_USE_FUSION
+
+ //[reference__associative_node_base__get_parent_ptr__const
+ const_pointer get_parent_ptr() const;
+ //]
+
+ //[reference__associative_node_base__get_parent_ptr
+ pointer get_parent_ptr();
+ //]
+
+ //[reference__associative_node_base__cbegin
+ const_iterator cbegin() const;
+ const_iterator begin() const;
+ //]
+
+ //[reference__associative_node_base__begin
+ iterator begin();
+ //]
+
+ //[reference__associative_node_base__cend
+ const_iterator cend() const;
+ const_iterator end() const;
+ //]
+
+ //[reference__associative_node_base__end
+ iterator end();
+ //]
+
+ //[reference__associative_node_base__crbegin
+ const_reverse_iterator crbegin() const;
+ const_reverse_iterator rbegin() const;
+ //]
+
+ //[reference__associative_node_base__rbegin
+ reverse_iterator rbegin();
+ //]
+
+ //[reference__associative_node_base__crend
+ const_reverse_iterator crend() const;
+ const_reverse_iterator rend() const;
+ //]
+
+ //[reference__associative_node_base__rend
+ reverse_iterator rend();
+ //]
+
+ //[reference__associative_node_base__size
+ size_type size() const;
+ //]
+
+ //[reference__associative_node_base__empty
+ bool empty() const;
+ //]
+
+ //[reference__associative_node_base__clear
+ void clear();
+ //]
+
+ //[reference__associative_node_base__insert
+ iterator
+ insert(
+ typename traits::key_type const& key
+ , Derived const& child
+ );
+ //]
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ iterator \
+ emplace( \
+ typename traits::key_type const& key \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ iterator
+ insert(
+ typename traits::key_type const& key
+ , BOOST_RV_REF(Derived) child
+ );
+
+#if defined BOOST_CONTAINER_PERFECT_FORWARDING
+ //[reference__associative_node_base__emplace
+ template <typename ...Args>
+ iterator emplace(typename traits::key_type const& key, Args&& ...args);
+ //]
+#else // !defined BOOST_CONTAINER_PERFECT_FORWARDING
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ iterator \
+ emplace( \
+ typename traits::key_type const& key \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // BOOST_CONTAINER_PERFECT_FORWARDING
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ //[reference__associative_node_base__find__const
+ const_iterator find(typename traits::key_type const& key) const;
+ //]
+
+ //[reference__associative_node_base__find
+ iterator find(typename traits::key_type const& key);
+ //]
+
+ //[reference__associative_node_base__lower_bound__const
+ const_iterator lower_bound(typename traits::key_type const& key) const;
+ //]
+
+ //[reference__associative_node_base__lower_bound
+ iterator lower_bound(typename traits::key_type const& key);
+ //]
+
+ //[reference__associative_node_base__upper_bound__const
+ const_iterator upper_bound(typename traits::key_type const& key) const;
+ //]
+
+ //[reference__associative_node_base__upper_bound
+ iterator upper_bound(typename traits::key_type const& key);
+ //]
+
+ //[reference__associative_node_base__equal_range__const
+ typename traits::const_iterator_range
+ equal_range(typename traits::key_type const& key) const;
+ //]
+
+ //[reference__associative_node_base__equal_range
+ typename traits::iterator_range
+ equal_range(typename traits::key_type const& key);
+ //]
+
+ //[reference__associative_node_base__erase
+ size_type erase(typename traits::key_type const& key);
+ //]
+
+ private:
+ void _clone_descendants(Derived const& copy);
+
+ void _clone_descendants(Derived const& copy, ::boost::mpl::true_);
+
+ void _clone_descendants(Derived const& copy, ::boost::mpl::false_);
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ void _move_descendants(Derived& source);
+
+ void _move_descendants(Derived& source, ::boost::mpl::true_);
+
+ void _move_descendants(Derived& source, ::boost::mpl::false_);
+#endif
+
+ void _on_post_insert(iterator itr, ::boost::mpl::true_);
+
+ void _on_post_insert(iterator itr, ::boost::mpl::false_);
+
+ void _link_children_to_parent();
+
+ void _on_post_modify_value(data_key const& key);
+
+ template <typename D, typename K, typename T, typename S, typename V>
+ friend void
+ put(
+ associative_node_base<D,K,T,S>& node
+ , data_key const& key
+ , V const& value
+ );
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+ template <typename FusionKey>
+ void _on_post_modify_value(FusionKey const& key);
+
+ template <
+ typename D
+ , typename K
+ , typename T
+ , typename S
+ , typename FusionKey
+ , typename V
+ >
+ friend void
+ put(
+ associative_node_base<D,K,T,S>& node
+ , FusionKey const& key
+ , V const& value
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<associative_node_base<D,K,T,S>,FusionKey>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::true_
+ >::type
+ );
+#endif // defined BOOST_TREE_NODE_CAN_USE_FUSION
+ };
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ template <typename Pair>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::_clone_transform_function::result_type
+ associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::_clone_transform_function::operator()(Pair const& p) const
+ {
+ return result_type(
+ p.first
+ , get(::boost::get_iterator_value_second(p), data_key())
+ );
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ associative_node_base<Derived,Key,Data,Selector>::associative_node_base(
+ Derived const& copy
+ ) : _children(), _data(copy._data), _parent()
+ {
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ associative_node_base<Derived,Key,Data,Selector>::associative_node_base(
+ Derived const& copy
+ , typename traits::allocator_reference allocator
+ ) : _children(allocator), _data(copy._data), _parent()
+ {
+ }
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename Derived \
+ , typename Key \
+ , typename Data \
+ , typename Selector \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ associative_node_base<Derived,Key,Data,Selector>::associative_node_base( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) : _children() \
+ , _data(BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p)) \
+ , _parent() \
+ { \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename Derived \
+ , typename Key \
+ , typename Data \
+ , typename Selector \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ associative_node_base<Derived,Key,Data,Selector>::associative_node_base( \
+ ::boost::container::allocator_arg_t \
+ , typename traits::allocator_reference allocator \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) : _children() \
+ , _data(BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p)) \
+ , _parent() \
+ { \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ template <typename Pair>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::_move_transform_function::result_type
+ associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::_move_transform_function::operator()(Pair& p) const
+ {
+ return ::std::make_pair(
+ p.first
+ , ::boost::move(get(::boost::get_iterator_value_second(p), data_key()))
+ );
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ associative_node_base<Derived,Key,Data,Selector>::associative_node_base(
+ BOOST_RV_REF(Derived) source
+ ) : _children(), _data(::boost::move(source._data)), _parent()
+ {
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ associative_node_base<Derived,Key,Data,Selector>::associative_node_base(
+ BOOST_RV_REF(Derived) source
+ , typename traits::allocator_reference allocator
+ ) : _children(allocator), _data(::boost::move(source._data)), _parent()
+ {
+ }
+
+#if defined BOOST_CONTAINER_PERFECT_FORWARDING
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ template <typename ...Args>
+ associative_node_base<Derived,Key,Data,Selector>::associative_node_base(
+ Args&& ...args
+ ) : _children(), _data(::boost::forward<Args>(args)...), _parent()
+ {
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ template <typename ...Args>
+ associative_node_base<Derived,Key,Data,Selector>::associative_node_base(
+ ::boost::container::allocator_arg_t
+ , typename traits::allocator_reference allocator
+ , Args&& ...args
+ ) : _children(allocator), _data(::boost::forward<Args>(args)...), _parent()
+ {
+ }
+#else // !defined BOOST_CONTAINER_PERFECT_FORWARDING
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename Derived \
+ , typename Key \
+ , typename Data \
+ , typename Selector \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ associative_node_base<Derived,Key,Data,Selector>::associative_node_base( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) : _children() \
+ , _data( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ) \
+ , _parent() \
+ { \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename Derived \
+ , typename Key \
+ , typename Data \
+ , typename Selector \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ associative_node_base<Derived,Key,Data,Selector>::associative_node_base( \
+ ::boost::container::allocator_arg_t \
+ , typename traits::allocator_reference allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) : _children(allocator) \
+ , _data( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ) \
+ , _parent() \
+ { \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // BOOST_CONTAINER_PERFECT_FORWARDING
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ associative_node_base<Derived,Key,Data,Selector>::~associative_node_base()
+ {
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline void
+ associative_node_base<Derived,Key,Data,Selector>::clone_descendants(
+ Derived const& copy
+ )
+ {
+ this->_clone_descendants(copy);
+ }
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ void
+ associative_node_base<Derived,Key,Data,Selector>::copy_assign(
+ Derived const& copy
+ )
+ {
+ Derived twin(copy._data);
+
+ twin._clone_descendants(copy);
+ this->_children.clear();
+ this->_data = twin._data;
+ this->clone_metadata(copy);
+ this->_clone_descendants(twin);
+ }
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline void
+ associative_node_base<Derived,Key,Data,Selector>::move_descendants(
+ BOOST_RV_REF(Derived) source
+ )
+ {
+ this->_move_descendants(static_cast<Derived&>(source));
+ source.on_post_clear();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ void
+ associative_node_base<Derived,Key,Data,Selector>::copy_assign(
+ BOOST_COPY_ASSIGN_REF(Derived) copy
+ )
+ {
+ Derived twin(copy._data);
+
+ twin._clone_descendants(static_cast<Derived const&>(copy));
+ this->_children.clear();
+ this->_data = ::boost::move(twin._data);
+ this->_move_descendants(twin);
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline void
+ associative_node_base<Derived,Key,Data,Selector>::move_assign(
+ BOOST_RV_REF(Derived) source
+ )
+ {
+ this->_children.clear();
+ this->_data = ::boost::move(source._data);
+ this->_move_descendants(static_cast<Derived&>(source));
+ source.on_post_clear();
+ }
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline void
+ associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::on_post_assign()
+ {
+ if (this->_parent)
+ {
+ this->_parent->on_post_propagate_value(data_key());
+ }
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::traits::data_type const&
+ associative_node_base<Derived,Key,Data,Selector>::operator[](
+ data_key const&
+ ) const
+ {
+ return this->_data;
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::traits::data_type&
+ associative_node_base<Derived,Key,Data,Selector>::operator[](
+ data_key const&
+ )
+ {
+ return this->_data;
+ }
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ template <typename FusionKey>
+ inline typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ associative_node_base<Derived,Key,Data,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<Data const,FusionKey>
+ >::type
+ associative_node_base<Derived,Key,Data,Selector>::operator[](
+ FusionKey const&
+ ) const
+ {
+ return ::boost::fusion::at_key<FusionKey>(this->_data);
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ template <typename FusionKey>
+ inline typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ associative_node_base<Derived,Key,Data,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<Data,FusionKey>
+ >::type
+ associative_node_base<Derived,Key,Data,Selector>::operator[](
+ FusionKey const&
+ )
+ {
+ return ::boost::fusion::at_key<FusionKey>(this->_data);
+ }
+#endif // defined BOOST_TREE_NODE_CAN_USE_FUSION
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::const_pointer
+ associative_node_base<Derived,Key,Data,Selector>::get_parent_ptr() const
+ {
+ return this->_parent;
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<Derived,Key,Data,Selector>::pointer
+ associative_node_base<Derived,Key,Data,Selector>::get_parent_ptr()
+ {
+ return this->_parent;
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::const_iterator
+ associative_node_base<Derived,Key,Data,Selector>::cbegin() const
+ {
+ return this->_children.cbegin();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::const_iterator
+ associative_node_base<Derived,Key,Data,Selector>::begin() const
+ {
+ return this->_children.begin();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<Derived,Key,Data,Selector>::iterator
+ associative_node_base<Derived,Key,Data,Selector>::begin()
+ {
+ return this->_children.begin();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::const_iterator
+ associative_node_base<Derived,Key,Data,Selector>::cend() const
+ {
+ return this->_children.cend();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::const_iterator
+ associative_node_base<Derived,Key,Data,Selector>::end() const
+ {
+ return this->_children.end();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<Derived,Key,Data,Selector>::iterator
+ associative_node_base<Derived,Key,Data,Selector>::end()
+ {
+ return this->_children.end();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::const_reverse_iterator
+ associative_node_base<Derived,Key,Data,Selector>::crbegin() const
+ {
+ return this->_children.crbegin();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::const_reverse_iterator
+ associative_node_base<Derived,Key,Data,Selector>::rbegin() const
+ {
+ return this->_children.rbegin();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::reverse_iterator
+ associative_node_base<Derived,Key,Data,Selector>::rbegin()
+ {
+ return this->_children.rbegin();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::const_reverse_iterator
+ associative_node_base<Derived,Key,Data,Selector>::crend() const
+ {
+ return this->_children.crend();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::const_reverse_iterator
+ associative_node_base<Derived,Key,Data,Selector>::rend() const
+ {
+ return this->_children.rend();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::reverse_iterator
+ associative_node_base<Derived,Key,Data,Selector>::rend()
+ {
+ return this->_children.rend();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<Derived,Key,Data,Selector>::size_type
+ associative_node_base<Derived,Key,Data,Selector>::size() const
+ {
+ return this->_children.size();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline bool associative_node_base<Derived,Key,Data,Selector>::empty() const
+ {
+ return this->_children.empty();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline void associative_node_base<Derived,Key,Data,Selector>::clear()
+ {
+ this->_children.clear();
+ this->on_post_clear();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ typename associative_node_base<Derived,Key,Data,Selector>::iterator
+ associative_node_base<Derived,Key,Data,Selector>::insert(
+ typename traits::key_type const& key
+ , Derived const& child
+ )
+ {
+ Derived twin(child._data);
+
+ twin._clone_descendants(child);
+
+ typename ::boost::emplace_associative_function_gen<Selector>::type
+ emplacer;
+ ::std::pair<iterator,bool> p = emplacer(
+ this->_children
+ , key
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ , twin._data
+#else
+ , ::boost::move(twin._data)
+#endif
+ );
+
+ if (p.second)
+ {
+ this->_on_post_insert(
+ p.first
+ , ::boost::has_stable_iterators_selector<Selector>()
+ );
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ dereference_iterator(p.first)._clone_descendants(twin);
+#else
+ dereference_iterator(p.first)._move_descendants(twin);
+#endif
+ dereference_iterator(p.first).on_post_inserted(
+ p.first
+ , ::boost::has_stable_iterators_selector<Selector>()
+ );
+ }
+
+ BOOST_ASSERT(
+ dereference_iterator(p.first)._parent == this->get_derived()
+ );
+ return p.first;
+ }
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename Derived \
+ , typename Key \
+ , typename Data \
+ , typename Selector \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ typename associative_node_base<Derived,Key,Data,Selector>::iterator \
+ associative_node_base<Derived,Key,Data,Selector>::emplace( \
+ typename traits::key_type const& key \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ typename ::boost::emplace_associative_function_gen<Selector>::type \
+ emplacer; \
+ ::std::pair<iterator,bool> p = emplacer( \
+ this->_children \
+ , key \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ if (p.second) \
+ { \
+ this->_on_post_insert( \
+ p.first \
+ , ::boost::has_stable_iterators_selector<Selector>() \
+ ); \
+ dereference_iterator(p.first).on_post_inserted( \
+ p.first \
+ , ::boost::has_stable_iterators_selector<Selector>() \
+ ); \
+ } \
+ BOOST_ASSERT( \
+ dereference_iterator(p.first)._parent == this->get_derived() \
+ ); \
+ return p.first; \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ typename associative_node_base<Derived,Key,Data,Selector>::iterator
+ associative_node_base<Derived,Key,Data,Selector>::insert(
+ typename traits::key_type const& key
+ , BOOST_RV_REF(Derived) child
+ )
+ {
+ typename ::boost::emplace_associative_function_gen<Selector>::type
+ emplacer;
+ ::std::pair<iterator,bool> p = emplacer(
+ this->_children
+ , key
+ , ::boost::move(child._data)
+ );
+
+ if (p.second)
+ {
+ this->_on_post_insert(
+ p.first
+ , ::boost::has_stable_iterators_selector<Selector>()
+ );
+ dereference_iterator(p.first)._move_descendants(
+ static_cast<Derived&>(child)
+ );
+ child.on_post_clear();
+ dereference_iterator(p.first).on_post_inserted(
+ p.first
+ , ::boost::has_stable_iterators_selector<Selector>()
+ );
+ }
+
+ BOOST_ASSERT(
+ dereference_iterator(p.first)._parent == this->get_derived()
+ );
+ return p.first;
+ }
+#if defined BOOST_CONTAINER_PERFECT_FORWARDING
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ template <typename ...Args>
+ typename associative_node_base<Derived,Key,Data,Selector>::iterator
+ associative_node_base<Derived,Key,Data,Selector>::emplace(
+ typename traits::key_type const& key
+ , Args&& ...args
+ )
+ {
+ typename ::boost::emplace_associative_function_gen<Selector>::type
+ emplacer;
+ ::std::pair<iterator,bool> p = emplacer(
+ this->_children
+ , key
+ , ::boost::forward<Args>(args)...
+ );
+
+ if (p.second)
+ {
+ this->_on_post_insert(
+ p.first
+ , ::boost::has_stable_iterators_selector<Selector>()
+ );
+ dereference_iterator(p.first).on_post_inserted(
+ p.first
+ , ::boost::has_stable_iterators_selector<Selector>()
+ );
+ }
+
+ BOOST_ASSERT(
+ dereference_iterator(p.first)._parent == this->get_derived()
+ );
+ return p.first;
+ }
+#else // !defined BOOST_CONTAINER_PERFECT_FORWARDING
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename Derived \
+ , typename Key \
+ , typename Data \
+ , typename Selector \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ typename associative_node_base<Derived,Key,Data,Selector>::iterator \
+ associative_node_base<Derived,Key,Data,Selector>::emplace( \
+ typename traits::key_type const& key \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ typename ::boost::emplace_associative_function_gen<Selector>::type \
+ emplacer; \
+ ::std::pair<iterator,bool> p = emplacer( \
+ this->_children \
+ , key \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ if (p.second) \
+ { \
+ this->_on_post_insert( \
+ p.first \
+ , ::boost::has_stable_iterators_selector<Selector>() \
+ ); \
+ dereference_iterator(p.first).on_post_inserted( \
+ p.first \
+ , ::boost::has_stable_iterators_selector<Selector>() \
+ ); \
+ } \
+ BOOST_ASSERT( \
+ dereference_iterator(p.first)._parent == this->get_derived() \
+ ); \
+ return p.first; \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // BOOST_CONTAINER_PERFECT_FORWARDING
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::const_iterator
+ associative_node_base<Derived,Key,Data,Selector>::find(
+ typename traits::key_type const& key
+ ) const
+ {
+ return this->_children.find(key);
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<Derived,Key,Data,Selector>::iterator
+ associative_node_base<Derived,Key,Data,Selector>::find(
+ typename traits::key_type const& key
+ )
+ {
+ return this->_children.find(key);
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::const_iterator
+ associative_node_base<Derived,Key,Data,Selector>::lower_bound(
+ typename traits::key_type const& key
+ ) const
+ {
+ return this->_children.lower_bound(key);
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::iterator
+ associative_node_base<Derived,Key,Data,Selector>::lower_bound(
+ typename traits::key_type const& key
+ )
+ {
+ return this->_children.lower_bound(key);
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::const_iterator
+ associative_node_base<Derived,Key,Data,Selector>::upper_bound(
+ typename traits::key_type const& key
+ ) const
+ {
+ return this->_children.upper_bound(key);
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::iterator
+ associative_node_base<Derived,Key,Data,Selector>::upper_bound(
+ typename traits::key_type const& key
+ )
+ {
+ return this->_children.upper_bound(key);
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::traits::const_iterator_range
+ associative_node_base<Derived,Key,Data,Selector>::equal_range(
+ typename traits::key_type const& key
+ ) const
+ {
+ return this->_children.equal_range(key);
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::traits::iterator_range
+ associative_node_base<Derived,Key,Data,Selector>::equal_range(
+ typename traits::key_type const& key
+ )
+ {
+ return this->_children.equal_range(key);
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ typename associative_node_base<Derived,Key,Data,Selector>::size_type
+ associative_node_base<Derived,Key,Data,Selector>::erase(
+ typename traits::key_type const& key
+ )
+ {
+ size_type result = this->_children.erase(key);
+ this->on_post_erase(
+ ::boost::has_stable_iterators_selector<Selector>()
+ );
+ return result;
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline void
+ associative_node_base<Derived,Key,Data,Selector>::_clone_descendants(
+ Derived const& copy
+ )
+ {
+ this->_clone_descendants(
+ copy
+ , ::boost::detail::metafunction::is_random_access_iterator<
+ iterator
+ >()
+ );
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline void
+ associative_node_base<Derived,Key,Data,Selector>::_clone_descendants(
+ Derived const& copy
+ , ::boost::mpl::true_
+ )
+ {
+ this->_children = copy._children;
+ this->_link_children_to_parent();
+ this->clone_metadata(copy);
+ this->on_post_copy_or_move();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ void
+ associative_node_base<Derived,Key,Data,Selector>::_clone_descendants(
+ Derived const& copy
+ , ::boost::mpl::false_ f
+ )
+ {
+ typename ::boost::emplace_associative_function_gen<Selector>::type
+ emplacer;
+ iterator child_itr;
+ pointer p = this->get_derived();
+
+ p->clone_metadata(copy);
+ p->_children.clear();
+
+ for (
+ depth_first_descendant_iterator<Derived const> itr(copy);
+ itr;
+ ++itr
+ )
+ {
+ switch (::boost::tree_node::traversal_state(itr))
+ {
+ case ::boost::tree_node::pre_order_traversal:
+ {
+ child_itr = emplacer(
+ p->_children
+ , itr->first
+ , dereference_iterator(itr)._data
+ ).first;
+ p->_on_post_insert(child_itr, f);
+ p = &dereference_iterator(child_itr);
+ p->clone_metadata(dereference_iterator(itr));
+ break;
+ }
+
+ case ::boost::tree_node::post_order_traversal:
+ {
+ p->on_post_copy_or_move();
+ p = p->get_parent_ptr();
+ break;
+ }
+
+ default:
+ {
+ BOOST_ASSERT_MSG(
+ false
+ , "traversal_state must be pre- or post-order!"
+ );
+ }
+ }
+ }
+
+ BOOST_ASSERT_MSG(p == this->get_derived(), "itr not at-the-end");
+ p->on_post_copy_or_move();
+ }
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline void
+ associative_node_base<Derived,Key,Data,Selector>::_move_descendants(
+ Derived& source
+ )
+ {
+ this->_move_descendants(
+ source
+ , ::boost::detail::metafunction::is_random_access_iterator<
+ iterator
+ >()
+ );
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline void
+ associative_node_base<Derived,Key,Data,Selector>::_move_descendants(
+ Derived& source
+ , ::boost::mpl::true_
+ )
+ {
+ this->_children.clear();
+ this->_children = ::boost::move(source._children);
+ this->_link_children_to_parent();
+ this->move_metadata(::boost::move(source));
+ this->on_post_copy_or_move();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ void
+ associative_node_base<Derived,Key,Data,Selector>::_move_descendants(
+ Derived& source
+ , ::boost::mpl::false_
+ )
+ {
+ typename ::boost::emplace_associative_function_gen<Selector>::type
+ emplacer;
+ iterator child_itr;
+ pointer p = this->get_derived();
+
+ p->move_metadata(::boost::move(source));
+ p->_children.clear();
+
+ for (depth_first_descendant_iterator<Derived> itr(source); itr; ++itr)
+ {
+ switch (::boost::tree_node::traversal_state(itr))
+ {
+ case ::boost::tree_node::pre_order_traversal:
+ {
+ child_itr = emplacer(
+ p->_children
+ , itr->first
+ , ::boost::move(dereference_iterator(itr)._data)
+ ).first;
+ p->_on_post_insert(
+ child_itr
+ , ::boost::has_stable_iterators_selector<Selector>()
+ );
+ p = &dereference_iterator(child_itr);
+ p->move_metadata(
+ ::boost::move(dereference_iterator(itr))
+ );
+ break;
+ }
+
+ case ::boost::tree_node::post_order_traversal:
+ {
+ dereference_iterator(itr)._children.clear();
+ p->on_post_copy_or_move();
+ p = p->get_parent_ptr();
+ break;
+ }
+
+ default:
+ {
+ BOOST_ASSERT_MSG(
+ false
+ , "traversal_state must be pre- or post-order!"
+ );
+ }
+ }
+ }
+
+ BOOST_ASSERT_MSG(p == this->get_derived(), "itr not at-the-end");
+ source._children.clear();
+ p->on_post_copy_or_move();
+ }
+#endif // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline void
+ associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::_on_post_insert(iterator itr, ::boost::mpl::true_)
+ {
+ dereference_iterator(itr)._parent = this->get_derived();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline void
+ associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::_on_post_insert(iterator itr, ::boost::mpl::false_)
+ {
+ this->_link_children_to_parent();
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ void
+ associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::_link_children_to_parent()
+ {
+ iterator itr = this->begin();
+
+ for (iterator itr_end = this->end(); itr != itr_end; ++itr)
+ {
+ dereference_iterator(itr)._parent = this->get_derived();
+ }
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline void
+ associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::_on_post_modify_value(data_key const& key)
+ {
+ this->on_post_propagate_value(key);
+ }
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ template <typename FusionKey>
+ inline void
+ associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::_on_post_modify_value(FusionKey const& key)
+ {
+ this->on_post_propagate_value(key);
+ }
+#endif
+}} // namespace boost::tree_node
+
+namespace boost { namespace tree_node {
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::traits::data_type const&
+ get(
+ associative_node_base<Derived,Key,Data,Selector> const& node
+ , data_key const& key
+ )
+ {
+ return node[key];
+ }
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ inline typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::traits::data_type&
+ get(
+ associative_node_base<Derived,Key,Data,Selector>& node
+ , data_key const& key
+ )
+ {
+ return node[key];
+ }
+
+#if !defined BOOST_NO_SFINAE
+ template <
+ typename DataKey
+ , typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ >
+ inline typename ::boost::enable_if<
+ ::std::tr1::is_same<DataKey,data_key>
+ , typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::traits::data_type const&
+ >::type
+ get(associative_node_base<Derived,Key,Data,Selector> const& node)
+ {
+ return node[data_key()];
+ }
+
+ template <
+ typename DataKey
+ , typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ >
+ inline typename ::boost::enable_if<
+ ::std::tr1::is_same<DataKey,data_key>
+ , typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::traits::data_type&
+ >::type
+ get(associative_node_base<Derived,Key,Data,Selector>& node)
+ {
+ return node[data_key()];
+ }
+#endif // !defined BOOST_NO_SFINAE
+
+ template <
+ typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ , typename V
+ >
+ inline void
+ put(
+ associative_node_base<Derived,Key,Data,Selector>& node
+ , data_key const& key
+ , V const& value
+ )
+ {
+ node[key] = value;
+ node._on_post_modify_value(key);
+ }
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+ template <
+ typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ , typename FusionKey
+ >
+ inline typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ associative_node_base<Derived,Key,Data,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<Data const,FusionKey>
+ >::type
+ get(
+ associative_node_base<Derived,Key,Data,Selector> const& node
+ , FusionKey const& key
+ )
+ {
+ return node[key];
+ }
+
+ template <
+ typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ , typename FusionKey
+ >
+ inline typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ associative_node_base<Derived,Key,Data,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<Data,FusionKey>
+ >::type
+ get(
+ associative_node_base<Derived,Key,Data,Selector>& node
+ , FusionKey const& key
+ )
+ {
+ return node[key];
+ }
+
+ template <
+ typename FusionKey
+ , typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ >
+ inline typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ associative_node_base<Derived,Key,Data,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<Data const,FusionKey>
+ >::type
+ get(associative_node_base<Derived,Key,Data,Selector> const& node)
+ {
+ return node[FusionKey()];
+ }
+
+ template <
+ typename FusionKey
+ , typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ >
+ inline typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ associative_node_base<Derived,Key,Data,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<Data,FusionKey>
+ >::type
+ get(associative_node_base<Derived,Key,Data,Selector>& node)
+ {
+ return node[FusionKey()];
+ }
+
+ template <
+ typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ , typename FusionKey
+ , typename V
+ >
+ inline void
+ put(
+ associative_node_base<Derived,Key,Data,Selector>& node
+ , FusionKey const& key
+ , V const& value
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ associative_node_base<Derived,Key,Data,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::true_
+ >::type
+ )
+ {
+ node[key] = value;
+ node._on_post_modify_value(key);
+ }
+#endif // defined BOOST_TREE_NODE_CAN_USE_FUSION
+}} // namespace boost::tree_node
+
+//[reference__associative_node_base_gen
+namespace boost { namespace tree_node {
+
+ template <typename Selector = ::boost::ptr_mapS>
+ struct associative_node_base_gen
+ {
+ template <typename Derived, typename Key, typename Data>
+ struct apply
+ {
+ typedef associative_node_base<Derived,Key,Data,Selector> type;
+ };
+ };
+
+ typedef associative_node_base_gen<> associative_node_base_default_gen;
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Key, typename Data, typename Selector>
+ struct associative_node
+ : public
+ //[reference__associative_node__bases
+ associative_node_base<
+ associative_node<Key,Data,Selector>
+ , Key
+ , Data
+ , Selector
+ >
+ //]
+ {
+ //[reference__associative_node__super_t
+ typedef associative_node_base<
+ associative_node
+ , Key
+ , Data
+ , Selector
+ >
+ super_t;
+ //]
+
+ //[reference__associative_node__traits
+ typedef typename super_t::traits
+ traits;
+ //]
+
+ //[reference__associative_node__pointer
+ typedef typename super_t::pointer
+ pointer;
+ //]
+
+ //[reference__associative_node__const_pointer
+ typedef typename super_t::const_pointer
+ const_pointer;
+ //]
+
+ //[reference__associative_node__iterator
+ typedef typename super_t::iterator
+ iterator;
+ //]
+
+ //[reference__associative_node__const_iterator
+ typedef typename super_t::const_iterator
+ const_iterator;
+ //]
+
+ //[reference__associative_node__reverse_iterator
+ typedef typename super_t::reverse_iterator
+ reverse_iterator;
+ //]
+
+ //[reference__associative_node__const_reverse_iterator
+ typedef typename super_t::const_reverse_iterator
+ const_reverse_iterator;
+ //]
+
+ //[reference__associative_node__size_type
+ typedef typename super_t::size_type
+ size_type;
+ //]
+
+ BOOST_TREE_NODE_COPYABLE_AND_MOVABLE(associative_node, super_t)
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ BOOST_PP_FOR(
+ ((0), (associative_node, super_t))
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED_WITH_DATA
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC_WITH_DATA
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_INLINE_DEF
+ )
+
+ BOOST_PP_FOR(
+ ((0), (associative_node, super_t))
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED_WITH_DATA
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC_WITH_DATA
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_W_ALLOC_INLINE_DEF
+ )
+#elif defined BOOST_CONTAINER_PERFECT_FORWARDING
+ //[reference__associative_node__emplacement_ctor
+ template <typename ...Args>
+ explicit associative_node(Args&& ...args);
+ //]
+
+ //[reference__associative_node__emplacement_ctor_w_allocator
+ template <typename ...Args>
+ explicit associative_node(
+ ::boost::container::allocator_arg_t
+ , typename traits::allocator_reference allocator
+ , Args&& ...args
+ );
+ //]
+#else // partial template specialization support, imperfect forwarding
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_INLINE_DEF
+ , (associative_node, super_t)
+ )
+
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_W_ALLOC_INLINE_DEF
+ , (associative_node, super_t)
+ )
+#endif // compiler defect handling
+ };
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION && \
+ defined BOOST_CONTAINER_PERFECT_FORWARDING
+ template <typename Key, typename Data, typename Selector>
+ template <typename ...Args>
+ inline associative_node<Key,Data,Selector>::associative_node(
+ Args&& ...args
+ ) : super_t(::boost::forward<Args>(args)...)
+ {
+ }
+
+ template <typename Key, typename Data, typename Selector>
+ template <typename ...Args>
+ inline associative_node<Key,Data,Selector>::associative_node(
+ ::boost::container::allocator_arg_t
+ , typename traits::allocator_reference allocator
+ , Args&& ...args
+ ) : super_t(
+ ::boost::container::allocator_arg
+ , allocator
+ , ::boost::forward<Args>(args)...
+ )
+ {
+ }
+#endif // partial template specialization support, perfect forwarding
+}} // namespace boost::tree_node
+
+//[reference__associative_node_gen
+namespace boost { namespace tree_node {
+
+ template <typename Selector = ::boost::ptr_mapS>
+ struct associative_node_gen
+ {
+ template <typename Key, typename Data>
+ struct apply
+ {
+ typedef associative_node<Key,Data,Selector> type;
+ };
+ };
+
+ typedef associative_node_gen<> associative_node_default_gen;
+}} // namespace boost::tree_node
+//]
+
+#include <boost/tree_node/_detail/config_end.hpp>
+
+#endif // BOOST_TREE_NODE_ASSOCIATIVE_NODE_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/associative_node_fwd.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/associative_node_fwd.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,293 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ASSOCIATIVE_NODE_FWD_HPP_INCLUDED
+#define BOOST_TREE_NODE_ASSOCIATIVE_NODE_FWD_HPP_INCLUDED
+
+#include <boost/config.hpp>
+#include <boost/container_gen/selectors.hpp>
+#include <boost/tree_node/preprocessor.hpp>
+#include <boost/tree_node/key/data.hpp>
+
+#if !defined BOOST_NO_SFINAE
+#include <boost/utility/enable_if.hpp>
+#include <boost/tr1/type_traits.hpp>
+#endif
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/fusion/sequence/intrinsic/has_key.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/support/category_of.hpp>
+#include <boost/tree_node/intrinsic/has_key.hpp>
+#endif
+
+namespace boost { namespace tree_node {
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ class associative_node_base;
+
+ template <
+ typename Key
+ , typename Data
+ , typename Selector = ::boost::ptr_mapS
+ >
+ struct associative_node;
+}} // namespace boost::tree_node
+
+//[reference__associative_node_base__at_data_key__const
+namespace boost { namespace tree_node {
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::traits::data_type const&
+ get(
+ associative_node_base<Derived,Key,Data,Selector> const& node
+ , data_key const& key
+ );
+
+//<-
+#if !defined BOOST_NO_SFINAE
+//->
+ template <
+ typename DataKey
+ , typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ >
+ typename ::boost::enable_if<
+ ::std::tr1::is_same<DataKey,data_key>
+ , typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::traits::data_type const&
+ >::type
+ get(associative_node_base<Derived,Key,Data,Selector> const& node);
+//<-
+#endif // BOOST_NO_SFINAE
+//->
+}} // namespace boost::tree_node
+//]
+
+//[reference__associative_node_base__at_data_key
+namespace boost { namespace tree_node {
+
+ template <typename Derived, typename Key, typename Data, typename Selector>
+ typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::traits::data_type&
+ get(
+ associative_node_base<Derived,Key,Data,Selector>& node
+ , data_key const& key
+ );
+
+//<-
+#if !defined BOOST_NO_SFINAE
+//->
+ template <
+ typename DataKey
+ , typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ >
+ typename ::boost::enable_if<
+ ::std::tr1::is_same<DataKey,data_key>
+ , typename associative_node_base<
+ Derived
+ , Key
+ , Data
+ , Selector
+ >::traits::data_type&
+ >::type
+ get(associative_node_base<Derived,Key,Data,Selector>& node);
+//<-
+#endif // BOOST_NO_SFINAE
+//->
+}} // namespace boost::tree_node
+//]
+
+//[reference__associative_node_base__put_data
+namespace boost { namespace tree_node {
+
+ template <
+ typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ , typename V
+ >
+ void
+ put(
+ associative_node_base<Derived,Key,Data,Selector>& node
+ , data_key const& key
+ , V const& value
+ );
+}} // namespace boost::tree_node
+//]
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+//[reference__associative_node_base__at_key__const
+namespace boost { namespace tree_node {
+
+ template <
+ typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ , typename FusionKey
+ >
+ typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ associative_node_base<Derived,Key,Data,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<Data const,FusionKey>
+ >::type
+ get(
+ associative_node_base<Derived,Key,Data,Selector> const& node
+ , FusionKey const& key
+ );
+
+ template <
+ typename FusionKey
+ , typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ >
+ typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ associative_node_base<Derived,Key,Data,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<Data const,FusionKey>
+ >::type
+ get(associative_node_base<Derived,Key,Data,Selector> const& node);
+}} // namespace boost::tree_node
+//]
+
+//[reference__associative_node_base__at_key
+namespace boost { namespace tree_node {
+
+ template <
+ typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ , typename FusionKey
+ >
+ typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ associative_node_base<Derived,Key,Data,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<Data,FusionKey>
+ >::type
+ get(
+ associative_node_base<Derived,Key,Data,Selector>& node
+ , FusionKey const& key
+ );
+
+ template <
+ typename FusionKey
+ , typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ >
+ typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ associative_node_base<Derived,Key,Data,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<Data,FusionKey>
+ >::type
+ get(associative_node_base<Derived,Key,Data,Selector>& node);
+}} // namespace boost::tree_node
+//]
+
+//[reference__associative_node_base__put
+namespace boost { namespace tree_node {
+
+ template <
+ typename Derived
+ , typename Key
+ , typename Data
+ , typename Selector
+ , typename FusionKey
+ , typename V
+ >
+ void
+ put(
+ associative_node_base<Derived,Key,Data,Selector>& node
+ , FusionKey const& key
+ , V const& value
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<Data>::type
+ , ::boost::fusion::traits::is_associative<Data>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ associative_node_base<Derived,Key,Data,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::true_
+ >::type = ::boost::mpl::true_()
+ );
+}} // namespace boost::tree_node
+//]
+#endif // BOOST_TREE_NODE_CAN_USE_FUSION
+
+#endif // BOOST_TREE_NODE_ASSOCIATIVE_NODE_FWD_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/balancer/adelson_velskii_landis.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/balancer/adelson_velskii_landis.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,184 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_BALANCER_ADELSON_VELSKII_LANDIS_HPP_INCLUDED
+#define BOOST_TREE_NODE_BALANCER_ADELSON_VELSKII_LANDIS_HPP_INCLUDED
+
+//[reference__adelson_velskii_landis_balancer
+namespace boost { namespace tree_node {
+
+ struct adelson_velskii_landis_balancer
+ {
+ template <typename NodePointer>
+ static NodePointer post_insert(NodePointer node_ptr);
+
+ template <typename Node>
+ static bool choose_predecessor(Node const& node);
+
+ template <typename Node>
+ static bool pre_erase(Node const& node);
+
+ template <typename NodePointer>
+ static NodePointer post_erase_left(NodePointer node_ptr);
+
+ template <typename NodePointer>
+ static NodePointer post_erase_right(NodePointer node_ptr);
+
+ //<-
+ private:
+ template <typename NodePointer>
+ static NodePointer _balance(NodePointer node_ptr);
+ //->
+ };
+
+ namespace balancer {
+
+ typedef ::boost::tree_node::adelson_velskii_landis_balancer
+ adelson_velskii_landis;
+ } // namespace balancer
+}} // namespace boost::tree_node
+//]
+
+#include <boost/tree_node/key/height.hpp>
+
+namespace boost { namespace tree_node {
+
+ template <typename NodePointer>
+ inline NodePointer
+ adelson_velskii_landis_balancer::post_insert(NodePointer node_ptr)
+ {
+ return adelson_velskii_landis_balancer::_balance(node_ptr);
+ }
+
+ template <typename Node>
+ inline bool adelson_velskii_landis_balancer::choose_predecessor(Node const& node)
+ {
+ return get(*node.get_right_child_ptr(), height_key()) < get(
+ *node.get_left_child_ptr()
+ , height_key()
+ );
+ }
+
+ template <typename Node>
+ inline bool adelson_velskii_landis_balancer::pre_erase(Node const& node)
+ {
+ return true;
+ }
+
+ template <typename NodePointer>
+ inline NodePointer
+ adelson_velskii_landis_balancer::post_erase_left(NodePointer node_ptr)
+ {
+ return adelson_velskii_landis_balancer::_balance(node_ptr);
+ }
+
+ template <typename NodePointer>
+ inline NodePointer
+ adelson_velskii_landis_balancer::post_erase_right(NodePointer node_ptr)
+ {
+ return adelson_velskii_landis_balancer::_balance(node_ptr);
+ }
+
+ template <typename NodePointer>
+ NodePointer adelson_velskii_landis_balancer::_balance(NodePointer node_ptr)
+ {
+ NodePointer grandparent_ptr;
+
+ for (
+ NodePointer parent_ptr;
+ (parent_ptr = node_ptr->get_parent_ptr()) && (
+ grandparent_ptr = parent_ptr->get_parent_ptr()
+ );
+ node_ptr = parent_ptr
+ )
+ {
+ if (
+ !grandparent_ptr->get_left_child_ptr() || (
+ grandparent_ptr->get_right_child_ptr() && (
+ 1 + get(
+ *grandparent_ptr->get_left_child_ptr()
+ , height_key()
+ ) < get(
+ *grandparent_ptr->get_right_child_ptr()
+ , height_key()
+ )
+ )
+ )
+ )
+ {
+ parent_ptr = grandparent_ptr->get_right_child_ptr();
+
+ if (
+ !parent_ptr->get_right_child_ptr() || (
+ parent_ptr->get_left_child_ptr() && (
+ get(
+ *parent_ptr->get_right_child_ptr()
+ , height_key()
+ ) < get(
+ *parent_ptr->get_left_child_ptr()
+ , height_key()
+ )
+ )
+ )
+ )
+ {
+ parent_ptr = parent_ptr->rotate_right();
+ }
+
+ grandparent_ptr = grandparent_ptr->rotate_left();
+
+ if (!grandparent_ptr->get_parent_ptr())
+ {
+ return grandparent_ptr;
+ }
+ }
+ else if (
+ !grandparent_ptr->get_right_child_ptr() || (
+ grandparent_ptr->get_left_child_ptr() && (
+ 1 + get(
+ *grandparent_ptr->get_right_child_ptr()
+ , height_key()
+ ) < get(
+ *grandparent_ptr->get_left_child_ptr()
+ , height_key()
+ )
+ )
+ )
+ )
+ {
+ parent_ptr = grandparent_ptr->get_left_child_ptr();
+
+ if (
+ !parent_ptr->get_left_child_ptr() || (
+ parent_ptr->get_right_child_ptr() && (
+ get(
+ *parent_ptr->get_left_child_ptr()
+ , height_key()
+ ) < get(
+ *parent_ptr->get_right_child_ptr()
+ , height_key()
+ )
+ )
+ )
+ )
+ {
+ parent_ptr = parent_ptr->rotate_left();
+ }
+
+ grandparent_ptr = grandparent_ptr->rotate_right();
+
+ if (!grandparent_ptr->get_parent_ptr())
+ {
+ return grandparent_ptr;
+ }
+ }
+ }
+
+ return node_ptr;
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_BALANCER_ADELSON_VELSKII_LANDIS_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/balancer/bayer_mccreight.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/balancer/bayer_mccreight.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,99 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_BALANCER_BAYER_MCCREIGHT_HPP_INCLUDED
+#define BOOST_TREE_NODE_BALANCER_BAYER_MCCREIGHT_HPP_INCLUDED
+
+//[reference__bayer_mccreight_balancer
+namespace boost { namespace tree_node {
+
+ template <typename KnuthOrder>
+ struct bayer_mccreight_balancer
+ {
+ template <typename NodePointer>
+ static NodePointer post_insert(NodePointer node_ptr);
+
+ template <typename Node>
+ static bool choose_predecessor(Node const& node);
+
+ template <typename Node>
+ static bool pre_erase(Node const& node);
+
+ template <typename NodePointer>
+ static NodePointer post_erase_left(NodePointer node_ptr);
+
+ template <typename NodePointer>
+ static NodePointer post_erase_right(NodePointer node_ptr);
+ };
+
+ namespace balancer {
+
+ template <typename KnuthOrder>
+ struct bayer_mccreight
+ : ::boost::tree_node::bayer_mccreight_balancer<KnuthOrder>
+ {
+ };
+ } // namespace balancer
+}} // namespace boost::tree_node
+//]
+
+#include <iterator>
+
+namespace boost { namespace tree_node {
+
+ template <typename KnuthOrder>
+ template <typename NodePointer>
+ inline NodePointer
+ bayer_mccreight<KnuthOrder>::post_insert(NodePointer node_ptr)
+ {
+ for (
+ NodePointer parent_ptr;
+ (parent_ptr = node_ptr->get_parent_ptr());
+ node_ptr = parent_ptr;
+ )
+ {
+ if (parent_ptr->size() == KnuthOrder::value)
+ {
+
+ }
+ }
+
+ return node_ptr;
+ }
+
+ template <typename KnuthOrder>
+ template <typename Node>
+ inline bool
+ bayer_mccreight<KnuthOrder>::choose_predecessor(Node const& node)
+ {
+ return true;
+ }
+
+ template <typename KnuthOrder>
+ template <typename Node>
+ inline bool bayer_mccreight<KnuthOrder>::pre_erase(Node const& node)
+ {
+ return true;
+ }
+
+ template <typename KnuthOrder>
+ template <typename NodePointer>
+ inline NodePointer
+ bayer_mccreight<KnuthOrder>::post_erase_left(NodePointer node_ptr)
+ {
+ return node_ptr;
+ }
+
+ template <typename KnuthOrder>
+ template <typename NodePointer>
+ inline NodePointer
+ bayer_mccreight<KnuthOrder>::post_erase_right(NodePointer node_ptr)
+ {
+ return node_ptr;
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_BALANCER_BAYER_MCCREIGHT_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/balancer/null.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/balancer/null.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,71 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_BALANCER_NULL_HPP_INCLUDED
+#define BOOST_TREE_NODE_BALANCER_NULL_HPP_INCLUDED
+
+//[reference__null_balancer
+namespace boost { namespace tree_node {
+
+ struct null_balancer
+ {
+ template <typename NodePointer>
+ static NodePointer post_insert(NodePointer node_ptr);
+
+ template <typename Node>
+ static bool choose_predecessor(Node const& node);
+
+ template <typename Node>
+ static bool pre_erase(Node const& node);
+
+ template <typename NodePointer>
+ static NodePointer post_erase_left(NodePointer node_ptr);
+
+ template <typename NodePointer>
+ static NodePointer post_erase_right(NodePointer node_ptr);
+ };
+
+ namespace balancer {
+
+ typedef ::boost::tree_node::null_balancer null;
+ } // namespace balancer
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename NodePointer>
+ inline NodePointer null_balancer::post_insert(NodePointer node_ptr)
+ {
+ return node_ptr;
+ }
+
+ template <typename Node>
+ inline bool null_balancer::choose_predecessor(Node const& node)
+ {
+ return true;
+ }
+
+ template <typename Node>
+ inline bool null_balancer::pre_erase(Node const& node)
+ {
+ return true;
+ }
+
+ template <typename NodePointer>
+ inline NodePointer null_balancer::post_erase_left(NodePointer node_ptr)
+ {
+ return node_ptr;
+ }
+
+ template <typename NodePointer>
+ inline NodePointer null_balancer::post_erase_right(NodePointer node_ptr)
+ {
+ return node_ptr;
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_BALANCER_NULL_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/balancer/red_black.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/balancer/red_black.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,422 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_BALANCER_RED_BLACK_HPP_INCLUDED
+#define BOOST_TREE_NODE_BALANCER_RED_BLACK_HPP_INCLUDED
+
+//[reference__red_black_balancer
+namespace boost { namespace tree_node {
+
+ struct red_black_balancer
+ {
+ template <typename NodePointer>
+ static NodePointer post_insert(NodePointer node_ptr);
+
+ template <typename Node>
+ static bool choose_predecessor(Node const& node);
+
+ template <typename Node>
+ static bool pre_erase(Node const& node);
+
+ template <typename NodePointer>
+ static NodePointer post_erase_left(NodePointer node_ptr);
+
+ template <typename NodePointer>
+ static NodePointer post_erase_right(NodePointer node_ptr);
+
+ //<-
+ private:
+ template <typename NodePointer>
+ static NodePointer _balance(NodePointer node_ptr);
+ //->
+ };
+
+ namespace balancer {
+
+ typedef ::boost::tree_node::red_black_balancer red_black;
+ } // namespace balancer
+}} // namespace boost::tree_node
+//]
+
+#include <boost/utility/value_init.hpp>
+#include <boost/tree_node/key/red_black_flag.hpp>
+#include <boost/assert.hpp>
+
+namespace boost { namespace tree_node {
+
+ template <typename NodePointer>
+ NodePointer red_black_balancer::post_insert(NodePointer node_ptr)
+ {
+ NodePointer parent_ptr;
+ NodePointer grandparent_ptr;
+ NodePointer uncle_ptr;
+
+ put(*node_ptr, red_flag_key(), true);
+
+ while ((parent_ptr = node_ptr->get_parent_ptr()))
+ {
+ if (get(*parent_ptr, black_flag_key()))
+ {
+ return node_ptr;
+ }
+
+ grandparent_ptr = parent_ptr->get_parent_ptr();
+
+ if (parent_ptr == grandparent_ptr->get_left_child_ptr())
+ {
+ if (
+ (
+ uncle_ptr = grandparent_ptr->get_right_child_ptr()
+ ) && get(*uncle_ptr, red_flag_key())
+ )
+ {
+ put(*parent_ptr, black_flag_key(), true);
+ put(*uncle_ptr, black_flag_key(), true);
+ put(*grandparent_ptr, red_flag_key(), true);
+ node_ptr = grandparent_ptr;
+ continue;
+ }
+ }
+ else // if (parent_ptr == grandparent_ptr->get_right_child_ptr())
+ {
+ if (
+ (
+ uncle_ptr = grandparent_ptr->get_left_child_ptr()
+ ) && get(*uncle_ptr, red_flag_key())
+ )
+ {
+ put(*parent_ptr, black_flag_key(), true);
+ put(*uncle_ptr, black_flag_key(), true);
+ put(*grandparent_ptr, red_flag_key(), true);
+ node_ptr = grandparent_ptr;
+ continue;
+ }
+ }
+
+ if (
+ (node_ptr == parent_ptr->get_right_child_ptr()) && (
+ parent_ptr == grandparent_ptr->get_left_child_ptr()
+ )
+ )
+ {
+ parent_ptr = parent_ptr->rotate_left();
+ node_ptr = node_ptr->get_left_child_ptr();
+ }
+ else if (
+ (node_ptr == parent_ptr->get_left_child_ptr()) && (
+ parent_ptr == grandparent_ptr->get_right_child_ptr()
+ )
+ )
+ {
+ parent_ptr = parent_ptr->rotate_right();
+ node_ptr = node_ptr->get_right_child_ptr();
+ }
+
+ grandparent_ptr = parent_ptr->get_parent_ptr();
+ put(*parent_ptr, black_flag_key(), true);
+ put(*grandparent_ptr, red_flag_key(), true);
+
+ return (node_ptr == parent_ptr->get_left_child_ptr()) ? (
+ grandparent_ptr->rotate_right()
+ ) : grandparent_ptr->rotate_left();
+ }
+
+ put(*node_ptr, black_flag_key(), true);
+ return node_ptr;
+ }
+
+ template <typename Node>
+ inline bool red_black_balancer::choose_predecessor(Node const& node)
+ {
+ typename Node::const_pointer succ_ptr = node.get_right_child_ptr();
+
+ while (succ_ptr->get_left_child_ptr())
+ {
+ succ_ptr = succ_ptr->get_left_child_ptr();
+ }
+
+ return get(*succ_ptr, black_flag_key()) && succ_ptr->empty();
+ }
+
+ template <typename Node>
+ inline bool red_black_balancer::pre_erase(Node const& node)
+ {
+ return get(node, black_flag_key());
+ }
+
+ template <typename NodePointer>
+ NodePointer red_black_balancer::post_erase_left(NodePointer node_ptr)
+ {
+ NodePointer result_ptr = ::boost::initialized_value;
+ NodePointer child_ptr = node_ptr->get_right_child_ptr();
+
+ if (get(*child_ptr, red_flag_key()))
+ {
+std::cout << "Right Sib 5.1" << std::endl;
+ put(*node_ptr, red_flag_key(), true);
+ put(*child_ptr, black_flag_key(), true);
+ result_ptr = node_ptr->rotate_left();
+ child_ptr = node_ptr->get_right_child_ptr();
+ }
+
+ NodePointer grandchild_ptr = child_ptr->get_right_child_ptr();
+
+ if (grandchild_ptr)
+ {
+ BOOST_ASSERT(get(*grandchild_ptr, red_flag_key()));
+std::cout << "Right Sib 5.3.2" << std::endl;
+ put(*grandchild_ptr, black_flag_key(), true);
+ put(
+ *child_ptr
+ , red_flag_key()
+ , get(*node_ptr, red_flag_key())
+ );
+ put(*node_ptr, black_flag_key(), true);
+
+ if (result_ptr)
+ {
+ node_ptr->rotate_left();
+ }
+ else
+ {
+ result_ptr = node_ptr->rotate_left();
+ }
+
+ return result_ptr;
+ }
+
+ if ((grandchild_ptr = child_ptr->get_left_child_ptr()))
+ {
+ BOOST_ASSERT(get(*grandchild_ptr, red_flag_key()));
+std::cout << "Right Sib 5.3.1" << std::endl;
+ put(
+ *(child_ptr = child_ptr->rotate_right())
+ , red_flag_key()
+ , get(*node_ptr, red_flag_key())
+ );
+ put(*node_ptr, black_flag_key(), true);
+
+ if (result_ptr)
+ {
+ node_ptr->rotate_left();
+ }
+ else
+ {
+ result_ptr = node_ptr->rotate_left();
+ }
+
+ return result_ptr;
+ }
+
+std::cout << "Right Sib 5.2" << std::endl;
+ put(*child_ptr, red_flag_key(), true);
+
+ if (result_ptr)
+ {
+ BOOST_ASSERT(get(*node_ptr, red_flag_key()));
+ put(*node_ptr, black_flag_key(), true);
+ return result_ptr;
+ }
+ else if (get(*node_ptr, red_flag_key()))
+ {
+ put(*node_ptr, black_flag_key(), true);
+ return node_ptr;
+ }
+ else
+ {
+ return red_black_balancer::_balance(node_ptr);
+ }
+ }
+
+ template <typename NodePointer>
+ NodePointer red_black_balancer::post_erase_right(NodePointer node_ptr)
+ {
+ NodePointer result_ptr = ::boost::initialized_value;
+ NodePointer child_ptr = node_ptr->get_left_child_ptr();
+
+ if (get(*child_ptr, red_flag_key()))
+ {
+std::cout << "Left Sib 5.1" << std::endl;
+ put(*node_ptr, red_flag_key(), true);
+ put(*child_ptr, black_flag_key(), true);
+ result_ptr = node_ptr->rotate_right();
+ child_ptr = node_ptr->get_left_child_ptr();
+ }
+
+ NodePointer grandchild_ptr = child_ptr->get_left_child_ptr();
+
+ if (grandchild_ptr)
+ {
+ BOOST_ASSERT(get(*grandchild_ptr, red_flag_key()));
+std::cout << "Left Sib 5.3.2" << std::endl;
+ put(*grandchild_ptr, black_flag_key(), true);
+ put(
+ *child_ptr
+ , red_flag_key()
+ , get(*node_ptr, red_flag_key())
+ );
+ put(*node_ptr, black_flag_key(), true);
+
+ if (result_ptr)
+ {
+ node_ptr->rotate_right();
+ }
+ else
+ {
+ result_ptr = node_ptr->rotate_right();
+ }
+
+ return result_ptr;
+ }
+
+ if ((grandchild_ptr = child_ptr->get_right_child_ptr()))
+ {
+ BOOST_ASSERT(get(*grandchild_ptr, red_flag_key()));
+std::cout << "Left Sib 5.3.1" << std::endl;
+ put(
+ *(child_ptr = child_ptr->rotate_left())
+ , red_flag_key()
+ , get(*node_ptr, red_flag_key())
+ );
+ put(*node_ptr, black_flag_key(), true);
+
+ if (result_ptr)
+ {
+ node_ptr->rotate_right();
+ }
+ else
+ {
+ result_ptr = node_ptr->rotate_right();
+ }
+
+ return result_ptr;
+ }
+
+std::cout << "Left Sib 5.2" << std::endl;
+ put(*child_ptr, red_flag_key(), true);
+
+ if (result_ptr)
+ {
+ BOOST_ASSERT(get(*node_ptr, red_flag_key()));
+ put(*node_ptr, black_flag_key(), true);
+ return result_ptr;
+ }
+ else if (get(*node_ptr, red_flag_key()))
+ {
+ put(*node_ptr, black_flag_key(), true);
+ return node_ptr;
+ }
+ else
+ {
+ return red_black_balancer::_balance(node_ptr);
+ }
+ }
+
+ template <typename NodePointer>
+ NodePointer red_black_balancer::_balance(NodePointer node_ptr)
+ {
+ NodePointer parent_ptr;
+ NodePointer sibling_ptr;
+ NodePointer nephew_ptr;
+
+ for (
+ bool is_left;
+ (parent_ptr = node_ptr->get_parent_ptr());
+ node_ptr = parent_ptr
+ )
+ {
+ sibling_ptr = (
+ is_left = (node_ptr == parent_ptr->get_left_child_ptr())
+ ) ? parent_ptr->get_right_child_ptr() : (
+ parent_ptr->get_left_child_ptr()
+ );
+
+ if (get(*sibling_ptr, red_flag_key()))
+ {
+std::cout << "5.1" << std::endl;
+ put(*parent_ptr, red_flag_key(), true);
+ put(*sibling_ptr, black_flag_key(), true);
+
+ if (is_left)
+ {
+ parent_ptr->rotate_left();
+ sibling_ptr = parent_ptr->get_right_child_ptr();
+ }
+ else
+ {
+ parent_ptr->rotate_right();
+ sibling_ptr = parent_ptr->get_left_child_ptr();
+ }
+
+ put(*sibling_ptr, red_flag_key(), true);
+ put(*parent_ptr, black_flag_key(), true);
+ return parent_ptr->get_parent_ptr();
+ }
+
+ nephew_ptr = is_left ? sibling_ptr->get_right_child_ptr() : (
+ sibling_ptr->get_left_child_ptr()
+ );
+
+ if (nephew_ptr)
+ {
+ if (get(*nephew_ptr, red_flag_key()))
+ {
+std::cout << "5.3.2" << std::endl;
+ put(*nephew_ptr, black_flag_key(), true);
+ put(
+ *sibling_ptr
+ , red_flag_key()
+ , get(*parent_ptr, red_flag_key())
+ );
+ put(*parent_ptr, black_flag_key(), true);
+ return is_left ? parent_ptr->rotate_left() : (
+ parent_ptr->rotate_right()
+ );
+ }
+ }
+
+ if (
+ (
+ nephew_ptr = is_left ? (
+ sibling_ptr->get_left_child_ptr()
+ ) : sibling_ptr->get_right_child_ptr()
+ )
+ )
+ {
+ if (get(*nephew_ptr, red_flag_key()))
+ {
+std::cout << "5.3.1" << std::endl;
+ put(
+ *(
+ sibling_ptr = is_left ? (
+ sibling_ptr->rotate_right()
+ ) : sibling_ptr->rotate_left()
+ )
+ , red_flag_key()
+ , get(*parent_ptr, red_flag_key())
+ );
+ put(*parent_ptr, black_flag_key(), true);
+ return is_left ? parent_ptr->rotate_left() : (
+ parent_ptr->rotate_right()
+ );
+ }
+ }
+
+std::cout << "5.2" << std::endl;
+ put(*sibling_ptr, red_flag_key(), true);
+
+ if (get(*parent_ptr, red_flag_key()))
+ {
+ put(*parent_ptr, black_flag_key(), true);
+ return parent_ptr;
+ }
+ }
+
+ return node_ptr;
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_BALANCER_RED_BLACK_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/base.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/base.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,428 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_BASE_HPP_INCLUDED
+#define BOOST_TREE_NODE_BASE_HPP_INCLUDED
+
+#include <boost/config.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/detail/base_pointee.hpp>
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <boost/move/move.hpp>
+#endif
+
+namespace boost { namespace tree_node {
+
+ template <typename Derived>
+ struct tree_node_base
+ : public ::boost::detail::base_pointee<Derived>
+ {
+ typedef typename ::boost::detail::base_pointee<Derived>::pointer
+ pointer;
+ typedef typename ::boost::detail::base_pointee<Derived>::const_pointer
+ const_pointer;
+ typedef void
+ super_t;
+
+ protected:
+ ~tree_node_base();
+
+ //[reference__tree_node_base__clone_metadata_impl
+ void clone_metadata_impl(Derived const& copy);
+ //]
+
+ //[reference__tree_node_base__clone_metadata
+ void clone_metadata(Derived const& copy);
+ //]
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#if defined BOOST_NO_RVALUE_REFERENCES
+ void move_metadata_impl(::boost::rv<Derived>& source);
+
+ void move_metadata(::boost::rv<Derived>& source);
+#else // !defined BOOST_NO_RVALUE_REFERENCES
+ //[reference__tree_node_base__move_metadata_impl
+ void move_metadata_impl(Derived&& source);
+ //]
+
+ //[reference__tree_node_base__move_metadata
+ void move_metadata(Derived&& source);
+ //]
+#endif // BOOST_NO_RVALUE_REFERENCES
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ //[reference__tree_node_base__on_post_emplacement_construct
+ void on_post_emplacement_construct();
+ //]
+
+ //[reference__tree_node_base__on_post_copy_or_move_impl
+ void on_post_copy_or_move_impl();
+ //]
+
+ //[reference__tree_node_base__on_post_copy_or_move
+ void on_post_copy_or_move();
+ //]
+
+ //[reference__tree_node_base__on_post_modify_value_impl
+ template <typename Key>
+ void on_post_modify_value_impl(Key const& key);
+ //]
+
+ //[reference__tree_node_base__on_post_modify_value
+ template <typename Key>
+ void on_post_modify_value(Key const& key);
+ //]
+
+ //[reference__tree_node_base__on_post_propagate_value_impl
+ template <typename Key>
+ void on_post_propagate_value_impl(Key const& key);
+ //]
+
+ //[reference__tree_node_base__on_post_propagate_value
+ template <typename Key>
+ void on_post_propagate_value(Key const& key);
+ //]
+
+ //[reference__tree_node_base__on_post_propagate_value_once_impl
+ template <typename Key>
+ void on_post_propagate_value_once_impl(Key const& key);
+ //]
+
+ //[reference__tree_node_base__on_post_propagate_value_once
+ template <typename Key>
+ void on_post_propagate_value_once(Key const& key);
+ //]
+
+ //[reference__tree_node_base__on_post_inserted_impl__true
+ template <typename Iterator>
+ void on_post_inserted_impl(Iterator position, ::boost::mpl::true_);
+ //]
+
+ //[reference__tree_node_base__on_post_inserted_impl__false
+ template <typename Iterator>
+ void on_post_inserted_impl(Iterator position, ::boost::mpl::false_);
+ //]
+
+ //[reference__tree_node_base__on_post_inserted
+ template <typename Iterator, typename BooleanIntegralConstant>
+ void
+ on_post_inserted(
+ Iterator position
+ , BooleanIntegralConstant does_not_invalidate_child_positions
+ );
+ //]
+
+ //[reference__tree_node_base__on_post_insert_impl__true
+ template <typename Iterator>
+ void
+ on_post_insert_impl(
+ Iterator itr
+ , Iterator itr_end
+ , ::boost::mpl::true_
+ );
+ //]
+
+ //[reference__tree_node_base__on_post_insert_impl__false
+ template <typename Iterator>
+ void
+ on_post_insert_impl(
+ Iterator itr
+ , Iterator itr_end
+ , ::boost::mpl::false_
+ );
+ //]
+
+ //[reference__tree_node_base__on_post_insert
+ template <typename Iterator, typename BooleanIntegralConstant>
+ void
+ on_post_insert(
+ Iterator itr
+ , Iterator itr_end
+ , BooleanIntegralConstant does_not_invalidate_child_positions
+ );
+ //]
+
+ //[reference__tree_node_base__on_post_erase_impl__true
+ void on_post_erase_impl(::boost::mpl::true_);
+ //]
+
+ //[reference__tree_node_base__on_post_erase_impl__false
+ void on_post_erase_impl(::boost::mpl::false_);
+ //]
+
+ //[reference__tree_node_base__on_post_erase
+ template <typename BooleanIntegralConstant>
+ void
+ on_post_erase(
+ BooleanIntegralConstant does_not_invalidate_child_positions
+ );
+ //]
+
+ //[reference__tree_node_base__on_post_clear_impl
+ void on_post_clear_impl();
+ //]
+
+ //[reference__tree_node_base__on_post_clear
+ void on_post_clear();
+ //]
+
+ //[reference__tree_node_base__on_post_rotate_left_impl
+ void on_post_rotate_left_impl();
+ //]
+
+ //[reference__tree_node_base__on_post_rotate_left
+ void on_post_rotate_left();
+ //]
+
+ //[reference__tree_node_base__on_post_rotate_right_impl
+ void on_post_rotate_right_impl();
+ //]
+
+ //[reference__tree_node_base__on_post_rotate_right
+ void on_post_rotate_right();
+ //]
+ };
+
+ template <typename Derived>
+ tree_node_base<Derived>::~tree_node_base()
+ {
+ }
+
+ template <typename Derived>
+ inline void
+ tree_node_base<Derived>::clone_metadata_impl(Derived const& copy)
+ {
+ }
+
+ template <typename Derived>
+ inline void tree_node_base<Derived>::clone_metadata(Derived const& copy)
+ {
+ this->get_derived()->clone_metadata_impl(copy);
+ }
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#if defined BOOST_NO_RVALUE_REFERENCES
+ template <typename Derived>
+ inline void
+ tree_node_base<Derived>::move_metadata_impl(
+ ::boost::rv<Derived>& source
+ )
+ {
+ }
+
+ template <typename Derived>
+ inline void
+ tree_node_base<Derived>::move_metadata(::boost::rv<Derived>& source)
+ {
+ this->get_derived()->move_metadata_impl(source);
+ }
+#else // !defined BOOST_NO_RVALUE_REFERENCES
+ template <typename Derived>
+ inline void tree_node_base<Derived>::move_metadata_impl(Derived&& source)
+ {
+ }
+
+ template <typename Derived>
+ inline void tree_node_base<Derived>::move_metadata(Derived&& source)
+ {
+ this->get_derived()->move_metadata_impl(
+ static_cast<Derived&&>(source)
+ );
+ }
+#endif // BOOST_NO_RVALUE_REFERENCES
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <typename Derived>
+ inline void tree_node_base<Derived>::on_post_emplacement_construct()
+ {
+ }
+
+ template <typename Derived>
+ inline void tree_node_base<Derived>::on_post_copy_or_move_impl()
+ {
+ }
+
+ template <typename Derived>
+ inline void tree_node_base<Derived>::on_post_copy_or_move()
+ {
+ this->get_derived()->on_post_copy_or_move_impl();
+ }
+
+ template <typename Derived>
+ template <typename Key>
+ inline void tree_node_base<Derived>::on_post_modify_value_impl(Key const&)
+ {
+ }
+
+ template <typename Derived>
+ template <typename Key>
+ inline void tree_node_base<Derived>::on_post_modify_value(Key const& key)
+ {
+ this->get_derived()->on_post_modify_value_impl(key);
+ }
+
+ template <typename Derived>
+ template <typename Key>
+ inline void
+ tree_node_base<Derived>::on_post_propagate_value_impl(Key const&)
+ {
+ }
+
+ template <typename Derived>
+ template <typename Key>
+ inline void
+ tree_node_base<Derived>::on_post_propagate_value(Key const& key)
+ {
+ this->get_derived()->on_post_propagate_value_impl(key);
+ }
+
+ template <typename Derived>
+ template <typename Key>
+ inline void
+ tree_node_base<Derived>::on_post_propagate_value_once_impl(Key const&)
+ {
+ }
+
+ template <typename Derived>
+ template <typename Key>
+ inline void
+ tree_node_base<Derived>::on_post_propagate_value_once(Key const& key)
+ {
+ this->get_derived()->on_post_propagate_value_once_impl(key);
+ }
+
+ template <typename Derived>
+ template <typename Iterator>
+ inline void
+ tree_node_base<Derived>::on_post_inserted_impl(
+ Iterator position
+ , ::boost::mpl::true_
+ )
+ {
+ }
+
+ template <typename Derived>
+ template <typename Iterator>
+ inline void
+ tree_node_base<Derived>::on_post_inserted_impl(
+ Iterator position
+ , ::boost::mpl::false_
+ )
+ {
+ }
+
+ template <typename Derived>
+ template <typename Iterator, typename BooleanIntegralConstant>
+ inline void
+ tree_node_base<Derived>::on_post_inserted(
+ Iterator position
+ , BooleanIntegralConstant does_not_invalidate_child_positions
+ )
+ {
+ this->get_derived()->on_post_inserted_impl(
+ position
+ , does_not_invalidate_child_positions
+ );
+ }
+
+ template <typename Derived>
+ template <typename Iterator>
+ inline void
+ tree_node_base<Derived>::on_post_insert_impl(
+ Iterator itr
+ , Iterator itr_end
+ , ::boost::mpl::true_
+ )
+ {
+ }
+
+ template <typename Derived>
+ template <typename Iterator>
+ inline void
+ tree_node_base<Derived>::on_post_insert_impl(
+ Iterator itr
+ , Iterator itr_end
+ , ::boost::mpl::false_
+ )
+ {
+ }
+
+ template <typename Derived>
+ template <typename Iterator, typename BooleanIntegralConstant>
+ inline void
+ tree_node_base<Derived>::on_post_insert(
+ Iterator itr
+ , Iterator itr_end
+ , BooleanIntegralConstant does_not_invalidate_child_positions
+ )
+ {
+ this->get_derived()->on_post_insert_impl(
+ itr
+ , itr_end
+ , does_not_invalidate_child_positions
+ );
+ }
+
+ template <typename Derived>
+ inline void
+ tree_node_base<Derived>::on_post_erase_impl(::boost::mpl::true_)
+ {
+ }
+
+ template <typename Derived>
+ inline void
+ tree_node_base<Derived>::on_post_erase_impl(::boost::mpl::false_)
+ {
+ }
+
+ template <typename Derived>
+ template <typename BooleanIntegralConstant>
+ inline void
+ tree_node_base<Derived>::on_post_erase(
+ BooleanIntegralConstant does_not_invalidate_child_positions
+ )
+ {
+ this->get_derived()->on_post_erase_impl(
+ does_not_invalidate_child_positions
+ );
+ }
+
+ template <typename Derived>
+ inline void tree_node_base<Derived>::on_post_clear_impl()
+ {
+ }
+
+ template <typename Derived>
+ inline void tree_node_base<Derived>::on_post_clear()
+ {
+ this->get_derived()->on_post_clear_impl();
+ }
+
+ template <typename Derived>
+ inline void tree_node_base<Derived>::on_post_rotate_left_impl()
+ {
+ }
+
+ template <typename Derived>
+ inline void tree_node_base<Derived>::on_post_rotate_left()
+ {
+ this->get_derived()->on_post_rotate_left_impl();
+ }
+
+ template <typename Derived>
+ inline void tree_node_base<Derived>::on_post_rotate_right_impl()
+ {
+ }
+
+ template <typename Derived>
+ inline void tree_node_base<Derived>::on_post_rotate_right()
+ {
+ this->get_derived()->on_post_rotate_right_impl();
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_BASE_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/binary_node.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/binary_node.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,3547 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_BINARY_NODE_HPP_INCLUDED
+#define BOOST_TREE_NODE_BINARY_NODE_HPP_INCLUDED
+
+#include <iterator>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/apply_wrap.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/container/scoped_allocator_fwd.hpp>
+#include <boost/tree_node/preprocessor.hpp>
+#include <boost/tree_node/base.hpp>
+#include <boost/tree_node/binary_node_fwd.hpp>
+#include <boost/tree_node/traits/binary_node_fwd.hpp>
+#include <boost/tree_node/intrinsic/has_key.hpp>
+#include <boost/tree_node/intrinsic/get_keys.hpp>
+#include <boost/tree_node/iterator/depth_first_descendant.hpp>
+#include <boost/utility/value_init.hpp>
+#include <boost/assert.hpp>
+
+#include <boost/tree_node/_detail/config_begin.hpp>
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <boost/type_traits/is_pod.hpp>
+#include <boost/move/move.hpp>
+#include <boost/container/allocator_traits.hpp>
+
+namespace boost {
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ struct is_POD<
+ ::boost::tree_node::binary_node_base<Derived,T,Size,Allocator>
+ > : ::boost::false_type
+ {
+ };
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ struct is_pod<
+ ::boost::tree_node::binary_node_base<Derived,T,Size,Allocator>
+ > : ::boost::false_type
+ {
+ };
+} // namespace boost
+#endif // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/transform_view.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/iterator/key_of.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/support/category_of.hpp>
+
+namespace boost { namespace tree_node { namespace result_of {
+
+ template <
+ typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ , typename FusionKey
+ >
+ struct has_key_impl<
+ binary_node_base<Derived,T,Size,Allocator>
+ , FusionKey
+ > : ::boost::mpl::eval_if<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::has_key<T,FusionKey>
+ , ::std::tr1::is_same<FusionKey,data_key>
+ >::type
+ {
+ };
+
+ template <
+ typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ >
+ struct get_keys_impl<binary_node_base<Derived,T,Size,Allocator> >
+ : ::boost::mpl::eval_if<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::transform_view<
+ T
+ , ::boost::fusion::result_of::key_of< ::boost::mpl::_>
+ >
+ , ::boost::mpl::vector1<data_key>
+ >
+ {
+ };
+}}} // namespace boost::tree_node::result_of
+#endif // defined BOOST_TREE_NODE_CAN_USE_FUSION
+
+namespace boost { namespace tree_node { namespace _detail {
+
+ template <typename Node, typename IsReverse>
+ class binary_child_iterator
+ {
+#if !defined BOOST_NO_SFINAE
+ struct enabler
+ {
+ };
+#endif
+
+ public:
+ typedef ::std::random_access_iterator_tag iterator_category;
+ typedef Node value_type;
+ typedef ::std::ptrdiff_t difference_type;
+ typedef value_type* pointer;
+ typedef value_type& reference;
+
+ private:
+ class proxy
+ {
+ binary_child_iterator _itr;
+
+ public:
+ proxy(pointer const& p, difference_type n);
+
+ operator binary_child_iterator&();
+ };
+
+ public: // Should be private, but conversion ctor won't work.
+ pointer _current;
+ pointer _parent;
+
+ public:
+ binary_child_iterator();
+
+ explicit binary_child_iterator(pointer const& p);
+
+ binary_child_iterator(pointer const& p, bool p_is_child);
+
+ template <typename N, typename I>
+ binary_child_iterator(
+ binary_child_iterator<N,I> const& other
+#if !defined BOOST_NO_SFINAE
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type = enabler()
+#endif
+ );
+
+ reference operator*() const;
+
+ pointer operator->() const;
+
+ proxy operator[](difference_type n) const;
+
+ binary_child_iterator& operator++();
+
+ binary_child_iterator operator++(int);
+
+ binary_child_iterator& operator--();
+
+ binary_child_iterator operator--(int);
+
+ binary_child_iterator& operator+=(difference_type n);
+
+ binary_child_iterator operator+(difference_type n) const;
+
+ binary_child_iterator& operator-=(difference_type n);
+
+ binary_child_iterator operator-(difference_type n) const;
+
+ private:
+ void _iterate(pointer const& sibling);
+
+ void _advance(difference_type n);
+
+ template <typename N1, typename I1, typename N2, typename I2>
+ friend
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if< ::boost::mpl::equal_to<I1,I2>,bool>::type
+#endif
+ operator==(
+ binary_child_iterator<N1,I1> const& lhs
+ , binary_child_iterator<N2,I2> const& rhs
+ );
+
+ template <typename N1, typename I1, typename N2, typename I2>
+ friend
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if< ::boost::mpl::equal_to<I1,I2>,bool>::type
+#endif
+ operator<(
+ binary_child_iterator<N1,I1> const& lhs
+ , binary_child_iterator<N2,I2> const& rhs
+ );
+
+ template <typename N1, typename I1, typename N2, typename I2>
+ friend ::std::ptrdiff_t
+ operator-(
+ binary_child_iterator<N1,I1> const& lhs
+ , binary_child_iterator<N2,I2> const& rhs
+ );
+ };
+
+ template <typename Node, typename IsReverse>
+ binary_child_iterator<Node,IsReverse>::proxy::proxy(
+ pointer const& p
+ , difference_type n
+ ) : _itr(p, true)
+ {
+ this->_itr._advance(n);
+ }
+
+ template <typename Node, typename IsReverse>
+ inline binary_child_iterator<
+ Node
+ , IsReverse
+ >::proxy::operator binary_child_iterator&()
+ {
+ return this->_itr;
+ }
+
+ template <typename Node, typename IsReverse>
+ binary_child_iterator<Node,IsReverse>::binary_child_iterator()
+ : _current(::boost::initialized_value)
+ , _parent(::boost::initialized_value)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ binary_child_iterator<Node,IsReverse>::binary_child_iterator(
+ pointer const& p
+ , bool p_is_child
+ ) : _current(
+ p_is_child ? p : IsReverse::value ? (
+ p->get_right_child_ptr()
+ ? p->get_right_child_ptr()
+ : p->get_left_child_ptr()
+ ) : (
+ p->get_left_child_ptr()
+ ? p->get_left_child_ptr()
+ : p->get_right_child_ptr()
+ )
+ )
+ , _parent(p_is_child ? p->get_parent_ptr() : p)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ binary_child_iterator<Node,IsReverse>::binary_child_iterator(
+ pointer const& p
+ ) : _current(::boost::initialized_value), _parent(p)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ binary_child_iterator<Node,IsReverse>::binary_child_iterator(
+ binary_child_iterator<N,I> const& other
+#if !defined BOOST_NO_SFINAE
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type
+#endif
+ ) : _current(other._current), _parent(other._parent)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ inline typename binary_child_iterator<Node,IsReverse>::reference
+ binary_child_iterator<Node,IsReverse>::operator*() const
+ {
+ return *this->_current;
+ }
+
+ template <typename Node, typename IsReverse>
+ inline typename binary_child_iterator<Node,IsReverse>::pointer
+ binary_child_iterator<Node,IsReverse>::operator->() const
+ {
+ return this->_current;
+ }
+
+ template <typename Node, typename IsReverse>
+ inline typename binary_child_iterator<Node,IsReverse>::proxy
+ binary_child_iterator<Node,IsReverse>::operator[](
+ difference_type n
+ ) const
+ {
+ return proxy(this->_current, n);
+ }
+
+ template <typename Node, typename IsReverse>
+ inline binary_child_iterator<Node,IsReverse>&
+ binary_child_iterator<Node,IsReverse>::operator++()
+ {
+ this->_iterate(
+ IsReverse::value
+ ? this->_parent->get_left_child_ptr()
+ : this->_parent->get_right_child_ptr()
+ );
+ return *this;
+ }
+
+ template <typename Node, typename IsReverse>
+ binary_child_iterator<Node,IsReverse>
+ binary_child_iterator<Node,IsReverse>::operator++(int)
+ {
+ binary_child_iterator itr(*this);
+ ++(*this);
+ return itr;
+ }
+
+ template <typename Node, typename IsReverse>
+ inline binary_child_iterator<Node,IsReverse>&
+ binary_child_iterator<Node,IsReverse>::operator--()
+ {
+ if (this->_current)
+ {
+ this->_iterate(
+ IsReverse::value
+ ? this->_parent->get_right_child_ptr()
+ : this->_parent->get_left_child_ptr()
+ );
+ }
+ else if (IsReverse::value)
+ {
+ this->_current = this->_parent->get_left_child_ptr();
+
+ if (!this->_current)
+ {
+ this->_current = this->_parent->get_right_child_ptr();
+ }
+ }
+ else
+ {
+ this->_current = this->_parent->get_right_child_ptr();
+
+ if (!this->_current)
+ {
+ this->_current = this->_parent->get_left_child_ptr();
+ }
+ }
+
+ BOOST_ASSERT_MSG(this->_current, "Result not dereferenceable.");
+ return *this;
+ }
+
+ template <typename Node, typename IsReverse>
+ binary_child_iterator<Node,IsReverse>
+ binary_child_iterator<Node,IsReverse>::operator--(int)
+ {
+ binary_child_iterator itr(*this);
+ --(*this);
+ return itr;
+ }
+
+ template <typename Node, typename IsReverse>
+ inline binary_child_iterator<Node,IsReverse>&
+ binary_child_iterator<Node,IsReverse>::operator+=(difference_type n)
+ {
+ this->_advance(n);
+ return *this;
+ }
+
+ template <typename Node, typename IsReverse>
+ binary_child_iterator<Node,IsReverse>
+ binary_child_iterator<Node,IsReverse>::operator+(
+ difference_type n
+ ) const
+ {
+ binary_child_iterator itr(*this);
+ itr += n;
+ return itr;
+ }
+
+ template <typename Node, typename IsReverse>
+ inline binary_child_iterator<Node,IsReverse>&
+ binary_child_iterator<Node,IsReverse>::operator-=(difference_type n)
+ {
+ this->_advance(-n);
+ return *this;
+ }
+
+ template <typename Node, typename IsReverse>
+ binary_child_iterator<Node,IsReverse>
+ binary_child_iterator<Node,IsReverse>::operator-(
+ difference_type n
+ ) const
+ {
+ binary_child_iterator itr(*this);
+ itr -= n;
+ return itr;
+ }
+
+ template <typename Node, typename IsReverse>
+ inline void
+ binary_child_iterator<Node,IsReverse>::_iterate(pointer const& sibling)
+ {
+ this->_current = (
+ this->_current == sibling
+ ) ? ::boost::initialized_value : sibling;
+ }
+
+ template <typename Node, typename IsReverse>
+ inline void
+ binary_child_iterator<Node,IsReverse>::_advance(difference_type n)
+ {
+ switch (n)
+ {
+ case -2:
+ {
+ BOOST_ASSERT_MSG(
+ (
+ IsReverse::value ? (
+ (
+ this->_current == (
+ this->_parent->get_left_child_ptr()
+ )
+ ) && this->_parent->get_right_child_ptr()
+ ) : (
+ (
+ this->_current == (
+ this->_parent->get_right_child_ptr()
+ )
+ ) && this->_parent->get_left_child_ptr()
+ )
+ )
+ , "n must be greater than -2."
+ );
+
+ this->_current = ::boost::initialized_value;
+ break;
+ }
+
+ case -1:
+ {
+ --(*this);
+ break;
+ }
+
+ case 0:
+ {
+ break;
+ }
+
+ case 1:
+ {
+ ++(*this);
+ break;
+ }
+
+ case 2:
+ {
+ BOOST_ASSERT_MSG(
+ (
+ IsReverse::value ? (
+ (
+ this->_current == (
+ this->_parent->get_right_child_ptr()
+ )
+ ) && this->_parent->get_left_child_ptr()
+ ) : (
+ (
+ this->_current == (
+ this->_parent->get_left_child_ptr()
+ )
+ ) && this->_parent->get_right_child_ptr()
+ )
+ )
+ , "n must be less than 2."
+ );
+
+ this->_current = ::boost::initialized_value;
+ break;
+ }
+
+ default:
+ {
+ BOOST_ASSERT_MSG(false, "|n| must be less than 3.");
+ }
+ }
+ }
+
+ template <typename Node1, typename IsR1, typename Node2, typename IsR2>
+ inline
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if< ::boost::mpl::equal_to<IsR1,IsR2>,bool>::type
+#endif
+ operator==(
+ binary_child_iterator<Node1,IsR1> const& lhs
+ , binary_child_iterator<Node2,IsR2> const& rhs
+ )
+ {
+ return lhs._current == rhs._current;
+ }
+
+ template <typename Node1, typename IsR1, typename Node2, typename IsR2>
+ inline
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if< ::boost::mpl::equal_to<IsR1,IsR2>,bool>::type
+#endif
+ operator!=(
+ binary_child_iterator<Node1,IsR1> const& lhs
+ , binary_child_iterator<Node2,IsR2> const& rhs
+ )
+ {
+ return !(lhs == rhs);
+ }
+
+ template <typename Node1, typename IsR1, typename Node2, typename IsR2>
+ inline
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if< ::boost::mpl::equal_to<IsR1,IsR2>,bool>::type
+#endif
+ operator<(
+ binary_child_iterator<Node1,IsR1> const& lhs
+ , binary_child_iterator<Node2,IsR2> const& rhs
+ )
+ {
+ BOOST_ASSERT_MSG(lhs._parent, "lhs is unreachable.");
+ BOOST_ASSERT_MSG(rhs._parent, "rhs is unreachable.");
+ BOOST_ASSERT_MSG(
+ rhs._parent == lhs._parent
+ , "Neither iterator is reachable from one other."
+ );
+
+ if (lhs._current)
+ {
+ if (rhs._current)
+ {
+ return rhs._current == lhs._parent->get_right_child_ptr();
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ template <typename Node1, typename IsR1, typename Node2, typename IsR2>
+ inline
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if< ::boost::mpl::equal_to<IsR1,IsR2>,bool>::type
+#endif
+ operator>(
+ binary_child_iterator<Node1,IsR1> const& lhs
+ , binary_child_iterator<Node2,IsR2> const& rhs
+ )
+ {
+ return rhs < lhs;
+ }
+
+ template <typename Node1, typename IsR1, typename Node2, typename IsR2>
+ inline
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if< ::boost::mpl::equal_to<IsR1,IsR2>,bool>::type
+#endif
+ operator<=(
+ binary_child_iterator<Node1,IsR1> const& lhs
+ , binary_child_iterator<Node2,IsR2> const& rhs
+ )
+ {
+ return !(rhs < lhs);
+ }
+
+ template <typename Node1, typename IsR1, typename Node2, typename IsR2>
+ inline
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if< ::boost::mpl::equal_to<IsR1,IsR2>,bool>::type
+#endif
+ operator>=(
+ binary_child_iterator<Node1,IsR1> const& lhs
+ , binary_child_iterator<Node2,IsR2> const& rhs
+ )
+ {
+ return !(lhs < rhs);
+ }
+
+ template <typename Node, typename IsReverse>
+ inline binary_child_iterator<Node,IsReverse>
+ operator+(
+ typename binary_child_iterator<Node,IsReverse>::difference_type n
+ , binary_child_iterator<Node,IsReverse> const& itr
+ )
+ {
+ return itr + n;
+ }
+
+ template <typename Node1, typename IsR1, typename Node2, typename IsR2>
+ inline ::std::ptrdiff_t
+ operator-(
+ binary_child_iterator<Node1,IsR1> const& lhs
+ , binary_child_iterator<Node2,IsR2> const& rhs
+ )
+ {
+ BOOST_ASSERT_MSG(lhs._parent, "lhs is unreachable.");
+ BOOST_ASSERT_MSG(rhs._parent, "rhs is unreachable.");
+ BOOST_ASSERT_MSG(
+ rhs._parent == lhs._parent
+ , "Neither iterator is reachable from one other."
+ );
+
+ if (lhs._current == rhs._current)
+ {
+ return 0;
+ }
+ else if (lhs._current)
+ {
+ if (rhs._current)
+ {
+ return (
+ rhs._current == lhs._parent->get_left_child_ptr()
+ ) ? 1 : -1;
+ }
+ else
+ {
+ return (
+ lhs._parent->get_left_child_ptr() && (
+ lhs._parent->get_right_child_ptr()
+ )
+ ) ? 2 : 1;
+ }
+ }
+ else
+ {
+ return (
+ rhs._parent->get_left_child_ptr() && (
+ rhs._parent->get_right_child_ptr()
+ )
+ ) ? -2 : -1;
+ }
+ }
+}}} // namespace boost::tree_node::_detail
+
+namespace boost { namespace tree_node {
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ class binary_node_base
+ : public
+ //[reference__binary_node_base__bases
+ tree_node_base<Derived>
+ //]
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ , public data_key
+#endif
+ , private ::boost::noncopyable
+ {
+ template <typename D>
+ friend struct binary_node_traits;
+
+ typedef binary_node_base<Derived,T,Size,Allocator> self;
+
+ public:
+ //[reference__binary_node_base__super_t
+ typedef tree_node_base<Derived> super_t;
+ //]
+
+ //[reference__binary_node_base__traits
+ struct traits
+ {
+ typedef T
+ data_type;
+ typedef typename ::std::tr1::remove_reference<Allocator>::type
+ allocator;
+ typedef typename ::boost::mpl::if_<
+ ::std::tr1::is_reference<Allocator>
+ , Allocator
+ , typename ::std::tr1::add_reference<
+ typename ::std::tr1::add_const<Allocator>::type
+ >::type
+ >::type
+ allocator_reference;
+ };
+ //]
+
+ //[reference__binary_node_base__pointer
+ typedef typename super_t::pointer pointer;
+ //]
+
+ //[reference__binary_node_base__const_pointer
+ typedef typename super_t::const_pointer const_pointer;
+ //]
+
+ typedef _detail::binary_child_iterator<Derived,::boost::mpl::false_>
+ iterator;
+ typedef _detail::binary_child_iterator<
+ Derived const
+ , ::boost::mpl::false_
+ >
+ const_iterator;
+ typedef _detail::binary_child_iterator<Derived,::boost::mpl::true_>
+ reverse_iterator;
+ typedef _detail::binary_child_iterator<
+ Derived const
+ , ::boost::mpl::true_
+ >
+ const_reverse_iterator;
+
+ //[reference__binary_node_base__size_type
+ typedef Size size_type;
+ //]
+
+ private:
+ typename traits::data_type _data;
+ Allocator _allocator;
+ pointer _left_child;
+ pointer _right_child;
+ pointer _parent;
+
+ protected:
+ //[reference__binary_node_base__derived_copy_ctor
+ binary_node_base(Derived const& copy);
+ //]
+
+ //[reference__binary_node_base__derived_copy_ctor_w_allocator
+ binary_node_base(
+ Derived const& copy
+ , typename traits::allocator_reference allocator
+ );
+ //]
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ BOOST_PP_FOR(
+ ((0), binary_node_base)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED_WITH_DATA
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC_WITH_DATA
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_FWD_DECL
+ )
+
+ BOOST_PP_FOR(
+ ((0), binary_node_base)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED_WITH_DATA
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC_WITH_DATA
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_W_ALLOC_FWD_DECL
+ )
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ binary_node_base(BOOST_RV_REF(Derived) source);
+
+ binary_node_base(
+ BOOST_RV_REF(Derived) source
+ , typename traits::allocator_reference allocator
+ );
+
+#if defined BOOST_CONTAINER_PERFECT_FORWARDING
+ //[reference__binary_node_base__emplacement_ctor
+ template <typename ...Args>
+ explicit binary_node_base(Args&& ...args);
+ //]
+
+ //[reference__binary_node_base__emplacement_ctor_w_allocator
+ template <typename ...Args>
+ explicit binary_node_base(
+ ::boost::container::allocator_arg_t
+ , typename traits::allocator_reference allocator
+ , Args&& ...args
+ );
+ //]
+#else // !defined BOOST_CONTAINER_PERFECT_FORWARDING
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_FWD_DECL
+ , binary_node_base
+ )
+
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_W_ALLOC_FWD_DECL
+ , binary_node_base
+ )
+#endif // BOOST_CONTAINER_PERFECT_FORWARDING
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ ~binary_node_base();
+
+ //[reference__binary_node_base__clone_descendants
+ void clone_descendants(Derived const& copy);
+ //]
+
+ //[reference__binary_node_base__copy_assign
+ void copy_assign(Derived const& copy);
+ //]
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ void move_descendants(BOOST_RV_REF(Derived) source);
+
+ void move_assign(BOOST_RV_REF(Derived) source);
+#endif
+
+ //[reference__binary_node_base__on_post_assign
+ void on_post_assign();
+ //]
+
+ public:
+ //[reference__binary_node_base__key_value_operator__const
+ typename traits::data_type const& operator[](data_key const&) const;
+
+//<-
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+//->
+ template <typename FusionKey>
+ typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ binary_node_base<Derived,T,Size,Allocator>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T const,FusionKey>
+ >::type
+ operator[](FusionKey const&) const;
+//<-
+#endif // defined BOOST_TREE_NODE_CAN_USE_FUSION
+//->
+ //]
+
+ //[reference__binary_node_base__key_value_operator
+ typename traits::data_type& operator[](data_key const&);
+
+//<-
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+//->
+ template <typename FusionKey>
+ typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ binary_node_base<Derived,T,Size,Allocator>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T,FusionKey>
+ >::type
+ operator[](FusionKey const&);
+//<-
+#endif // defined BOOST_TREE_NODE_CAN_USE_FUSION
+//->
+ //]
+
+ //[reference__binary_node_base__get_parent_ptr__const
+ const_pointer get_parent_ptr() const;
+ //]
+
+ //[reference__binary_node_base__get_parent_ptr
+ pointer get_parent_ptr();
+ //]
+
+ //[reference__binary_node_base__get_left_child_ptr__const
+ const_pointer get_left_child_ptr() const;
+ //]
+
+ //[reference__binary_node_base__get_left_child_ptr
+ pointer get_left_child_ptr();
+ //]
+
+ //[reference__binary_node_base__get_right_child_ptr__const
+ const_pointer get_right_child_ptr() const;
+ //]
+
+ //[reference__binary_node_base__get_right_child_ptr
+ pointer get_right_child_ptr();
+ //]
+
+ //[reference__binary_node_base__cbegin
+ const_iterator cbegin() const;
+ const_iterator begin() const;
+ //]
+
+ //[reference__binary_node_base__begin
+ iterator begin();
+ //]
+
+ //[reference__binary_node_base__cend
+ const_iterator cend() const;
+ const_iterator end() const;
+ //]
+
+ //[reference__binary_node_base__end
+ iterator end();
+ //]
+
+ //[reference__binary_node_base__crbegin
+ const_reverse_iterator crbegin() const;
+ const_reverse_iterator rbegin() const;
+ //]
+
+ //[reference__binary_node_base__rbegin
+ reverse_iterator rbegin();
+ //]
+
+ //[reference__binary_node_base__crend
+ const_reverse_iterator crend() const;
+ const_reverse_iterator rend() const;
+ //]
+
+ //[reference__binary_node_base__rend
+ reverse_iterator rend();
+ //]
+
+ //[reference__binary_node_base__size
+ size_type size() const;
+ //]
+
+ //[reference__binary_node_base__empty
+ bool empty() const;
+ //]
+
+ //[reference__binary_node_base__clear
+ void clear();
+ //]
+
+ //[reference__binary_node_base__insert_left
+ iterator insert_left(Derived const& child);
+ //]
+
+ //[reference__binary_node_base__insert_right
+ iterator insert_right(Derived const& child);
+ //]
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ iterator \
+ emplace_left( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ iterator \
+ emplace_right( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ pointer \
+ emplace_parent_of_left( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ pointer \
+ emplace_parent_of_right( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#elif defined BOOST_CONTAINER_PERFECT_FORWARDING
+ //[reference__binary_node_base__emplace_left
+ template <typename ...Args>
+ iterator emplace_left(Args&& ...args);
+ //]
+
+ //[reference__binary_node_base__emplace_right
+ template <typename ...Args>
+ iterator emplace_right(Args&& ...args);
+ //]
+
+ //[reference__binary_node_base__emplace_parent_of_left
+ template <typename ...Args>
+ pointer emplace_parent_of_left(Args&& ...args);
+ //]
+
+ //[reference__binary_node_base__emplace_parent_of_right
+ template <typename ...Args>
+ pointer emplace_parent_of_right(Args&& ...args);
+ //]
+#else // partial template specialization support, imperfect forwarding
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ iterator \
+ emplace_left( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ iterator \
+ emplace_right( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ pointer \
+ emplace_parent_of_left( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ pointer \
+ emplace_parent_of_right( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // compiler defect handling
+
+ //[reference__binary_node_base__rotate_left
+ pointer rotate_left();
+ //]
+
+ //[reference__binary_node_base__rotate_right
+ pointer rotate_right();
+ //]
+
+ //[reference__binary_node_base__erase_left
+ bool erase_left();
+ //]
+
+ //[reference__binary_node_base__erase_right
+ bool erase_right();
+ //]
+
+ private:
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ static typename traits::allocator_reference
+ _construct_from(
+ typename traits::allocator_reference allocator
+ , ::std::tr1::true_type
+ );
+
+ static Allocator
+ _construct_from(
+ typename traits::allocator_reference allocator
+ , ::std::tr1::false_type
+ );
+#endif
+
+ static bool
+ _clone_data(
+ pointer& p
+ , const_pointer const& c_p
+ , Allocator& allocator
+ );
+
+ static bool
+ _move(pointer& dest_p, pointer& src_p, Allocator& allocator);
+
+ static void _destroy(pointer const& p, Allocator& allocator);
+
+ static bool _erase(pointer& p, Allocator& allocator);
+
+ static iterator _on_post_inserted(pointer const& child);
+
+ void _clone_descendants(Derived const& copy);
+
+ void _move_descendants(Derived& source);
+
+ void _on_post_modify_value(data_key const& key);
+
+ void _set_parent_ptr(pointer p);
+
+ void _set_left_child_ptr(pointer p);
+
+ void _set_right_child_ptr(pointer p);
+
+ template <typename D, typename T0, typename S, typename A, typename V>
+ friend void
+ put(binary_node_base<D,T0,S,A>&, data_key const&, V const&);
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+ template <typename FusionKey>
+ void _on_post_modify_value(FusionKey const& key);
+
+ template <
+ typename D
+ , typename T0
+ , typename S
+ , typename A
+ , typename FK
+ , typename V
+ >
+ friend void
+ put(
+ binary_node_base<D,T0,S,A>& node
+ , FK const& key
+ , V const& value
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T0>::type
+ , ::boost::fusion::traits::is_associative<T0>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<binary_node_base<D,T0,S,A>,FK>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::true_
+ >::type
+ );
+#endif // defined BOOST_TREE_NODE_CAN_USE_FUSION
+ };
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ binary_node_base<Derived,T,Size,Allocator>::binary_node_base(
+ Derived const& copy
+ ) : _data(copy._data)
+ , _allocator(
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ copy._allocator
+#else
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::select_on_container_copy_construction(copy._allocator)
+#endif
+ )
+ , _left_child(::boost::initialized_value)
+ , _right_child(::boost::initialized_value)
+ , _parent(::boost::initialized_value)
+ {
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ binary_node_base<Derived,T,Size,Allocator>::binary_node_base(
+ Derived const& copy
+ , typename traits::allocator_reference allocator
+ ) : _data(copy._data)
+ , _allocator(
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ allocator
+#else
+ this->_construct_from(
+ allocator
+ , typename ::std::tr1::is_reference<Allocator>::type()
+ )
+#endif
+ )
+ , _left_child(::boost::initialized_value)
+ , _right_child(::boost::initialized_value)
+ , _parent(::boost::initialized_value)
+ {
+ }
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename Derived \
+ , typename T \
+ , typename Size \
+ , typename Allocator \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ binary_node_base<Derived,T,Size,Allocator>::binary_node_base( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) : _data(BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p)) \
+ , _allocator() \
+ , _left_child(::boost::initialized_value) \
+ , _right_child(::boost::initialized_value) \
+ , _parent(::boost::initialized_value) \
+ { \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename Derived \
+ , typename T \
+ , typename Size \
+ , typename Allocator \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ binary_node_base<Derived,T,Size,Allocator>::binary_node_base( \
+ ::boost::container::allocator_arg_t \
+ , typename traits::allocator_reference allocator \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) : _data(BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p)) \
+ , _allocator( \
+ this->_construct_from( \
+ allocator \
+ , typename ::std::tr1::is_reference<Allocator>::type() \
+ ) \
+ ) \
+ , _left_child(::boost::initialized_value) \
+ , _right_child(::boost::initialized_value) \
+ , _parent(::boost::initialized_value) \
+ { \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ binary_node_base<Derived,T,Size,Allocator>::binary_node_base(
+ BOOST_RV_REF(Derived) source
+ ) : _data(::boost::move(source._data))
+ , _allocator(::boost::move(source._allocator))
+ , _left_child(source._left_child)
+ , _right_child(source._right_child)
+ , _parent(::boost::initialized_value)
+ {
+ source._left_child = source._right_child = ::boost::initialized_value;
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ binary_node_base<Derived,T,Size,Allocator>::binary_node_base(
+ BOOST_RV_REF(Derived) source
+ , typename traits::allocator_reference allocator
+ ) : _data(::boost::move(source._data))
+ , _allocator(
+ this->_construct_from(
+ allocator
+ , typename ::std::tr1::is_reference<Allocator>::type()
+ )
+ )
+ , _left_child(source._left_child)
+ , _right_child(source._right_child)
+ , _parent(::boost::initialized_value)
+ {
+ source._left_child = source._right_child = ::boost::initialized_value;
+ }
+
+#if defined BOOST_CONTAINER_PERFECT_FORWARDING
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ template <typename ...Args>
+ binary_node_base<Derived,T,Size,Allocator>::binary_node_base(
+ Args&& ...args
+ ) : _data(::boost::forward<Args>(args)...)
+ , _allocator()
+ , _left_child(::boost::initialized_value)
+ , _right_child(::boost::initialized_value)
+ , _parent(::boost::initialized_value)
+ {
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ template <typename ...Args>
+ binary_node_base<Derived,T,Size,Allocator>::binary_node_base(
+ ::boost::container::allocator_arg_t
+ , typename traits::allocator_reference allocator
+ , Args&& ...args
+ ) : _data(::boost::forward<Args>(args)...)
+ , _allocator(
+ this->_construct_from(
+ allocator
+ , typename ::std::tr1::is_reference<Allocator>::type()
+ )
+ )
+ , _left_child(::boost::initialized_value)
+ , _right_child(::boost::initialized_value)
+ , _parent(::boost::initialized_value)
+ {
+ }
+#else // !defined BOOST_CONTAINER_PERFECT_FORWARDING
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename Derived \
+ , typename T \
+ , typename Size \
+ , typename Allocator \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ binary_node_base<Derived,T,Size,Allocator>::binary_node_base( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) : _data( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ) \
+ , _allocator() \
+ , _left_child(::boost::initialized_value) \
+ , _right_child(::boost::initialized_value) \
+ , _parent(::boost::initialized_value) \
+ { \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename Derived \
+ , typename T \
+ , typename Size \
+ , typename Allocator \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ binary_node_base<Derived,T,Size,Allocator>::binary_node_base( \
+ ::boost::container::allocator_arg_t \
+ , typename traits::allocator_reference allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) : _data( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ) \
+ , _allocator( \
+ this->_construct_from( \
+ allocator \
+ , typename ::std::tr1::is_reference<Allocator>::type() \
+ ) \
+ ) \
+ , _left_child(::boost::initialized_value) \
+ , _right_child(::boost::initialized_value) \
+ , _parent(::boost::initialized_value) \
+ { \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // BOOST_CONTAINER_PERFECT_FORWARDING
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ binary_node_base<Derived,T,Size,Allocator>::~binary_node_base()
+ {
+ if (this->_left_child)
+ {
+ self::_destroy(this->_left_child, this->_allocator);
+ }
+
+ if (this->_right_child)
+ {
+ self::_destroy(this->_right_child, this->_allocator);
+ }
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline void
+ binary_node_base<Derived,T,Size,Allocator>::clone_descendants(
+ Derived const& copy
+ )
+ {
+ this->_clone_descendants(copy);
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ void
+ binary_node_base<Derived,T,Size,Allocator>::copy_assign(
+ Derived const& copy
+ )
+ {
+ Derived twin(copy._data);
+
+ twin._clone_descendants(copy);
+ this->_data = twin._data;
+ this->_move_descendants(twin);
+ this->clone_metadata(copy);
+ }
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline void
+ binary_node_base<Derived,T,Size,Allocator>::move_descendants(
+ BOOST_RV_REF(Derived) source
+ )
+ {
+ if (this->_left_child)
+ {
+ this->_left_child->_parent = this->get_derived();
+ }
+
+ if (this->_right_child)
+ {
+ this->_right_child->_parent = this->get_derived();
+ }
+
+ source.on_post_clear();
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline void
+ binary_node_base<Derived,T,Size,Allocator>::move_assign(
+ BOOST_RV_REF(Derived) source
+ )
+ {
+ this->_data = ::boost::move(source._data);
+ this->_move_descendants(static_cast<Derived&>(source));
+#if defined BOOST_NO_RVALUE_REFERENCES
+ this->move_metadata(source);
+#else
+ this->move_metadata(static_cast<Derived&&>(source));
+#endif
+ source.on_post_clear();
+ }
+#endif // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline void
+ binary_node_base<Derived,T,Size,Allocator>::on_post_assign()
+ {
+ if (this->_parent)
+ {
+ this->_parent->on_post_propagate_value(data_key());
+ }
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<
+ Derived
+ , T
+ , Size
+ , Allocator
+ >::traits::data_type const&
+ binary_node_base<Derived,T,Size,Allocator>::operator[](
+ data_key const&
+ ) const
+ {
+ return this->_data;
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<
+ Derived
+ , T
+ , Size
+ , Allocator
+ >::traits::data_type&
+ binary_node_base<Derived,T,Size,Allocator>::operator[](data_key const&)
+ {
+ return this->_data;
+ }
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ template <typename FusionKey>
+ inline typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ binary_node_base<Derived,T,Size,Allocator>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T const,FusionKey>
+ >::type
+ binary_node_base<Derived,T,Size,Allocator>::operator[](
+ FusionKey const&
+ ) const
+ {
+ return ::boost::fusion::at_key<FusionKey>(this->_data);
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ template <typename FusionKey>
+ inline typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ binary_node_base<Derived,T,Size,Allocator>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T,FusionKey>
+ >::type
+ binary_node_base<Derived,T,Size,Allocator>::operator[](
+ FusionKey const&
+ )
+ {
+ return ::boost::fusion::at_key<FusionKey>(this->_data);
+ }
+#endif // defined BOOST_TREE_NODE_CAN_USE_FUSION
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::const_pointer
+ binary_node_base<Derived,T,Size,Allocator>::get_parent_ptr() const
+ {
+ return this->_parent;
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::pointer
+ binary_node_base<Derived,T,Size,Allocator>::get_parent_ptr()
+ {
+ return this->_parent;
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ typename binary_node_base<Derived,T,Size,Allocator>::iterator
+ binary_node_base<Derived,T,Size,Allocator>::insert_left(
+ Derived const& child
+ )
+ {
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ pointer p(this->_allocator.allocate(1));
+ this->_allocator.construct(p, child._data);
+#else
+ pointer p(
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::allocate(this->_allocator, 1)
+ );
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::construct(this->_allocator, p, child._data);
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ p->_clone_descendants(child);
+ p->clone_metadata(child);
+
+ pointer c = p->_left_child;
+
+ if (c)
+ {
+ while (c->_left_child)
+ {
+ c = c->_left_child;
+ }
+
+ this->_left_child->_parent = c;
+ self::_on_post_inserted(c->_left_child = this->_left_child);
+ this->_left_child = ::boost::initialized_value;
+ this->on_post_erase(::boost::mpl::true_());
+ }
+
+ p->_parent = this->get_derived();
+ return self::_on_post_inserted(this->_left_child = p);
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ typename binary_node_base<Derived,T,Size,Allocator>::iterator
+ binary_node_base<Derived,T,Size,Allocator>::insert_right(
+ Derived const& child
+ )
+ {
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ pointer p(this->_allocator.allocate(1));
+ this->_allocator.construct(p, child._data);
+#else
+ pointer p(
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::allocate(this->_allocator, 1)
+ );
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::construct(this->_allocator, p, child._data);
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ p->_clone_descendants(child);
+ p->clone_metadata(child);
+
+ pointer c = p->_right_child;
+
+ if (c)
+ {
+ while (c->_right_child)
+ {
+ c = c->_right_child;
+ }
+
+ this->_right_child->_parent = c;
+ self::_on_post_inserted(c->_right_child = this->_right_child);
+ this->_right_child = ::boost::initialized_value;
+ this->on_post_erase(::boost::mpl::true_());
+ }
+
+ p->_parent = this->get_derived();
+ return self::_on_post_inserted(this->_right_child = p);
+ }
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename Derived \
+ , typename T \
+ , typename Size \
+ , typename Allocator \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ inline typename binary_node_base<Derived,T,Size,Allocator>::iterator \
+ binary_node_base<Derived,T,Size,Allocator>::emplace_left( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ if (this->_left_child) \
+ { \
+ pointer p(this->_allocator.allocate(1)); \
+ this->_allocator.construct( \
+ p \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ this->_left_child->_parent = p; \
+ self::_on_post_inserted(p->_left_child = this->_left_child); \
+ this->_left_child = ::boost::initialized_value; \
+ this->on_post_erase(::boost::mpl::true_()); \
+ p->_parent = this->get_derived(); \
+ return self::_on_post_inserted(this->_left_child = p); \
+ } \
+ else \
+ { \
+ this->_allocator.construct( \
+ this->_left_child = this->_allocator.allocate(1) \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ this->_left_child->_parent = this->get_derived(); \
+ return self::_on_post_inserted(this->_left_child); \
+ } \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename Derived \
+ , typename T \
+ , typename Size \
+ , typename Allocator \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ inline typename binary_node_base<Derived,T,Size,Allocator>::iterator \
+ binary_node_base<Derived,T,Size,Allocator>::emplace_right( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ if (this->_right_child) \
+ { \
+ pointer p(this->_allocator.allocate(1)); \
+ this->_allocator.construct( \
+ p \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ this->_right_child->_parent = p; \
+ self::_on_post_inserted(p->_right_child = this->_right_child); \
+ this->_right_child = ::boost::initialized_value; \
+ this->on_post_erase(::boost::mpl::true_()); \
+ p->_parent = this->get_derived(); \
+ return self::_on_post_inserted(this->_right_child = p); \
+ } \
+ else \
+ { \
+ this->_allocator.construct( \
+ this->_right_child = this->_allocator.allocate(1) \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ this->_right_child->_parent = this->get_derived(); \
+ return self::_on_post_inserted(this->_right_child); \
+ } \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename Derived \
+ , typename T \
+ , typename Size \
+ , typename Allocator \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ inline typename binary_node_base<Derived,T,Size,Allocator>::pointer \
+ binary_node_base<Derived,T,Size,Allocator>::emplace_parent_of_left( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ if (this->_parent) \
+ { \
+ pointer p(this->_allocator.allocate(1)); \
+ this->_allocator.construct( \
+ p \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ if (this->get_derived() == this->_parent->_left_child) \
+ { \
+ this->_parent->_left_child = ::boost::initialized_value; \
+ this->_parent->on_post_erase(::boost::mpl::true_()); \
+ self::_on_post_inserted( \
+ (p->_parent = this->_parent)->_left_child = p \
+ ); \
+ } \
+ else \
+ { \
+ this->_parent->_right_child = ::boost::initialized_value; \
+ this->_parent->on_post_erase(::boost::mpl::true_()); \
+ self::_on_post_inserted( \
+ (p->_parent = this->_parent)->_right_child = p \
+ ); \
+ } \
+ this->_parent = p; \
+ self::_on_post_inserted(p->_left_child = this->get_derived()); \
+ return p; \
+ } \
+ else \
+ { \
+ this->_allocator.construct( \
+ this->_parent = this->_allocator.allocate(1) \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ self::_on_post_inserted( \
+ this->_parent->_left_child = this->get_derived() \
+ ); \
+ return this->_parent; \
+ } \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename Derived \
+ , typename T \
+ , typename Size \
+ , typename Allocator \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ inline typename binary_node_base<Derived,T,Size,Allocator>::pointer \
+ binary_node_base<Derived,T,Size,Allocator>::emplace_parent_of_right( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ if (this->_parent) \
+ { \
+ pointer p(this->_allocator.allocate(1)); \
+ this->_allocator.construct( \
+ p \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ if (this->get_derived() == this->_parent->_left_child) \
+ { \
+ this->_parent->_left_child = ::boost::initialized_value; \
+ this->_parent->on_post_erase(::boost::mpl::true_()); \
+ self::_on_post_inserted( \
+ (p->_parent = this->_parent)->_left_child = p \
+ ); \
+ } \
+ else \
+ { \
+ this->_parent->_right_child = ::boost::initialized_value; \
+ this->_parent->on_post_erase(::boost::mpl::true_()); \
+ self::_on_post_inserted( \
+ (p->_parent = this->_parent)->_right_child = p \
+ ); \
+ } \
+ this->_parent = p; \
+ self::_on_post_inserted(p->_right_child = this->get_derived()); \
+ return p; \
+ } \
+ else \
+ { \
+ this->_allocator.construct( \
+ this->_parent = this->_allocator.allocate(1) \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ self::_on_post_inserted( \
+ this->_parent->_right_child = this->get_derived() \
+ ); \
+ return this->_parent; \
+ } \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#elif defined BOOST_CONTAINER_PERFECT_FORWARDING
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ template <typename ...Args>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::iterator
+ binary_node_base<Derived,T,Size,Allocator>::emplace_left(
+ Args&& ...args
+ )
+ {
+ if (this->_left_child)
+ {
+ pointer p(
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::allocate(this->_allocator, 1)
+ );
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::construct(this->_allocator, p, ::boost::forward<Args>(args)...);
+ this->_left_child->_parent = p;
+ self::_on_post_inserted(p->_left_child = this->_left_child);
+ this->_left_child = ::boost::initialized_value;
+ this->on_post_erase(::boost::mpl::true_());
+ p->_parent = this->get_derived();
+ return self::_on_post_inserted(this->_left_child = p);
+ }
+ else // if (!this->_left_child)
+ {
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::construct(
+ this->_allocator
+ , this->_left_child = ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::allocate(this->_allocator, 1)
+ , ::boost::forward<Args>(args)...
+ );
+ this->_left_child->_parent = this->get_derived();
+ return self::_on_post_inserted(this->_left_child);
+ }
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ template <typename ...Args>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::iterator
+ binary_node_base<Derived,T,Size,Allocator>::emplace_right(
+ Args&& ...args
+ )
+ {
+ if (this->_right_child)
+ {
+ pointer p(
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::allocate(this->_allocator, 1)
+ );
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::construct(this->_allocator, p, ::boost::forward<Args>(args)...);
+ this->_right_child->_parent = p;
+ self::_on_post_inserted(p->_right_child = this->_right_child);
+ this->_right_child = ::boost::initialized_value;
+ this->on_post_erase(::boost::mpl::true_());
+ p->_parent = this->get_derived();
+ return self::_on_post_inserted(this->_right_child = p);
+ }
+ else // if (!this->_right_child)
+ {
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::construct(
+ this->_allocator
+ , this->_right_child = ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::allocate(this->_allocator, 1)
+ , ::boost::forward<Args>(args)...
+ );
+ this->_right_child->_parent = this->get_derived();
+ return self::_on_post_inserted(this->_right_child);
+ }
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ template <typename ...Args>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::pointer
+ binary_node_base<Derived,T,Size,Allocator>::emplace_parent_of_left(
+ Args&& ...args
+ )
+ {
+ if (this->_parent)
+ {
+ pointer p(
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::allocate(this->_allocator, 1)
+ );
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::construct(this->_allocator, p, ::boost::forward<Args>(args)...);
+
+ if (this->get_derived() == this->_parent->_left_child)
+ {
+ this->_parent->_left_child = ::boost::initialized_value;
+ this->_parent->on_post_erase(::boost::mpl::true_());
+ self::_on_post_inserted(
+ (p->_parent = this->_parent)->_left_child = p
+ );
+ }
+ else // if (this->get_derived() == this->_parent->_right_child)
+ {
+ this->_parent->_right_child = ::boost::initialized_value;
+ this->_parent->on_post_erase(::boost::mpl::true_());
+ self::_on_post_inserted(
+ (p->_parent = this->_parent)->_right_child = p
+ );
+ }
+
+ this->_parent = p;
+ self::_on_post_inserted(p->_left_child = this->get_derived());
+ return p;
+ }
+ else // if (!this->_parent)
+ {
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::construct(
+ this->_allocator
+ , this->_parent = ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::allocate(this->_allocator, 1)
+ , ::boost::forward<Args>(args)...
+ );
+ self::_on_post_inserted(
+ this->_parent->_left_child = this->get_derived()
+ );
+ return this->_parent;
+ }
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ template <typename ...Args>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::pointer
+ binary_node_base<Derived,T,Size,Allocator>::emplace_parent_of_right(
+ Args&& ...args
+ )
+ {
+ if (this->_parent)
+ {
+ pointer p(
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::allocate(this->_allocator, 1)
+ );
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::construct(this->_allocator, p, ::boost::forward<Args>(args)...);
+
+ if (this->get_derived() == this->_parent->_left_child)
+ {
+ this->_parent->_left_child = ::boost::initialized_value;
+ this->_parent->on_post_erase(::boost::mpl::true_());
+ self::_on_post_inserted(
+ (p->_parent = this->_parent)->_left_child = p
+ );
+ }
+ else // if (this->get_derived() == this->_parent->_right_child)
+ {
+ this->_parent->_right_child = ::boost::initialized_value;
+ this->_parent->on_post_erase(::boost::mpl::true_());
+ self::_on_post_inserted(
+ (p->_parent = this->_parent)->_right_child = p
+ );
+ }
+
+ this->_parent = p;
+ self::_on_post_inserted(p->_right_child = this->get_derived());
+ return p;
+ }
+ else // if (!this->_parent)
+ {
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::construct(
+ this->_allocator
+ , this->_parent = ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::allocate(this->_allocator, 1)
+ , ::boost::forward<Args>(args)...
+ );
+ self::_on_post_inserted(
+ this->_parent->_right_child = this->get_derived()
+ );
+ return this->_parent;
+ }
+ }
+#else // partial template specialization support, imperfect forwarding
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename Derived \
+ , typename T \
+ , typename Size \
+ , typename Allocator \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ inline typename binary_node_base<Derived,T,Size,Allocator>::iterator \
+ binary_node_base<Derived,T,Size,Allocator>::emplace_left( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ if (this->_left_child) \
+ { \
+ pointer p( \
+ ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::allocate(this->_allocator, 1) \
+ ); \
+ ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::construct( \
+ this->_allocator \
+ , p \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ this->_left_child->_parent = p; \
+ self::_on_post_inserted(p->_left_child = this->_left_child); \
+ this->_left_child = ::boost::initialized_value; \
+ this->on_post_erase(::boost::mpl::true_()); \
+ p->_parent = this->get_derived(); \
+ return self::_on_post_inserted(this->_left_child = p); \
+ } \
+ else \
+ { \
+ ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::construct( \
+ this->_allocator \
+ , this->_left_child = ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::allocate(this->_allocator, 1) \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ this->_left_child->_parent = this->get_derived(); \
+ return self::_on_post_inserted(this->_left_child); \
+ } \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename Derived \
+ , typename T \
+ , typename Size \
+ , typename Allocator \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ inline typename binary_node_base<Derived,T,Size,Allocator>::iterator \
+ binary_node_base<Derived,T,Size,Allocator>::emplace_right( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ if (this->_right_child) \
+ { \
+ pointer p( \
+ ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::allocate(this->_allocator, 1) \
+ ); \
+ ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::construct( \
+ this->_allocator \
+ , p \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ this->_right_child->_parent = p; \
+ self::_on_post_inserted(p->_right_child = this->_right_child); \
+ this->_right_child = ::boost::initialized_value; \
+ this->on_post_erase(::boost::mpl::true_()); \
+ p->_parent = this->get_derived(); \
+ return self::_on_post_inserted(this->_right_child = p); \
+ } \
+ else \
+ { \
+ ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::construct( \
+ this->_allocator \
+ , this->_right_child = ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::allocate(this->_allocator, 1) \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ this->_right_child->_parent = this->get_derived(); \
+ return self::_on_post_inserted(this->_right_child); \
+ } \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename Derived \
+ , typename T \
+ , typename Size \
+ , typename Allocator \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ inline typename binary_node_base<Derived,T,Size,Allocator>::pointer \
+ binary_node_base<Derived,T,Size,Allocator>::emplace_parent_of_left( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ if (this->_parent) \
+ { \
+ pointer p( \
+ ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::allocate(this->_allocator, 1) \
+ ); \
+ ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::construct( \
+ this->_allocator \
+ , p \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ if (this->get_derived() == this->_parent->_left_child) \
+ { \
+ this->_parent->_left_child = ::boost::initialized_value; \
+ this->_parent->on_post_erase(::boost::mpl::true_()); \
+ self::_on_post_inserted( \
+ (p->_parent = this->_parent)->_left_child = p \
+ ); \
+ } \
+ else \
+ { \
+ this->_parent->_right_child = ::boost::initialized_value; \
+ this->_parent->on_post_erase(::boost::mpl::true_()); \
+ self::_on_post_inserted( \
+ (p->_parent = this->_parent)->_right_child = p \
+ ); \
+ } \
+ this->_parent = p; \
+ self::_on_post_inserted(p->_left_child = this->get_derived()); \
+ return p; \
+ } \
+ else \
+ { \
+ ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::construct( \
+ this->_allocator \
+ , this->_parent = ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::allocate(this->_allocator, 1) \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ self::_on_post_inserted( \
+ this->_parent->_left_child = this->get_derived() \
+ ); \
+ return this->_parent; \
+ } \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename Derived \
+ , typename T \
+ , typename Size \
+ , typename Allocator \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ inline typename binary_node_base<Derived,T,Size,Allocator>::pointer \
+ binary_node_base<Derived,T,Size,Allocator>::emplace_parent_of_right( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ if (this->_parent) \
+ { \
+ pointer p( \
+ ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::allocate(this->_allocator, 1) \
+ ); \
+ ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::construct( \
+ this->_allocator \
+ , p \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ if (this->get_derived() == this->_parent->_left_child) \
+ { \
+ this->_parent->_left_child = ::boost::initialized_value; \
+ this->_parent->on_post_erase(::boost::mpl::true_()); \
+ self::_on_post_inserted( \
+ (p->_parent = this->_parent)->_left_child = p \
+ ); \
+ } \
+ else \
+ { \
+ this->_parent->_right_child = ::boost::initialized_value; \
+ this->_parent->on_post_erase(::boost::mpl::true_()); \
+ self::_on_post_inserted( \
+ (p->_parent = this->_parent)->_right_child = p \
+ ); \
+ } \
+ this->_parent = p; \
+ self::_on_post_inserted(p->_right_child = this->get_derived()); \
+ return p; \
+ } \
+ else \
+ { \
+ ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::construct( \
+ this->_allocator \
+ , this->_parent = ::boost::container::allocator_traits< \
+ typename traits::allocator \
+ >::allocate(this->_allocator, 1) \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ self::_on_post_inserted( \
+ this->_parent->_right_child = this->get_derived() \
+ ); \
+ return this->_parent; \
+ } \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // compiler defect handling
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::const_pointer
+ binary_node_base<Derived,T,Size,Allocator>::get_left_child_ptr() const
+ {
+ return this->_left_child;
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::pointer
+ binary_node_base<Derived,T,Size,Allocator>::get_left_child_ptr()
+ {
+ return this->_left_child;
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::const_pointer
+ binary_node_base<Derived,T,Size,Allocator>::get_right_child_ptr() const
+ {
+ return this->_right_child;
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::pointer
+ binary_node_base<Derived,T,Size,Allocator>::get_right_child_ptr()
+ {
+ return this->_right_child;
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::const_iterator
+ binary_node_base<Derived,T,Size,Allocator>::cbegin() const
+ {
+ return const_iterator(this->get_derived(), false);
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::const_iterator
+ binary_node_base<Derived,T,Size,Allocator>::begin() const
+ {
+ return const_iterator(this->get_derived(), false);
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::iterator
+ binary_node_base<Derived,T,Size,Allocator>::begin()
+ {
+ return iterator(this->get_derived(), false);
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::const_iterator
+ binary_node_base<Derived,T,Size,Allocator>::cend() const
+ {
+ return const_iterator(this->get_derived());
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::const_iterator
+ binary_node_base<Derived,T,Size,Allocator>::end() const
+ {
+ return const_iterator(this->get_derived());
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::iterator
+ binary_node_base<Derived,T,Size,Allocator>::end()
+ {
+ return iterator(this->get_derived());
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<
+ Derived
+ , T
+ , Size
+ , Allocator
+ >::const_reverse_iterator
+ binary_node_base<Derived,T,Size,Allocator>::crbegin() const
+ {
+ return const_reverse_iterator(this->get_derived(), false);
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<
+ Derived
+ , T
+ , Size
+ , Allocator
+ >::const_reverse_iterator
+ binary_node_base<Derived,T,Size,Allocator>::rbegin() const
+ {
+ return const_reverse_iterator(this->get_derived(), false);
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<
+ Derived
+ , T
+ , Size
+ , Allocator
+ >::reverse_iterator
+ binary_node_base<Derived,T,Size,Allocator>::rbegin()
+ {
+ return reverse_iterator(this->get_derived(), false);
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<
+ Derived
+ , T
+ , Size
+ , Allocator
+ >::const_reverse_iterator
+ binary_node_base<Derived,T,Size,Allocator>::crend() const
+ {
+ return const_reverse_iterator(this->get_derived());
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<
+ Derived
+ , T
+ , Size
+ , Allocator
+ >::const_reverse_iterator
+ binary_node_base<Derived,T,Size,Allocator>::rend() const
+ {
+ return const_reverse_iterator(this->get_derived());
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<
+ Derived
+ , T
+ , Size
+ , Allocator
+ >::reverse_iterator
+ binary_node_base<Derived,T,Size,Allocator>::rend()
+ {
+ return reverse_iterator(this->get_derived());
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::size_type
+ binary_node_base<Derived,T,Size,Allocator>::size() const
+ {
+ return (
+ this->_left_child ? (
+ this->_right_child ? 2 : 1
+ ) : (this->_right_child ? 1 : 0)
+ );
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline bool binary_node_base<Derived,T,Size,Allocator>::empty() const
+ {
+ return !this->_left_child && !this->_right_child;
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline void binary_node_base<Derived,T,Size,Allocator>::clear()
+ {
+ if (this->_left_child)
+ {
+ self::_destroy(this->_left_child, this->_allocator);
+ }
+
+ if (this->_right_child)
+ {
+ self::_destroy(this->_right_child, this->_allocator);
+ }
+
+ this->_left_child = this->_right_child = ::boost::initialized_value;
+ this->on_post_clear();
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::pointer
+ binary_node_base<Derived,T,Size,Allocator>::rotate_left()
+ {
+ pointer pivot = this->_right_child;
+
+ pivot->_parent = this->_parent;
+
+ if ((this->_right_child = pivot->_left_child))
+ {
+ this->_right_child->_parent = this->get_derived();
+ }
+
+ pivot->_left_child = this->get_derived();
+
+ if (this->_parent)
+ {
+ if (this->_parent->_left_child == this->get_derived())
+ {
+ this->_parent->_left_child = pivot;
+ }
+ else // if (this->_parent->_right_child == this->get_derived())
+ {
+ this->_parent->_right_child = pivot;
+ }
+ }
+
+ this->_parent = pivot;
+ this->on_post_rotate_left();
+ return pivot;
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::pointer
+ binary_node_base<Derived,T,Size,Allocator>::rotate_right()
+ {
+ pointer pivot = this->_left_child;
+
+ pivot->_parent = this->_parent;
+
+ if ((this->_left_child = pivot->_right_child))
+ {
+ this->_left_child->_parent = this->get_derived();
+ }
+
+ pivot->_right_child = this->get_derived();
+
+ if (this->_parent)
+ {
+ if (this->_parent->_right_child == this->get_derived())
+ {
+ this->_parent->_right_child = pivot;
+ }
+ else // if (this->_parent->_left_child == this->get_derived())
+ {
+ this->_parent->_left_child = pivot;
+ }
+ }
+
+ this->_parent = pivot;
+ this->on_post_rotate_right();
+ return pivot;
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline bool binary_node_base<Derived,T,Size,Allocator>::erase_left()
+ {
+ if (self::_erase(this->_left_child, this->_allocator))
+ {
+ this->on_post_erase(::boost::mpl::true_());
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline bool binary_node_base<Derived,T,Size,Allocator>::erase_right()
+ {
+ if (self::_erase(this->_right_child, this->_allocator))
+ {
+ this->on_post_erase(::boost::mpl::true_());
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<
+ Derived
+ , T
+ , Size
+ , Allocator
+ >::traits::allocator_reference
+ binary_node_base<Derived,T,Size,Allocator>::_construct_from(
+ typename traits::allocator_reference allocator
+ , ::std::tr1::true_type
+ )
+ {
+ return allocator;
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline Allocator
+ binary_node_base<Derived,T,Size,Allocator>::_construct_from(
+ typename traits::allocator_reference allocator
+ , ::std::tr1::false_type
+ )
+ {
+ return ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::select_on_container_copy_construction(allocator);
+ }
+#endif // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline bool
+ binary_node_base<Derived,T,Size,Allocator>::_clone_data(
+ pointer& p
+ , const_pointer const& c_p
+ , Allocator& allocator
+ )
+ {
+ if (c_p)
+ {
+ if (p)
+ {
+ p->_data = c_p->_data;
+ }
+ else
+ {
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ allocator.construct(p = allocator.allocate(1), c_p->_data);
+#else
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::construct(
+ allocator
+ , p = ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::allocate(allocator, 1)
+ , c_p->_data
+ );
+#endif
+ }
+
+ return true;
+ }
+ else
+ {
+ if (p)
+ {
+ self::_destroy(p, allocator);
+ p = ::boost::initialized_value;
+ }
+
+ return false;
+ }
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline bool
+ binary_node_base<Derived,T,Size,Allocator>::_move(
+ pointer& dest_p
+ , pointer& src_p
+ , Allocator& allocator
+ )
+ {
+ if (dest_p)
+ {
+ self::_destroy(dest_p, allocator);
+ }
+
+ if ((dest_p = src_p))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline void
+ binary_node_base<Derived,T,Size,Allocator>::_destroy(
+ pointer const& p
+ , Allocator& allocator
+ )
+ {
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ allocator.destroy(p);
+ allocator.deallocate(p, 1);
+#else
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::destroy(allocator, p);
+ ::boost::container::allocator_traits<
+ typename traits::allocator
+ >::deallocate(allocator, p, 1);
+#endif
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline bool
+ binary_node_base<Derived,T,Size,Allocator>::_erase(
+ pointer& p
+ , Allocator& allocator
+ )
+ {
+ if (p)
+ {
+ self::_destroy(p, allocator);
+ p = ::boost::initialized_value;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<Derived,T,Size,Allocator>::iterator
+ binary_node_base<Derived,T,Size,Allocator>::_on_post_inserted(
+ pointer const& child
+ )
+ {
+ iterator result(child, true);
+ result->on_post_inserted(result, ::boost::mpl::true_());
+ return result;
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ void
+ binary_node_base<Derived,T,Size,Allocator>::_clone_descendants(
+ Derived const& copy
+ )
+ {
+ bool must_traverse_left_child = true;
+
+ if (
+ self::_clone_data(
+ this->_left_child
+ , copy._left_child
+ , this->_allocator
+ )
+ )
+ {
+ this->_left_child->_parent = this->get_derived();
+ }
+ else
+ {
+ must_traverse_left_child = false;
+ }
+
+ if (
+ self::_clone_data(
+ this->_right_child
+ , copy._right_child
+ , this->_allocator
+ )
+ )
+ {
+ this->_right_child->_parent = this->get_derived();
+ }
+
+ pointer p = this->get_derived();
+
+ for (
+ depth_first_descendant_iterator<Derived const> itr(copy);
+ itr;
+ ++itr
+ )
+ {
+ BOOST_ASSERT_MSG(p, "Premature past-the-end target.");
+
+ switch (::boost::tree_node::traversal_state(itr))
+ {
+ case ::boost::tree_node::pre_order_traversal:
+ {
+ if (must_traverse_left_child)
+ {
+ p = p->_left_child;
+ }
+ else
+ {
+ BOOST_ASSERT_MSG(
+ p->_right_child
+ , "itr is at wrong traversal_state"
+ );
+ p = p->_right_child;
+ }
+
+ if (
+ (
+ must_traverse_left_child = self::_clone_data(
+ p->_left_child
+ , itr->_left_child
+ , p->_allocator
+ )
+ )
+ )
+ {
+ p->_left_child->_parent = p;
+ }
+
+ if (
+ self::_clone_data(
+ p->_right_child
+ , itr->_right_child
+ , p->_allocator
+ )
+ )
+ {
+ p->_right_child->_parent = p;
+ }
+
+ p->clone_metadata(*itr);
+ break;
+ }
+
+ case ::boost::tree_node::post_order_traversal:
+ {
+ p->on_post_copy_or_move();
+ p = p->get_parent_ptr();
+ must_traverse_left_child = false;
+ break;
+ }
+
+ default:
+ {
+ BOOST_ASSERT_MSG(
+ false
+ , "traversal_state must be pre- or post-order!"
+ );
+ }
+ }
+ }
+
+ BOOST_ASSERT_MSG(p == this->get_derived(), "p not at-the-end");
+ p->on_post_copy_or_move();
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline void
+ binary_node_base<Derived,T,Size,Allocator>::_move_descendants(
+ Derived& source
+ )
+ {
+ if (
+ self::_move(
+ this->_left_child
+ , source._left_child
+ , source._allocator
+ )
+ )
+ {
+ this->_left_child->_parent = this->get_derived();
+ source._left_child = ::boost::initialized_value;
+ }
+
+ if (
+ self::_move(
+ this->_right_child
+ , source._right_child
+ , source._allocator
+ )
+ )
+ {
+ this->_right_child->_parent = this->get_derived();
+ source._right_child = ::boost::initialized_value;
+ }
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline void
+ binary_node_base<Derived,T,Size,Allocator>::_on_post_modify_value(
+ data_key const& key
+ )
+ {
+ this->on_post_propagate_value(key);
+ }
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ template <typename FusionKey>
+ inline void
+ binary_node_base<Derived,T,Size,Allocator>::_on_post_modify_value(
+ FusionKey const& key
+ )
+ {
+ this->on_post_propagate_value(key);
+ }
+#endif
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline void
+ binary_node_base<Derived,T,Size,Allocator>::_set_parent_ptr(pointer p)
+ {
+ if (this->_parent)
+ {
+ if (this->get_derived() == this->_parent->_left_child)
+ {
+ this->_parent->_left_child = ::boost::initialized_value;
+ }
+ else // if (this->get_derived() == this->_parent->_right_child)
+ {
+ this->_parent->_right_child = ::boost::initialized_value;
+ }
+
+ this->_parent->on_post_erase();
+ }
+
+ if ((this->_parent = p))
+ {
+ this->on_post_inserted(
+ iterator(this->get_derived(), true)
+ , ::boost::mpl::true_()
+ );
+ }
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline void
+ binary_node_base<Derived,T,Size,Allocator>::_set_left_child_ptr(
+ pointer p
+ )
+ {
+ if (this->_left_child)
+ {
+ this->_left_child = ::boost::initialized_value;
+ this->on_post_erase(::boost::mpl::true_());
+ }
+
+ if ((this->_left_child = p))
+ {
+ p->_parent = this->get_derived();
+ p->on_post_inserted(iterator(p, true), ::boost::mpl::true_());
+ }
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline void
+ binary_node_base<Derived,T,Size,Allocator>::_set_right_child_ptr(
+ pointer p
+ )
+ {
+ if (this->_right_child)
+ {
+ this->_right_child = ::boost::initialized_value;
+ this->on_post_erase(::boost::mpl::true_());
+ }
+
+ if ((this->_right_child = p))
+ {
+ p->_parent = this->get_derived();
+ p->on_post_inserted(iterator(p, true), ::boost::mpl::true_());
+ }
+ }
+}} // namespace boost::tree_node
+
+namespace boost { namespace tree_node {
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<
+ Derived
+ , T
+ , Size
+ , Allocator
+ >::traits::data_type const&
+ get(
+ binary_node_base<Derived,T,Size,Allocator> const& node
+ , data_key const& key
+ )
+ {
+ return node[key];
+ }
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ inline typename binary_node_base<
+ Derived
+ , T
+ , Size
+ , Allocator
+ >::traits::data_type&
+ get(
+ binary_node_base<Derived,T,Size,Allocator>& node
+ , data_key const& key
+ )
+ {
+ return node[key];
+ }
+
+#if !defined BOOST_NO_SFINAE
+ template <
+ typename Key
+ , typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ >
+ inline typename ::boost::enable_if<
+ ::std::tr1::is_same<Key,data_key>
+ , typename binary_node_base<
+ Derived
+ , T
+ , Size
+ , Allocator
+ >::traits::data_type const&
+ >::type
+ get(binary_node_base<Derived,T,Size,Allocator> const& node)
+ {
+ return node[data_key()];
+ }
+
+ template <
+ typename Key
+ , typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ >
+ inline typename ::boost::enable_if<
+ ::std::tr1::is_same<Key,data_key>
+ , typename binary_node_base<Derived,T,Size,Allocator>::traits::data_type&
+ >::type
+ get(binary_node_base<Derived,T,Size,Allocator>& node)
+ {
+ return node[data_key()];
+ }
+#endif // !defined BOOST_NO_SFINAE
+
+ template <
+ typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ , typename V
+ >
+ inline void
+ put(
+ binary_node_base<Derived,T,Size,Allocator>& node
+ , data_key const& key
+ , V const& value
+ )
+ {
+ node[key] = value;
+ node._on_post_modify_value(key);
+ }
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+ template <
+ typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ , typename FusionKey
+ >
+ inline typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ binary_node_base<Derived,T,Size,Allocator>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T const,FusionKey>
+ >::type
+ get(
+ binary_node_base<Derived,T,Size,Allocator> const& node
+ , FusionKey const& key
+ )
+ {
+ return node[key];
+ }
+
+ template <
+ typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ , typename FusionKey
+ >
+ inline typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ binary_node_base<Derived,T,Size,Allocator>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T,FusionKey>
+ >::type
+ get(
+ binary_node_base<Derived,T,Size,Allocator>& node
+ , FusionKey const& key
+ )
+ {
+ return node[key];
+ }
+
+ template <
+ typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ , typename FusionKey
+ , typename V
+ >
+ inline void
+ put(
+ binary_node_base<Derived,T,Size,Allocator>& node
+ , FusionKey const& key
+ , V const& value
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ binary_node_base<Derived,T,Size,Allocator>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::true_
+ >::type
+ )
+ {
+ node[key] = value;
+ node._on_post_modify_value(key);
+ }
+
+ template <
+ typename FusionKey
+ , typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ >
+ inline typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ binary_node_base<Derived,T,Size,Allocator>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T const,FusionKey>
+ >::type
+ get(binary_node_base<Derived,T,Size,Allocator> const& node)
+ {
+ return node[FusionKey()];
+ }
+
+ template <
+ typename FusionKey
+ , typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ >
+ inline typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ binary_node_base<Derived,T,Size,Allocator>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T,FusionKey>
+ >::type
+ get(binary_node_base<Derived,T,Size,Allocator>& node)
+ {
+ return node[FusionKey()];
+ }
+#endif // defined BOOST_TREE_NODE_CAN_USE_FUSION
+}} // namespace boost::tree_node
+
+//[reference__binary_node_base_gen
+namespace boost { namespace tree_node {
+
+ template <
+ typename Size = ::boost::uint32_t
+ , typename AllocatorSelector = ::boost::std_allocator_selector
+ >
+ struct binary_node_base_gen
+ {
+ template <typename Derived, typename T>
+ struct apply
+ {
+ typedef binary_node_base<
+ Derived
+ , T
+ , Size
+ , typename ::boost::mpl::apply_wrap1<
+ AllocatorSelector
+ , Derived
+ >::type
+ >
+ type;
+ };
+ };
+
+ typedef binary_node_base_gen<> binary_node_base_default_gen;
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename T, typename Size, typename AllocatorSelector>
+ struct binary_node
+ : public
+ //[reference__binary_node__bases
+ binary_node_base<
+ binary_node<T,Size,AllocatorSelector>
+ , T
+ , Size
+ , typename ::boost::mpl::apply_wrap1<
+ AllocatorSelector
+ , binary_node<T,Size,AllocatorSelector>
+ >::type
+ >
+ //]
+ {
+ //[reference__binary_node__super_t
+ typedef binary_node_base<
+ binary_node
+ , T
+ , Size
+ , typename ::boost::mpl::apply_wrap1<
+ AllocatorSelector
+ , binary_node
+ >::type
+ >
+ super_t;
+ //]
+
+ //[reference__binary_node__traits
+ typedef typename super_t::traits
+ traits;
+ //]
+
+ //[reference__binary_node__pointer
+ typedef typename super_t::pointer
+ pointer;
+ //]
+
+ //[reference__binary_node__const_pointer
+ typedef typename super_t::const_pointer
+ const_pointer;
+ //]
+
+ //[reference__binary_node__iterator
+ typedef typename super_t::iterator
+ iterator;
+ //]
+
+ //[reference__binary_node__const_iterator
+ typedef typename super_t::const_iterator
+ const_iterator;
+ //]
+
+ //[reference__binary_node__reverse_iterator
+ typedef typename super_t::reverse_iterator
+ reverse_iterator;
+ //]
+
+ //[reference__binary_node__const_reverse_iterator
+ typedef typename super_t::const_reverse_iterator
+ const_reverse_iterator;
+ //]
+
+ //[reference__binary_node__size_type
+ typedef typename super_t::size_type
+ size_type;
+ //]
+
+ BOOST_TREE_NODE_COPYABLE_AND_MOVABLE(binary_node, super_t)
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ BOOST_PP_FOR(
+ ((0), (binary_node, super_t))
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED_WITH_DATA
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC_WITH_DATA
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_INLINE_DEF
+ )
+
+ BOOST_PP_FOR(
+ ((0), (binary_node, super_t))
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED_WITH_DATA
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC_WITH_DATA
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_W_ALLOC_INLINE_DEF
+ )
+#elif defined BOOST_CONTAINER_PERFECT_FORWARDING
+ //[reference__binary_node__emplacement_ctor
+ template <typename ...Args>
+ explicit binary_node(Args&& ...args);
+ //]
+
+ //[reference__binary_node__emplacement_ctor_w_allocator
+ template <typename ...Args>
+ explicit binary_node(
+ ::boost::container::allocator_arg_t
+ , typename traits::allocator_reference allocator
+ , Args&& ...args
+ );
+ //]
+#else // partial template specialization support, imperfect forwarding
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_INLINE_DEF
+ , (binary_node, super_t)
+ )
+
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_W_ALLOC_INLINE_DEF
+ , (binary_node, super_t)
+ )
+#endif // compiler defect handling
+ };
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION && \
+ defined BOOST_CONTAINER_PERFECT_FORWARDING
+ template <typename T, typename Size, typename AllocatorSelector>
+ template <typename ...Args>
+ inline binary_node<T,Size,AllocatorSelector>::binary_node(Args&& ...args)
+ : super_t(::boost::forward<Args>(args)...)
+ {
+ }
+
+ template <typename T, typename Size, typename AllocatorSelector>
+ template <typename ...Args>
+ inline binary_node<T,Size,AllocatorSelector>::binary_node(
+ ::boost::container::allocator_arg_t
+ , typename traits::allocator_reference allocator
+ , Args&& ...args
+ ) : super_t(
+ ::boost::container::allocator_arg
+ , allocator
+ , ::boost::forward<Args>(args)...
+ )
+ {
+ }
+#endif // partial template specialization support, perfect forwarding
+}} // namespace boost::tree_node
+
+//[reference__binary_node_gen
+namespace boost { namespace tree_node {
+
+ template <
+ typename Size = ::boost::uint32_t
+ , typename AllocatorSelector = ::boost::std_allocator_selector
+ >
+ struct binary_node_gen
+ {
+ template <typename T>
+ struct apply
+ {
+ typedef binary_node<T,Size,AllocatorSelector> type;
+ };
+ };
+
+ typedef binary_node_gen<> binary_node_default_gen;
+}} // namespace boost::tree_node
+//]
+
+#include <boost/tree_node/_detail/config_end.hpp>
+
+#endif // BOOST_TREE_NODE_BINARY_NODE_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/binary_node_fwd.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/binary_node_fwd.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,289 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_BINARY_NODE_FWD_HPP_INCLUDED
+#define BOOST_TREE_NODE_BINARY_NODE_FWD_HPP_INCLUDED
+
+#include <boost/config.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/container_gen/selectors.hpp>
+#include <boost/tree_node/preprocessor.hpp>
+#include <boost/tree_node/key/data.hpp>
+
+#if !defined BOOST_NO_SFINAE
+#include <boost/utility/enable_if.hpp>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/equal_to.hpp>
+#endif
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/support/category_of.hpp>
+#include <boost/tree_node/intrinsic/has_key.hpp>
+#endif
+
+namespace boost { namespace tree_node {
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ class binary_node_base;
+
+ template <
+ typename T
+ , typename Size = ::boost::uint32_t
+ , typename AllocatorSelector = ::boost::std_allocator_selector
+ >
+ struct binary_node;
+}} // namespace boost::tree_node
+
+//[reference__binary_node_base__at_data_key__const
+namespace boost { namespace tree_node {
+
+ template <typename Derived, typename T, typename Size, typename Allocator>
+ typename binary_node_base<
+ Derived
+ , T
+ , Size
+ , Allocator
+ >::traits::data_type const&
+ get(
+ binary_node_base<Derived,T,Size,Allocator> const& node
+ , data_key const& key
+ );
+
+//<-
+#if !defined BOOST_NO_SFINAE
+//->
+ template <
+ typename Key
+ , typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ >
+ typename ::boost::enable_if<
+ ::std::tr1::is_same<Key,data_key>
+ , typename binary_node_base<
+ Derived
+ , T
+ , Size
+ , Allocator
+ >::traits::data_type const&
+ >::type
+ get(binary_node_base<Derived,T,Size,Allocator> const& node);
+//<-
+#endif // BOOST_NO_SFINAE
+//->
+}} // namespace boost::tree_node
+//]
+
+//[reference__binary_node_base__at_data_key
+namespace boost { namespace tree_node {
+
+ template <
+ typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ >
+ typename binary_node_base<Derived,T,Size,Allocator>::traits::data_type&
+ get(
+ binary_node_base<Derived,T,Size,Allocator>& node
+ , data_key const& key
+ );
+
+//<-
+#if !defined BOOST_NO_SFINAE
+//->
+ template <
+ typename Key
+ , typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ >
+ typename ::boost::enable_if<
+ ::std::tr1::is_same<Key,data_key>
+ , typename binary_node_base<Derived,T,Size,Allocator>::traits::data_type&
+ >::type
+ get(binary_node_base<Derived,T,Size,Allocator>& node);
+//<-
+#endif // BOOST_NO_SFINAE
+//->
+}} // namespace boost::tree_node
+//]
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+//[reference__binary_node_base__at_key__const
+namespace boost { namespace tree_node {
+
+ template <
+ typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ , typename FusionKey
+ >
+ typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ binary_node_base<Derived,T,Size,Allocator>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T const,FusionKey>
+ >::type
+ get(
+ binary_node_base<Derived,T,Size,Allocator> const& node
+ , FusionKey const& key
+ );
+
+ template <
+ typename FusionKey
+ , typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ >
+ typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ binary_node_base<Derived,T,Size,Allocator>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T const,FusionKey>
+ >::type
+ get(binary_node_base<Derived,T,Size,Allocator> const& node);
+}} // namespace boost::tree_node
+//]
+
+//[reference__binary_node_base__at_key
+namespace boost { namespace tree_node {
+
+ template <
+ typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ , typename FusionKey
+ >
+ typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ binary_node_base<Derived,T,Size,Allocator>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T,FusionKey>
+ >::type
+ get(binary_node_base<Derived,T,Size,Allocator>& node, FusionKey const& key);
+
+ template <
+ typename FusionKey
+ , typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ >
+ typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ binary_node_base<Derived,T,Size,Allocator>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T,FusionKey>
+ >::type
+ get(binary_node_base<Derived,T,Size,Allocator>& node);
+}} // namespace boost::tree_node
+//]
+#endif // BOOST_TREE_NODE_CAN_USE_FUSION
+
+//[reference__binary_node_base__put_data
+namespace boost { namespace tree_node {
+
+ template <
+ typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ , typename V
+ >
+ void
+ put(
+ binary_node_base<Derived,T,Size,Allocator>& node
+ , data_key const& key
+ , V const& value
+ );
+}} // namespace boost::tree_node
+//]
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+//[reference__binary_node_base__put
+namespace boost { namespace tree_node {
+
+ template <
+ typename Derived
+ , typename T
+ , typename Size
+ , typename Allocator
+ , typename FusionKey
+ , typename V
+ >
+ void
+ put(
+ binary_node_base<Derived,T,Size,Allocator>& node
+ , FusionKey const& key
+ , V const& value
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ binary_node_base<Derived,T,Size,Allocator>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::true_
+ >::type = ::boost::mpl::true_()
+ );
+}} // namespace boost::tree_node
+//]
+#endif // BOOST_TREE_NODE_CAN_USE_FUSION
+
+#endif // BOOST_TREE_NODE_BINARY_NODE_FWD_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/container/binode.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/container/binode.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,2203 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_CONTAINER_BINODE_HPP_INCLUDED
+#define BOOST_TREE_NODE_CONTAINER_BINODE_HPP_INCLUDED
+
+#include <boost/config.hpp>
+
+#if !defined BOOST_NO_CXX11_NULLPTR
+#include <cstddef>
+#endif
+
+#include <algorithm>
+#include <utility>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/apply_wrap.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/utility/value_init.hpp>
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <boost/move/move.hpp>
+#include <boost/container/allocator_traits.hpp>
+#endif
+
+#include <boost/tree_node/preprocessor.hpp>
+#include <boost/tree_node/key/data.hpp>
+#include <boost/tree_node/key/count.hpp>
+#include <boost/tree_node/iterator/in_order.hpp>
+#include <boost/tree_node/intrinsic/has_key.hpp>
+#include <boost/tree_node/intrinsic/at_key.hpp>
+#include <boost/tree_node/intrinsic/value_at_key.hpp>
+#include <boost/tree_node/algorithm/binary_descendant_at_index.hpp>
+#include <boost/tree_node/container/binode_fwd.hpp>
+#include <boost/assert.hpp>
+
+namespace boost { namespace tree_node {
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ class binode_container
+ {
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ BOOST_COPYABLE_AND_MOVABLE(binode_container)
+#endif
+
+ public:
+ //[reference__binode_container__value_type
+ typedef T value_type;
+ //]
+
+ //[reference__binode_container__reference
+ typedef value_type& reference;
+ //]
+
+ //[reference__binode_container__const_reference
+ typedef value_type const& const_reference;
+ //]
+
+ //[reference__binode_container__pointer
+ typedef value_type* pointer;
+ //]
+
+ //[reference__binode_container__const_pointer
+ typedef value_type const* const_pointer;
+ //]
+
+ //[reference__binode_container__node
+ typedef typename ::boost::mpl::apply_wrap1<
+ NodeGenerator
+ , value_type
+ >::type
+ node;
+ //]
+
+ //[reference__binode_container__allocator_type
+ typedef typename node::traits::allocator allocator_type;
+ //]
+
+ //[reference__binode_container__iterator
+ typedef ::boost::transform_iterator<
+ at_key<data_key>
+ , in_order_iterator<node>
+ >
+ iterator;
+ //]
+
+ //[reference__binode_container__const_iterator
+ typedef ::boost::transform_iterator<
+ at_key<data_key>
+ , in_order_iterator<node const>
+ >
+ const_iterator;
+ //]
+
+ //[reference__binode_container__reverse_iterator
+ typedef ::boost::transform_iterator<
+ at_key<data_key>
+ , in_order_iterator<node,::boost::mpl::true_>
+ >
+ reverse_iterator;
+ //]
+
+ //[reference__binode_container__const_reverse_iterator
+ typedef ::boost::transform_iterator<
+ at_key<data_key>
+ , in_order_iterator<node const,::boost::mpl::true_>
+ >
+ const_reverse_iterator;
+ //]
+
+ //[reference__binode_container__size_type
+ typedef typename ::boost::mpl::eval_if<
+ result_of::has_key<node,count_key>
+ , result_of::value_at_key<node,count_key>
+ , typename node::size_type
+ >::type
+ size_type;
+ //]
+
+ private:
+ allocator_type _allocator;
+ typename node::pointer _root_ptr;
+
+ public:
+ //[reference__binode_container__default_ctor
+ binode_container();
+ //]
+
+ //[reference__binode_container__ctor_w_alloc
+ explicit binode_container(allocator_type const& allocator);
+ //]
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ //[reference__binode_container__copy_ctor
+ binode_container(binode_container const& copy);
+ //]
+
+ //[reference__binode_container__copy_ctor_w_alloc
+ binode_container(
+ binode_container const& copy
+ , allocator_type const& allocator
+ );
+ //]
+
+ //[reference__binode_container__copy_assign
+ binode_container& operator=(binode_container const& copy);
+ //]
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ binode_container(
+ BOOST_COPY_ASSIGN_REF(binode_container) copy
+ );
+
+ binode_container(
+ BOOST_COPY_ASSIGN_REF(binode_container) copy
+ , allocator_type const& allocator
+ );
+
+ binode_container(
+ BOOST_RV_REF(binode_container) source
+ );
+
+ binode_container(
+ BOOST_RV_REF(binode_container) source
+ , allocator_type const& allocator
+ );
+
+ binode_container& operator=(BOOST_RV_REF(binode_container) source);
+
+ binode_container&
+ operator=(BOOST_COPY_ASSIGN_REF(binode_container) copy);
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ //[reference__binode_container__dtor
+ ~binode_container();
+ //]
+
+ //[reference__binode_container__data__const
+ typename node::const_pointer data() const;
+ //]
+
+ //[reference__binode_container__data
+ typename node::pointer data();
+ //]
+
+ //[reference__binode_container__cbegin
+ const_iterator cbegin() const;
+ const_iterator begin() const;
+ //]
+
+ //[reference__binode_container__begin
+ iterator begin();
+ //]
+
+ //[reference__binode_container__cend
+ const_iterator cend() const;
+ const_iterator end() const;
+ //]
+
+ //[reference__binode_container__end
+ iterator end();
+ //]
+
+ //[reference__binode_container__crbegin
+ const_reverse_iterator crbegin() const;
+ const_reverse_iterator rbegin() const;
+ //]
+
+ //[reference__binode_container__rbegin
+ reverse_iterator rbegin();
+ //]
+
+ //[reference__binode_container__crend
+ const_reverse_iterator crend() const;
+ const_reverse_iterator rend() const;
+ //]
+
+ //[reference__binode_container__rend
+ reverse_iterator rend();
+ //]
+
+ //[reference__binode_container__cback
+ const_reference back() const;
+ //]
+
+ //[reference__binode_container__back
+ reference back();
+ //]
+
+ //[reference__binode_container__cfront
+ const_reference front() const;
+ //]
+
+ //[reference__binode_container__front
+ reference front();
+ //]
+
+ //[reference__binode_container__push_back
+ void push_back(const_reference t);
+ //]
+
+ //[reference__binode_container__push_front
+ void push_front(const_reference t);
+ //]
+
+ //[reference__binode_container__insert
+ iterator insert(const_iterator itr, const_reference t);
+ //]
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ void \
+ emplace_back( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ void \
+ emplace_front( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ iterator \
+ emplace( \
+ const_iterator itr \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#elif defined BOOST_CONTAINER_PERFECT_FORWARDING
+ //[reference__binode_container__emplace_back
+ template <typename ...Args>
+ void emplace_back(Args&& ...args);
+ //]
+
+ //[reference__binode_container__emplace_front
+ template <typename ...Args>
+ void emplace_front(Args&& ...args);
+ //]
+
+ //[reference__binode_container__emplace
+ template <typename ...Args>
+ iterator emplace(const_iterator itr, Args&& ...args);
+ //]
+#else // partial template specialization support, imperfect forwarding
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ void \
+ emplace_back( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ void \
+ emplace_front( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ iterator \
+ emplace( \
+ const_iterator itr \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // compiler defect handling
+
+ //[reference__binode_container__pop_back
+ void pop_back();
+ //]
+
+ //[reference__binode_container__pop_front
+ void pop_front();
+ //]
+
+ //[reference__binode_container__erase
+ iterator erase(const_iterator p);
+ //]
+
+ //[reference__binode_container__erase_range
+ void erase(const_iterator itr, const_iterator itr_end);
+ //]
+
+ //[reference__binode_container__empty
+ bool empty() const;
+ //]
+
+ //[reference__binode_container__clear
+ void clear();
+ //]
+
+ //[reference__binode_container__size
+ size_type size() const;
+ //]
+
+ //[reference__binode_container__index_operator__const
+ const_reference operator[](size_type index) const;
+ //]
+
+ //[reference__binode_container__index_operator
+ reference operator[](size_type index);
+ //]
+
+ private:
+ static typename node::pointer
+ _construct_from(
+ ::std::tr1::true_type
+ , allocator_type& allocator
+ , value_type const& value
+ );
+
+ static typename node::pointer
+ _construct_from(
+ ::std::tr1::false_type
+ , allocator_type& allocator
+ , value_type const& value
+ );
+
+ static typename node::pointer
+ _construct_from(
+ ::std::tr1::true_type
+ , allocator_type& allocator
+ , typename node::pointer p
+ );
+
+ static typename node::pointer
+ _construct_from(
+ ::std::tr1::false_type
+ , allocator_type& allocator
+ , typename node::pointer p
+ );
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ static typename node::pointer \
+ _construct_from( \
+ ::std::tr1::true_type \
+ , allocator_type& allocator \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ static typename node::pointer \
+ _construct_from( \
+ ::std::tr1::false_type \
+ , allocator_type& allocator \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#elif defined BOOST_CONTAINER_PERFECT_FORWARDING
+ template <typename ...Args>
+ static typename node::pointer
+ _construct_from(
+ ::std::tr1::true_type
+ , allocator_type& allocator
+ , Args&& ...args
+ );
+
+ template <typename ...Args>
+ static typename node::pointer
+ _construct_from(
+ ::std::tr1::false_type
+ , allocator_type& allocator
+ , Args&& ...args
+ );
+#else // partial template specialization support, imperfect forwarding
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ static typename node::pointer \
+ _construct_from( \
+ ::std::tr1::true_type \
+ , allocator_type& allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ static typename node::pointer \
+ _construct_from( \
+ ::std::tr1::false_type \
+ , allocator_type& allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // compiler defect handling
+
+ size_type _size(::boost::mpl::true_) const;
+
+ size_type _size(::boost::mpl::false_) const;
+
+ typename node::const_pointer _back() const;
+
+ typename node::pointer _back();
+ };
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ binode_container<T,NodeGenerator,Balancer>::binode_container()
+ : _allocator()
+ , _root_ptr(
+#if defined BOOST_NO_CXX11_NULLPTR
+ 0
+#else
+ nullptr
+#endif
+ )
+ {
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ binode_container<T,NodeGenerator,Balancer>::binode_container(
+ allocator_type const& allocator
+ ) : _allocator(allocator)
+ , _root_ptr(
+#if defined BOOST_NO_CXX11_NULLPTR
+ 0
+#else
+ nullptr
+#endif
+ )
+ {
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ typename binode_container<T,NodeGenerator,Balancer>::node::pointer
+ binode_container<T,NodeGenerator,Balancer>::_construct_from(
+ ::std::tr1::true_type
+ , allocator_type& allocator
+ , typename node::pointer p
+ )
+ {
+ if (p)
+ {
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ typename node::pointer result(allocator.allocate(1));
+ allocator.construct(result, *p);
+#else
+ typename node::pointer result(
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::allocate(allocator, 1)
+ );
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::construct(allocator, result, *p);
+#endif
+ return result;
+ }
+ else
+ {
+ return p;
+ }
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ typename binode_container<T,NodeGenerator,Balancer>::node::pointer
+ binode_container<T,NodeGenerator,Balancer>::_construct_from(
+ ::std::tr1::false_type
+ , allocator_type& allocator
+ , typename node::pointer p
+ )
+ {
+ if (p)
+ {
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ typename node::pointer result(allocator.allocate(1));
+ allocator.construct(result, *p, allocator);
+#else
+ typename node::pointer result(
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::allocate(allocator, 1)
+ );
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::construct(allocator, result, *p, allocator);
+#endif
+ return result;
+ }
+ else
+ {
+ return p;
+ }
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ binode_container<T,NodeGenerator,Balancer>::binode_container(
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ binode_container const& copy
+#else
+ BOOST_COPY_ASSIGN_REF(binode_container) copy
+#endif
+ ) : _allocator(copy._allocator)
+ , _root_ptr(
+ this->_construct_from(
+ ::std::tr1::is_const<
+ typename ::std::tr1::remove_reference<
+ typename node::traits::allocator_reference
+ >::type
+ >()
+ , this->_allocator
+ , copy._root_ptr
+ )
+ )
+ {
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ binode_container<T,NodeGenerator,Balancer>::binode_container(
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ binode_container const& copy
+#else
+ BOOST_COPY_ASSIGN_REF(binode_container) copy
+#endif
+ , allocator_type const& allocator
+ ) : _allocator(copy._allocator)
+ , _root_ptr(
+ this->_construct_from(
+ ::std::tr1::is_const<
+ typename ::std::tr1::remove_reference<
+ typename node::traits::allocator_reference
+ >::type
+ >()
+ , this->_allocator
+ , copy._root_ptr
+ )
+ )
+ {
+ }
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <typename T, typename NodeGenerator, typename Balancer>
+ binode_container<T,NodeGenerator,Balancer>::binode_container(
+ BOOST_RV_REF(binode_container) source
+ ) : _allocator(::boost::move(source._allocator))
+ , _root_ptr(source._root_ptr)
+ {
+#if defined BOOST_NO_CXX11_NULLPTR
+ source._root_ptr = 0;
+#else
+ source._root_ptr = nullptr;
+#endif
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ binode_container<T,NodeGenerator,Balancer>::binode_container(
+ BOOST_RV_REF(binode_container) source
+ , allocator_type const& allocator
+ ) : _allocator(allocator), _root_ptr(source._root_ptr)
+ {
+#if defined BOOST_NO_CXX11_NULLPTR
+ source._root_ptr = 0;
+#else
+ source._root_ptr = nullptr;
+#endif
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline binode_container<T,NodeGenerator,Balancer>&
+ binode_container<T,NodeGenerator,Balancer>::operator=(
+ BOOST_RV_REF(binode_container) source
+ )
+ {
+ if (this != &static_cast<binode_container&>(source))
+ {
+ this->_allocator = ::boost::move(source._allocator);
+ this->clear();
+ this->_root_ptr = source._root_ptr;
+#if defined BOOST_NO_CXX11_NULLPTR
+ source._root_ptr = 0;
+#else
+ source._root_ptr = nullptr;
+#endif
+ }
+
+ return *this;
+ }
+#endif // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline binode_container<T,NodeGenerator,Balancer>&
+ binode_container<T,NodeGenerator,Balancer>::operator=(
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ binode_container const& copy
+#else
+ BOOST_COPY_ASSIGN_REF(binode_container) copy
+#endif
+ )
+ {
+ if (this != &copy)
+ {
+ if (copy._root_ptr)
+ {
+ if (this->_root_ptr)
+ {
+ *this->_root_ptr = *copy._root_ptr;
+ }
+ else
+ {
+ this->_root_ptr = this->_construct_from(
+ ::std::tr1::is_const<
+ typename ::std::tr1::remove_reference<
+ typename node::traits::allocator_reference
+ >::type
+ >()
+ , this->_allocator
+ , copy._root_ptr
+ );
+ }
+ }
+ else
+ {
+ this->clear();
+ }
+ }
+
+ return *this;
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ binode_container<T,NodeGenerator,Balancer>::~binode_container()
+ {
+ this->clear();
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<
+ T
+ , NodeGenerator
+ , Balancer
+ >::node::const_pointer
+ binode_container<T,NodeGenerator,Balancer>::data() const
+ {
+ return this->_root_ptr;
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::node::pointer
+ binode_container<T,NodeGenerator,Balancer>::data()
+ {
+ return this->_root_ptr;
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::const_iterator
+ binode_container<T,NodeGenerator,Balancer>::cbegin() const
+ {
+ return this->_root_ptr ? const_iterator(
+ make_in_order_iterator(*this->_root_ptr)
+ , at_key<data_key>()
+ ) : this->cend();
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::const_iterator
+ binode_container<T,NodeGenerator,Balancer>::begin() const
+ {
+ return this->_root_ptr ? const_iterator(
+ make_in_order_iterator(*this->_root_ptr)
+ , at_key<data_key>()
+ ) : this->end();
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::iterator
+ binode_container<T,NodeGenerator,Balancer>::begin()
+ {
+ return this->_root_ptr ? iterator(
+ make_in_order_iterator(*this->_root_ptr)
+ , at_key<data_key>()
+ ) : this->end();
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::const_iterator
+ binode_container<T,NodeGenerator,Balancer>::cend() const
+ {
+ return const_iterator(
+ make_in_order_iterator_end(this->_root_ptr)
+ , at_key<data_key>()
+ );
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::const_iterator
+ binode_container<T,NodeGenerator,Balancer>::end() const
+ {
+ return const_iterator(
+ make_in_order_iterator_end(this->_root_ptr)
+ , at_key<data_key>()
+ );
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::iterator
+ binode_container<T,NodeGenerator,Balancer>::end()
+ {
+ return iterator(
+ make_in_order_iterator_end(this->_root_ptr)
+ , at_key<data_key>()
+ );
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<
+ T
+ , NodeGenerator
+ , Balancer
+ >::const_reverse_iterator
+ binode_container<T,NodeGenerator,Balancer>::crbegin() const
+ {
+ return this->_root_ptr ? const_reverse_iterator(
+ make_in_order_reverse_iterator(*this->_root_ptr)
+ , at_key<data_key>()
+ ) : this->crend();
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<
+ T
+ , NodeGenerator
+ , Balancer
+ >::const_reverse_iterator
+ binode_container<T,NodeGenerator,Balancer>::rbegin() const
+ {
+ return this->_root_ptr ? const_reverse_iterator(
+ make_in_order_reverse_iterator(*this->_root_ptr)
+ , at_key<data_key>()
+ ) : this->rend();
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<
+ T
+ , NodeGenerator
+ , Balancer
+ >::reverse_iterator
+ binode_container<T,NodeGenerator,Balancer>::rbegin()
+ {
+ return this->_root_ptr ? reverse_iterator(
+ make_in_order_reverse_iterator(*this->_root_ptr)
+ , at_key<data_key>()
+ ) : this->rend();
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<
+ T
+ , NodeGenerator
+ , Balancer
+ >::const_reverse_iterator
+ binode_container<T,NodeGenerator,Balancer>::crend() const
+ {
+ return const_reverse_iterator(
+ make_in_order_reverse_iterator_end(this->_root_ptr)
+ , at_key<data_key>()
+ );
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<
+ T
+ , NodeGenerator
+ , Balancer
+ >::const_reverse_iterator
+ binode_container<T,NodeGenerator,Balancer>::rend() const
+ {
+ return const_reverse_iterator(
+ make_in_order_reverse_iterator_end(this->_root_ptr)
+ , at_key<data_key>()
+ );
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<
+ T
+ , NodeGenerator
+ , Balancer
+ >::reverse_iterator
+ binode_container<T,NodeGenerator,Balancer>::rend()
+ {
+ return reverse_iterator(
+ make_in_order_reverse_iterator_end(this->_root_ptr)
+ , at_key<data_key>()
+ );
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::const_reference
+ binode_container<T,NodeGenerator,Balancer>::front() const
+ {
+ return *this->cbegin();
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::reference
+ binode_container<T,NodeGenerator,Balancer>::front()
+ {
+ return *this->begin();
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::const_reference
+ binode_container<T,NodeGenerator,Balancer>::back() const
+ {
+ return *this->crbegin();
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::reference
+ binode_container<T,NodeGenerator,Balancer>::back()
+ {
+ return *this->rbegin();
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline void binode_container<T,NodeGenerator,Balancer>::pop_front()
+ {
+ this->erase(this->cbegin());
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ typename binode_container<T,NodeGenerator,Balancer>::node::const_pointer
+ binode_container<T,NodeGenerator,Balancer>::_back() const
+ {
+ typename node::const_pointer result = this->_root_ptr;
+
+ if (result)
+ {
+ while (result->get_right_child_ptr())
+ {
+ result = result->get_right_child_ptr();
+ }
+ }
+
+ return result;
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ typename binode_container<T,NodeGenerator,Balancer>::node::pointer
+ binode_container<T,NodeGenerator,Balancer>::_back()
+ {
+ typename node::pointer result = this->_root_ptr;
+
+ if (result)
+ {
+ while (result->get_right_child_ptr())
+ {
+ result = result->get_right_child_ptr();
+ }
+ }
+
+ return result;
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline void binode_container<T,NodeGenerator,Balancer>::pop_back()
+ {
+ this->erase(
+ iterator(
+ make_in_order_iterator_position(*this->_back())
+ , at_key<data_key>()
+ )
+ );
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ typename binode_container<T,NodeGenerator,Balancer>::node::pointer
+ binode_container<T,NodeGenerator,Balancer>::_construct_from(
+ ::std::tr1::true_type
+ , allocator_type& allocator
+ , value_type const& value
+ )
+ {
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ typename node::pointer result(allocator.allocate(1));
+ allocator.construct(result, value);
+#else
+ typename node::pointer result(
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::allocate(allocator, 1)
+ );
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::construct(allocator, result, value);
+#endif
+ return result;
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ typename binode_container<T,NodeGenerator,Balancer>::node::pointer
+ binode_container<T,NodeGenerator,Balancer>::_construct_from(
+ ::std::tr1::false_type
+ , allocator_type& allocator
+ , value_type const& value
+ )
+ {
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ typename node::pointer result(allocator.allocate(1));
+ allocator.construct(
+ result
+ , ::boost::container::allocator_arg
+ , allocator
+ , value
+ );
+#else
+ typename node::pointer result(
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::allocate(allocator, 1)
+ );
+ ::boost::container::allocator_traits<allocator_type>::construct(
+ allocator
+ , result
+ , ::boost::container::allocator_arg
+ , allocator
+ , value
+ );
+#endif
+ return result;
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ void
+ binode_container<T,NodeGenerator,Balancer>::push_front(
+ const_reference t
+ )
+ {
+ if (this->_root_ptr)
+ {
+ typename node::pointer p = this->_root_ptr;
+
+ while (p->get_left_child_ptr())
+ {
+ p = p->get_left_child_ptr();
+ }
+
+ p = Balancer::post_insert(p = &*p->emplace_left(t));
+
+ if (!p->get_parent_ptr())
+ {
+ this->_root_ptr = p;
+ }
+ }
+ else // if (!this->_root_ptr)
+ {
+ this->_root_ptr = this->_construct_from(
+ ::std::tr1::is_const<
+ typename ::std::tr1::remove_reference<
+ typename node::traits::allocator_reference
+ >::type
+ >()
+ , this->_allocator
+ , t
+ );
+ }
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ void
+ binode_container<T,NodeGenerator,Balancer>::push_back(
+ const_reference t
+ )
+ {
+ if (this->_root_ptr)
+ {
+ typename node::pointer p = this->_root_ptr;
+
+ while (p->get_right_child_ptr())
+ {
+ p = p->get_right_child_ptr();
+ }
+
+ p = Balancer::post_insert(p = &*p->emplace_right(t));
+
+ if (!p->get_parent_ptr())
+ {
+ this->_root_ptr = p;
+ }
+ }
+ else // if (!this->_root_ptr)
+ {
+ this->_root_ptr = this->_construct_from(
+ ::std::tr1::is_const<
+ typename ::std::tr1::remove_reference<
+ typename node::traits::allocator_reference
+ >::type
+ >()
+ , this->_allocator
+ , t
+ );
+ }
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ typename binode_container<T,NodeGenerator,Balancer>::iterator
+ binode_container<T,NodeGenerator,Balancer>::insert(
+ const_iterator itr
+ , const_reference t
+ )
+ {
+ if (itr.base())
+ {
+ typename node::pointer anc_ptr = const_cast<
+ typename node::pointer
+ >(&*itr.base());
+ typename node::pointer node_ptr = anc_ptr->get_left_child_ptr();
+
+ if (node_ptr)
+ {
+ while (node_ptr->get_right_child_ptr())
+ {
+ node_ptr = node_ptr->get_right_child_ptr();
+ }
+
+ node_ptr = &*node_ptr->emplace_right(t);
+ }
+ else
+ {
+ node_ptr = &*anc_ptr->emplace_left(t);
+ }
+
+ anc_ptr = Balancer::post_insert(node_ptr);
+
+ if (!anc_ptr->get_parent_ptr())
+ {
+ this->_root_ptr = anc_ptr;
+ }
+
+ return iterator(
+ make_in_order_iterator_position(*node_ptr)
+ , at_key<data_key>()
+ );
+ }
+ else // if (!itr)
+ {
+ this->push_back(t);
+ return this->end();
+ }
+ }
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template <typename T, typename NodeGenerator, typename Balancer> \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ typename binode_container<T,NodeGenerator,Balancer>::node::pointer \
+ binode_container<T,NodeGenerator,Balancer>::_construct_from( \
+ ::std::tr1::true_type \
+ , allocator_type& allocator \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ typename node::pointer result(allocator.allocate(1)); \
+ allocator.construct( \
+ result \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ return result; \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template <typename T, typename NodeGenerator, typename Balancer> \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ typename binode_container<T,NodeGenerator,Balancer>::node::pointer \
+ binode_container<T,NodeGenerator,Balancer>::_construct_from( \
+ ::std::tr1::false_type \
+ , allocator_type& allocator \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ typename node::pointer result(allocator.allocate(1)); \
+ allocator.construct( \
+ result \
+ , ::boost::container::allocator_arg \
+ , allocator \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ return result; \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template <typename T, typename NodeGenerator, typename Balancer> \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ void \
+ binode_container<T,NodeGenerator,Balancer>::emplace_front( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ if (this->_root_ptr) \
+ { \
+ typename node::pointer p = this->_root; \
+ while (p->get_left_child_ptr()) \
+ { \
+ p = p->get_left_child_ptr(); \
+ } \
+ p = Balancer::post_insert( \
+ p = &*p->emplace_left( \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ) \
+ ); \
+ if (!p->get_parent_ptr()) \
+ { \
+ this->_root_ptr = p; \
+ } \
+ } \
+ else \
+ { \
+ this->_root_ptr = this->_construct_from( \
+ ::std::tr1::is_const< \
+ typename ::std::tr1::remove_reference< \
+ typename node::traits::allocator_reference \
+ >::type \
+ >() \
+ , this->_allocator \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ } \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template <typename T, typename NodeGenerator, typename Balancer> \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ void \
+ binode_container<T,NodeGenerator,Balancer>::emplace_back( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ if (this->_root_ptr) \
+ { \
+ typename node::pointer p = this->_root; \
+ while (p->get_right_child_ptr()) \
+ { \
+ p = p->get_right_child_ptr(); \
+ } \
+ p = Balancer::post_insert( \
+ p = &*p->emplace_right( \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ) \
+ ); \
+ if (!p->get_parent_ptr()) \
+ { \
+ this->_root_ptr = p; \
+ } \
+ } \
+ else \
+ { \
+ this->_root_ptr = this->_construct_from( \
+ ::std::tr1::is_const< \
+ typename ::std::tr1::remove_reference< \
+ typename node::traits::allocator_reference \
+ >::type \
+ >() \
+ , this->_allocator \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ } \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template <typename T, typename NodeGenerator, typename Balancer> \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ typename binode_container<T,NodeGenerator,Balancer>::iterator \
+ binode_container<T,NodeGenerator,Balancer>::emplace( \
+ const_iterator itr \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ if (itr.base()) \
+ { \
+ typename node::pointer anc_ptr = const_cast< \
+ typename node::pointer \
+ >(&*itr.base()); \
+ typename node::pointer node_ptr = ( \
+ anc_ptr->get_left_child_ptr() \
+ ); \
+ if (node_ptr) \
+ { \
+ while (node_ptr->get_right_child_ptr()) \
+ { \
+ node_ptr = node_ptr->get_right_child_ptr(); \
+ } \
+ node_ptr = &*node_ptr->emplace_right( \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ } \
+ else \
+ { \
+ node_ptr = &*anc_ptr->emplace_left( \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ } \
+ anc_ptr = Balancer::post_insert(node_ptr); \
+ if (!anc_ptr->get_parent_ptr()) \
+ { \
+ this->_root_ptr = anc_ptr; \
+ } \
+ return iterator( \
+ make_in_order_iterator_position(*node_ptr) \
+ , at_key<data_key>() \
+ ); \
+ } \
+ else \
+ { \
+ this->emplace_back( \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ return this->end(); \
+ } \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#elif defined BOOST_CONTAINER_PERFECT_FORWARDING
+ template <typename T, typename NodeGenerator, typename Balancer>
+ template <typename ...Args>
+ typename binode_container<T,NodeGenerator,Balancer>::node::pointer
+ binode_container<T,NodeGenerator,Balancer>::_construct_from(
+ ::std::tr1::true_type
+ , allocator_type& allocator
+ , Args&& ...args
+ )
+ {
+ typename node::pointer result(
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::allocate(allocator, 1)
+ );
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::construct(allocator, result, ::boost::forward<Args>(args)...);
+ return result;
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ template <typename ...Args>
+ typename binode_container<T,NodeGenerator,Balancer>::node::pointer
+ binode_container<T,NodeGenerator,Balancer>::_construct_from(
+ ::std::tr1::false_type
+ , allocator_type& allocator
+ , Args&& ...args
+ )
+ {
+ typename node::pointer result(
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::allocate(allocator, 1)
+ );
+ ::boost::container::allocator_traits<allocator_type>::construct(
+ allocator
+ , result
+ , ::boost::container::allocator_arg
+ , allocator
+ , ::boost::forward<Args>(args)...
+ );
+ return result;
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ template <typename ...Args>
+ void
+ binode_container<T,NodeGenerator,Balancer>::emplace_front(
+ Args&& ...args
+ )
+ {
+ if (this->_root_ptr)
+ {
+ typename node::pointer p = this->_root;
+
+ while (p->get_left_child_ptr())
+ {
+ p = p->get_left_child_ptr();
+ }
+
+ p = Balancer::post_insert(
+ p = &*p->emplace_left(::boost::forward<Args>(args)...)
+ );
+
+ if (!p->get_parent_ptr())
+ {
+ this->_root_ptr = p;
+ }
+ }
+ else // if (!this->_root_ptr)
+ {
+ this->_root_ptr = this->_construct_from(
+ ::std::tr1::is_const<
+ typename ::std::tr1::remove_reference<
+ typename node::traits::allocator_reference
+ >::type
+ >()
+ , this->_allocator
+ , ::boost::forward<Args>(args)...
+ );
+ }
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ template <typename ...Args>
+ void
+ binode_container<T,NodeGenerator,Balancer>::emplace_back(
+ Args&& ...args
+ )
+ {
+ if (this->_root_ptr)
+ {
+ typename node::pointer p = this->_root;
+
+ while (p->get_right_child_ptr())
+ {
+ p = p->get_right_child_ptr();
+ }
+
+ p = Balancer::post_insert(
+ p = &*p->emplace_right(::boost::forward<Args>(args)...)
+ );
+
+ if (!p->get_parent_ptr())
+ {
+ this->_root_ptr = p;
+ }
+ }
+ else // if (!this->_root_ptr)
+ {
+ this->_root_ptr = this->_construct_from(
+ ::std::tr1::is_const<
+ typename ::std::tr1::remove_reference<
+ typename node::traits::allocator_reference
+ >::type
+ >()
+ , this->_allocator
+ , ::boost::forward<Args>(args)...
+ );
+ }
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ template <typename ...Args>
+ typename binode_container<T,NodeGenerator,Balancer>::iterator
+ binode_container<T,NodeGenerator,Balancer>::emplace(
+ const_iterator itr
+ , Args&& ...args
+ )
+ {
+ if (itr.base())
+ {
+ typename node::pointer anc_ptr = const_cast<
+ typename node::pointer
+ >(&*itr.base());
+ typename node::pointer node_ptr = anc_ptr->get_left_child_ptr();
+
+ if (node_ptr)
+ {
+ while (node_ptr->get_right_child_ptr())
+ {
+ node_ptr = node_ptr->get_right_child_ptr();
+ }
+
+ node_ptr = &*node_ptr->emplace_right(
+ ::boost::forward<Args>(args)...
+ );
+ }
+ else
+ {
+ node_ptr = &*anc_ptr->emplace_left(
+ ::boost::forward<Args>(args)...
+ );
+ }
+
+ anc_ptr = Balancer::post_insert(node_ptr);
+
+ if (!anc_ptr->get_parent_ptr())
+ {
+ this->_root_ptr = anc_ptr;
+ }
+
+ return iterator(
+ make_in_order_iterator_position(*node_ptr)
+ , at_key<data_key>()
+ );
+ }
+ else // if (!itr)
+ {
+ this->emplace_back(::boost::forward<Args>(args)...);
+ return this->end();
+ }
+ }
+#else // partial template specialization support, imperfect forwarding
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template <typename T, typename NodeGenerator, typename Balancer> \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ typename binode_container<T,NodeGenerator,Balancer>::node::pointer \
+ binode_container<T,NodeGenerator,Balancer>::_construct_from( \
+ ::std::tr1::true_type \
+ , allocator_type& allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ typename node::pointer result( \
+ ::boost::container::allocator_traits< \
+ allocator_type \
+ >::allocate(allocator, 1) \
+ ); \
+ ::boost::container::allocator_traits<allocator_type>::construct( \
+ allocator \
+ , result \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ return result; \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template <typename T, typename NodeGenerator, typename Balancer> \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ typename binode_container<T,NodeGenerator,Balancer>::node::pointer \
+ binode_container<T,NodeGenerator,Balancer>::_construct_from( \
+ ::std::tr1::false_type \
+ , allocator_type& allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ typename node::pointer result( \
+ ::boost::container::allocator_traits< \
+ allocator_type \
+ >::allocate(allocator, 1) \
+ ); \
+ ::boost::container::allocator_traits<allocator_type>::construct( \
+ allocator \
+ , result \
+ , ::boost::container::allocator_arg \
+ , allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ return result; \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template <typename T, typename NodeGenerator, typename Balancer> \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ void \
+ binode_container<T,NodeGenerator,Balancer>::emplace_front( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ if (this->_root_ptr) \
+ { \
+ typename node::pointer p = this->_root; \
+ while (p->get_left_child_ptr()) \
+ { \
+ p = p->get_left_child_ptr(); \
+ } \
+ p = Balancer::post_insert( \
+ p = &*p->emplace_left( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ) \
+ ); \
+ if (!p->get_parent_ptr()) \
+ { \
+ this->_root_ptr = p; \
+ } \
+ } \
+ else \
+ { \
+ this->_root_ptr = this->_construct_from( \
+ ::std::tr1::is_const< \
+ typename ::std::tr1::remove_reference< \
+ typename node::traits::allocator_reference \
+ >::type \
+ >() \
+ , this->_allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ } \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template <typename T, typename NodeGenerator, typename Balancer> \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ void \
+ binode_container<T,NodeGenerator,Balancer>::emplace_back( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ if (this->_root_ptr) \
+ { \
+ typename node::pointer p = this->_root; \
+ while (p->get_right_child_ptr()) \
+ { \
+ p = p->get_right_child_ptr(); \
+ } \
+ p = Balancer::post_insert( \
+ p = &*p->emplace_right( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ) \
+ ); \
+ if (!p->get_parent_ptr()) \
+ { \
+ this->_root_ptr = p; \
+ } \
+ } \
+ else \
+ { \
+ this->_root_ptr = this->_construct_from( \
+ ::std::tr1::is_const< \
+ typename ::std::tr1::remove_reference< \
+ typename node::traits::allocator_reference \
+ >::type \
+ >() \
+ , this->_allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ } \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template <typename T, typename NodeGenerator, typename Balancer> \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ typename binode_container<T,NodeGenerator,Balancer>::iterator \
+ binode_container<T,NodeGenerator,Balancer>::emplace( \
+ const_iterator itr \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ if (itr.base()) \
+ { \
+ typename node::pointer anc_ptr = const_cast< \
+ typename node::pointer \
+ >(&*itr.base()); \
+ typename node::pointer node_ptr = ( \
+ anc_ptr->get_left_child_ptr() \
+ ); \
+ if (node_ptr) \
+ { \
+ while (node_ptr->get_right_child_ptr()) \
+ { \
+ node_ptr = node_ptr->get_right_child_ptr(); \
+ } \
+ node_ptr = &*node_ptr->emplace_right( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ } \
+ else \
+ { \
+ node_ptr = &*anc_ptr->emplace_left( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ } \
+ anc_ptr = Balancer::post_insert(node_ptr); \
+ if (!anc_ptr->get_parent_ptr()) \
+ { \
+ this->_root_ptr = anc_ptr; \
+ } \
+ return iterator( \
+ make_in_order_iterator_position(*node_ptr) \
+ , at_key<data_key>() \
+ ); \
+ } \
+ else \
+ { \
+ this->emplace_back( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ return this->end(); \
+ } \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // compiler defect handling
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ typename binode_container<T,NodeGenerator,Balancer>::iterator
+ binode_container<T,NodeGenerator,Balancer>::erase(
+ const_iterator itr
+ )
+ {
+ if (itr.base()->empty() && (this->_root_ptr == &*itr.base()))
+ {
+ this->clear();
+ return this->end();
+ }
+
+ typename node::pointer anc_ptr = const_cast<typename node::pointer>(
+ &*itr.base()
+ );
+ iterator result(
+ make_in_order_iterator_position(*anc_ptr)
+ , at_key<data_key>()
+ );
+ bool must_erase_begin = (result == this->begin());
+
+ if (!must_erase_begin)
+ {
+ --result;
+ }
+
+ for (typename node::pointer desc_ptr;;)
+ {
+ if (
+ (desc_ptr = anc_ptr->get_left_child_ptr()) && (
+ !anc_ptr->get_right_child_ptr()
+ )
+ )
+ {
+ while (desc_ptr->get_right_child_ptr())
+ {
+ desc_ptr = desc_ptr->get_right_child_ptr();
+ }
+
+ if (desc_ptr->get_parent_ptr() == anc_ptr)
+ {
+ if (!anc_ptr->get_right_child_ptr())
+ {
+ put(*anc_ptr, data_key(), get(*desc_ptr, data_key()));
+
+ bool must_rebalance = Balancer::pre_erase(*desc_ptr);
+
+ anc_ptr->erase_left();
+
+ if (must_rebalance)
+ {
+ anc_ptr = Balancer::post_erase_left(anc_ptr);
+
+ if (!anc_ptr->get_parent_ptr())
+ {
+ this->_root_ptr = anc_ptr;
+ }
+ }
+
+ break;
+ }
+ }
+ else // if (desc_ptr == anc_ptr->get_right_child_ptr())
+ {
+ put(*anc_ptr, data_key(), get(*desc_ptr, data_key()));
+
+ if (desc_ptr->get_left_child_ptr())
+ {
+ anc_ptr = desc_ptr;
+ }
+ else // if (desc_ptr->empty())
+ {
+ anc_ptr = desc_ptr->get_parent_ptr();
+
+ if (anc_ptr->get_left_child_ptr())
+ {
+ put(*desc_ptr, data_key(), get(*anc_ptr, data_key()));
+ }
+ else // desc_ptr is only child of anc_ptr
+ {
+ bool must_rebalance = Balancer::pre_erase(*desc_ptr);
+
+ anc_ptr->erase_right();
+
+ if (must_rebalance)
+ {
+ anc_ptr = Balancer::post_erase_right(anc_ptr);
+
+ if (!anc_ptr->get_parent_ptr())
+ {
+ this->_root_ptr = anc_ptr;
+ }
+ }
+
+ break;
+ }
+ }
+
+ continue;
+ }
+ }
+
+ if ((desc_ptr = anc_ptr->get_right_child_ptr()))
+ {
+ while (desc_ptr->get_left_child_ptr())
+ {
+ desc_ptr = desc_ptr->get_left_child_ptr();
+ }
+
+ put(*anc_ptr, data_key(), get(*desc_ptr, data_key()));
+
+ if (desc_ptr->get_right_child_ptr())
+ {
+ if (desc_ptr->get_right_child_ptr()->empty())
+ {
+ bool must_rebalance = Balancer::pre_erase(*desc_ptr);
+
+ anc_ptr->erase_right();
+
+ if (must_rebalance)
+ {
+ anc_ptr = Balancer::post_erase_right(anc_ptr);
+
+ if (!anc_ptr->get_parent_ptr())
+ {
+ this->_root_ptr = anc_ptr;
+ }
+ }
+ }
+ else
+ {
+ anc_ptr = desc_ptr;
+ }
+ }
+ else if (desc_ptr->get_parent_ptr() == anc_ptr)
+ {
+ bool must_rebalance = Balancer::pre_erase(*desc_ptr);
+
+ anc_ptr->erase_right();
+
+ if (must_rebalance)
+ {
+ anc_ptr = Balancer::post_erase_right(anc_ptr);
+
+ if (!anc_ptr->get_parent_ptr())
+ {
+ this->_root_ptr = anc_ptr;
+ }
+ }
+
+ break;
+ }
+ else
+ {
+ BOOST_ASSERT(desc_ptr->empty());
+ anc_ptr = desc_ptr->get_parent_ptr();
+ BOOST_ASSERT(anc_ptr->get_left_child_ptr() == desc_ptr);
+
+ if (anc_ptr->get_right_child_ptr())
+ {
+ put(*desc_ptr, data_key(), get(*anc_ptr, data_key()));
+ }
+ else // desc_ptr is only child of anc_ptr
+ {
+ bool must_rebalance = Balancer::pre_erase(*desc_ptr);
+
+ anc_ptr->erase_left();
+
+ if (must_rebalance)
+ {
+ anc_ptr = Balancer::post_erase_left(anc_ptr);
+
+ if (!anc_ptr->get_parent_ptr())
+ {
+ this->_root_ptr = anc_ptr;
+ }
+ }
+
+ break;
+ }
+ }
+ }
+ else // if (anc_ptr->empty())
+ {
+ desc_ptr = anc_ptr;
+ anc_ptr = anc_ptr->get_parent_ptr();
+
+ bool must_rebalance = Balancer::pre_erase(*desc_ptr);
+
+ if (anc_ptr->get_left_child_ptr() == desc_ptr)
+ {
+ anc_ptr->erase_left();
+
+ if (must_rebalance)
+ {
+ anc_ptr = Balancer::post_erase_left(anc_ptr);
+
+ if (!anc_ptr->get_parent_ptr())
+ {
+ this->_root_ptr = anc_ptr;
+ }
+ }
+ }
+ else // if (anc_ptr->get_right_child_ptr() == desc_ptr)
+ {
+ anc_ptr->erase_right();
+
+ if (must_rebalance)
+ {
+ anc_ptr = Balancer::post_erase_right(anc_ptr);
+
+ if (!anc_ptr->get_parent_ptr())
+ {
+ this->_root_ptr = anc_ptr;
+ }
+ }
+ }
+
+ break;
+ }
+ }
+
+ return must_erase_begin ? this->begin() : ++result;
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ void
+ binode_container<T,NodeGenerator,Balancer>::erase(
+ const_iterator itr
+ , const_iterator itr_end
+ )
+ {
+ while (itr != itr_end)
+ {
+ itr = this->erase(itr);
+ }
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline bool binode_container<T,NodeGenerator,Balancer>::empty() const
+ {
+ return !this->_root_ptr;
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ void binode_container<T,NodeGenerator,Balancer>::clear()
+ {
+ if (this->_root_ptr)
+ {
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ this->_allocator.destroy(this->_root_ptr);
+ this->_allocator.deallocate(this->_root_ptr, 1);
+#else
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::destroy(this->_allocator, this->_root_ptr);
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::deallocate(this->_allocator, this->_root_ptr, 1);
+#endif
+
+#if defined BOOST_NO_CXX11_NULLPTR
+ this->_root_ptr = 0;
+#else
+ this->_root_ptr = nullptr;
+#endif
+ }
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::size_type
+ binode_container<T,NodeGenerator,Balancer>::_size(
+ ::boost::mpl::true_
+ ) const
+ {
+ return this->_root_ptr ? get(*this->_root_ptr, count_key()) : 0;
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::size_type
+ binode_container<T,NodeGenerator,Balancer>::_size(
+ ::boost::mpl::false_
+ ) const
+ {
+ return ::std::distance(this->cbegin(), this->cend());
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::size_type
+ binode_container<T,NodeGenerator,Balancer>::size() const
+ {
+ return this->_size(result_of::has_key<node,count_key>());
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::const_reference
+ binode_container<T,NodeGenerator,Balancer>::operator[](
+ size_type index
+ ) const
+ {
+ BOOST_ASSERT_MSG(
+ this->_root_ptr && (index < this->size())
+ , "index out of bounds"
+ );
+
+ typename node::const_pointer node_ptr = this->_root_ptr;
+
+ return get(*binary_descendant_at_index(node_ptr, index), data_key());
+ }
+
+ template <typename T, typename NodeGenerator, typename Balancer>
+ inline typename binode_container<T,NodeGenerator,Balancer>::reference
+ binode_container<T,NodeGenerator,Balancer>::operator[](size_type index)
+ {
+ BOOST_ASSERT_MSG(
+ this->_root_ptr && (index < this->size())
+ , "index out of bounds"
+ );
+
+ return get(
+ *binary_descendant_at_index(this->_root_ptr, index)
+ , data_key()
+ );
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_CONTAINER_BINODE_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/container/binode_associative.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/container/binode_associative.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,5162 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_CONTAINER_BINODE_ASSOCIATIVE_HPP_INCLUDED
+#define BOOST_TREE_NODE_CONTAINER_BINODE_ASSOCIATIVE_HPP_INCLUDED
+
+#include <boost/config.hpp>
+
+#if !defined BOOST_NO_CXX11_NULLPTR
+#include <cstddef>
+#endif
+
+#include <algorithm>
+#include <utility>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/apply_wrap.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/utility/value_init.hpp>
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <boost/move/move.hpp>
+#include <boost/container/allocator_traits.hpp>
+#endif
+
+#include <boost/tree_node/preprocessor.hpp>
+#include <boost/tree_node/key/data.hpp>
+#include <boost/tree_node/key/count.hpp>
+#include <boost/tree_node/iterator/in_order.hpp>
+#include <boost/tree_node/intrinsic/has_key.hpp>
+#include <boost/tree_node/intrinsic/value_at_key.hpp>
+#include <boost/tree_node/algorithm/binary_descendant.hpp>
+#include <boost/tree_node/algorithm/binary_lower_bound.hpp>
+#include <boost/tree_node/algorithm/binary_upper_bound.hpp>
+#include <boost/tree_node/algorithm/binary_descendant_at_index.hpp>
+#include <boost/tree_node/container/binode_associative_fwd.hpp>
+#include <boost/assert.hpp>
+
+namespace boost { namespace tree_node {
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ class binode_associative_container
+ {
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ BOOST_COPYABLE_AND_MOVABLE(binode_associative_container)
+#endif
+
+ public:
+ //[reference__binode_associative_container__key_type
+ typedef T1 key_type;
+ //]
+
+ //[reference__binode_associative_container__value_type
+ typedef typename ::boost::mpl::if_<
+ ::std::tr1::is_void<T2>
+ , T1
+ , ::std::pair<T1 const,T2>
+ >::type
+ value_type;
+ //]
+
+ //[reference__binode_associative_container__reference
+ typedef value_type& reference;
+ //]
+
+ //[reference__binode_associative_container__const_reference
+ typedef value_type const& const_reference;
+ //]
+
+ //[reference__binode_associative_container__pointer
+ typedef value_type* pointer;
+ //]
+
+ //[reference__binode_associative_container__const_pointer
+ typedef value_type const* const_pointer;
+ //]
+
+ //[reference__binode_associative_container__node
+ typedef typename ::boost::mpl::apply_wrap1<
+ NodeGenerator
+ , typename ::boost::mpl::if_<
+ ::std::tr1::is_void<T2>
+ , T1
+ , ::std::pair<T1,T2>
+ >::type
+ >::type
+ node;
+ //]
+
+ //[reference__binode_associative_container__allocator_type
+ typedef typename node::traits::allocator allocator_type;
+ //]
+
+ private:
+ //[reference__binode_associative_container__transform_function
+ struct simple_transform_function
+ {
+ typedef const_reference const_result;
+ typedef const_reference mutable_result;
+ const_reference operator()(node const& n) const;
+ };
+
+ struct pair_associative_transform_function
+ {
+ typedef ::std::pair<T1 const&,T2 const&> const_result;
+ typedef ::std::pair<T1 const&,T2&> mutable_result;
+ const_result operator()(node const& n) const;
+ mutable_result operator()(node& n) const;
+ };
+
+ typedef typename ::boost::mpl::if_<
+ ::std::tr1::is_void<T2>
+ , simple_transform_function
+ , pair_associative_transform_function
+ >::type
+ transform_function;
+ //]
+
+ public:
+ //[reference__binode_associative_container__iterator
+ typedef ::boost::transform_iterator<
+ transform_function
+ , in_order_iterator<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_void<T2>
+ , node const
+ , node
+ >::type
+ >
+ >
+ iterator;
+ //]
+
+ //[reference__binode_associative_container__const_iterator
+ typedef ::boost::transform_iterator<
+ transform_function
+ , in_order_iterator<node const>
+ >
+ const_iterator;
+ //]
+
+ //[reference__binode_associative_container__reverse_iterator
+ typedef ::boost::transform_iterator<
+ transform_function
+ , in_order_iterator<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_void<T2>
+ , node const
+ , node
+ >::type
+ , ::boost::mpl::true_
+ >
+ >
+ reverse_iterator;
+ //]
+
+ //[reference__binode_associative_container__const_reverse_iterator
+ typedef ::boost::transform_iterator<
+ transform_function
+ , in_order_iterator<node const,::boost::mpl::true_>
+ >
+ const_reverse_iterator;
+ //]
+
+ //[reference__binode_associative_container__size_type
+ typedef typename ::boost::mpl::eval_if<
+ result_of::has_key<node,count_key>
+ , result_of::value_at_key<node,count_key>
+ , typename node::size_type
+ >::type
+ size_type;
+ //]
+
+ //[reference__binode_associative_container__key_compare
+ typedef typename ::boost::mpl::apply_wrap1<
+ CompareSelector
+ , key_type
+ >::type
+ key_compare;
+ //]
+
+ //[reference__binode_associative_container__value_compare
+ class value_compare
+ {
+ //<-
+ key_compare const& _compare;
+ //->
+
+ public:
+ typedef bool result_type;
+
+ explicit value_compare(key_compare const& compare);
+ result_type operator()(const_reference, const_reference) const;
+ result_type operator()(node const& n, key_type const& key) const;
+ result_type operator()(key_type const& key, node const& n) const;
+
+ //<-
+ private:
+ result_type
+ _evaluate(
+ const_reference arg1
+ , const_reference arg2
+ , ::std::tr1::true_type
+ ) const;
+ result_type
+ _evaluate(
+ const_reference arg1
+ , const_reference arg2
+ , ::std::tr1::false_type
+ ) const;
+ result_type
+ _evaluate(
+ node const& n
+ , key_type const& key
+ , ::std::tr1::true_type
+ ) const;
+ result_type
+ _evaluate(
+ node const& n
+ , key_type const& key
+ , ::std::tr1::false_type
+ ) const;
+ result_type
+ _evaluate(
+ key_type const& key
+ , node const& n
+ , ::std::tr1::true_type
+ ) const;
+ result_type
+ _evaluate(
+ key_type const& key
+ , node const& n
+ , ::std::tr1::false_type
+ ) const;
+ //->
+ };
+ //]
+
+ private:
+ class insert_compare
+ {
+ key_compare const& _compare;
+
+ public:
+ typedef bool result_type;
+
+ explicit insert_compare(key_compare const& compare);
+ result_type operator()(node const&, const_reference) const;
+ result_type operator()(const_reference, node const&) const;
+
+ private:
+ result_type
+ _evaluate(
+ node const& n
+ , const_reference value
+ , ::std::tr1::true_type
+ ) const;
+ result_type
+ _evaluate(
+ node const& n
+ , const_reference value
+ , ::std::tr1::false_type
+ ) const;
+ result_type
+ _evaluate(
+ const_reference value
+ , node const& n
+ , ::std::tr1::true_type
+ ) const;
+ result_type
+ _evaluate(
+ const_reference value
+ , node const& n
+ , ::std::tr1::false_type
+ ) const;
+ };
+
+ allocator_type _allocator;
+ typename node::pointer _root_ptr;
+ key_compare _key_compare;
+ value_compare _value_compare;
+
+ public:
+ //[reference__binode_associative_container__default_ctor
+ binode_associative_container();
+ //]
+
+ //[reference__binode_associative_container__ctor_w_alloc
+ explicit binode_associative_container(allocator_type const& allocator);
+ //]
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ //[reference__binode_associative_container__copy_ctor
+ binode_associative_container(
+ binode_associative_container const& copy
+ );
+ //]
+
+ //[reference__binode_associative_container__copy_ctor_w_alloc
+ binode_associative_container(
+ binode_associative_container const& copy
+ , allocator_type const& allocator
+ );
+ //]
+
+ //[reference__binode_associative_container__copy_assign
+ binode_associative_container&
+ operator=(binode_associative_container const& copy);
+ //]
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ binode_associative_container(
+ BOOST_COPY_ASSIGN_REF(binode_associative_container) copy
+ );
+
+ binode_associative_container(
+ BOOST_COPY_ASSIGN_REF(binode_associative_container) copy
+ , allocator_type const& allocator
+ );
+
+ binode_associative_container(
+ BOOST_RV_REF(binode_associative_container) source
+ );
+
+ binode_associative_container(
+ BOOST_RV_REF(binode_associative_container) source
+ , allocator_type const& allocator
+ );
+
+ binode_associative_container&
+ operator=(BOOST_RV_REF(binode_associative_container) source);
+
+ binode_associative_container&
+ operator=(
+ BOOST_COPY_ASSIGN_REF(binode_associative_container) copy
+ );
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ //[reference__binode_associative_container__dtor
+ ~binode_associative_container();
+ //]
+
+ //[reference__binode_associative_container__data
+ typename node::const_pointer data() const;
+ //]
+
+ //[reference__binode_associative_container__cbegin
+ const_iterator cbegin() const;
+ const_iterator begin() const;
+ //]
+
+ //[reference__binode_associative_container__begin
+ iterator begin();
+ //]
+
+ //[reference__binode_associative_container__cend
+ const_iterator cend() const;
+ const_iterator end() const;
+ //]
+
+ //[reference__binode_associative_container__end
+ iterator end();
+ //]
+
+ //[reference__binode_associative_container__crbegin
+ const_reverse_iterator crbegin() const;
+ const_reverse_iterator rbegin() const;
+ //]
+
+ //[reference__binode_associative_container__rbegin
+ reverse_iterator rbegin();
+ //]
+
+ //[reference__binode_associative_container__crend
+ const_reverse_iterator crend() const;
+ const_reverse_iterator rend() const;
+ //]
+
+ //[reference__binode_associative_container__rend
+ reverse_iterator rend();
+ //]
+
+ //[reference__binode_associative_container__cfind
+ const_iterator find(key_type const& key) const;
+ //]
+
+ //[reference__binode_associative_container__find
+ iterator find(key_type const& key);
+ //]
+
+ //[reference__binode_associative_container__lower_bound__const
+ const_iterator lower_bound(key_type const& key) const;
+ //]
+
+ //[reference__binode_associative_container__lower_bound
+ iterator lower_bound(key_type const& key);
+ //]
+
+ //[reference__binode_associative_container__upper_bound__const
+ const_iterator upper_bound(key_type const& key) const;
+ //]
+
+ //[reference__binode_associative_container__upper_bound
+ iterator upper_bound(key_type const& key);
+ //]
+
+ //[reference__binode_associative_container__equal_range__const
+ ::std::pair<const_iterator,const_iterator>
+ equal_range(key_type const& key) const;
+ //]
+
+ //[reference__binode_associative_container__equal_range
+ ::std::pair<iterator,iterator> equal_range(key_type const& key);
+ //]
+
+ //[reference__binode_associative_container__insert
+ typename ::boost::mpl::if_<
+ IsMultipleAssociative
+ , iterator
+ , ::std::pair<iterator,bool>
+ >::type
+ insert(value_type const& value);
+ //]
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ typename ::boost::mpl::if_< \
+ IsMultipleAssociative \
+ , iterator \
+ , ::std::pair<iterator,bool> \
+ >::type \
+ emplace( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#elif defined BOOST_CONTAINER_PERFECT_FORWARDING
+ //[reference__binode_associative_container__emplace
+ template <typename ...Args>
+ typename ::boost::mpl::if_<
+ IsMultipleAssociative
+ , iterator
+ , ::std::pair<iterator,bool>
+ >::type
+ emplace(Args&& ...args);
+ //]
+#else // partial template specialization support, imperfect forwarding
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ typename ::boost::mpl::if_< \
+ IsMultipleAssociative \
+ , iterator \
+ , ::std::pair<iterator,bool> \
+ >::type \
+ emplace( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // compiler defect handling
+
+ //[reference__binode_associative_container__erase
+ size_type erase(key_type const& key);
+ //]
+
+ //[reference__binode_associative_container__empty
+ bool empty() const;
+ //]
+
+ //[reference__binode_associative_container__clear
+ void clear();
+ //]
+
+ //[reference__binode_associative_container__size
+ size_type size() const;
+ //]
+
+ //[reference__binode_associative_container__index_operator__const
+ typename transform_function::const_result
+ operator[](size_type const& index) const;
+ //]
+
+ //[reference__binode_associative_container__index_operator
+ typename transform_function::mutable_result
+ operator[](size_type const& index);
+ //]
+
+ private:
+ static typename node::pointer
+ _construct_node_from(
+ ::std::tr1::true_type
+ , allocator_type& allocator
+ , value_type const& value
+ );
+
+ static typename node::pointer
+ _construct_node_from(
+ ::std::tr1::false_type
+ , allocator_type& allocator
+ , value_type const& value
+ );
+
+ static typename node::pointer
+ _construct_node_from(
+ ::std::tr1::true_type
+ , allocator_type& allocator
+ , typename node::pointer p
+ );
+
+ static typename node::pointer
+ _construct_node_from(
+ ::std::tr1::false_type
+ , allocator_type& allocator
+ , typename node::pointer p
+ );
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ static typename node::pointer \
+ _construct_node_from( \
+ ::std::tr1::true_type \
+ , allocator_type& allocator \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ static typename node::pointer \
+ _construct_node_from( \
+ ::std::tr1::false_type \
+ , allocator_type& allocator \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ static value_type \
+ _construct_node_from( \
+ ::std::tr1::true_type \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ static value_type \
+ _construct_node_from( \
+ ::std::tr1::false_type \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ iterator \
+ _emplace( \
+ ::boost::mpl::true_ \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ ::std::pair<iterator,bool> \
+ _emplace( \
+ ::boost::mpl::false_ \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#elif defined BOOST_CONTAINER_PERFECT_FORWARDING
+ template <typename ...Args>
+ static typename node::pointer
+ _construct_node_from(
+ ::std::tr1::true_type
+ , allocator_type& allocator
+ , Args&& ...args
+ );
+
+ template <typename ...Args>
+ static typename node::pointer
+ _construct_node_from(
+ ::std::tr1::false_type
+ , allocator_type& allocator
+ , Args&& ...args
+ );
+
+ template <typename ...Args>
+ static value_type
+ _construct_value_from(
+ ::std::tr1::true_type
+ , Args&& ...args
+ );
+
+ template <typename ...Args>
+ static value_type
+ _construct_value_from(
+ ::std::tr1::false_type
+ , key_type const& key
+ , Args&& ...args
+ );
+
+ template <typename ...Args>
+ iterator _emplace(::boost::mpl::true_, Args&& ...args);
+
+ template <typename ...Args>
+ ::std::pair<iterator,bool>
+ _emplace(::boost::mpl::false_, Args&& ...args);
+#else // partial template specialization support, imperfect forwarding
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ static typename node::pointer \
+ _construct_node_from( \
+ ::std::tr1::true_type \
+ , allocator_type& allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ static typename node::pointer \
+ _construct_node_from( \
+ ::std::tr1::false_type \
+ , allocator_type& allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ static value_type \
+ _construct_value_from( \
+ ::std::tr1::true_type \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ static value_type \
+ _construct_value_from( \
+ ::std::tr1::false_type \
+ , key_type const& key \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_PP_DEC(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ iterator \
+ _emplace( \
+ ::boost::mpl::true_ \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ ::std::pair<iterator,bool> \
+ _emplace( \
+ ::boost::mpl::false_ \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // compiler defect handling
+
+ iterator _insert(value_type const& value, ::boost::mpl::true_);
+
+ ::std::pair<iterator,bool>
+ _insert(value_type const& value, ::boost::mpl::false_);
+
+ void _erase_one(typename node::pointer p);
+
+ size_type _erase(key_type const& key, ::boost::mpl::true_);
+
+ size_type _erase(key_type const& key, ::boost::mpl::false_);
+
+ size_type _size(::boost::mpl::true_) const;
+
+ size_type _size(::boost::mpl::false_) const;
+ };
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::const_reference
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::simple_transform_function::operator()(node const& n) const
+ {
+ return get(n, data_key());
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::pair_associative_transform_function::const_result
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::pair_associative_transform_function::operator()(node const& n) const
+ {
+ ::std::pair<T1,T2> const& p = get(n, data_key());
+ ::std::pair<T1 const&,T2 const&> result(p.first, p.second);
+ return result;
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::pair_associative_transform_function::mutable_result
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::pair_associative_transform_function::operator()(node& n) const
+ {
+ ::std::pair<T1,T2>& p = get(n, data_key());
+ ::std::pair<T1 const&,T2&> result(p.first, p.second);
+ return result;
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::value_compare(key_compare const& c) : _compare(c)
+ {
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::result_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::_evaluate(
+ const_reference arg1
+ , const_reference arg2
+ , ::std::tr1::true_type
+ ) const
+ {
+ return this->_compare(arg1, arg2);
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::result_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::_evaluate(
+ const_reference arg1
+ , const_reference arg2
+ , ::std::tr1::false_type
+ ) const
+ {
+ return this->_compare(arg1.first, arg2.first);
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::result_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::operator()(
+ const_reference arg1
+ , const_reference arg2
+ ) const
+ {
+ return this->_evaluate(arg1, arg2, ::std::tr1::is_void<T2>());
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::result_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::_evaluate(
+ node const& n
+ , key_type const& key
+ , ::std::tr1::true_type
+ ) const
+ {
+ return this->_compare(get(n, data_key()), key);
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::result_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::_evaluate(
+ node const& n
+ , key_type const& key
+ , ::std::tr1::false_type
+ ) const
+ {
+ return this->_compare(get(n, data_key()).first, key);
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::result_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::operator()(node const& n, key_type const& key) const
+ {
+ return this->_evaluate(n, key, ::std::tr1::is_void<T2>());
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::result_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::_evaluate(
+ key_type const& key
+ , node const& n
+ , ::std::tr1::true_type
+ ) const
+ {
+ return this->_compare(key, get(n, data_key()));
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::result_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::_evaluate(
+ key_type const& key
+ , node const& n
+ , ::std::tr1::false_type
+ ) const
+ {
+ return this->_compare(key, get(n, data_key()).first);
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::result_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_compare::operator()(key_type const& key, node const& n) const
+ {
+ return this->_evaluate(key, n, ::std::tr1::is_void<T2>());
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::insert_compare::insert_compare(key_compare const& c) : _compare(c)
+ {
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::insert_compare::result_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::insert_compare::_evaluate(
+ const_reference value
+ , node const& n
+ , ::std::tr1::true_type
+ ) const
+ {
+ return this->_compare(value, get(n, data_key()));
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::insert_compare::result_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::insert_compare::_evaluate(
+ const_reference value
+ , node const& n
+ , ::std::tr1::false_type
+ ) const
+ {
+ return this->_compare(value.first, get(n, data_key()).first);
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::insert_compare::result_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::insert_compare::operator()(
+ const_reference value
+ , node const& n
+ ) const
+ {
+ return this->_evaluate(value, n, ::std::tr1::is_void<T2>());
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::insert_compare::result_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::insert_compare::_evaluate(
+ node const& n
+ , const_reference value
+ , ::std::tr1::true_type
+ ) const
+ {
+ return this->_compare(get(n, data_key()), value);
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::insert_compare::result_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::insert_compare::_evaluate(
+ node const& n
+ , const_reference value
+ , ::std::tr1::false_type
+ ) const
+ {
+ return this->_compare(get(n, data_key()).first, value.first);
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::insert_compare::result_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::insert_compare::operator()(
+ node const& n
+ , const_reference value
+ ) const
+ {
+ return this->_evaluate(n, value, ::std::tr1::is_void<T2>());
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::binode_associative_container()
+ : _allocator()
+ , _root_ptr(
+#if defined BOOST_NO_CXX11_NULLPTR
+ 0
+#else
+ nullptr
+#endif
+ )
+ , _key_compare()
+ , _value_compare(this->_key_compare)
+ {
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::binode_associative_container(allocator_type const& allocator)
+ : _allocator(allocator)
+ , _root_ptr(
+#if defined BOOST_NO_CXX11_NULLPTR
+ 0
+#else
+ nullptr
+#endif
+ )
+ , _key_compare()
+ , _value_compare(this->_key_compare)
+ {
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::node::pointer
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_construct_node_from(
+ ::std::tr1::true_type
+ , allocator_type& allocator
+ , typename node::pointer p
+ )
+ {
+ if (p)
+ {
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ typename node::pointer result(allocator.allocate(1));
+ allocator.construct(result, *p);
+#else
+ typename node::pointer result(
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::allocate(allocator, 1)
+ );
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::construct(allocator, result, *p);
+#endif
+ return result;
+ }
+ else
+ {
+ return p;
+ }
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::node::pointer
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_construct_node_from(
+ ::std::tr1::false_type
+ , allocator_type& allocator
+ , typename node::pointer p
+ )
+ {
+ if (p)
+ {
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ typename node::pointer result(allocator.allocate(1));
+ allocator.construct(result, *p, allocator);
+#else
+ typename node::pointer result(
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::allocate(allocator, 1)
+ );
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::construct(allocator, result, *p, allocator);
+#endif
+ return result;
+ }
+ else
+ {
+ return p;
+ }
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::binode_associative_container(
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ binode_associative_container const& copy
+#else
+ BOOST_COPY_ASSIGN_REF(binode_associative_container) copy
+#endif
+ ) : _allocator(copy._allocator)
+ , _root_ptr(
+ this->_construct_node_from(
+ ::std::tr1::is_const<
+ typename ::std::tr1::remove_reference<
+ typename node::traits::allocator_reference
+ >::type
+ >()
+ , this->_allocator
+ , copy._root_ptr
+ )
+ )
+ , _key_compare(copy._key_compare)
+ , _value_compare(this->_key_compare)
+ {
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::binode_associative_container(
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ binode_associative_container const& copy
+#else
+ BOOST_COPY_ASSIGN_REF(binode_associative_container) copy
+#endif
+ , allocator_type const& allocator
+ ) : _allocator(allocator)
+ , _root_ptr(
+ this->_construct_node_from(
+ ::std::tr1::is_const<
+ typename ::std::tr1::remove_reference<
+ typename node::traits::allocator_reference
+ >::type
+ >()
+ , this->_allocator
+ , copy._root_ptr
+ )
+ )
+ , _key_compare(copy._key_compare)
+ , _value_compare(this->_key_compare)
+ {
+ }
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::binode_associative_container(
+ BOOST_RV_REF(binode_associative_container) source
+ ) : _allocator(::boost::move(source._allocator))
+ , _root_ptr(source._root_ptr)
+ , _key_compare(::boost::move(source._key_compare))
+ , _value_compare(this->_key_compare)
+ {
+#if defined BOOST_NO_CXX11_NULLPTR
+ source._root_ptr = 0;
+#else
+ source._root_ptr = nullptr;
+#endif
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::binode_associative_container(
+ BOOST_RV_REF(binode_associative_container) source
+ , allocator_type const& allocator
+ ) : _allocator(allocator)
+ , _root_ptr(source._root_ptr)
+ , _key_compare(::boost::move(source._key_compare))
+ , _value_compare(this->_key_compare)
+ {
+#if defined BOOST_NO_CXX11_NULLPTR
+ source._root_ptr = 0;
+#else
+ source._root_ptr = nullptr;
+#endif
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >&
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::operator=(BOOST_RV_REF(binode_associative_container) source)
+ {
+ if (this != &static_cast<binode_associative_container&>(source))
+ {
+ this->_allocator = ::boost::move(source._allocator);
+ this->clear();
+ this->_root_ptr = source._root_ptr;
+#if defined BOOST_NO_CXX11_NULLPTR
+ source._root_ptr = 0;
+#else
+ source._root_ptr = nullptr;
+#endif
+ this->_key_compare = ::boost::move(source._key_compare);
+ }
+
+ return *this;
+ }
+#endif // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >&
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::operator=(
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ binode_associative_container const& copy
+#else
+ BOOST_COPY_ASSIGN_REF(binode_associative_container) copy
+#endif
+ )
+ {
+ if (this != &static_cast<binode_associative_container const&>(copy))
+ {
+ if (copy._root_ptr)
+ {
+ if (this->_root_ptr)
+ {
+ *this->_root_ptr = *copy._root_ptr;
+ }
+ else
+ {
+ this->_root_ptr = this->_construct_node_from(
+ ::std::tr1::is_const<
+ typename ::std::tr1::remove_reference<
+ typename node::traits::allocator_reference
+ >::type
+ >()
+ , this->_allocator
+ , copy._root_ptr
+ );
+ }
+ }
+ else
+ {
+ this->clear();
+ }
+
+ this->_key_compare = copy._key_compare;
+ }
+
+ return *this;
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::~binode_associative_container()
+ {
+ this->clear();
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::node::const_pointer
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::data() const
+ {
+ return this->_root_ptr;
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::const_iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::cbegin() const
+ {
+ return this->_root_ptr ? const_iterator(
+ make_in_order_iterator(*this->_root_ptr)
+ , transform_function()
+ ) : this->cend();
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::const_iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::begin() const
+ {
+ return this->_root_ptr ? const_iterator(
+ make_in_order_iterator(*this->_root_ptr)
+ , transform_function()
+ ) : this->end();
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::begin()
+ {
+ return this->_root_ptr ? iterator(
+ make_in_order_iterator(*this->_root_ptr)
+ , transform_function()
+ ) : this->end();
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::const_iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::cend() const
+ {
+ return const_iterator(
+ make_in_order_iterator_end(this->_root_ptr)
+ , transform_function()
+ );
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::const_iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::end() const
+ {
+ return const_iterator(
+ make_in_order_iterator_end(this->_root_ptr)
+ , transform_function()
+ );
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::end()
+ {
+ return iterator(
+ make_in_order_iterator_end(this->_root_ptr)
+ , transform_function()
+ );
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::const_reverse_iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::crbegin() const
+ {
+ return this->_root_ptr ? const_reverse_iterator(
+ make_in_order_reverse_iterator(*this->_root_ptr)
+ , transform_function()
+ ) : this->crend();
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::const_reverse_iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::rbegin() const
+ {
+ return this->_root_ptr ? const_reverse_iterator(
+ make_in_order_reverse_iterator(*this->_root_ptr)
+ , transform_function()
+ ) : this->rend();
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::reverse_iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::rbegin()
+ {
+ return this->_root_ptr ? reverse_iterator(
+ make_in_order_reverse_iterator(*this->_root_ptr)
+ , transform_function()
+ ) : this->rend();
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::const_reverse_iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::crend() const
+ {
+ return const_reverse_iterator(
+ make_in_order_reverse_iterator_end(this->_root_ptr)
+ , transform_function()
+ );
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::const_reverse_iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::rend() const
+ {
+ return const_reverse_iterator(
+ make_in_order_reverse_iterator_end(this->_root_ptr)
+ , transform_function()
+ );
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::reverse_iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::rend()
+ {
+ return reverse_iterator(
+ make_in_order_reverse_iterator_end(this->_root_ptr)
+ , transform_function()
+ );
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::const_iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::find(key_type const& key) const
+ {
+ typename node::const_pointer node_ptr = this->_root_ptr;
+
+ node_ptr = binary_descendant(node_ptr, key, this->_value_compare);
+ return node_ptr ? const_iterator(
+ make_in_order_iterator_position(*node_ptr)
+ , transform_function()
+ ) : this->cend();
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::find(key_type const& key)
+ {
+ typename node::pointer node_ptr = binary_descendant(
+ this->_root_ptr
+ , key
+ , this->_value_compare
+ );
+
+ return node_ptr ? iterator(
+ make_in_order_iterator_position(*node_ptr)
+ , transform_function()
+ ) : this->end();
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::const_iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::lower_bound(key_type const& key) const
+ {
+ typename node::const_pointer node_ptr = this->_root_ptr;
+
+ node_ptr = binary_lower_bound(node_ptr, key, this->_value_compare);
+ return node_ptr ? const_iterator(
+ make_in_order_iterator_position(*node_ptr)
+ , transform_function()
+ ) : this->cend();
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::lower_bound(key_type const& key)
+ {
+ typename node::pointer node_ptr = binary_lower_bound(
+ this->_root_ptr
+ , key
+ , this->_value_compare
+ );
+
+ return node_ptr ? iterator(
+ make_in_order_iterator_position(*node_ptr)
+ , transform_function()
+ ) : this->end();
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::const_iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::upper_bound(key_type const& key) const
+ {
+ typename node::const_pointer node_ptr = this->_root_ptr;
+
+ node_ptr = binary_upper_bound(node_ptr, key, this->_value_compare);
+ return node_ptr ? const_iterator(
+ make_in_order_iterator_position(*node_ptr)
+ , transform_function()
+ ) : this->cend();
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::upper_bound(key_type const& key)
+ {
+ typename node::pointer node_ptr = binary_upper_bound(
+ this->_root_ptr
+ , key
+ , this->_value_compare
+ );
+
+ return node_ptr ? iterator(
+ make_in_order_iterator_position(*node_ptr)
+ , transform_function()
+ ) : this->end();
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline ::std::pair<
+ typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::const_iterator
+ , typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::const_iterator
+ >
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::equal_range(key_type const& key) const
+ {
+ return ::std::make_pair(
+ this->lower_bound(key)
+ , this->upper_bound(key)
+ );
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline ::std::pair<
+ typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::iterator
+ , typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::iterator
+ >
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::equal_range(key_type const& key)
+ {
+ return ::std::make_pair(
+ this->lower_bound(key)
+ , this->upper_bound(key)
+ );
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::node::pointer
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_construct_node_from(
+ ::std::tr1::true_type
+ , allocator_type& allocator
+ , value_type const& value
+ )
+ {
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ typename node::pointer result(allocator.allocate(1));
+ allocator.construct(result, value);
+#else
+ typename node::pointer result(
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::allocate(allocator, 1)
+ );
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::construct(allocator, result, value);
+#endif
+ return result;
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::node::pointer
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_construct_node_from(
+ ::std::tr1::false_type
+ , allocator_type& allocator
+ , value_type const& value
+ )
+ {
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ typename node::pointer result(allocator.allocate(1));
+ allocator.construct(
+ result
+ , ::boost::container::allocator_arg
+ , allocator
+ , value
+ );
+#else
+ typename node::pointer result(
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::allocate(allocator, 1)
+ );
+ ::boost::container::allocator_traits<allocator_type>::construct(
+ allocator
+ , result
+ , ::boost::container::allocator_arg
+ , allocator
+ , value
+ );
+#endif
+ return result;
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_insert(value_type const& value, ::boost::mpl::true_)
+ {
+ if (!this->_root_ptr)
+ {
+ return iterator(
+ make_in_order_iterator(
+ *(
+ this->_root_ptr = this->_construct_node_from(
+ ::std::tr1::is_const<
+ typename ::std::tr1::remove_reference<
+ typename node::traits::allocator_reference
+ >::type
+ >()
+ , this->_allocator
+ , value
+ )
+ )
+ )
+ , transform_function()
+ );
+ }
+
+ typename node::pointer node_ptr = binary_upper_bound(
+ this->_root_ptr
+ , value
+ , insert_compare(this->_key_compare)
+ );
+
+ if (node_ptr)
+ {
+ if (node_ptr->get_left_child_ptr())
+ {
+ for (
+ node_ptr = node_ptr->get_left_child_ptr();
+ node_ptr->get_right_child_ptr();
+ node_ptr = node_ptr->get_right_child_ptr()
+ )
+ {
+ }
+
+ node_ptr = &*node_ptr->emplace_right(value);
+ }
+ else
+ {
+ node_ptr = &*node_ptr->emplace_left(value);
+ }
+ }
+ else // if (!node_ptr)
+ {
+ for (
+ node_ptr = this->_root_ptr;
+ node_ptr->get_right_child_ptr();
+ node_ptr = node_ptr->get_right_child_ptr()
+ )
+ {
+ }
+
+ node_ptr = &*node_ptr->emplace_right(value);
+ }
+
+ node_ptr = Balancer::post_insert(node_ptr);
+
+ if (!node_ptr->get_parent_ptr())
+ {
+ this->_root_ptr = node_ptr;
+ }
+
+ return iterator(
+ make_in_order_iterator_position(*node_ptr)
+ , transform_function()
+ );
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ ::std::pair<
+ typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::iterator
+ , bool
+ >
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_insert(value_type const& value, ::boost::mpl::false_)
+ {
+ if (!this->_root_ptr)
+ {
+ return ::std::make_pair(
+ iterator(
+ make_in_order_iterator(
+ *(
+ this->_root_ptr = this->_construct_node_from(
+ ::std::tr1::is_const<
+ typename ::std::tr1::remove_reference<
+ typename node::traits::allocator_reference
+ >::type
+ >()
+ , this->_allocator
+ , value
+ )
+ )
+ )
+ , transform_function()
+ )
+ , true
+ );
+ }
+
+ insert_compare compare(this->_key_compare);
+ typename node::pointer p = this->_root_ptr;
+
+ for (;;)
+ {
+ if (compare(value, *p))
+ {
+ if (p->get_left_child_ptr())
+ {
+ p = p->get_left_child_ptr();
+ }
+ else
+ {
+ typename node::pointer n = Balancer::post_insert(
+ p = &*p->emplace_left(value)
+ );
+
+ if (!n->get_parent_ptr())
+ {
+ this->_root_ptr = n;
+ }
+
+ return ::std::make_pair(
+ iterator(
+ make_in_order_iterator_position(*p)
+ , transform_function()
+ )
+ , true
+ );
+ }
+ }
+ else if (compare(*p, value))
+ {
+ if (p->get_right_child_ptr())
+ {
+ p = p->get_right_child_ptr();
+ }
+ else
+ {
+ typename node::pointer n = Balancer::post_insert(
+ p = &*p->emplace_right(value)
+ );
+
+ if (!n->get_parent_ptr())
+ {
+ this->_root_ptr = n;
+ }
+
+ return ::std::make_pair(
+ iterator(
+ make_in_order_iterator_position(*p)
+ , transform_function()
+ )
+ , true
+ );
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ return ::std::make_pair(
+ iterator(
+ make_in_order_iterator_position(*p)
+ , transform_function()
+ )
+ , false
+ );
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename ::boost::mpl::if_<
+ IsMultipleAssociative
+ , typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::iterator
+ , ::std::pair<
+ typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::iterator
+ , bool
+ >
+ >::type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::insert(value_type const& value)
+ {
+ return this->_insert(value, IsMultipleAssociative());
+ }
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename NodeGenerator \
+ , typename T1 \
+ , typename T2 \
+ , typename IsMultipleAssociative \
+ , typename CompareSelector \
+ , typename Balancer \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::node::pointer \
+ binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::_construct_node_from( \
+ ::std::tr1::true_type \
+ , allocator_type& allocator \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ typename node::pointer result(allocator.allocate(1)); \
+ allocator.construct( \
+ result \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ return result; \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename NodeGenerator \
+ , typename T1 \
+ , typename T2 \
+ , typename IsMultipleAssociative \
+ , typename CompareSelector \
+ , typename Balancer \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::node::pointer \
+ binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::_construct_node_from( \
+ ::std::tr1::false_type \
+ , allocator_type& allocator \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ typename node::pointer result(allocator.allocate(1)); \
+ allocator.construct( \
+ result \
+ , ::boost::container::allocator_arg \
+ , allocator \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ return result; \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename NodeGenerator \
+ , typename T1 \
+ , typename T2 \
+ , typename IsMultipleAssociative \
+ , typename CompareSelector \
+ , typename Balancer \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ inline typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::value_type \
+ binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::_construct_value_from( \
+ ::std::tr1::true_type \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ return value_type( \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename NodeGenerator \
+ , typename T1 \
+ , typename T2 \
+ , typename IsMultipleAssociative \
+ , typename CompareSelector \
+ , typename Balancer \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ inline typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::value_type \
+ binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::_construct_value_from( \
+ ::std::tr1::false_type \
+ , key_type const& key \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ return value_type( \
+ key \
+ , T2(BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p)) \
+ ); \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename NodeGenerator \
+ , typename T1 \
+ , typename T2 \
+ , typename IsMultipleAssociative \
+ , typename CompareSelector \
+ , typename Balancer \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::iterator \
+ binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::_emplace( \
+ ::boost::mpl::true_ \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ if (!this->_root_ptr) \
+ { \
+ return iterator( \
+ make_in_order_iterator( \
+ *( \
+ this->_root_ptr = this->_construct_node_from( \
+ ::std::tr1::is_const< \
+ typename ::std::tr1::remove_reference< \
+ typename node::traits::allocator_reference \
+ >::type \
+ >() \
+ , this->_allocator \
+ BOOST_PP_ENUM_TRAILING_PARAMS( \
+ BOOST_PP_SEQ_SIZE(seq) \
+ , p \
+ ) \
+ ) \
+ ) \
+ ) \
+ , transform_function() \
+ ); \
+ } \
+ typename node::pointer node_ptr = binary_upper_bound( \
+ this->_root_ptr \
+ , this->_construct_value_from( \
+ ::std::tr1::is_void<T2>() \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ) \
+ , insert_compare(this->_key_compare) \
+ ); \
+ if (node_ptr) \
+ { \
+ if (node_ptr->get_left_child_ptr()) \
+ { \
+ for ( \
+ node_ptr = node_ptr->get_left_child_ptr(); \
+ node_ptr->get_right_child_ptr(); \
+ node_ptr = node_ptr->get_right_child_ptr() \
+ ) \
+ { \
+ } \
+ node_ptr = &*node_ptr->emplace_right( \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ } \
+ else \
+ { \
+ node_ptr = &*node_ptr->emplace_left( \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ } \
+ } \
+ else \
+ { \
+ for ( \
+ node_ptr = this->_root_ptr; \
+ node_ptr->get_right_child_ptr(); \
+ node_ptr = node_ptr->get_right_child_ptr() \
+ ) \
+ { \
+ } \
+ node_ptr = &*node_ptr->emplace_right( \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ } \
+ node_ptr = Balancer::post_insert(node_ptr); \
+ if (!node_ptr->get_parent_ptr()) \
+ { \
+ this->_root_ptr = node_ptr; \
+ } \
+ return iterator( \
+ make_in_order_iterator_position(*node_ptr) \
+ , transform_function() \
+ ); \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename NodeGenerator \
+ , typename T1 \
+ , typename T2 \
+ , typename IsMultipleAssociative \
+ , typename CompareSelector \
+ , typename Balancer \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ ::std::pair< \
+ typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::iterator \
+ , bool \
+ > \
+ binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::_emplace( \
+ ::boost::mpl::false_ \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ if (!this->_root_ptr) \
+ { \
+ return ::std::make_pair( \
+ iterator( \
+ make_in_order_iterator( \
+ *( \
+ this->_root_ptr = this->_construct_node_from( \
+ ::std::tr1::is_const< \
+ typename ::std::tr1::remove_reference< \
+ typename node::traits::allocator_reference \
+ >::type \
+ >() \
+ , this->_allocator \
+ BOOST_PP_ENUM_TRAILING_PARAMS( \
+ BOOST_PP_SEQ_SIZE(seq) \
+ , p \
+ ) \
+ ) \
+ ) \
+ ) \
+ , transform_function() \
+ ) \
+ , true \
+ ); \
+ } \
+ value_type value( \
+ this->_construct_value_from( \
+ ::std::tr1::is_void<T2>() \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ) \
+ ); \
+ insert_compare compare(this->_key_compare); \
+ typename node::pointer p = this->_root_ptr; \
+ for (;;) \
+ { \
+ if (compare(value, *p)) \
+ { \
+ if (p->get_left_child_ptr()) \
+ { \
+ p = p->get_left_child_ptr(); \
+ } \
+ else \
+ { \
+ typename node::pointer n = Balancer::post_insert( \
+ p = &*p->emplace_left( \
+ BOOST_PP_ENUM_PARAMS( \
+ BOOST_PP_SEQ_SIZE(seq) \
+ , p \
+ ) \
+ ) \
+ ); \
+ if (!n->get_parent_ptr()) \
+ { \
+ this->_root_ptr = n; \
+ } \
+ return ::std::make_pair( \
+ iterator( \
+ make_in_order_iterator_position(*p) \
+ , transform_function() \
+ ) \
+ , true \
+ ); \
+ } \
+ } \
+ else if (compare(*p, value)) \
+ { \
+ if (p->get_right_child_ptr()) \
+ { \
+ p = p->get_right_child_ptr(); \
+ } \
+ else \
+ { \
+ typename node::pointer n = Balancer::post_insert( \
+ p = &*p->emplace_right( \
+ BOOST_PP_ENUM_PARAMS( \
+ BOOST_PP_SEQ_SIZE(seq) \
+ , p \
+ ) \
+ ) \
+ ); \
+ if (!n->get_parent_ptr()) \
+ { \
+ this->_root_ptr = n; \
+ } \
+ return ::std::make_pair( \
+ iterator( \
+ make_in_order_iterator_position(*p) \
+ , transform_function() \
+ ) \
+ , true \
+ ); \
+ } \
+ } \
+ else \
+ { \
+ break; \
+ } \
+ } \
+ return ::std::make_pair( \
+ iterator( \
+ make_in_order_iterator_position(*p) \
+ , transform_function() \
+ ) \
+ , false \
+ ); \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template < \
+ typename NodeGenerator \
+ , typename T1 \
+ , typename T2 \
+ , typename IsMultipleAssociative \
+ , typename CompareSelector \
+ , typename Balancer \
+ > \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ inline typename ::boost::mpl::if_< \
+ IsMultipleAssociative \
+ , typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::iterator \
+ , ::std::pair< \
+ typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::iterator \
+ , bool \
+ > \
+ >::type \
+ binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::emplace( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ return this->_emplace( \
+ IsMultipleAssociative() \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#elif defined BOOST_CONTAINER_PERFECT_FORWARDING
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ template <typename ...Args>
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::node::pointer
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_construct_node_from(
+ ::std::tr1::true_type
+ , allocator_type& allocator
+ , Args&& ...args
+ )
+ {
+ typename node::pointer result(
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::allocate(allocator, 1)
+ );
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::construct(allocator, result, ::boost::forward<Args>(args)...);
+ return result;
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ template <typename ...Args>
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::node::pointer
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_construct_node_from(
+ ::std::tr1::false_type
+ , allocator_type& allocator
+ , Args&& ...args
+ )
+ {
+ typename node::pointer result(
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::allocate(allocator, 1)
+ );
+ ::boost::container::allocator_traits<allocator_type>::construct(
+ allocator
+ , result
+ , ::boost::container::allocator_arg
+ , allocator
+ , ::boost::forward<Args>(args)...
+ );
+ return result;
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ template <typename ...Args>
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_construct_value_from(
+ ::std::tr1::true_type
+ , Args&& ...args
+ )
+ {
+ return value_type(::boost::forward<Args>(args)...);
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ template <typename ...Args>
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::value_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_construct_value_from(
+ ::std::tr1::false_type
+ , key_type const& key
+ , Args&& ...args
+ )
+ {
+ return value_type(key, T2(::boost::forward<Args>(args)...));
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ template <typename ...Args>
+ typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::iterator
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_emplace(::boost::mpl::true_, Args&& ...args)
+ {
+ if (!this->_root_ptr)
+ {
+ return iterator(
+ make_in_order_iterator(
+ *(
+ this->_root_ptr = this->_construct_node_from(
+ ::std::tr1::is_const<
+ typename ::std::tr1::remove_reference<
+ typename node::traits::allocator_reference
+ >::type
+ >()
+ , this->_allocator
+ , ::boost::forward<Args>(args)...
+ )
+ )
+ )
+ , transform_function()
+ );
+ }
+
+ typename node::pointer node_ptr = binary_upper_bound(
+ this->_root_ptr
+ , this->_construct_value_from(
+ ::std::tr1::is_void<T2>()
+ , ::boost::forward<Args>(args)...
+ )
+ , insert_compare(this->_key_compare)
+ );
+
+ if (node_ptr)
+ {
+ if (node_ptr->get_left_child_ptr())
+ {
+ for (
+ node_ptr = node_ptr->get_left_child_ptr();
+ node_ptr->get_right_child_ptr();
+ node_ptr = node_ptr->get_right_child_ptr()
+ )
+ {
+ }
+
+ node_ptr = &*node_ptr->emplace_right(
+ ::boost::forward<Args>(args)...
+ );
+ }
+ else
+ {
+ node_ptr = &*node_ptr->emplace_left(
+ ::boost::forward<Args>(args)...
+ );
+ }
+ }
+ else // if (!node_ptr)
+ {
+ for (
+ node_ptr = this->_root_ptr;
+ node_ptr->get_right_child_ptr();
+ node_ptr = node_ptr->get_right_child_ptr()
+ )
+ {
+ }
+
+ node_ptr = &*node_ptr->emplace_right(
+ ::boost::forward<Args>(args)...
+ );
+ }
+
+ typename node::pointer anc_ptr = Balancer::post_insert(node_ptr);
+
+ if (!anc_ptr->get_parent_ptr())
+ {
+ this->_root_ptr = anc_ptr;
+ }
+
+ return iterator(
+ make_in_order_iterator_position(*node_ptr)
+ , transform_function()
+ );
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ template <typename ...Args>
+ ::std::pair<
+ typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::iterator
+ , bool
+ >
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_emplace(::boost::mpl::false_, Args&& ...args)
+ {
+ if (!this->_root_ptr)
+ {
+ return ::std::make_pair(
+ iterator(
+ make_in_order_iterator(
+ *(
+ this->_root_ptr = this->_construct_node_from(
+ ::std::tr1::is_const<
+ typename ::std::tr1::remove_reference<
+ typename node::traits::allocator_reference
+ >::type
+ >()
+ , this->_allocator
+ , ::boost::forward<Args>(args)...
+ )
+ )
+ )
+ , transform_function()
+ )
+ , true
+ );
+ }
+
+ value_type value(
+ this->_construct_value_from(
+ ::std::tr1::is_void<T2>()
+ , ::boost::forward<Args>(args)...
+ )
+ );
+ insert_compare compare(this->_key_compare);
+ typename node::pointer p = this->_root_ptr;
+
+ for (;;)
+ {
+ if (compare(value, *p))
+ {
+ if (p->get_left_child_ptr())
+ {
+ p = p->get_left_child_ptr();
+ }
+ else
+ {
+ typename node::pointer n = Balancer::post_insert(
+ p = &*p->emplace_left(::boost::forward<Args>(args)...)
+ );
+
+ if (!n->get_parent_ptr())
+ {
+ this->_root_ptr = n;
+ }
+
+ return ::std::make_pair(
+ iterator(
+ make_in_order_iterator_position(*p)
+ , transform_function()
+ )
+ , true
+ );
+ }
+ }
+ else if (compare(*p, value))
+ {
+ if (p->get_right_child_ptr())
+ {
+ p = p->get_right_child_ptr();
+ }
+ else
+ {
+ typename node::pointer n = Balancer::post_insert(
+ p = &*p->emplace_right(::boost::forward<Args>(args)...)
+ );
+
+ if (!n->get_parent_ptr())
+ {
+ this->_root_ptr = n;
+ }
+
+ return ::std::make_pair(
+ iterator(
+ make_in_order_iterator_position(*p)
+ , transform_function()
+ )
+ , true
+ );
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ return ::std::make_pair(
+ iterator(
+ make_in_order_iterator_position(*p)
+ , transform_function()
+ )
+ , false
+ );
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ template <typename ...Args>
+ inline typename ::boost::mpl::if_<
+ IsMultipleAssociative
+ , typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::iterator
+ , ::std::pair<
+ typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::iterator
+ , bool
+ >
+ >::type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::emplace(Args&& ...args)
+ {
+ return this->_emplace(
+ IsMultipleAssociative()
+ , ::boost::forward<Args>(args)...
+ );
+ }
+#else // partial template specialization support, imperfect forwarding
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename NodeGenerator \
+ , typename T1 \
+ , typename T2 \
+ , typename IsMultipleAssociative \
+ , typename CompareSelector \
+ , typename Balancer \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::node::pointer \
+ binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::_construct_node_from( \
+ ::std::tr1::true_type \
+ , allocator_type& allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ typename node::pointer result( \
+ ::boost::container::allocator_traits< \
+ allocator_type \
+ >::allocate(allocator, 1) \
+ ); \
+ ::boost::container::allocator_traits<allocator_type>::construct( \
+ allocator \
+ , result \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ return result; \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename NodeGenerator \
+ , typename T1 \
+ , typename T2 \
+ , typename IsMultipleAssociative \
+ , typename CompareSelector \
+ , typename Balancer \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::node::pointer \
+ binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::_construct_node_from( \
+ ::std::tr1::false_type \
+ , allocator_type& allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ typename node::pointer result( \
+ ::boost::container::allocator_traits< \
+ allocator_type \
+ >::allocate(allocator, 1) \
+ ); \
+ ::boost::container::allocator_traits<allocator_type>::construct( \
+ allocator \
+ , result \
+ , ::boost::container::allocator_arg \
+ , allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ return result; \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename NodeGenerator \
+ , typename T1 \
+ , typename T2 \
+ , typename IsMultipleAssociative \
+ , typename CompareSelector \
+ , typename Balancer \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ inline typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::value_type \
+ binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::_construct_value_from( \
+ ::std::tr1::true_type \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ return value_type( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename NodeGenerator \
+ , typename T1 \
+ , typename T2 \
+ , typename IsMultipleAssociative \
+ , typename CompareSelector \
+ , typename Balancer \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ inline typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::value_type \
+ binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::_construct_value_from( \
+ ::std::tr1::false_type \
+ , key_type const& key \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ return value_type( \
+ key \
+ , T2( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ) \
+ ); \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_PP_DEC(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename NodeGenerator \
+ , typename T1 \
+ , typename T2 \
+ , typename IsMultipleAssociative \
+ , typename CompareSelector \
+ , typename Balancer \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::iterator \
+ binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::_emplace( \
+ ::boost::mpl::true_ \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ if (!this->_root_ptr) \
+ { \
+ return iterator( \
+ make_in_order_iterator( \
+ *( \
+ this->_root_ptr = this->_construct_node_from( \
+ ::std::tr1::is_const< \
+ typename ::std::tr1::remove_reference< \
+ typename node::traits::allocator_reference \
+ >::type \
+ >() \
+ , this->_allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ) \
+ ) \
+ ) \
+ , transform_function() \
+ ); \
+ } \
+ typename node::pointer node_ptr = binary_upper_bound( \
+ this->_root_ptr \
+ , this->_construct_value_from( \
+ ::std::tr1::is_void<T2>() \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ) \
+ , insert_compare(this->_key_compare) \
+ ); \
+ if (node_ptr) \
+ { \
+ if (node_ptr->get_left_child_ptr()) \
+ { \
+ for ( \
+ node_ptr = node_ptr->get_left_child_ptr(); \
+ node_ptr->get_right_child_ptr(); \
+ node_ptr = node_ptr->get_right_child_ptr() \
+ ) \
+ { \
+ } \
+ node_ptr = &*node_ptr->emplace_right( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ } \
+ else \
+ { \
+ node_ptr = &*node_ptr->emplace_left( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ } \
+ } \
+ else \
+ { \
+ for ( \
+ node_ptr = this->_root_ptr; \
+ node_ptr->get_right_child_ptr(); \
+ node_ptr = node_ptr->get_right_child_ptr() \
+ ) \
+ { \
+ } \
+ node_ptr = &*node_ptr->emplace_right( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ } \
+ node_ptr = Balancer::post_insert(node_ptr); \
+ if (!node_ptr->get_parent_ptr()) \
+ { \
+ this->_root_ptr = node_ptr; \
+ } \
+ return iterator( \
+ make_in_order_iterator_position(*node_ptr) \
+ , transform_function() \
+ ); \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename NodeGenerator \
+ , typename T1 \
+ , typename T2 \
+ , typename IsMultipleAssociative \
+ , typename CompareSelector \
+ , typename Balancer \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ ::std::pair< \
+ typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::iterator \
+ , bool \
+ > \
+ binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::_emplace( \
+ ::boost::mpl::false_ \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ if (!this->_root_ptr) \
+ { \
+ return ::std::make_pair( \
+ iterator( \
+ make_in_order_iterator( \
+ *( \
+ this->_root_ptr = this->_construct_node_from( \
+ ::std::tr1::is_const< \
+ typename ::std::tr1::remove_reference< \
+ typename node::traits::allocator_reference \
+ >::type \
+ >() \
+ , this->_allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ) \
+ ) \
+ ) \
+ , transform_function() \
+ ) \
+ , true \
+ ); \
+ } \
+ value_type value( \
+ this->_construct_value_from( \
+ ::std::tr1::is_void<T2>() \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ) \
+ ); \
+ insert_compare compare(this->_key_compare); \
+ typename node::pointer p = this->_root_ptr; \
+ for (;;) \
+ { \
+ if (compare(value, *p)) \
+ { \
+ if (p->get_left_child_ptr()) \
+ { \
+ p = p->get_left_child_ptr(); \
+ } \
+ else \
+ { \
+ typename node::pointer n = Balancer::post_insert( \
+ p = &*p->emplace_left( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ) \
+ ); \
+ if (!n->get_parent_ptr()) \
+ { \
+ this->_root_ptr = n; \
+ } \
+ return ::std::make_pair( \
+ iterator( \
+ make_in_order_iterator_position(*p) \
+ , transform_function() \
+ ) \
+ , true \
+ ); \
+ } \
+ } \
+ else if (compare(*p, value)) \
+ { \
+ if (p->get_right_child_ptr()) \
+ { \
+ p = p->get_right_child_ptr(); \
+ } \
+ else \
+ { \
+ typename node::pointer n = Balancer::post_insert( \
+ p = &*p->emplace_right( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ) \
+ ); \
+ if (!n->get_parent_ptr()) \
+ { \
+ this->_root_ptr = n; \
+ } \
+ return ::std::make_pair( \
+ iterator( \
+ make_in_order_iterator_position(*p) \
+ , transform_function() \
+ ) \
+ , true \
+ ); \
+ } \
+ } \
+ else \
+ { \
+ break; \
+ } \
+ } \
+ return ::std::make_pair( \
+ iterator( \
+ make_in_order_iterator_position(*p) \
+ , transform_function() \
+ ) \
+ , false \
+ ); \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template < \
+ typename NodeGenerator \
+ , typename T1 \
+ , typename T2 \
+ , typename IsMultipleAssociative \
+ , typename CompareSelector \
+ , typename Balancer \
+ > \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ inline typename ::boost::mpl::if_< \
+ IsMultipleAssociative \
+ , typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::iterator \
+ , ::std::pair< \
+ typename binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::iterator \
+ , bool \
+ > \
+ >::type \
+ binode_associative_container< \
+ NodeGenerator \
+ , T1 \
+ , T2 \
+ , IsMultipleAssociative \
+ , CompareSelector \
+ , Balancer \
+ >::emplace( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ return this->_emplace( \
+ IsMultipleAssociative() \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // compiler defect handling
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ void
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_erase_one(typename node::pointer p)
+ {
+ for (typename node::pointer s;;)
+ {
+ if (
+ (s = p->get_left_child_ptr()) && (
+ !p->get_right_child_ptr() || Balancer::choose_predecessor(
+ *typename node::const_pointer(p)
+ )
+ )
+ )
+ {
+ while (s->get_right_child_ptr())
+ {
+ s = s->get_right_child_ptr();
+ }
+
+ if (s->get_parent_ptr() == p)
+ {
+ if (!p->get_right_child_ptr())
+ {
+ put(*p, data_key(), get(*s, data_key()));
+
+ bool must_rebalance = Balancer::pre_erase(*s);
+
+ p->erase_left();
+
+ if (must_rebalance)
+ {
+ p = Balancer::post_erase_left(p);
+
+ if (!p->get_parent_ptr())
+ {
+ this->_root_ptr = p;
+ }
+ }
+
+ break;
+ }
+ }
+ else // if (s == s->get_parent_ptr()->get_right_child_ptr())
+ {
+ put(*p, data_key(), get(*s, data_key()));
+
+ if (s->get_left_child_ptr())
+ {
+ p = s;
+ }
+ else // if (s->empty())
+ {
+ p = s->get_parent_ptr();
+
+ if (p->get_left_child_ptr())
+ {
+ put(*s, data_key(), get(*p, data_key()));
+ }
+ else // s is only child of p
+ {
+ bool must_rebalance = Balancer::pre_erase(*s);
+
+ p->erase_right();
+
+ if (must_rebalance)
+ {
+ p = Balancer::post_erase_right(p);
+
+ if (!p->get_parent_ptr())
+ {
+ this->_root_ptr = p;
+ }
+ }
+
+ break;
+ }
+ }
+
+ continue;
+ }
+ }
+
+ if ((s = p->get_right_child_ptr()))
+ {
+ while (s->get_left_child_ptr())
+ {
+ s = s->get_left_child_ptr();
+ }
+
+ put(*p, data_key(), get(*s, data_key()));
+
+ if (s->get_right_child_ptr())
+ {
+ p = s;
+ }
+ else if (s->get_parent_ptr() == p)
+ {
+ bool must_rebalance = Balancer::pre_erase(*s);
+
+ p->erase_right();
+
+ if (must_rebalance)
+ {
+ p = Balancer::post_erase_right(p);
+
+ if (!p->get_parent_ptr())
+ {
+ this->_root_ptr = p;
+ }
+ }
+
+ break;
+ }
+ else
+ {
+ BOOST_ASSERT(s->empty());
+ p = s->get_parent_ptr();
+ BOOST_ASSERT(p->get_left_child_ptr() == s);
+
+ if (p->get_right_child_ptr())
+ {
+ put(*s, data_key(), get(*p, data_key()));
+ }
+ else // s is only child of p
+ {
+ bool must_rebalance = Balancer::pre_erase(*s);
+
+ p->erase_left();
+
+ if (must_rebalance)
+ {
+ p = Balancer::post_erase_left(p);
+
+ if (!p->get_parent_ptr())
+ {
+ this->_root_ptr = p;
+ }
+ }
+
+ break;
+ }
+ }
+ }
+ else // if (p->empty())
+ {
+ s = p;
+ p = p->get_parent_ptr();
+
+ bool must_rebalance = Balancer::pre_erase(*s);
+
+ if (p->get_left_child_ptr() == s)
+ {
+ p->erase_left();
+
+ if (must_rebalance)
+ {
+ p = Balancer::post_erase_left(p);
+
+ if (!p->get_parent_ptr())
+ {
+ this->_root_ptr = p;
+ }
+ }
+ }
+ else // if (p->get_right_child_ptr() == s)
+ {
+ p->erase_right();
+
+ if (must_rebalance)
+ {
+ p = Balancer::post_erase_right(p);
+
+ if (!p->get_parent_ptr())
+ {
+ this->_root_ptr = p;
+ }
+ }
+ }
+
+ break;
+ }
+ }
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::size_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_erase(key_type const& key, ::boost::mpl::true_)
+ {
+ size_type result = ::boost::initialized_value;
+
+ for (
+ typename node::pointer p;
+ (
+ p = binary_descendant(
+ this->_root_ptr
+ , key
+ , this->_value_compare
+ )
+ );
+ ++result
+ )
+ {
+ this->_erase_one(p);
+ }
+
+ return result;
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::size_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_erase(key_type const& key, ::boost::mpl::false_)
+ {
+ this->_erase_one(
+ binary_descendant(
+ this->_root_ptr
+ , key
+ , this->_value_compare
+ )
+ );
+ return 1;
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::size_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::erase(key_type const& key)
+ {
+ if (this->_root_ptr)
+ {
+ if (this->_root_ptr->empty())
+ {
+ this->clear();
+ return 1;
+ }
+ else
+ {
+ return this->_erase(key, IsMultipleAssociative());
+ }
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline bool
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::empty() const
+ {
+ return !this->_root_ptr;
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ void
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::clear()
+ {
+ if (this->_root_ptr)
+ {
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ this->_allocator.destroy(this->_root_ptr);
+ this->_allocator.deallocate(this->_root_ptr, 1);
+#else
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::destroy(this->_allocator, this->_root_ptr);
+ ::boost::container::allocator_traits<
+ allocator_type
+ >::deallocate(this->_allocator, this->_root_ptr, 1);
+#endif
+
+#if defined BOOST_NO_CXX11_NULLPTR
+ this->_root_ptr = 0;
+#else
+ this->_root_ptr = nullptr;
+#endif
+ }
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::size_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_size(::boost::mpl::true_) const
+ {
+ return this->_root_ptr ? get(*this->_root_ptr, count_key()) : 0;
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::size_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::_size(::boost::mpl::false_) const
+ {
+ return ::std::distance(this->cbegin(), this->cend());
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::size_type
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::size() const
+ {
+ return this->_size(result_of::has_key<node,count_key>());
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::transform_function::const_result
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::operator[](size_type const& index) const
+ {
+ BOOST_ASSERT_MSG(
+ this->_root_ptr && (index < this->size())
+ , "index out of bounds"
+ );
+
+ typename node::const_pointer node_ptr = this->_root_ptr;
+
+ return transform_function()(
+ *binary_descendant_at_index(node_ptr, index)
+ );
+ }
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ inline typename binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::transform_function::mutable_result
+ binode_associative_container<
+ NodeGenerator
+ , T1
+ , T2
+ , IsMultipleAssociative
+ , CompareSelector
+ , Balancer
+ >::operator[](size_type const& index)
+ {
+ BOOST_ASSERT_MSG(
+ this->_root_ptr && (index < this->size())
+ , "index out of bounds"
+ );
+
+ return transform_function()(
+ *binary_descendant_at_index(this->_root_ptr, index)
+ );
+ }
+}} // namespace boost::tree_node
+
+namespace boost { namespace tree_node {
+
+ template <
+ typename T
+ , typename NodeGenerator
+ , typename Balancer
+ , typename CompareSelector
+ >
+ class binode_set
+ : public
+ //[reference__binode_set__bases
+ binode_associative_container<
+ NodeGenerator
+ , T
+ , void
+ , ::boost::mpl::false_
+ , CompareSelector
+ , Balancer
+ >
+ //]
+ {
+ typedef binode_associative_container<
+ NodeGenerator
+ , T
+ , void
+ , ::boost::mpl::false_
+ , CompareSelector
+ , Balancer
+ >
+ super_t;
+
+ public:
+ BOOST_TREE_NODE_ASSOCIATIVE_CONTAINER_DERIVED_BODY(binode_set, super_t)
+ };
+}} // namespace boost::tree_node
+
+namespace boost { namespace tree_node {
+
+ template <
+ typename T
+ , typename NodeGenerator
+ , typename Balancer
+ , typename CompareSelector
+ >
+ class binode_multiset
+ : public
+ //[reference__binode_multiset__bases
+ binode_associative_container<
+ NodeGenerator
+ , T
+ , void
+ , ::boost::mpl::true_
+ , CompareSelector
+ , Balancer
+ >
+ //]
+ {
+ typedef binode_associative_container<
+ NodeGenerator
+ , T
+ , void
+ , ::boost::mpl::true_
+ , CompareSelector
+ , Balancer
+ >
+ super_t;
+
+ public:
+ BOOST_TREE_NODE_ASSOCIATIVE_CONTAINER_DERIVED_BODY(
+ binode_multiset
+ , super_t
+ )
+ };
+}} // namespace boost::tree_node
+
+namespace boost { namespace tree_node {
+
+ template <
+ typename Key
+ , typename Mapped
+ , typename NodeGenerator
+ , typename Balancer
+ , typename CompareSelector
+ >
+ class binode_map
+ : public
+ //[reference__binode_map__bases
+ binode_associative_container<
+ NodeGenerator
+ , Key
+ , Mapped
+ , ::boost::mpl::false_
+ , CompareSelector
+ , Balancer
+ >
+ //]
+ {
+ typedef binode_associative_container<
+ NodeGenerator
+ , Key
+ , Mapped
+ , ::boost::mpl::false_
+ , CompareSelector
+ , Balancer
+ >
+ super_t;
+
+ public:
+ //[reference__binode_map__mapped_type
+ typedef Mapped mapped_type;
+ //]
+
+ BOOST_TREE_NODE_ASSOCIATIVE_CONTAINER_DERIVED_BODY(binode_map, super_t)
+ };
+}} // namespace boost::tree_node
+
+namespace boost { namespace tree_node {
+
+ template <
+ typename Key
+ , typename Mapped
+ , typename NodeGenerator
+ , typename Balancer
+ , typename CompareSelector
+ >
+ class binode_multimap
+ : public
+ //[reference__binode_multimap__bases
+ binode_associative_container<
+ NodeGenerator
+ , Key
+ , Mapped
+ , ::boost::mpl::true_
+ , CompareSelector
+ , Balancer
+ >
+ //]
+ {
+ typedef binode_associative_container<
+ NodeGenerator
+ , Key
+ , Mapped
+ , ::boost::mpl::true_
+ , CompareSelector
+ , Balancer
+ >
+ super_t;
+
+ public:
+ //[reference__binode_multimap__mapped_type
+ typedef Mapped mapped_type;
+ //]
+
+ BOOST_TREE_NODE_ASSOCIATIVE_CONTAINER_DERIVED_BODY(
+ binode_multimap
+ , super_t
+ )
+ };
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_CONTAINER_BINODE_ASSOCIATIVE_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/container/binode_associative_fwd.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/container/binode_associative_fwd.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,61 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_CONTAINER_BINODE_ASSOCIATIVE_FWD_HPP_INCLUDED
+#define BOOST_TREE_NODE_CONTAINER_BINODE_ASSOCIATIVE_FWD_HPP_INCLUDED
+
+#include <boost/container_gen/selectors.hpp>
+#include <boost/tree_node/binary_node.hpp>
+#include <boost/tree_node/balancer/null.hpp>
+
+namespace boost { namespace tree_node {
+
+ template <
+ typename NodeGenerator
+ , typename T1
+ , typename T2
+ , typename IsMultipleAssociative
+ , typename CompareSelector
+ , typename Balancer
+ >
+ class binode_associative_container;
+
+ template <
+ typename T
+ , typename NodeGenerator = binary_node_default_gen
+ , typename Balancer = null_balancer
+ , typename CompareSelector = ::boost::less_than_selector
+ >
+ class binode_set;
+
+ template <
+ typename T
+ , typename NodeGenerator = binary_node_default_gen
+ , typename Balancer = null_balancer
+ , typename CompareSelector = ::boost::less_than_selector
+ >
+ class binode_multiset;
+
+ template <
+ typename Key
+ , typename Mapped
+ , typename NodeGenerator = binary_node_default_gen
+ , typename Balancer = null_balancer
+ , typename CompareSelector = ::boost::less_than_selector
+ >
+ class binode_map;
+
+ template <
+ typename Key
+ , typename Mapped
+ , typename NodeGenerator = binary_node_default_gen
+ , typename Balancer = null_balancer
+ , typename CompareSelector = ::boost::less_than_selector
+ >
+ class binode_multimap;
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_CONTAINER_BINODE_ASSOCIATIVE_FWD_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/container/binode_fwd.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/container/binode_fwd.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,23 @@
+// Copyright (C) 2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_CONTAINER_BINODE_FWD_HPP_INCLUDED
+#define BOOST_TREE_NODE_CONTAINER_BINODE_FWD_HPP_INCLUDED
+
+#include <boost/tree_node/binary_node.hpp>
+#include <boost/tree_node/balancer/null.hpp>
+
+namespace boost { namespace tree_node {
+
+ template <
+ typename T
+ , typename NodeGenerator = binary_node_default_gen
+ , typename Balancer = null_balancer
+ >
+ class binode_container;
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_CONTAINER_BINODE_FWD_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/intrinsic/at_key.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/intrinsic/at_key.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,77 @@
+// Copyright (C) 2012-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_INTRINSIC_AT_KEY_HPP_INCLUDED
+#define BOOST_TREE_NODE_INTRINSIC_AT_KEY_HPP_INCLUDED
+
+#include <boost/typeof/typeof.hpp>
+#include <boost/mpl/apply_wrap.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/utility/get_reference.hpp>
+
+//[reference__tree_node__result_of__at_key
+namespace boost { namespace tree_node { namespace result_of {
+
+ template <typename Key>
+ struct at_key_impl
+ {
+ template <typename Node>
+ struct apply
+ {
+ typedef BOOST_TYPEOF_TPL(
+ get(::boost::get_reference<Node>(), Key())
+ )
+ type;
+ };
+ };
+
+ template <typename Node, typename Key>
+ struct at_key : ::boost::mpl::apply_wrap1<at_key_impl<Key>,Node>
+ {
+ //<-
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(2,at_key,(Node,Key))
+ //->
+ };
+}}} // namespace boost::tree_node::result_of
+//]
+
+//[reference__tree_node__at_key
+namespace boost { namespace tree_node {
+
+ template <typename Key>
+ struct at_key
+ {
+ template <typename Node>
+ typename result_of::at_key<Node const,Key>::type
+ operator()(Node const& node) const;
+
+ template <typename Node>
+ typename result_of::at_key<Node,Key>::type
+ operator()(Node& node) const;
+ };
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Key>
+ template <typename Node>
+ inline typename result_of::at_key<Node const,Key>::type
+ at_key<Key>::operator()(Node const& node) const
+ {
+ return get(node, Key());
+ }
+
+ template <typename Key>
+ template <typename Node>
+ inline typename result_of::at_key<Node,Key>::type
+ at_key<Key>::operator()(Node& node) const
+ {
+ return get(node, Key());
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_INTRINSIC_AT_KEY_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/intrinsic/get_keys.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/intrinsic/get_keys.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,52 @@
+// Copyright (C) 2012-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_INTRINSIC_GET_KEYS_HPP_INCLUDED
+#define BOOST_TREE_NODE_INTRINSIC_GET_KEYS_HPP_INCLUDED
+
+#include <boost/config.hpp>
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/vector/vector0.hpp>
+#include <boost/mpl/joint_view.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+
+//[reference__tree_node__result_of__get_keys
+namespace boost { namespace tree_node { namespace result_of {
+
+ template <typename Node>
+ struct get_keys_impl
+ {
+ typedef ::boost::mpl::vector0<> type;
+ };
+
+ template <typename Node>
+ class get_keys
+ {
+ typedef typename Node::super_t _base;
+
+ public:
+ typedef typename ::boost::mpl::joint_view<
+ typename get_keys_impl<Node>::type
+ , typename ::boost::mpl::eval_if<
+ ::std::tr1::is_void<_base>
+ , ::boost::mpl::vector0<>
+ , get_keys<_base>
+ >::type
+ >::type
+ type;
+
+ //<-
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,get_keys,(Node))
+ //->
+ };
+}}} // namespace boost::tree_node::result_of
+//]
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+#endif // BOOST_TREE_NODE_INTRINSIC_GET_KEYS_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/intrinsic/get_properties.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/intrinsic/get_properties.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,132 @@
+// Copyright (C) 2012-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_INTRINSIC_GET_PROPERTIES_HPP_INCLUDED
+#define BOOST_TREE_NODE_INTRINSIC_GET_PROPERTIES_HPP_INCLUDED
+
+#include <boost/tree_node/preprocessor.hpp>
+
+#if !defined BOOST_TREE_NODE_CAN_USE_FUSION
+#error This component requires working Boost.Fusion.
+#endif
+
+#include <boost/fusion/support/pair.hpp>
+#include <boost/tree_node/intrinsic/at_key.hpp>
+
+namespace boost { namespace tree_node { namespace _detail {
+
+ template <typename Node>
+ class fused_val_function
+ {
+ Node& _node;
+
+ public:
+ template <typename T>
+ struct result;
+
+ template <typename Key>
+ struct result<fused_val_function(Key)>
+ {
+ typedef typename ::boost::fusion::result_of::make_pair<
+ Key
+ , typename ::boost::tree_node::result_of::at_key<
+ Node
+ , Key
+ >::type
+ >::type
+ type;
+ };
+
+ explicit fused_val_function(Node& node);
+
+ template <typename Key>
+ typename result<fused_val_function(Key)>::type operator()(Key) const;
+ };
+
+ template <typename Node>
+ fused_val_function<Node>::fused_val_function(Node& node) : _node(node)
+ {
+ }
+
+ template <typename Node>
+ template <typename Key>
+ inline typename fused_val_function<
+ Node
+ >::BOOST_NESTED_TEMPLATE result<fused_val_function<Node>(Key)>::type
+ fused_val_function<Node>::operator()(Key) const
+ {
+ return ::boost::fusion::make_pair<Key>(get<Key>(_node));
+ }
+}}} // namespace boost::tree_node::_detail
+
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/fusion/view/transform_view.hpp>
+#include <boost/tree_node/intrinsic/get_keys.hpp>
+
+//[reference__result_of__get_properties
+namespace boost { namespace tree_node { namespace result_of {
+
+ template <typename Node>
+ struct get_properties
+ {
+//<-
+#if 0
+//->
+ typedef unspecified type;
+//<-
+#endif
+ typedef ::boost::fusion::transform_view<
+ typename get_keys<
+ typename ::std::tr1::remove_const<Node>::type
+ >::type const
+ , ::boost::tree_node::_detail::fused_val_function<Node>
+ >
+ type;
+
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,get_properties,(Node))
+//->
+ };
+}}} // namespace boost::tree_node::result_of
+//]
+
+//[reference__get_properties
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ typename result_of::get_properties<Node const>::type
+ get_properties(Node const& node);
+
+ template <typename Node>
+ typename result_of::get_properties<Node>::type
+ get_properties(Node& node);
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ inline typename result_of::get_properties<Node const>::type
+ get_properties(Node const& node)
+ {
+ typedef ::boost::tree_node::_detail::fused_val_function<Node const> F;
+ typedef typename result_of::get_keys<Node>::type Keys;
+
+ return ::boost::fusion::transform_view<Keys const,F>(Keys(), F(node));
+ }
+
+ template <typename Node>
+ inline typename result_of::get_properties<Node>::type
+ get_properties(Node& node)
+ {
+ typedef ::boost::tree_node::_detail::fused_val_function<Node> F;
+ typedef typename result_of::get_keys<Node>::type Keys;
+
+ return ::boost::fusion::transform_view<Keys const,F>(Keys(), F(node));
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_INTRINSIC_GET_PROPERTIES_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/intrinsic/has_key.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/intrinsic/has_key.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,71 @@
+// Copyright (C) 2012-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_INTRINSIC_HAS_KEY_HPP_INCLUDED
+#define BOOST_TREE_NODE_INTRINSIC_HAS_KEY_HPP_INCLUDED
+
+#include <boost/config.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+#include <boost/tr1/type_traits.hpp>
+
+namespace boost { namespace tree_node { namespace result_of {
+
+ template <typename Node, typename Key>
+ struct has_key : ::std::tr1::is_base_of<Key,Node>
+ {
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(2,has_key,(Node,Key))
+ };
+}}} // namespace boost::tree_node::result_of
+
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+//[reference__tree_node__result_of__has_key
+namespace boost { namespace tree_node { namespace result_of {
+
+ template <typename Node, typename Key>
+ struct has_key_impl : has_key_impl<typename Node::super_t,Key>
+ {
+ };
+
+ template <typename Key>
+ struct has_key_impl<void,Key> : ::boost::mpl::false_
+ {
+ };
+
+ template <typename Node, typename Key>
+ struct has_key : has_key_impl<Node,Key>::type
+ {
+ //<-
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(2,has_key,(Node,Key))
+ //->
+ };
+}}} // namespace boost::tree_node::result_of
+//]
+
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+//[reference__tree_node__has_key
+namespace boost { namespace tree_node {
+
+ template <typename Key, typename Node>
+ typename result_of::has_key<Node,Key>::type has_key(Node const& node);
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Key, typename Node>
+ inline typename result_of::has_key<Node,Key>::type has_key(Node const&)
+ {
+ return typename result_of::has_key<Node,Key>::type();
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_INTRINSIC_HAS_KEY_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/intrinsic/value_at_key.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/intrinsic/value_at_key.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,47 @@
+// Copyright (C) 2012-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_INTRINSIC_VALUE_AT_KEY_HPP_INCLUDED
+#define BOOST_TREE_NODE_INTRINSIC_VALUE_AT_KEY_HPP_INCLUDED
+
+#include <boost/tr1/type_traits.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/utility/get_reference.hpp>
+
+//[reference__tree_node__result_of__value_at_key
+namespace boost { namespace tree_node { namespace result_of {
+
+ template <typename Node, typename Key>
+ class value_at_key
+ {
+ typedef typename ::std::tr1::remove_const<Node>::type::super_t
+ _base;
+
+ public:
+ typedef BOOST_TYPEOF_TPL(
+ get(
+ ::boost::get_reference<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_const<Node>
+ , _base const
+ , _base
+ >::type
+ >()
+ , Key()
+ )
+ )
+ type;
+
+ //<-
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(2,value_at_key,(Node,Key))
+ //->
+ };
+}}} // namespace boost::tree_node::result_of
+//]
+
+#endif // BOOST_TREE_NODE_INTRINSIC_VALUE_AT_KEY_HPP_INCLUDED
+

Added: sandbox/tree_node/boost/tree_node/iterator/breadth_first.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/iterator/breadth_first.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,551 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ITERATOR_BREADTH_FIRST_HPP
+#define BOOST_TREE_NODE_ITERATOR_BREADTH_FIRST_HPP
+
+#include <boost/config.hpp>
+
+#if defined BOOST_NO_SFINAE
+#include <iterator>
+#include <boost/range/algorithm/copy.hpp>
+#else
+#include <boost/utility/enable_if.hpp>
+#include <boost/tr1/type_traits.hpp>
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/iterator/iterator_categories.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/heap/heap_merge.hpp>
+#include <boost/container_gen/selectors.hpp>
+#include <boost/container_gen/container_gen.hpp>
+#include <boost/container_gen/is_std_heap_selector.hpp>
+#include <boost/container_gen/is_heap_selector.hpp>
+#include <boost/container_gen/is_mergeable_heap_selector.hpp>
+#include <boost/tree_node/traversal_state.hpp>
+#include <boost/tree_node/iterator/dereference.hpp>
+#include <boost/detail/metafunction/container_pointer.hpp>
+#include <boost/detail/metafunction/container_iterator.hpp>
+
+//[reference__breadth_first_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename Selector = ::boost::dequeS>
+ class breadth_first_iterator
+ : public ::boost::iterator_adaptor<
+ breadth_first_iterator<Node,Selector>
+//<-
+#if 0
+//->
+ , Node*
+//<-
+#endif
+ , typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+//->
+ , ::boost::use_default
+ , ::boost::forward_traversal_tag
+ >
+ {
+ //<-
+ typedef ::boost::iterator_adaptor<
+ breadth_first_iterator<Node,Selector>
+ , typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+ , ::boost::use_default
+ , ::boost::forward_traversal_tag
+ >
+ super_t;
+ typedef typename ::boost::container_gen<
+ Selector
+ , typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+ >::type
+ Queue;
+
+#if !defined BOOST_NO_SFINAE
+ //->
+ struct enabler
+ {
+ };
+ //<-
+#endif
+
+ public: // Should be private, but conversion ctor won't work.
+ Queue _queue;
+ ::boost::tree_node::traversal_state _state;
+ //->
+
+ public:
+ breadth_first_iterator();
+
+ template <typename Compare>
+ explicit breadth_first_iterator(Compare const& compare);
+
+ explicit breadth_first_iterator(Node& node);
+
+ template <typename Compare>
+ breadth_first_iterator(Node& node, Compare const& compare);
+
+//<-
+#if defined BOOST_NO_SFINAE
+ template <typename N, typename S>
+ breadth_first_iterator(breadth_first_iterator<N,S> const& other);
+#else
+//->
+ template <typename N, typename S>
+ breadth_first_iterator(
+ breadth_first_iterator<N,S> const& other
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_same<S,Selector>
+ , ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::eval_if<
+ ::boost::is_heap_selector<Selector>
+ , ::boost::mpl::false_
+ , ::boost::mpl::if_<
+ ::boost::is_std_heap_selector<Selector>
+ , ::boost::mpl::false_
+ , ::boost::mpl::true_
+ >
+ >
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type = enabler()
+ );
+
+ template <typename N, typename S>
+ breadth_first_iterator(
+ breadth_first_iterator<N,S> const& other
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_same<S,Selector>
+ , ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::if_<
+ ::boost::is_heap_selector<Selector>
+ , ::boost::mpl::true_
+ , ::boost::is_std_heap_selector<Selector>
+ >
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type = enabler()
+ );
+//<-
+#endif // BOOST_NO_SFINAE
+//->
+
+ operator ::boost::tree_node::traversal_state() const;
+
+ //<-
+#if !BOOST_WORKAROUND(__GNUC__, == 2)
+ private:
+ friend class ::boost::iterator_core_access;
+#endif
+
+ void increment();
+
+ template <typename N, typename S>
+ bool equal(breadth_first_iterator<N,S> const& other) const;
+
+ private:
+ void _increment(::boost::mpl::true_);
+
+ void _increment(::boost::mpl::false_);
+
+ static void
+ _merge_heap(
+ Queue& this_queue
+ , Queue& other_queue
+ , ::boost::mpl::true_
+ );
+
+ template <typename OtherQueue, typename BooleanConstant>
+ static void
+ _merge_heap(
+ Queue& this_queue
+ , OtherQueue& other_queue
+ , BooleanConstant
+ );
+
+ template <typename OtherQueue>
+ static void
+ _merge(
+ Queue& this_queue
+ , OtherQueue& other_queue
+ , ::boost::mpl::true_
+ );
+
+ template <typename OtherQueue>
+ static void
+ _merge(
+ Queue& this_queue
+ , OtherQueue& other_queue
+ , ::boost::mpl::false_
+ );
+
+#if defined BOOST_NO_SFINAE
+ template <typename CopyQueue>
+ static void
+ _clone(
+ Queue& this_queue
+ , CopyQueue const& copy_queue
+ , ::boost::mpl::true_
+ );
+
+ template <typename CopyQueue>
+ static void
+ _clone(
+ Queue& this_queue
+ , CopyQueue const& copy_queue
+ , ::boost::mpl::false_
+ );
+#endif
+ //->
+ };
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename Selector>
+ breadth_first_iterator<Node,Selector>::breadth_first_iterator()
+ : super_t(), _queue(), _state(::boost::tree_node::no_traversal)
+ {
+ }
+
+ template <typename Node, typename Selector>
+ template <typename Compare>
+ breadth_first_iterator<Node,Selector>::breadth_first_iterator(
+ Compare const& compare
+ ) : super_t(), _queue(compare), _state(::boost::tree_node::no_traversal)
+ {
+ }
+
+ template <typename Node, typename Selector>
+ breadth_first_iterator<Node,Selector>::breadth_first_iterator(Node& node)
+ : super_t(&node)
+ , _queue()
+ , _state(::boost::tree_node::breadth_first_traversal)
+ {
+ }
+
+ template <typename Node, typename Selector>
+ template <typename Compare>
+ breadth_first_iterator<Node,Selector>::breadth_first_iterator(
+ Node& node
+ , Compare const& compare
+ ) : super_t(&node)
+ , _queue(compare)
+ , _state(::boost::tree_node::breadth_first_traversal)
+ {
+ }
+
+ template <typename Node, typename Selector>
+ inline void
+ breadth_first_iterator<Node,Selector>::_merge_heap(
+ Queue& this_queue
+ , Queue& other_queue
+ , ::boost::mpl::true_
+ )
+ {
+ this_queue.merge(other_queue);
+ }
+
+ template <typename Node, typename Selector>
+ template <typename OtherQueue, typename BooleanConstant>
+ inline void
+ breadth_first_iterator<Node,Selector>::_merge_heap(
+ Queue& this_queue
+ , OtherQueue& other_queue
+ , BooleanConstant
+ )
+ {
+ ::boost::heap::heap_merge(this_queue, other_queue);
+ }
+
+ template <typename Node, typename Selector>
+ template <typename OtherQueue>
+ inline void
+ breadth_first_iterator<Node,Selector>::_merge(
+ Queue& this_queue
+ , OtherQueue& other_queue
+ , ::boost::mpl::true_
+ )
+ {
+ breadth_first_iterator<Node,Selector>::_merge_heap(
+ this_queue
+ , other_queue
+ , ::boost::is_mergeable_heap_selector<Selector>()
+ );
+ }
+
+ template <typename Node, typename Selector>
+ template <typename OtherQueue>
+ void
+ breadth_first_iterator<Node,Selector>::_merge(
+ Queue& this_queue
+ , OtherQueue& other_queue
+ , ::boost::mpl::false_
+ )
+ {
+ for (; !other_queue.empty(); other_queue.pop())
+ {
+ this_queue.push(other_queue.top());
+ }
+ }
+
+#if defined BOOST_NO_SFINAE
+ template <typename Node, typename Selector>
+ template <typename CopyQueue>
+ inline void
+ breadth_first_iterator<Node,Selector>::_clone(
+ Queue& this_queue
+ , CopyQueue const& copy_queue
+ , ::boost::mpl::true_
+ )
+ {
+ CopyQueue other_queue(copy_queue);
+
+ breadth_first_iterator<Node,Selector>::_merge(
+ this_queue
+ , other_queue
+ , ::boost::is_heap_selector<Selector>()
+ );
+ }
+
+ template <typename Node, typename Selector>
+ template <typename CopyQueue>
+ inline void
+ breadth_first_iterator<Node,Selector>::_clone(
+ Queue& this_queue
+ , CopyQueue const& copy_queue
+ , ::boost::mpl::false_
+ )
+ {
+ ::boost::range::copy(copy_queue, ::std::back_inserter(this_queue));
+ }
+
+ template <typename Node, typename Selector>
+ template <typename N, typename S>
+ breadth_first_iterator<Node,Selector>::breadth_first_iterator(
+ breadth_first_iterator<N,S> const& other
+ ) : super_t(other.base()), _queue(), _state(other._state)
+ {
+ breadth_first_iterator<Node,Selector>::_clone(
+ this->_queue
+ , other._queue
+ , typename ::boost::mpl::if_<
+ ::boost::is_std_heap_selector<Selector>
+ , ::boost::mpl::true_
+ , ::boost::is_heap_selector<Selector>
+ >::type()
+ );
+ }
+#else // !defined BOOST_NO_SFINAE
+ template <typename Node, typename Selector>
+ template <typename N, typename S>
+ breadth_first_iterator<Node,Selector>::breadth_first_iterator(
+ breadth_first_iterator<N,S> const& other
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_same<S,Selector>
+ , ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::eval_if<
+ ::boost::is_heap_selector<Selector>
+ , ::boost::mpl::false_
+ , ::boost::mpl::if_<
+ ::boost::is_std_heap_selector<Selector>
+ , ::boost::mpl::false_
+ , ::boost::mpl::true_
+ >
+ >
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type
+ ) : super_t(other.base())
+ , _queue(other._queue.begin(), other._queue.end())
+ , _state(other._state)
+ {
+ }
+
+ template <typename Node, typename Selector>
+ template <typename N, typename S>
+ breadth_first_iterator<Node,Selector>::breadth_first_iterator(
+ breadth_first_iterator<N,S> const& other
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_same<S,Selector>
+ , ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::if_<
+ ::boost::is_heap_selector<Selector>
+ , ::boost::mpl::true_
+ , ::boost::is_std_heap_selector<Selector>
+ >
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type
+ ) : super_t(other.base()), _queue(), _state(other._state)
+ {
+ typename breadth_first_iterator<N,S>::Queue other_queue(other._queue);
+
+ breadth_first_iterator<Node,Selector>::_merge(
+ this->_queue
+ , other_queue
+ , ::boost::is_heap_selector<Selector>()
+ );
+ }
+#endif // BOOST_NO_SFINAE
+
+ template <typename Node, typename Selector>
+ inline breadth_first_iterator<Node,Selector>::operator
+ ::boost::tree_node::traversal_state() const
+ {
+ return this->_state;
+ }
+
+ template <typename Node, typename Selector>
+ void breadth_first_iterator<Node,Selector>::_increment(::boost::mpl::true_)
+ {
+ typedef typename ::boost::detail::metafunction::container_iterator<
+ Node
+ >::type
+ child_itr;
+
+ child_itr itr_end = this->base()->end();
+
+ for (child_itr itr = this->base()->begin(); itr != itr_end; ++itr)
+ {
+ this->_queue.push(&dereference_iterator(itr));
+ }
+
+ if (this->_queue.empty())
+ {
+ this->_state = ::boost::tree_node::no_traversal;
+ }
+ else
+ {
+ this->base_reference() = this->_queue.top();
+ this->_queue.pop();
+ }
+ }
+
+ template <typename Node, typename Selector>
+ void
+ breadth_first_iterator<Node,Selector>::_increment(::boost::mpl::false_)
+ {
+ typedef typename ::boost::detail::metafunction::container_iterator<
+ Node
+ >::type
+ child_itr;
+
+ child_itr itr_end = this->base()->end();
+
+ for (child_itr itr = this->base()->begin(); itr != itr_end; ++itr)
+ {
+ this->_queue.push_back(&dereference_iterator(itr));
+ }
+
+ if (this->_queue.empty())
+ {
+ this->_state = ::boost::tree_node::no_traversal;
+ }
+ else
+ {
+ this->base_reference() = this->_queue.front();
+ this->_queue.pop_front();
+ }
+ }
+
+ template <typename Node, typename Selector>
+ inline void breadth_first_iterator<Node,Selector>::increment()
+ {
+ this->_increment(
+ typename ::boost::mpl::if_<
+ ::boost::is_std_heap_selector<Selector>
+ , ::boost::mpl::true_
+ , ::boost::is_heap_selector<Selector>
+ >::type()
+ );
+ }
+
+ template <typename Node, typename Selector>
+ template <typename N, typename S>
+ inline bool
+ breadth_first_iterator<Node,Selector>::equal(
+ breadth_first_iterator<N,S> const& other
+ ) const
+ {
+ if (this->_state == other._state)
+ {
+ return this->_state ? (
+ this->base() == other.base()
+ ) : !other._state;
+ }
+ else
+ {
+ return false;
+ }
+ }
+}} // namespace boost::tree_node
+
+//[reference__make_breadth_first_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ breadth_first_iterator<Node,::boost::dequeS>
+ make_breadth_first_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_breadth_first_iterator__with_selector
+namespace boost { namespace tree_node {
+
+ template <typename Selector, typename Node>
+ breadth_first_iterator<Node,Selector>
+ make_breadth_first_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ inline breadth_first_iterator<Node,::boost::dequeS>
+ make_breadth_first_iterator(Node& node)
+ {
+ return breadth_first_iterator<Node,::boost::dequeS>(node);
+ }
+
+ template <typename Selector, typename Node>
+ inline breadth_first_iterator<Node,Selector>
+ make_breadth_first_iterator(Node& node)
+ {
+ return breadth_first_iterator<Node,Selector>(node);
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ITERATOR_BREADTH_FIRST_HPP
+

Added: sandbox/tree_node/boost/tree_node/iterator/breadth_first_descendant.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/iterator/breadth_first_descendant.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,620 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ITERATOR_BREADTH_FIRST_DESCENDANT_HPP
+#define BOOST_TREE_NODE_ITERATOR_BREADTH_FIRST_DESCENDANT_HPP
+
+#include <boost/config.hpp>
+
+#if defined BOOST_NO_SFINAE
+#include <iterator>
+#include <boost/range/algorithm/copy.hpp>
+#else
+#include <boost/utility/enable_if.hpp>
+#include <boost/tr1/type_traits.hpp>
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/iterator/iterator_categories.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/heap/heap_merge.hpp>
+#include <boost/container_gen/selectors.hpp>
+#include <boost/container_gen/container_gen.hpp>
+#include <boost/container_gen/is_std_heap_selector.hpp>
+#include <boost/container_gen/is_heap_selector.hpp>
+#include <boost/container_gen/is_mergeable_heap_selector.hpp>
+#include <boost/tree_node/traversal_state.hpp>
+#include <boost/tree_node/iterator/dereference.hpp>
+#include <boost/detail/metafunction/container_iterator.hpp>
+
+//[reference__breadth_first_descendant_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename Selector = ::boost::dequeS>
+ class breadth_first_descendant_iterator
+ : public ::boost::iterator_adaptor<
+ breadth_first_descendant_iterator<Node,Selector>
+//<-
+#if 0
+//->
+ , typename ::boost::mpl::if_<
+ ::std::tr1::is_const<Node>
+ , typename Node::const_iterator
+ , typename Node::iterator
+ >::type
+//<-
+#endif
+ , typename ::boost::detail::metafunction::container_iterator<
+ Node
+ >::type
+//->
+ , ::boost::use_default
+ , ::boost::forward_traversal_tag
+ >
+ {
+ //<-
+ typedef typename ::boost::detail::metafunction::container_iterator<
+ Node
+ >::type
+ child_iterator;
+ typedef ::boost::iterator_adaptor<
+ breadth_first_descendant_iterator<Node,Selector>
+ , child_iterator
+ , ::boost::use_default
+ , ::boost::forward_traversal_tag
+ >
+ super_t;
+ typedef typename ::boost::container_gen<Selector,child_iterator>::type
+ Queue;
+
+#if !defined BOOST_NO_SFINAE
+ //->
+ struct enabler
+ {
+ };
+ //<-
+#endif
+
+ public: // Should be private, but conversion ctor won't work.
+ Queue _queue;
+ ::boost::tree_node::traversal_state _state;
+ //->
+
+ public:
+ breadth_first_descendant_iterator();
+
+ template <typename Compare>
+ explicit breadth_first_descendant_iterator(Compare const& compare);
+
+ explicit breadth_first_descendant_iterator(Node& node);
+
+ template <typename Compare>
+ breadth_first_descendant_iterator(Node& node, Compare const& compare);
+
+//<-
+#if defined BOOST_NO_SFINAE
+ template <typename N, typename S>
+ breadth_first_descendant_iterator(
+ breadth_first_descendant_iterator<N,S> const& other
+ )
+#else
+//->
+ template <typename N, typename S>
+ breadth_first_descendant_iterator(
+ breadth_first_descendant_iterator<N,S> const& other
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_same<S,Selector>
+ , ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::eval_if<
+ ::boost::is_heap_selector<Selector>
+ , ::boost::mpl::false_
+ , ::boost::mpl::if_<
+ ::boost::is_std_heap_selector<Selector>
+ , ::boost::mpl::false_
+ , ::boost::mpl::true_
+ >
+ >
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type = enabler()
+ );
+
+ template <typename N, typename S>
+ breadth_first_descendant_iterator(
+ breadth_first_descendant_iterator<N,S> const& other
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_same<S,Selector>
+ , ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::if_<
+ ::boost::is_heap_selector<Selector>
+ , ::boost::mpl::true_
+ , ::boost::is_std_heap_selector<Selector>
+ >
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type = enabler()
+ );
+//<-
+#endif // BOOST_NO_SFINAE
+//->
+
+ operator ::boost::tree_node::traversal_state() const;
+
+ //<-
+#if !BOOST_WORKAROUND(__GNUC__, == 2)
+ private:
+ friend class ::boost::iterator_core_access;
+#endif
+
+ void increment();
+
+ template <typename N, typename S>
+ bool equal(breadth_first_descendant_iterator<N,S> const& other) const;
+
+ private:
+ void _push_children(Node& node);
+
+ void _pop(::boost::mpl::true_);
+
+ void _pop(::boost::mpl::false_);
+
+ static void
+ _push(Queue& queue, child_iterator itr, ::boost::mpl::true_);
+
+ static void
+ _push(Queue& queue, child_iterator itr, ::boost::mpl::false_);
+
+ static void
+ _merge_heap(
+ Queue& this_queue
+ , Queue& other_queue
+ , ::boost::mpl::true_
+ );
+
+ template <typename OtherQueue, typename BooleanConstant>
+ static void
+ _merge_heap(
+ Queue& this_queue
+ , OtherQueue& other_queue
+ , BooleanConstant
+ );
+
+ template <typename OtherQueue>
+ static void
+ _merge(
+ Queue& this_queue
+ , OtherQueue& other_queue
+ , ::boost::mpl::true_
+ );
+
+ template <typename OtherQueue>
+ static void
+ _merge(
+ Queue& this_queue
+ , OtherQueue& other_queue
+ , ::boost::mpl::false_
+ );
+
+#if defined BOOST_NO_SFINAE
+ template <typename CopyQueue>
+ static void
+ _clone(
+ Queue& this_queue
+ , CopyQueue const& copy_queue
+ , ::boost::mpl::true_
+ );
+
+ template <typename CopyQueue>
+ static void
+ _clone(
+ Queue& this_queue
+ , CopyQueue const& copy_queue
+ , ::boost::mpl::false_
+ );
+#endif
+ //->
+ };
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename Selector>
+ inline void
+ breadth_first_descendant_iterator<Node,Selector>::_push(
+ Queue& queue
+ , child_iterator itr
+ , ::boost::mpl::true_
+ )
+ {
+ queue.push(itr);
+ }
+
+ template <typename Node, typename Selector>
+ inline void
+ breadth_first_descendant_iterator<Node,Selector>::_push(
+ Queue& queue
+ , child_iterator itr
+ , ::boost::mpl::false_
+ )
+ {
+ queue.push_back(itr);
+ }
+
+ template <typename Node, typename Selector>
+ void breadth_first_descendant_iterator<Node,Selector>::_push_children(Node& node)
+ {
+ child_iterator itr_end = node.end();
+
+ for (child_iterator itr = node.begin(); itr != itr_end; ++itr)
+ {
+ breadth_first_descendant_iterator<Node,Selector>::_push(
+ this->_queue
+ , itr
+ , typename ::boost::mpl::if_<
+ ::boost::is_std_heap_selector<Selector>
+ , ::boost::mpl::true_
+ , ::boost::is_heap_selector<Selector>
+ >::type()
+ );
+ }
+ }
+
+ template <typename Node, typename Selector>
+ inline void
+ breadth_first_descendant_iterator<Node,Selector>::_pop(
+ ::boost::mpl::true_
+ )
+ {
+ if (this->_queue.empty())
+ {
+ this->_state = ::boost::tree_node::no_traversal;
+ }
+ else
+ {
+ this->base_reference() = this->_queue.top();
+ this->_queue.pop();
+ }
+ }
+
+ template <typename Node, typename Selector>
+ inline void
+ breadth_first_descendant_iterator<Node,Selector>::_pop(
+ ::boost::mpl::false_
+ )
+ {
+ if (this->_queue.empty())
+ {
+ this->_state = ::boost::tree_node::no_traversal;
+ }
+ else
+ {
+ this->base_reference() = this->_queue.front();
+ this->_queue.pop_front();
+ }
+ }
+
+ template <typename Node, typename Selector>
+ breadth_first_descendant_iterator<
+ Node
+ , Selector
+ >::breadth_first_descendant_iterator()
+ : super_t(), _queue(), _state(::boost::tree_node::no_traversal)
+ {
+ }
+
+ template <typename Node, typename Selector>
+ template <typename Compare>
+ breadth_first_descendant_iterator<
+ Node
+ , Selector
+ >::breadth_first_descendant_iterator(Compare const& compare)
+ : super_t(), _queue(compare), _state(::boost::tree_node::no_traversal)
+ {
+ }
+
+ template <typename Node, typename Selector>
+ breadth_first_descendant_iterator<
+ Node
+ , Selector
+ >::breadth_first_descendant_iterator(Node& node)
+ : super_t()
+ , _queue()
+ , _state(::boost::tree_node::breadth_first_traversal)
+ {
+ this->_push_children(node);
+ this->_pop(
+ typename ::boost::mpl::if_<
+ ::boost::is_std_heap_selector<Selector>
+ , ::boost::mpl::true_
+ , ::boost::is_heap_selector<Selector>
+ >::type()
+ );
+ }
+
+ template <typename Node, typename Selector>
+ template <typename Compare>
+ breadth_first_descendant_iterator<
+ Node
+ , Selector
+ >::breadth_first_descendant_iterator(Node& node, Compare const& compare)
+ : super_t()
+ , _queue(compare)
+ , _state(::boost::tree_node::breadth_first_traversal)
+ {
+ this->_push_children(node);
+ this->_pop(
+ typename ::boost::mpl::if_<
+ ::boost::is_std_heap_selector<Selector>
+ , ::boost::mpl::true_
+ , ::boost::is_heap_selector<Selector>
+ >::type()
+ );
+ }
+
+ template <typename Node, typename Selector>
+ inline void
+ breadth_first_descendant_iterator<Node,Selector>::_merge_heap(
+ Queue& this_queue
+ , Queue& other_queue
+ , ::boost::mpl::true_
+ )
+ {
+ this_queue.merge(other_queue);
+ }
+
+ template <typename Node, typename Selector>
+ template <typename OtherQueue, typename BooleanConstant>
+ inline void
+ breadth_first_descendant_iterator<Node,Selector>::_merge_heap(
+ Queue& this_queue
+ , OtherQueue& other_queue
+ , BooleanConstant
+ )
+ {
+ ::boost::heap::heap_merge(this_queue, other_queue);
+ }
+
+ template <typename Node, typename Selector>
+ template <typename OtherQueue>
+ inline void
+ breadth_first_descendant_iterator<Node,Selector>::_merge(
+ Queue& this_queue
+ , OtherQueue& other_queue
+ , ::boost::mpl::true_
+ )
+ {
+ breadth_first_descendant_iterator<Node,Selector>::_merge_heap(
+ this_queue
+ , other_queue
+ , ::boost::is_mergeable_heap_selector<Selector>()
+ );
+ }
+
+ template <typename Node, typename Selector>
+ template <typename OtherQueue>
+ void
+ breadth_first_descendant_iterator<Node,Selector>::_merge(
+ Queue& this_queue
+ , OtherQueue& other_queue
+ , ::boost::mpl::false_
+ )
+ {
+ for (; !other_queue.empty(); other_queue.pop())
+ {
+ this_queue.push(other_queue.top());
+ }
+ }
+
+#if defined BOOST_NO_SFINAE
+ template <typename Node, typename Selector>
+ template <typename CopyQueue>
+ inline void
+ breadth_first_descendant_iterator<Node,Selector>::_clone(
+ Queue& this_queue
+ , CopyQueue const& copy_queue
+ , ::boost::mpl::true_
+ )
+ {
+ CopyQueue other_queue(copy_queue);
+
+ breadth_first_iterator<Node,Selector>::_merge(
+ this_queue
+ , other_queue
+ , ::boost::is_heap_selector<Selector>()
+ );
+ }
+
+ template <typename Node, typename Selector>
+ template <typename CopyQueue>
+ inline void
+ breadth_first_descendant_iterator<Node,Selector>::_clone(
+ Queue& this_queue
+ , CopyQueue const& copy_queue
+ , ::boost::mpl::false_
+ )
+ {
+ ::boost::range::copy(copy_queue, ::std::back_inserter(this_queue));
+ }
+
+ template <typename Node, typename Selector>
+ template <typename N, typename S>
+ breadth_first_descendant_iterator<
+ Node
+ , Selector
+ >::breadth_first_descendant_iterator(
+ breadth_first_descendant_iterator<N,S> const& other
+ ) : super_t(other.base()), _queue(), _state(other._state)
+ {
+ breadth_first_iterator<Node,Selector>::_clone(
+ this->_queue
+ , other._queue
+ , typename ::boost::mpl::if_<
+ ::boost::is_std_heap_selector<Selector>
+ , ::boost::mpl::true_
+ , ::boost::is_heap_selector<Selector>
+ >::type()
+ );
+ }
+#else // !defined BOOST_NO_SFINAE
+ template <typename Node, typename Selector>
+ template <typename N, typename S>
+ breadth_first_descendant_iterator<
+ Node
+ , Selector
+ >::breadth_first_descendant_iterator(
+ breadth_first_descendant_iterator<N,S> const& other
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_same<S,Selector>
+ , ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::eval_if<
+ ::boost::is_heap_selector<Selector>
+ , ::boost::mpl::false_
+ , ::boost::mpl::if_<
+ ::boost::is_std_heap_selector<Selector>
+ , ::boost::mpl::false_
+ , ::boost::mpl::true_
+ >
+ >
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type
+ ) : super_t(other.base())
+ , _queue(other._queue.begin(), other._queue.end())
+ , _state(other._state)
+ {
+ }
+
+ template <typename Node, typename Selector>
+ template <typename N, typename S>
+ breadth_first_descendant_iterator<
+ Node
+ , Selector
+ >::breadth_first_descendant_iterator(
+ breadth_first_descendant_iterator<N,S> const& other
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_same<S,Selector>
+ , ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::if_<
+ ::boost::is_heap_selector<Selector>
+ , ::boost::mpl::true_
+ , ::boost::is_std_heap_selector<Selector>
+ >
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type
+ ) : super_t(other.base()), _queue(), _state(other._state)
+ {
+ typename breadth_first_descendant_iterator<N,S>::Queue other_queue(
+ other._queue
+ );
+
+ breadth_first_descendant_iterator<Node,Selector>::_merge(
+ this->_queue
+ , other_queue
+ , ::boost::is_heap_selector<Selector>()
+ );
+ }
+#endif // BOOST_NO_SFINAE
+
+ template <typename Node, typename Selector>
+ inline breadth_first_descendant_iterator<Node,Selector>::operator
+ ::boost::tree_node::traversal_state() const
+ {
+ return this->_state;
+ }
+
+ template <typename Node, typename Selector>
+ inline void breadth_first_descendant_iterator<Node,Selector>::increment()
+ {
+ this->_push_children(dereference_iterator(this->base()));
+ this->_pop(
+ typename ::boost::mpl::if_<
+ ::boost::is_std_heap_selector<Selector>
+ , ::boost::mpl::true_
+ , ::boost::is_heap_selector<Selector>
+ >::type()
+ );
+ }
+
+ template <typename Node, typename Selector>
+ template <typename N, typename S>
+ inline bool
+ breadth_first_descendant_iterator<Node,Selector>::equal(
+ breadth_first_descendant_iterator<N,S> const& other
+ ) const
+ {
+ if (this->_state == other._state)
+ {
+ return this->_state ? (
+ this->base() == other.base()
+ ) : !other._state;
+ }
+ else
+ {
+ return false;
+ }
+ }
+}} // namespace boost::tree_node
+
+//[reference__make_breadth_first_descendant_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ breadth_first_descendant_iterator<Node,::boost::dequeS>
+ make_breadth_first_descendant_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_breadth_first_descendant_iterator__with_selector
+namespace boost { namespace tree_node {
+
+ template <typename Selector, typename Node>
+ breadth_first_descendant_iterator<Node,Selector>
+ make_breadth_first_descendant_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ inline breadth_first_descendant_iterator<Node,::boost::dequeS>
+ make_breadth_first_descendant_iterator(Node& node)
+ {
+ return breadth_first_descendant_iterator<Node,::boost::dequeS>(node);
+ }
+
+ template <typename Selector, typename Node>
+ inline breadth_first_descendant_iterator<Node,Selector>
+ make_breadth_first_descendant_iterator(Node& node)
+ {
+ return breadth_first_descendant_iterator<Node,Selector>(node);
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ITERATOR_BREADTH_FIRST_DESCENDANT_HPP
+

Added: sandbox/tree_node/boost/tree_node/iterator/depth_first.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/iterator/depth_first.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,563 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ITERATOR_DEPTH_FIRST_HPP
+#define BOOST_TREE_NODE_ITERATOR_DEPTH_FIRST_HPP
+
+#include <boost/config.hpp>
+
+#if !defined BOOST_NO_CXX11_NULLPTR
+#include <cstddef>
+#endif
+
+#include <iterator>
+#include <deque>
+#include <boost/assert.hpp>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/utility/value_init.hpp>
+
+#if !defined BOOST_NO_SFINAE
+#include <boost/utility/enable_if.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/equal_to.hpp>
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/iterator/iterator_categories.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/tree_node/traversal_state.hpp>
+#include <boost/tree_node/iterator/dereference.hpp>
+#include <boost/detail/metafunction/is_bidirectional_iterator.hpp>
+#include <boost/detail/metafunction/container_pointer.hpp>
+#include <boost/detail/metafunction/container_iterator.hpp>
+#include <boost/detail/metafunction/container_reverse_iterator.hpp>
+
+//[reference__depth_first_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename IsReverse = ::boost::mpl::false_>
+ class depth_first_iterator
+ : public ::boost::iterator_adaptor<
+ depth_first_iterator<Node,IsReverse>
+//<-
+#if 0
+//->
+ , Node*
+ //<-
+#endif
+ , typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+ //->
+ , ::boost::use_default
+ , typename ::boost::mpl::if_<
+ // Node [const] has bidirectional iterators
+ //<-
+ ::boost::detail::metafunction::is_bidirectional_iterator<
+ typename ::std::tr1::remove_const<Node>::type::iterator
+ >
+ //->
+ , ::boost::bidirectional_traversal_tag
+ , ::boost::forward_traversal_tag
+ >::type
+ >
+ {
+ //<-
+ typedef typename ::boost::mpl::eval_if<
+ IsReverse
+ , ::boost::detail::metafunction::container_reverse_iterator<
+ Node
+ >
+ , ::boost::detail::metafunction::container_iterator<Node>
+ >::type
+ child_iterator;
+ typedef ::boost::iterator_adaptor<
+ depth_first_iterator<Node,IsReverse>
+ , typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+ , ::boost::use_default
+ , typename ::boost::mpl::if_<
+ ::boost::detail::metafunction
+ ::is_bidirectional_iterator<
+ typename ::std::tr1::remove_const<
+ Node
+ >::type::iterator
+ >
+ , ::boost::bidirectional_traversal_tag
+ , ::boost::forward_traversal_tag
+ >::type
+ >
+ super_t;
+
+#if !defined BOOST_NO_SFINAE
+ struct enabler
+ {
+ };
+#endif
+
+ public: // Should be private, but conversion ctor won't work.
+ ::std::deque<
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+ > _node_stack; // ancestors
+ ::std::deque<child_iterator> _itr_stack; // total position
+ child_iterator _current_itr; // points to base()
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type _root_ptr;
+ ::boost::tree_node::traversal_state _state;
+ //->
+
+ public:
+//<-
+#if 0
+//->
+ explicit depth_first_iterator(Node* const& node_ptr = nullptr);
+//<-
+#endif
+ explicit depth_first_iterator(
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type const& node_ptr = ::boost::initialized_value
+ );
+//->
+
+ explicit depth_first_iterator(Node& node);
+
+ template <typename N, typename I>
+ depth_first_iterator(
+ depth_first_iterator<N,I> const& other
+//<-
+#if !defined BOOST_NO_SFINAE
+//->
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type = enabler()
+//<-
+#endif
+//->
+ );
+
+ operator ::boost::tree_node::traversal_state() const;
+
+ //<-
+#if !BOOST_WORKAROUND(__GNUC__, == 2)
+ private:
+ friend class ::boost::iterator_core_access;
+#endif
+
+ void increment();
+
+ void decrement();
+
+ template <typename N, typename I>
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if<
+ ::boost::mpl::equal_to<I,IsReverse>
+ , bool
+ >::type
+#endif
+ equal(depth_first_iterator<N,I> const& other) const;
+
+ private:
+ child_iterator _begin(::boost::mpl::false_);
+
+ child_iterator _begin(::boost::mpl::true_);
+
+ child_iterator _end(::boost::mpl::false_);
+
+ child_iterator _end(::boost::mpl::true_);
+ //->
+ };
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_depth_first_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ depth_first_iterator<Node> make_depth_first_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_depth_first_iterator_end
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ depth_first_iterator<Node> make_depth_first_iterator_end(Node* ptr);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_depth_first_reverse_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ depth_first_iterator<Node,::boost::mpl::true_>
+ make_depth_first_reverse_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_depth_first_reverse_iterator_end
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ depth_first_iterator<Node,::boost::mpl::true_>
+ make_depth_first_reverse_iterator_end(Node* ptr);
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename IsReverse>
+ depth_first_iterator<Node,IsReverse>::depth_first_iterator(
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type const& node_ptr
+ ) : super_t(
+#if defined BOOST_NO_CXX11_NULLPTR
+ 0
+#else
+ nullptr
+#endif
+ )
+ , _node_stack()
+ , _itr_stack()
+ , _current_itr()
+ , _root_ptr(node_ptr)
+ , _state(::boost::tree_node::no_traversal)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ depth_first_iterator<Node,IsReverse>::depth_first_iterator(Node& node)
+ : super_t(&node)
+ , _node_stack()
+ , _itr_stack()
+ , _current_itr()
+ , _root_ptr(&node)
+ , _state(::boost::tree_node::pre_order_traversal)
+ {
+ this->_itr_stack.push_back(this->_begin(IsReverse()));
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ depth_first_iterator<Node,IsReverse>::depth_first_iterator(
+ depth_first_iterator<N,I> const& other
+#if !defined BOOST_NO_SFINAE
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type
+#endif
+ ) : super_t(other.base())
+ , _node_stack(other._node_stack.begin(), other._node_stack.end())
+ , _itr_stack(other._itr_stack.begin(), other._itr_stack.end())
+ , _current_itr(other._current_itr)
+ , _root_ptr(other._root_ptr)
+ , _state(other._state)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ inline depth_first_iterator<Node,IsReverse>::operator
+ ::boost::tree_node::traversal_state() const
+ {
+ return this->_state;
+ }
+
+ template <typename Node, typename IsReverse>
+ void depth_first_iterator<Node,IsReverse>::increment()
+ {
+ switch (this->_state)
+ {
+ case ::boost::tree_node::pre_order_traversal:
+ {
+ child_iterator& itr = this->_itr_stack.back();
+
+ if (itr == this->_end(IsReverse()))
+ {
+ // No children: change state.
+ this->_state = ::boost::tree_node::post_order_traversal;
+ }
+ else
+ {
+ // Go deeper.
+ this->_node_stack.push_back(this->base());
+ this->base_reference() = &(
+ dereference_iterator(this->_current_itr = itr)
+ );
+ this->_itr_stack.push_back(this->_begin(IsReverse()));
+ }
+
+ break;
+ }
+
+ case ::boost::tree_node::post_order_traversal:
+ {
+ this->_itr_stack.pop_back();
+
+ if (this->_node_stack.empty())
+ {
+ // Pass the end.
+ this->_state = ::boost::tree_node::no_traversal;
+ this->_itr_stack.clear();
+ }
+ else
+ {
+ this->base_reference() = this->_node_stack.back();
+ this->_node_stack.pop_back();
+
+ if (++this->_current_itr == this->_end(IsReverse()))
+ {
+ // No next sibling: traverse the parent.
+ child_iterator itr = this->_itr_stack.back();
+
+ this->_itr_stack.pop_back();
+
+ if (!this->_itr_stack.empty())
+ {
+ this->_current_itr = this->_itr_stack.back();
+ }
+
+ this->_itr_stack.push_back(itr);
+ }
+ else
+ {
+ // Traverse the sibling.
+ this->_itr_stack.pop_back();
+ this->_node_stack.push_back(this->base());
+ this->_itr_stack.push_back(this->_current_itr);
+ this->base_reference() = &(
+ dereference_iterator(this->_current_itr)
+ );
+ this->_state = ::boost::tree_node::pre_order_traversal;
+ this->_itr_stack.push_back(this->_begin(IsReverse()));
+ }
+ }
+
+ break;
+ }
+
+ default:
+ {
+ BOOST_ASSERT_MSG(false, "Do not increment past-the-end!");
+ }
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ void depth_first_iterator<Node,IsReverse>::decrement()
+ {
+ switch (this->_state)
+ {
+ case ::boost::tree_node::pre_order_traversal:
+ {
+ this->_itr_stack.pop_back();
+
+ if (this->_node_stack.empty())
+ {
+ // Pass the end.
+ this->_state = ::boost::tree_node::no_traversal;
+ this->_itr_stack.clear();
+ }
+ else
+ {
+ this->base_reference() = this->_node_stack.back();
+ this->_node_stack.pop_back();
+
+ if (this->_current_itr == this->_begin(IsReverse()))
+ {
+ // No previous sibling: traverse the parent.
+ child_iterator itr = this->_itr_stack.back();
+
+ this->_itr_stack.pop_back();
+
+ if (!this->_itr_stack.empty())
+ {
+ this->_current_itr = this->_itr_stack.back();
+ }
+
+ this->_itr_stack.push_back(itr);
+ }
+ else
+ {
+ // Traverse the sibling.
+ this->_itr_stack.pop_back();
+ this->_node_stack.push_back(this->base());
+ this->_itr_stack.push_back(--this->_current_itr);
+ this->base_reference() = &(
+ dereference_iterator(this->_current_itr)
+ );
+ this->_state = (
+ ::boost::tree_node::post_order_traversal
+ );
+
+ // Add last child position, if any, to total position.
+ child_iterator last_itr = this->_begin(IsReverse());
+
+ if (last_itr != this->_end(IsReverse()))
+ {
+ ::std::advance(last_itr, this->base()->size() - 1);
+ }
+
+ this->_itr_stack.push_back(last_itr);
+ }
+ }
+
+ break;
+ }
+
+ case ::boost::tree_node::post_order_traversal:
+ {
+ child_iterator& itr = this->_itr_stack.back();
+
+ if (itr == this->_end(IsReverse()))
+ {
+ // No children: change state.
+ this->_state = ::boost::tree_node::pre_order_traversal;
+ }
+ else
+ {
+ // Go deeper.
+ this->_node_stack.push_back(this->base());
+ this->base_reference() = &(
+ dereference_iterator(this->_current_itr = itr)
+ );
+
+ // Add last child position, if any, to total position.
+ child_iterator last_itr = this->_begin(IsReverse());
+
+ if (last_itr != this->_end(IsReverse()))
+ {
+ ::std::advance(last_itr, this->base()->size() - 1);
+ }
+
+ this->_itr_stack.push_back(last_itr);
+ }
+
+ break;
+ }
+
+ default:
+ {
+ BOOST_ASSERT_MSG(
+ this->_root_ptr
+ , "Do not decrement past-the-end of NULL!"
+ );
+ this->base_reference() = this->_root_ptr;
+ this->_state = ::boost::tree_node::post_order_traversal;
+
+ // Add last child position, if any, to total position.
+ child_iterator last_itr = this->_begin(IsReverse());
+
+ if (last_itr != this->_end(IsReverse()))
+ {
+ ::std::advance(last_itr, this->base()->size() - 1);
+ }
+
+ this->_itr_stack.push_back(last_itr);
+ break;
+ }
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ inline
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if<
+ ::boost::mpl::equal_to<I,IsReverse>
+ , bool
+ >::type
+#endif
+ depth_first_iterator<Node,IsReverse>::equal(
+ depth_first_iterator<N,I> const& other
+ ) const
+ {
+ if (this->_state == other._state)
+ {
+ return this->_state ? (
+ this->base() == other.base()
+ ) : !other._state;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ inline typename depth_first_iterator<Node,IsReverse>::child_iterator
+ depth_first_iterator<Node,IsReverse>::_begin(::boost::mpl::false_)
+ {
+ return this->base()->begin();
+ }
+
+ template <typename Node, typename IsReverse>
+ inline typename depth_first_iterator<Node,IsReverse>::child_iterator
+ depth_first_iterator<Node,IsReverse>::_begin(::boost::mpl::true_)
+ {
+ return this->base()->rbegin();
+ }
+
+ template <typename Node, typename IsReverse>
+ inline typename depth_first_iterator<Node,IsReverse>::child_iterator
+ depth_first_iterator<Node,IsReverse>::_end(::boost::mpl::false_)
+ {
+ return this->base()->end();
+ }
+
+ template <typename Node, typename IsReverse>
+ inline typename depth_first_iterator<Node,IsReverse>::child_iterator
+ depth_first_iterator<Node,IsReverse>::_end(::boost::mpl::true_)
+ {
+ return this->base()->rend();
+ }
+
+ template <typename Node>
+ inline depth_first_iterator<Node> make_depth_first_iterator(Node& node)
+ {
+ return depth_first_iterator<Node>(node);
+ }
+
+ template <typename Node>
+ inline depth_first_iterator<Node> make_depth_first_iterator_end(Node* ptr)
+ {
+ return depth_first_iterator<Node>(ptr);
+ }
+
+ template <typename Node>
+ inline depth_first_iterator<Node,::boost::mpl::true_>
+ make_depth_first_reverse_iterator(Node& node)
+ {
+ return depth_first_iterator<Node,::boost::mpl::true_>(node);
+ }
+
+ template <typename Node>
+ inline depth_first_iterator<Node,::boost::mpl::true_>
+ make_depth_first_reverse_iterator_end(Node* ptr)
+ {
+ return depth_first_iterator<Node,::boost::mpl::true_>(ptr);
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ITERATOR_DEPTH_FIRST_HPP
+

Added: sandbox/tree_node/boost/tree_node/iterator/depth_first_descendant.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/iterator/depth_first_descendant.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,660 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ITERATOR_DEPTH_FIRST_DESCENDANT_HPP
+#define BOOST_TREE_NODE_ITERATOR_DEPTH_FIRST_DESCENDANT_HPP
+
+#include <boost/config.hpp>
+
+#if !defined BOOST_NO_CXX11_NULLPTR
+#include <cstddef>
+#endif
+
+#include <iterator>
+#include <deque>
+#include <boost/assert.hpp>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/utility/value_init.hpp>
+
+#if !defined BOOST_NO_SFINAE
+#include <boost/utility/enable_if.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/equal_to.hpp>
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/iterator/iterator_categories.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/tree_node/traversal_state.hpp>
+#include <boost/tree_node/iterator/dereference.hpp>
+#include <boost/detail/metafunction/container_pointer.hpp>
+#include <boost/detail/metafunction/container_iterator.hpp>
+#include <boost/detail/metafunction/container_reverse_iterator.hpp>
+
+//[reference__depth_first_descendant_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename IsReverse = ::boost::mpl::false_>
+ class depth_first_descendant_iterator
+ : public ::boost::iterator_adaptor<
+ depth_first_descendant_iterator<Node,IsReverse>
+//<-
+#if 0
+//->
+ , typename ::boost::mpl::eval_if<
+ IsReverse
+ , ::boost::mpl::if_<
+ ::std::tr1::is_const<Node>
+ , typename Node::const_reverse_iterator
+ , typename Node::reverse_iterator
+ >
+ , ::boost::mpl::if_<
+ ::std::tr1::is_const<Node>
+ , typename Node::const_iterator
+ , typename Node::iterator
+ >
+ >::type
+ //<-
+#endif
+ , typename ::boost::mpl::eval_if<
+ IsReverse
+ , ::boost::detail::metafunction::container_reverse_iterator<Node>
+ , ::boost::detail::metafunction::container_iterator<Node>
+ >::type
+ //->
+ , ::boost::use_default
+ , typename ::boost::mpl::if_<
+ // Node [const] has bidirectional iterators
+ //<-
+ ::boost::detail::metafunction::is_bidirectional_iterator<
+ typename ::std::tr1::remove_const<Node>::type::iterator
+ >
+ //->
+ , ::boost::bidirectional_traversal_tag
+ , ::boost::forward_traversal_tag
+ >::type
+ >
+ {
+ //<-
+ typedef typename ::boost::mpl::eval_if<
+ IsReverse
+ , ::boost::detail::metafunction::container_reverse_iterator<
+ Node
+ >
+ , ::boost::detail::metafunction::container_iterator<Node>
+ >::type
+ child_iterator;
+ typedef ::boost::iterator_adaptor<
+ depth_first_descendant_iterator<Node,IsReverse>
+ , child_iterator
+ , ::boost::use_default
+ , typename ::boost::mpl::if_<
+ ::boost::detail::metafunction
+ ::is_bidirectional_iterator<
+ typename ::std::tr1::remove_const<
+ Node
+ >::type::iterator
+ >
+ , ::boost::bidirectional_traversal_tag
+ , ::boost::forward_traversal_tag
+ >::type
+ >
+ super_t;
+
+#if !defined BOOST_NO_SFINAE
+ //->
+ struct enabler
+ {
+ };
+ //<-
+#endif
+
+ public: // Should be private, but conversion ctor won't work.
+ ::std::deque<
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+ > _node_stack;
+ ::std::deque<child_iterator> _itr_stack;
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type _node_ptr;
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type _root_ptr;
+ ::boost::tree_node::traversal_state _state;
+ //->
+
+ public:
+//<-
+#if 0
+//->
+ explicit depth_first_descendant_iterator(
+ Node* const& node_ptr = nullptr
+ );
+//<-
+#endif
+ explicit depth_first_descendant_iterator(
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type const& node_ptr = ::boost::initialized_value
+ );
+//->
+
+ explicit depth_first_descendant_iterator(Node& node);
+
+ template <typename N, typename I>
+ depth_first_descendant_iterator(
+ depth_first_descendant_iterator<N,I> const& other
+//<-
+#if !defined BOOST_NO_SFINAE
+//->
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type = enabler()
+//<-
+#endif
+//->
+ );
+
+ operator ::boost::tree_node::traversal_state() const;
+
+ //<-
+#if !BOOST_WORKAROUND(__GNUC__, == 2)
+ private:
+ friend class ::boost::iterator_core_access;
+#endif
+
+ void increment();
+
+ void decrement();
+
+ template <typename N, typename I>
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if<
+ ::boost::mpl::equal_to<I,IsReverse>
+ , bool
+ >::type
+#endif
+ equal(depth_first_descendant_iterator<N,I> const& other) const;
+
+ private:
+ child_iterator _begin(::boost::mpl::false_);
+
+ child_iterator _begin(::boost::mpl::true_);
+
+ child_iterator _end(::boost::mpl::false_);
+
+ child_iterator _end(::boost::mpl::true_);
+ //->
+ };
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_depth_first_descendant_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ depth_first_descendant_iterator<Node>
+ make_depth_first_descendant_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_depth_first_descendant_iterator_end
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ depth_first_descendant_iterator<Node>
+ make_depth_first_descendant_iterator_end(Node* ptr);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_depth_first_descendant_reverse_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ depth_first_descendant_iterator<Node,::boost::mpl::true_>
+ make_depth_first_descendant_reverse_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_depth_first_descendant_reverse_iterator_end
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ depth_first_descendant_iterator<Node,::boost::mpl::true_>
+ make_depth_first_descendant_reverse_iterator_end(Node* ptr);
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename IsReverse>
+ depth_first_descendant_iterator<
+ Node
+ , IsReverse
+ >::depth_first_descendant_iterator(
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type const& node_ptr
+ ) : super_t()
+ , _node_stack()
+ , _itr_stack()
+ , _node_ptr(
+#if defined BOOST_NO_CXX11_NULLPTR
+ 0
+#else
+ nullptr
+#endif
+ )
+ , _root_ptr(node_ptr)
+ , _state(::boost::tree_node::no_traversal)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ depth_first_descendant_iterator<
+ Node
+ , IsReverse
+ >::depth_first_descendant_iterator(Node& node)
+ : super_t()
+ , _node_stack()
+ , _itr_stack()
+ , _node_ptr(&node)
+ , _root_ptr(&node)
+ , _state(::boost::tree_node::pre_order_traversal)
+ {
+ this->_itr_stack.push_back(this->_begin(IsReverse()));
+ this->increment();
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ depth_first_descendant_iterator<
+ Node
+ , IsReverse
+ >::depth_first_descendant_iterator(
+ depth_first_descendant_iterator<N,I> const& other
+#if !defined BOOST_NO_SFINAE
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type
+#endif
+ ) : super_t(other.base())
+ , _node_stack(other._node_stack.begin(), other._node_stack.end())
+ , _itr_stack(other._itr_stack.begin(), other._itr_stack.end())
+ , _node_ptr(other._node_ptr)
+ , _root_ptr(other._root_ptr)
+ , _state(other._state)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ inline depth_first_descendant_iterator<Node,IsReverse>::operator
+ ::boost::tree_node::traversal_state() const
+ {
+ return this->_state;
+ }
+
+ template <typename Node, typename IsReverse>
+ void depth_first_descendant_iterator<Node,IsReverse>::increment()
+ {
+ switch (this->_state)
+ {
+ case ::boost::tree_node::pre_order_traversal:
+ {
+ child_iterator& itr = this->_itr_stack.back();
+
+ if (itr == this->_end(IsReverse()))
+ {
+ if (this->_node_stack.empty())
+ {
+ // Root has no descendants.
+ this->_state = ::boost::tree_node::no_traversal;
+ this->_node_ptr = ::boost::initialized_value;
+ this->_itr_stack.clear();
+ }
+ else
+ {
+ // No children: change state.
+ this->_state = ::boost::tree_node::post_order_traversal;
+ }
+ }
+ else
+ {
+ // Go deeper.
+ this->_node_stack.push_back(this->_node_ptr);
+ this->_node_ptr = &dereference_iterator(
+ this->base_reference() = itr
+ );
+ this->_itr_stack.push_back(this->_begin(IsReverse()));
+ }
+
+ break;
+ }
+
+ case ::boost::tree_node::post_order_traversal:
+ {
+ if (this->_node_stack.empty())
+ {
+ // Pass the end.
+ this->_state = ::boost::tree_node::no_traversal;
+ this->_node_ptr = ::boost::initialized_value;
+ this->_itr_stack.clear();
+ }
+ else
+ {
+ this->_itr_stack.pop_back();
+ this->_node_ptr = this->_node_stack.back();
+ this->_node_stack.pop_back();
+
+ if (++this->base_reference() == this->_end(IsReverse()))
+ {
+ if (this->_node_stack.empty())
+ {
+ // Pass the end.
+ this->_state = ::boost::tree_node::no_traversal;
+ this->_node_ptr = ::boost::initialized_value;
+ this->_itr_stack.clear();
+ }
+ else
+ {
+ // No next sibling: traverse the parent.
+ child_iterator itr = this->_itr_stack.back();
+
+ this->_itr_stack.pop_back();
+
+ if (!this->_itr_stack.empty())
+ {
+ this->base_reference() = (
+ this->_itr_stack.back()
+ );
+ }
+
+ this->_itr_stack.push_back(itr);
+ }
+ }
+ else
+ {
+ // Traverse the sibling.
+ this->_itr_stack.pop_back();
+ this->_node_stack.push_back(this->_node_ptr);
+ this->_itr_stack.push_back(this->base());
+ this->_node_ptr = &dereference_iterator(this->base());
+ this->_state = ::boost::tree_node::pre_order_traversal;
+ this->_itr_stack.push_back(this->_begin(IsReverse()));
+ }
+ }
+
+ break;
+ }
+
+ default:
+ {
+ BOOST_ASSERT_MSG(false, "Do not increment past-the-end!");
+ }
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ void depth_first_descendant_iterator<Node,IsReverse>::decrement()
+ {
+ switch (this->_state)
+ {
+ case ::boost::tree_node::pre_order_traversal:
+ {
+ if (this->_node_stack.empty())
+ {
+ // Pass the end.
+ this->_state = ::boost::tree_node::no_traversal;
+ this->_node_ptr = ::boost::initialized_value;
+ this->_itr_stack.clear();
+ }
+ else
+ {
+ this->_itr_stack.pop_back();
+ this->_node_ptr = this->_node_stack.back();
+ this->_node_stack.pop_back();
+
+ if (this->base() == this->_begin(IsReverse()))
+ {
+ if (this->_node_stack.empty())
+ {
+ // Pass the end.
+ this->_state = ::boost::tree_node::no_traversal;
+ this->_node_ptr = ::boost::initialized_value;
+ this->_itr_stack.clear();
+ }
+ else
+ {
+ // No next sibling: traverse the parent.
+ child_iterator itr = this->_itr_stack.back();
+
+ this->_itr_stack.pop_back();
+
+ if (!this->_itr_stack.empty())
+ {
+ this->base_reference() = (
+ this->_itr_stack.back()
+ );
+ }
+
+ this->_itr_stack.push_back(itr);
+ }
+ }
+ else
+ {
+ // Traverse the sibling.
+ --this->base_reference();
+ this->_itr_stack.pop_back();
+ this->_node_stack.push_back(this->_node_ptr);
+ this->_itr_stack.push_back(this->base());
+ this->_node_ptr = &dereference_iterator(this->base());
+ this->_state = ::boost::tree_node::post_order_traversal;
+
+ // Add last child position, if any, to total position.
+ child_iterator last_itr = this->_begin(IsReverse());
+
+ if (last_itr != this->_end(IsReverse()))
+ {
+ ::std::advance(
+ last_itr
+ , this->_node_ptr->size() - 1
+ );
+ }
+
+ this->_itr_stack.push_back(last_itr);
+ }
+ }
+
+ break;
+ }
+
+ case ::boost::tree_node::post_order_traversal:
+ {
+ child_iterator& itr = this->_itr_stack.back();
+
+ if (itr == this->_end(IsReverse()))
+ {
+ // No children: change state.
+ this->_state = ::boost::tree_node::pre_order_traversal;
+ }
+ else
+ {
+ // Go deeper.
+ this->_node_stack.push_back(this->_node_ptr);
+ this->_node_ptr = &dereference_iterator(
+ this->base_reference() = itr
+ );
+
+ // Add last child position, if any, to total position.
+ child_iterator last_itr = this->_begin(IsReverse());
+
+ if (last_itr != this->_end(IsReverse()))
+ {
+ ::std::advance(last_itr, this->_node_ptr->size() - 1);
+ }
+
+ this->_itr_stack.push_back(last_itr);
+ }
+
+ break;
+ }
+
+ default:
+ {
+ BOOST_ASSERT_MSG(
+ this->_root_ptr
+ , "Do not decrement past-the-end of NULL!"
+ );
+ BOOST_ASSERT_MSG(
+ !this->_root_ptr->empty()
+ , "There are no descendants to traverse!"
+ );
+ this->_node_ptr = this->_root_ptr;
+ this->_state = ::boost::tree_node::post_order_traversal;
+
+ child_iterator last_itr = this->_begin(IsReverse());
+
+ if (last_itr != this->_end(IsReverse()))
+ {
+ ::std::advance(last_itr, this->_node_ptr->size() - 1);
+ }
+
+ this->_itr_stack.push_back(this->base_reference() = last_itr);
+ this->_node_stack.push_back(this->_node_ptr);
+ this->_node_ptr = &dereference_iterator(this->base());
+ last_itr = this->_begin(IsReverse());
+
+ if (last_itr != this->_end(IsReverse()))
+ {
+ ::std::advance(last_itr, this->_node_ptr->size() - 1);
+ }
+
+ this->_itr_stack.push_back(last_itr);
+ break;
+ }
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ inline
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if<
+ ::boost::mpl::equal_to<I,IsReverse>
+ , bool
+ >::type
+#endif
+ depth_first_descendant_iterator<Node,IsReverse>::equal(
+ depth_first_descendant_iterator<N,I> const& other
+ ) const
+ {
+ if (this->_state == other._state)
+ {
+ return this->_state ? (
+ this->base() == other.base()
+ ) : !other._state;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ inline typename depth_first_descendant_iterator<
+ Node
+ , IsReverse
+ >::child_iterator
+ depth_first_descendant_iterator<Node,IsReverse>::_begin(
+ ::boost::mpl::false_
+ )
+ {
+ return this->_node_ptr->begin();
+ }
+
+ template <typename Node, typename IsReverse>
+ inline typename depth_first_descendant_iterator<
+ Node
+ , IsReverse
+ >::child_iterator
+ depth_first_descendant_iterator<Node,IsReverse>::_begin(
+ ::boost::mpl::true_
+ )
+ {
+ return this->_node_ptr->rbegin();
+ }
+
+ template <typename Node, typename IsReverse>
+ inline typename depth_first_descendant_iterator<
+ Node
+ , IsReverse
+ >::child_iterator
+ depth_first_descendant_iterator<Node,IsReverse>::_end(
+ ::boost::mpl::false_
+ )
+ {
+ return this->_node_ptr->end();
+ }
+
+ template <typename Node, typename IsReverse>
+ inline typename depth_first_descendant_iterator<
+ Node
+ , IsReverse
+ >::child_iterator
+ depth_first_descendant_iterator<Node,IsReverse>::_end(
+ ::boost::mpl::true_
+ )
+ {
+ return this->_node_ptr->rend();
+ }
+
+ template <typename Node>
+ inline depth_first_descendant_iterator<Node>
+ make_depth_first_descendant_iterator(Node& node)
+ {
+ return depth_first_descendant_iterator<Node>(node);
+ }
+
+ template <typename Node>
+ inline depth_first_descendant_iterator<Node>
+ make_depth_first_descendant_iterator_end(Node* ptr)
+ {
+ return depth_first_descendant_iterator<Node>(ptr);
+ }
+
+ template <typename Node>
+ inline depth_first_descendant_iterator<Node,::boost::mpl::true_>
+ make_depth_first_descendant_reverse_iterator(Node& node)
+ {
+ return depth_first_descendant_iterator<Node,::boost::mpl::true_>(node);
+ }
+
+ template <typename Node>
+ inline depth_first_descendant_iterator<Node,::boost::mpl::true_>
+ make_depth_first_descendant_reverse_iterator_end(Node* ptr)
+ {
+ return depth_first_descendant_iterator<Node,::boost::mpl::true_>(ptr);
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ITERATOR_DEPTH_FIRST_DESCENDANT_HPP
+

Added: sandbox/tree_node/boost/tree_node/iterator/dereference.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/iterator/dereference.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,126 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ITERATOR_DEREFERENCE_HPP
+#define BOOST_TREE_NODE_ITERATOR_DEREFERENCE_HPP
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/iterator/iterator_traits.hpp>
+#include <boost/utility/get_iterator_second.hpp>
+#include <boost/detail/metafunction/has_first_type.hpp>
+#include <boost/detail/metafunction/has_second_type.hpp>
+
+namespace boost { namespace tree_node { namespace _detail {
+
+ template <typename Iterator>
+ class deref_iterator_helper
+ {
+ typedef typename ::boost::iterator_value<Iterator>::type
+ _value_type;
+ typedef typename ::boost::mpl::and_<
+ typename ::boost::detail::metafunction::has_first_type<
+ _value_type
+ >::type
+ , typename ::boost::detail::metafunction::has_second_type<
+ _value_type
+ >::type
+ >::type
+ _is_associative;
+
+ public:
+ typedef Iterator
+ argument_type;
+ typedef typename ::boost::mpl::eval_if<
+ _is_associative
+ , ::boost::get_iterator_second_result<Iterator>
+ , ::boost::iterator_reference<Iterator>
+ >::type
+ result_type;
+
+ result_type operator()(argument_type itr) const;
+
+ private:
+ static result_type _evaluate(Iterator itr, ::boost::mpl::true_);
+
+ static result_type _evaluate(Iterator itr, ::boost::mpl::false_);
+ };
+
+ template <typename Iterator>
+ inline typename deref_iterator_helper<Iterator>::result_type
+ deref_iterator_helper<Iterator>::operator()(
+ argument_type itr
+ ) const
+ {
+ return this->_evaluate(itr, _is_associative());
+ }
+
+ template <typename Iterator>
+ inline typename deref_iterator_helper<Iterator>::result_type
+ deref_iterator_helper<Iterator>::_evaluate(
+ Iterator itr
+ , ::boost::mpl::true_
+ )
+ {
+ return ::boost::get_iterator_second(itr);
+ }
+
+ template <typename Iterator>
+ inline typename deref_iterator_helper<Iterator>::result_type
+ deref_iterator_helper<Iterator>::_evaluate(
+ Iterator itr
+ , ::boost::mpl::false_
+ )
+ {
+ return *itr;
+ }
+}}} // namespace boost::tree_node::_detail
+
+//[reference__tree_node__result_of__dereference_iterator
+namespace boost { namespace tree_node { namespace result_of {
+
+ template <typename Iterator>
+ struct dereference_iterator
+ {
+//<-
+#if 0
+//->
+ typedef unspecified type;
+//<-
+#endif
+ typedef typename ::boost::tree_node::_detail::deref_iterator_helper<
+ Iterator
+ >::result_type
+ type;
+
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,dereference_iterator,(Iterator))
+//->
+ };
+}}} // namespace boost::tree_node::result_of
+//]
+
+//[reference__tree_node__dereference_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Iterator>
+ typename result_of::dereference_iterator<Iterator>::type
+ dereference_iterator(Iterator itr);
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Iterator>
+ inline typename result_of::dereference_iterator<Iterator>::type
+ dereference_iterator(Iterator itr)
+ {
+ return _detail::deref_iterator_helper<Iterator>()(itr);
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ITERATOR_DEREFERENCE_HPP
+

Added: sandbox/tree_node/boost/tree_node/iterator/in_order.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/iterator/in_order.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,635 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ITERATOR_IN_ORDER_HPP
+#define BOOST_TREE_NODE_ITERATOR_IN_ORDER_HPP
+
+#include <boost/config.hpp>
+
+#if !defined BOOST_NO_CXX11_NULLPTR
+#include <cstddef>
+#endif
+
+#include <iterator>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/utility/value_init.hpp>
+
+#if !defined BOOST_NO_SFINAE
+#include <boost/utility/enable_if.hpp>
+#include <boost/mpl/equal_to.hpp>
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/iterator/iterator_categories.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/detail/metafunction/container_pointer.hpp>
+#include <boost/tree_node/traversal_state.hpp>
+#include <boost/tree_node/key/count.hpp>
+#include <boost/tree_node/intrinsic/has_key.hpp>
+#include <boost/tree_node/algorithm/advance_binary.hpp>
+#include <boost/tree_node/algorithm/binary_index_of.hpp>
+#include <boost/assert.hpp>
+
+//[reference__in_order_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename IsReverse = ::boost::mpl::false_>
+ class in_order_iterator
+ : public ::boost::iterator_adaptor<
+ in_order_iterator<Node,IsReverse>
+//<-
+#if 0
+//->
+ , Node*
+ //<-
+#endif
+ , typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+ //->
+ , ::boost::use_default
+ , typename ::boost::mpl::if_<
+ result_of::has_key<
+ typename ::std::tr1::remove_const<Node>::type
+ , count_key
+ >
+ //<-
+ // TODO: Replace with indexable_traversal_tag
+ //->
+ , ::boost::random_access_traversal_tag
+ , ::boost::bidirectional_traversal_tag
+ >::type
+ >
+ {
+ //<-
+ typedef ::boost::iterator_adaptor<
+ in_order_iterator<Node,IsReverse>
+ , typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+ , ::boost::use_default
+ , typename ::boost::mpl::if_<
+ result_of::has_key<
+ typename ::std::tr1::remove_const<Node>::type
+ , count_key
+ >
+ // TODO: Replace with indexable_traversal_tag
+ , ::boost::random_access_traversal_tag
+ , ::boost::bidirectional_traversal_tag
+ >::type
+ >
+ super_t;
+
+#if !defined BOOST_NO_SFINAE
+ //->
+ struct enabler
+ {
+ };
+ //<-
+#endif
+
+ public: // Should be private, but conversion ctor won't work.
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type _root_ptr;
+ ::boost::tree_node::traversal_state _state;
+ //->
+
+ public:
+//<-
+#if 0
+//->
+ explicit in_order_iterator(Node* const& node_ptr = nullptr);
+//<-
+#endif
+ explicit in_order_iterator(
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type const& node_ptr = ::boost::initialized_value
+ );
+//->
+
+ explicit in_order_iterator(Node& node, bool is_not_position = true);
+
+ template <typename N, typename I>
+ in_order_iterator(
+ in_order_iterator<N,I> const& other
+//<-
+#if !defined BOOST_NO_SFINAE
+//->
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type = enabler()
+//<-
+#endif
+//->
+ );
+
+ operator ::boost::tree_node::traversal_state() const;
+
+ //<-
+#if !BOOST_WORKAROUND(__GNUC__, == 2)
+ private:
+ friend class ::boost::iterator_core_access;
+#endif
+
+ void increment();
+
+ void decrement();
+
+ void advance(typename super_t::difference_type n);
+
+ template <typename N, typename I>
+#if defined BOOST_NO_SFINAE
+ typename super_t::difference_type
+#else
+ typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , typename super_t::difference_type
+ >::type
+#endif
+ distance_to(in_order_iterator<N,I> const& other) const;
+
+ template <typename N, typename I>
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if<
+ ::boost::mpl::equal_to<I,IsReverse>
+ , bool
+ >::type
+#endif
+ equal(in_order_iterator<N,I> const& other) const;
+
+ private:
+ void _increment(::boost::mpl::false_);
+
+ void _increment(::boost::mpl::true_);
+
+ void _initialize(::boost::mpl::false_);
+
+ void _initialize(::boost::mpl::true_);
+ //->
+ };
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_in_order_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ in_order_iterator<Node> make_in_order_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_in_order_iterator_end
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ in_order_iterator<Node> make_in_order_iterator_end(Node* node_ptr);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_in_order_reverse_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ in_order_iterator<Node,::boost::mpl::true_>
+ make_in_order_reverse_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_in_order_reverse_iterator_end
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ in_order_iterator<Node,::boost::mpl::true_>
+ make_in_order_reverse_iterator_end(Node* node_ptr);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_in_order_iterator_position
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ in_order_iterator<Node> make_in_order_iterator_position(Node& node);
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename IsReverse>
+ in_order_iterator<Node,IsReverse>::in_order_iterator(
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type const& node_ptr
+ ) : super_t(
+#if defined BOOST_NO_CXX11_NULLPTR
+ 0
+#else
+ nullptr
+#endif
+ )
+ , _root_ptr(node_ptr)
+ , _state(::boost::tree_node::no_traversal)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ in_order_iterator<Node,IsReverse>::in_order_iterator(
+ Node& node
+ , bool is_not_position
+ ) : super_t(&node)
+ , _root_ptr(&node)
+ , _state(::boost::tree_node::in_order_traversal)
+ {
+ if (is_not_position)
+ {
+ this->_initialize(IsReverse());
+ }
+ else
+ {
+ while (this->_root_ptr->get_parent_ptr())
+ {
+ this->_root_ptr = this->_root_ptr->get_parent_ptr();
+ }
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ in_order_iterator<Node,IsReverse>::in_order_iterator(
+ in_order_iterator<N,I> const& other
+#if !defined BOOST_NO_SFINAE
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type
+#endif
+ ) : super_t(other.base())
+ , _root_ptr(other._root_ptr)
+ , _state(other._state)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ inline in_order_iterator<Node,IsReverse>::operator
+ ::boost::tree_node::traversal_state() const
+ {
+ return this->_state;
+ }
+
+ template <typename Node, typename IsReverse>
+ void in_order_iterator<Node,IsReverse>::_initialize(::boost::mpl::false_)
+ {
+ while (this->base()->get_left_child_ptr())
+ {
+ this->base_reference() = this->base()->get_left_child_ptr();
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ void in_order_iterator<Node,IsReverse>::_initialize(::boost::mpl::true_)
+ {
+ while (this->base()->get_right_child_ptr())
+ {
+ this->base_reference() = this->base()->get_right_child_ptr();
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ void in_order_iterator<Node,IsReverse>::_increment(::boost::mpl::false_ tag)
+ {
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type node_ptr = this->base();
+
+ if (node_ptr)
+ {
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type other_ptr = node_ptr->get_right_child_ptr();
+
+ if (other_ptr)
+ {
+ while (other_ptr->get_left_child_ptr())
+ {
+ other_ptr = other_ptr->get_left_child_ptr();
+ }
+
+ this->base_reference() = other_ptr;
+ return;
+ }
+
+ other_ptr = this->_root_ptr->get_parent_ptr();
+
+ for (
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type next_ptr = node_ptr->get_parent_ptr();
+ next_ptr != other_ptr;
+ next_ptr = next_ptr->get_parent_ptr()
+ )
+ {
+ if (node_ptr == next_ptr->get_left_child_ptr())
+ {
+ this->base_reference() = next_ptr;
+ return;
+ }
+
+ node_ptr = next_ptr;
+ }
+
+ this->base_reference() = ::boost::initialized_value;
+ this->_state = ::boost::tree_node::no_traversal;
+ }
+ else
+ {
+ BOOST_ASSERT_MSG(
+ this->_root_ptr
+ , "Do not decrement past-the-end of NULL!"
+ );
+ this->base_reference() = this->_root_ptr;
+ this->_state = ::boost::tree_node::in_order_traversal;
+ this->_initialize(tag);
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ void in_order_iterator<Node,IsReverse>::_increment(::boost::mpl::true_ tag)
+ {
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type node_ptr = this->base();
+
+ if (node_ptr)
+ {
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type other_ptr = node_ptr->get_left_child_ptr();
+
+ if (other_ptr)
+ {
+ while (other_ptr->get_right_child_ptr())
+ {
+ other_ptr = other_ptr->get_right_child_ptr();
+ }
+
+ this->base_reference() = other_ptr;
+ return;
+ }
+
+ other_ptr = this->_root_ptr->get_parent_ptr();
+
+ for (
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type next_ptr = node_ptr->get_parent_ptr();
+ next_ptr != other_ptr;
+ next_ptr = next_ptr->get_parent_ptr()
+ )
+ {
+ if (node_ptr == next_ptr->get_right_child_ptr())
+ {
+ this->base_reference() = next_ptr;
+ return;
+ }
+
+ node_ptr = next_ptr;
+ }
+
+ this->base_reference() = ::boost::initialized_value;
+ this->_state = ::boost::tree_node::no_traversal;
+ }
+ else
+ {
+ BOOST_ASSERT_MSG(
+ this->_root_ptr
+ , "Do not decrement past-the-end of NULL!"
+ );
+ this->base_reference() = this->_root_ptr;
+ this->_state = ::boost::tree_node::in_order_traversal;
+ this->_initialize(tag);
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ inline void in_order_iterator<Node,IsReverse>::increment()
+ {
+ BOOST_ASSERT_MSG(this->_state, "Do not increment past-the-end!");
+ this->_increment(IsReverse());
+ }
+
+ template <typename Node, typename IsReverse>
+ inline void in_order_iterator<Node,IsReverse>::decrement()
+ {
+ this->_increment(::boost::mpl::not_<IsReverse>());
+ }
+
+ template <typename Node, typename IsReverse>
+ inline void
+ in_order_iterator<Node,IsReverse>::advance(
+ typename super_t::difference_type n
+ )
+ {
+ if (!n)
+ {
+ return;
+ }
+
+ static typename super_t::difference_type const z = (
+ ::boost::initialized_value
+ );
+
+ if (n < z)
+ {
+ if (this->_state)
+ {
+ BOOST_ASSERT_MSG(
+ IsReverse::value ? !(
+ get(*this->_root_ptr, count_key()) < binary_index_of(
+ this->base()
+ , -n
+ , this->_root_ptr
+ )
+ ) : !(
+ binary_index_of(this->base(), n, this->_root_ptr) < z
+ )
+ , "Index out of bounds."
+ );
+ }
+ else
+ {
+ this->decrement();
+
+ if (!++n)
+ {
+ return;
+ }
+ }
+ }
+
+ if (
+ !(
+ this->base_reference() = advance_binary(
+ this->base()
+ , IsReverse::value ? -n : n
+ , this->_root_ptr
+ )
+ )
+ )
+ {
+ this->_state = ::boost::tree_node::no_traversal;
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ inline
+#if defined BOOST_NO_SFINAE
+ typename in_order_iterator<Node,IsReverse>::super_t::difference_type
+#else
+ typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , typename in_order_iterator<
+ Node
+ , IsReverse
+ >::super_t::difference_type
+ >::type
+#endif
+ in_order_iterator<Node,IsReverse>::distance_to(
+ in_order_iterator<N,I> const& other
+ ) const
+ {
+ BOOST_ASSERT_MSG(
+ this->_root_ptr == other._root_ptr
+ , "Iterators are unreachable from each other."
+ );
+
+ typename super_t::difference_type v = ::boost::initialized_value;
+
+ if (this->_state)
+ {
+ if (other._state)
+ {
+ return IsReverse::value ? (
+ binary_index_of(this->base(), v, this->_root_ptr)
+ - binary_index_of(other.base(), v, other._root_ptr)
+ ) : (
+ binary_index_of(other.base(), v, other._root_ptr)
+ - binary_index_of(this->base(), v, this->_root_ptr)
+ );
+ }
+ else if (IsReverse::value)
+ {
+ v = binary_index_of(this->base(), v, this->_root_ptr);
+ return ++v;
+ }
+ else
+ {
+ v = -binary_index_of(this->base(), v, this->_root_ptr);
+ return (v += get(*this->_root_ptr, count_key()));
+ }
+ }
+ else if (other._state)
+ {
+ if (IsReverse::value)
+ {
+ v = -binary_index_of(other.base(), v, other._root_ptr);
+ return --v;
+ }
+ else
+ {
+ v = binary_index_of(other.base(), v, other._root_ptr);
+ return (v -= get(*other._root_ptr, count_key()));
+ }
+ }
+ else
+ {
+ return v;
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ inline
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if<
+ ::boost::mpl::equal_to<I,IsReverse>
+ , bool
+ >::type
+#endif
+ in_order_iterator<Node,IsReverse>::equal(
+ in_order_iterator<N,I> const& other
+ ) const
+ {
+ if (this->_state == other._state)
+ {
+ return this->_state ? (
+ this->base() == other.base()
+ ) : !other._state;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ template <typename Node>
+ inline in_order_iterator<Node> make_in_order_iterator(Node& node)
+ {
+ return in_order_iterator<Node>(node);
+ }
+
+ template <typename Node>
+ inline in_order_iterator<Node> make_in_order_iterator_end(Node* node_ptr)
+ {
+ return in_order_iterator<Node>(node_ptr);
+ }
+
+ template <typename Node>
+ inline in_order_iterator<Node,::boost::mpl::true_>
+ make_in_order_reverse_iterator(Node& node)
+ {
+ return in_order_iterator<Node,::boost::mpl::true_>(node);
+ }
+
+ template <typename Node>
+ inline in_order_iterator<Node,::boost::mpl::true_>
+ make_in_order_reverse_iterator_end(Node* node_ptr)
+ {
+ return in_order_iterator<Node,::boost::mpl::true_>(node_ptr);
+ }
+
+ template <typename Node>
+ inline in_order_iterator<Node> make_in_order_iterator_position(Node& node)
+ {
+ return in_order_iterator<Node>(node, false);
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ITERATOR_IN_ORDER_HPP
+

Added: sandbox/tree_node/boost/tree_node/iterator/post_order.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/iterator/post_order.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,363 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ITERATOR_POST_ORDER_HPP
+#define BOOST_TREE_NODE_ITERATOR_POST_ORDER_HPP
+
+#include <deque>
+#include <boost/config.hpp>
+
+#if !defined BOOST_NO_SFINAE
+#include <boost/utility/enable_if.hpp>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/equal_to.hpp>
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/iterator/iterator_categories.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/tree_node/traversal_state.hpp>
+#include <boost/tree_node/iterator/dereference.hpp>
+#include <boost/detail/metafunction/container_pointer.hpp>
+#include <boost/detail/metafunction/container_iterator.hpp>
+#include <boost/detail/metafunction/container_reverse_iterator.hpp>
+
+//[reference__post_order_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename IsReverse = ::boost::mpl::false_>
+ class post_order_iterator
+ : public ::boost::iterator_adaptor<
+ post_order_iterator<Node,IsReverse>
+//<-
+#if 0
+//->
+ , Node*
+ //<-
+#endif
+ , typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+ //->
+ , ::boost::use_default
+ , ::boost::forward_traversal_tag
+ >
+ {
+ //<-
+ typedef ::boost::iterator_adaptor<
+ post_order_iterator<Node,IsReverse>
+ , typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+ , ::boost::use_default
+ , ::boost::forward_traversal_tag
+ >
+ super_t;
+
+#if !defined BOOST_NO_SFINAE
+ //->
+ struct enabler
+ {
+ };
+ //<-
+#endif
+
+ public: // Should be private, but conversion ctor won't work.
+ ::std::deque<
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+ > _stack;
+ ::boost::tree_node::traversal_state _state;
+ //->
+
+ public:
+ post_order_iterator();
+
+ explicit post_order_iterator(Node& node);
+
+ template <typename N, typename I>
+ post_order_iterator(
+ post_order_iterator<N,I> const& other
+//<-
+#if !defined BOOST_NO_SFINAE
+//->
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type = enabler()
+//<-
+#endif
+//->
+ );
+
+ operator ::boost::tree_node::traversal_state() const;
+
+ //<-
+#if !BOOST_WORKAROUND(__GNUC__, == 2)
+ private:
+ friend class ::boost::iterator_core_access;
+#endif
+
+ void increment();
+
+ template <typename N, typename I>
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if<
+ ::boost::mpl::equal_to<I,IsReverse>
+ , bool
+ >::type
+#endif
+ equal(post_order_iterator<N,I> const& other) const;
+
+ private:
+ void _init(::boost::mpl::false_);
+
+ void _init(::boost::mpl::true_);
+ //->
+ };
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_post_order_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ post_order_iterator<Node> make_post_order_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_pre_order_reverse_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ post_order_iterator<Node,::boost::mpl::true_>
+ make_pre_order_reverse_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename IsReverse>
+ post_order_iterator<Node,IsReverse>::post_order_iterator()
+ : super_t(), _stack(), _state(::boost::tree_node::no_traversal)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ post_order_iterator<Node,IsReverse>::post_order_iterator(Node& node)
+ : super_t(&node)
+ , _stack()
+ , _state(::boost::tree_node::post_order_traversal)
+ {
+ this->_init(IsReverse());
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ post_order_iterator<Node,IsReverse>::post_order_iterator(
+ post_order_iterator<N,I> const& other
+#if !defined BOOST_NO_SFINAE
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type
+#endif
+ ) : super_t(other.base())
+ , _stack(other._stack.begin(), other._stack.end())
+ , _state(other._state)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ inline post_order_iterator<Node,IsReverse>::operator
+ ::boost::tree_node::traversal_state() const
+ {
+ return this->_state;
+ }
+
+ template <typename Node, typename IsReverse>
+ inline void post_order_iterator<Node,IsReverse>::increment()
+ {
+ if (this->_stack.empty())
+ {
+ this->_state = ::boost::tree_node::no_traversal;
+ }
+ else
+ {
+ this->base_reference() = this->_stack.back();
+ this->_stack.pop_back();
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ inline
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if<
+ ::boost::mpl::equal_to<I,IsReverse>
+ , bool
+ >::type
+#endif
+ post_order_iterator<Node,IsReverse>::equal(
+ post_order_iterator<N,I> const& other
+ ) const
+ {
+ if (this->_state == other._state)
+ {
+ return this->_state ? (
+ this->base() == other.base()
+ ) : !other._state;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ void post_order_iterator<Node,IsReverse>::_init(::boost::mpl::false_)
+ {
+ typedef typename ::boost::detail::metafunction::container_iterator<
+ Node
+ >::type
+ child_iterator;
+
+ child_iterator itr = this->base()->begin();
+ child_iterator itr_end = this->base()->end();
+
+ if (itr != itr_end)
+ {
+ this->_stack.push_back(this->base());
+
+ for (::std::deque<child_iterator> pre_order_stack;;)
+ {
+ while (itr != itr_end)
+ {
+ pre_order_stack.push_back(itr);
+ ++itr;
+ }
+
+ this->_stack.push_back(
+ &dereference_iterator(pre_order_stack.back())
+ );
+ pre_order_stack.pop_back();
+
+ if (pre_order_stack.empty())
+ {
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type node_ptr = (
+ this->base_reference() = this->_stack.back()
+ );
+
+ itr = node_ptr->begin();
+ itr_end = node_ptr->end();
+
+ if (itr == itr_end)
+ {
+ this->_stack.pop_back();
+ break;
+ }
+ }
+ else
+ {
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type node_ptr = this->_stack.back();
+
+ itr = node_ptr->begin();
+ itr_end = node_ptr->end();
+ }
+ }
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ void post_order_iterator<Node,IsReverse>::_init(::boost::mpl::true_)
+ {
+ typedef typename ::boost::detail::metafunction
+ ::container_reverse_iterator<Node>::type
+ child_iterator;
+
+ child_iterator itr = this->base()->rbegin();
+ child_iterator itr_end = this->base()->rend();
+
+ if (itr != itr_end)
+ {
+ this->_stack.push_back(this->base());
+
+ for (::std::deque<child_iterator> pre_order_stack;;)
+ {
+ while (itr != itr_end)
+ {
+ pre_order_stack.push_back(itr);
+ ++itr;
+ }
+
+ this->_stack.push_back(
+ &dereference_iterator(pre_order_stack.back())
+ );
+ pre_order_stack.pop_back();
+
+ if (pre_order_stack.empty())
+ {
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type node_ptr = (
+ this->base_reference() = this->_stack.back()
+ );
+
+ itr = node_ptr->rbegin();
+ itr_end = node_ptr->rend();
+
+ if (itr == itr_end)
+ {
+ this->_stack.pop_back();
+ break;
+ }
+ }
+ else
+ {
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type node_ptr = this->_stack.back();
+
+ itr = node_ptr->rbegin();
+ itr_end = node_ptr->rend();
+ }
+ }
+ }
+ }
+
+ template <typename Node>
+ inline post_order_iterator<Node> make_post_order_iterator(Node& node)
+ {
+ return post_order_iterator<Node>(node);
+ }
+
+ template <typename Node>
+ inline post_order_iterator<Node,::boost::mpl::true_>
+ make_pre_order_reverse_iterator(Node& node)
+ {
+ return post_order_iterator<Node,::boost::mpl::true_>(node);
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ITERATOR_POST_ORDER_HPP
+

Added: sandbox/tree_node/boost/tree_node/iterator/post_order_descendant.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/iterator/post_order_descendant.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,376 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ITERATOR_POST_ORDER_DESCENDANT_HPP
+#define BOOST_TREE_NODE_ITERATOR_POST_ORDER_DESCENDANT_HPP
+
+#include <deque>
+#include <boost/config.hpp>
+
+#if !defined BOOST_NO_SFINAE
+#include <boost/utility/enable_if.hpp>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/equal_to.hpp>
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/iterator/iterator_categories.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/tree_node/traversal_state.hpp>
+#include <boost/tree_node/iterator/dereference.hpp>
+#include <boost/detail/metafunction/container_iterator.hpp>
+#include <boost/detail/metafunction/container_reverse_iterator.hpp>
+
+//[reference__post_order_descendant_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename IsReverse = ::boost::mpl::false_>
+ class post_order_descendant_iterator
+ : public ::boost::iterator_adaptor<
+ post_order_descendant_iterator<Node,IsReverse>
+//<-
+#if 0
+//->
+ , typename ::boost::mpl::eval_if<
+ IsReverse
+ , ::boost::mpl::if_<
+ ::std::tr1::is_const<Node>
+ , typename Node::const_reverse_iterator
+ , typename Node::reverse_iterator
+ >
+ , ::boost::mpl::if_<
+ ::std::tr1::is_const<Node>
+ , typename Node::const_iterator
+ , typename Node::iterator
+ >
+ >::type
+ //<-
+#endif
+ , typename ::boost::mpl::eval_if<
+ IsReverse
+ , ::boost::detail::metafunction::container_reverse_iterator<Node>
+ , ::boost::detail::metafunction::container_iterator<Node>
+ >::type
+ //->
+ , ::boost::use_default
+ , ::boost::forward_traversal_tag
+ >
+ {
+ //<-
+ typedef typename ::boost::mpl::eval_if<
+ IsReverse
+ , ::boost::detail::metafunction::container_reverse_iterator<
+ Node
+ >
+ , ::boost::detail::metafunction::container_iterator<Node>
+ >::type
+ child_iterator;
+ typedef ::boost::iterator_adaptor<
+ post_order_descendant_iterator<Node,IsReverse>
+ , child_iterator
+ , ::boost::use_default
+ , ::boost::forward_traversal_tag
+ >
+ super_t;
+
+#if !defined BOOST_NO_SFINAE
+ //->
+ struct enabler
+ {
+ };
+ //<-
+#endif
+
+ public: // Should be private, but conversion ctor won't work.
+ ::std::deque<child_iterator> _stack;
+ ::boost::tree_node::traversal_state _state;
+ //->
+
+ public:
+ post_order_descendant_iterator();
+
+ explicit post_order_descendant_iterator(Node& node);
+
+ template <typename N, typename I>
+ post_order_descendant_iterator(
+ post_order_descendant_iterator<N,I> const& other
+//<-
+#if !defined BOOST_NO_SFINAE
+//->
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type = enabler()
+//<-
+#endif
+//->
+ );
+
+ operator ::boost::tree_node::traversal_state() const;
+
+ //<-
+#if !BOOST_WORKAROUND(__GNUC__, == 2)
+ private:
+ friend class ::boost::iterator_core_access;
+#endif
+
+ void increment();
+
+ template <typename N, typename I>
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if<
+ ::boost::mpl::equal_to<I,IsReverse>
+ , bool
+ >::type
+#endif
+ equal(post_order_descendant_iterator<N,I> const& other) const;
+
+ private:
+ void _initialize(Node& node, ::boost::mpl::false_);
+
+ void _initialize(Node& node, ::boost::mpl::true_);
+ //->
+ };
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_post_order_descendant_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ post_order_descendant_iterator<Node>
+ make_post_order_descendant_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_pre_order_descendant_reverse_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ post_order_descendant_iterator<Node,::boost::mpl::true_>
+ make_pre_order_descendant_reverse_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename IsReverse>
+ post_order_descendant_iterator<
+ Node
+ , IsReverse
+ >::post_order_descendant_iterator()
+ : super_t(), _stack(), _state(::boost::tree_node::no_traversal)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ post_order_descendant_iterator<
+ Node
+ , IsReverse
+ >::post_order_descendant_iterator(Node& node)
+ : super_t(), _stack(), _state(::boost::tree_node::post_order_traversal)
+ {
+ this->_initialize(node, IsReverse());
+
+ if (this->_stack.empty())
+ {
+ this->_state = ::boost::tree_node::no_traversal;
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ post_order_descendant_iterator<
+ Node
+ , IsReverse
+ >::post_order_descendant_iterator(
+ post_order_descendant_iterator<N,I> const& other
+#if !defined BOOST_NO_SFINAE
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type
+#endif
+ ) : super_t(other.base())
+ , _stack(other._stack.begin(), other._stack.end())
+ , _state(other._state)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ inline post_order_descendant_iterator<Node,IsReverse>::operator
+ ::boost::tree_node::traversal_state() const
+ {
+ return this->_state;
+ }
+
+ template <typename Node, typename IsReverse>
+ inline void post_order_descendant_iterator<Node,IsReverse>::increment()
+ {
+ if (this->_stack.empty())
+ {
+ this->_state = ::boost::tree_node::no_traversal;
+ }
+ else
+ {
+ this->base_reference() = this->_stack.back();
+ this->_stack.pop_back();
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ inline
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if<
+ ::boost::mpl::equal_to<I,IsReverse>
+ , bool
+ >::type
+#endif
+ post_order_descendant_iterator<Node,IsReverse>::equal(
+ post_order_descendant_iterator<N,I> const& other
+ ) const
+ {
+ if (this->_state == other._state)
+ {
+ return this->_state ? (
+ this->base() == other.base()
+ ) : !other._state;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ void
+ post_order_descendant_iterator<Node,IsReverse>::_initialize(
+ Node& node
+ , ::boost::mpl::false_
+ )
+ {
+ child_iterator itr = node.begin();
+ child_iterator itr_end = node.end();
+
+ if (itr != itr_end)
+ {
+ for (::std::deque<child_iterator> pre_order_stack;;)
+ {
+ while (itr != itr_end)
+ {
+ pre_order_stack.push_back(itr);
+ ++itr;
+ }
+
+ this->_stack.push_back(pre_order_stack.back());
+ pre_order_stack.pop_back();
+
+ if (pre_order_stack.empty())
+ {
+ Node& n = dereference_iterator(
+ this->base_reference() = this->_stack.back()
+ );
+
+ itr = n.begin();
+ itr_end = n.end();
+
+ if (itr == itr_end)
+ {
+ this->_stack.pop_back();
+ break;
+ }
+ }
+ else
+ {
+ Node& n = dereference_iterator(this->_stack.back());
+
+ itr = n.begin();
+ itr_end = n.end();
+ }
+ }
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ void
+ post_order_descendant_iterator<Node,IsReverse>::_initialize(
+ Node& node
+ , ::boost::mpl::true_
+ )
+ {
+ child_iterator itr = node.rbegin();
+ child_iterator itr_end = node.rend();
+
+ if (itr != itr_end)
+ {
+ for (::std::deque<child_iterator> pre_order_stack;;)
+ {
+ while (itr != itr_end)
+ {
+ pre_order_stack.push_back(itr);
+ ++itr;
+ }
+
+ this->_stack.push_back(pre_order_stack.back());
+ pre_order_stack.pop_back();
+
+ if (pre_order_stack.empty())
+ {
+ Node& n = dereference_iterator(
+ this->base_reference() = this->_stack.back()
+ );
+
+ itr = n.rbegin();
+ itr_end = n.rend();
+
+ if (itr == itr_end)
+ {
+ this->_stack.pop_back();
+ break;
+ }
+ }
+ else
+ {
+ Node& n = dereference_iterator(this->_stack.back());
+
+ itr = n.rbegin();
+ itr_end = n.rend();
+ }
+ }
+ }
+ }
+
+ template <typename Node>
+ inline post_order_descendant_iterator<Node>
+ make_post_order_descendant_iterator(Node& node)
+ {
+ return post_order_descendant_iterator<Node>(node);
+ }
+
+ template <typename Node>
+ inline post_order_descendant_iterator<Node,::boost::mpl::true_>
+ make_pre_order_descendant_reverse_iterator(Node& node)
+ {
+ return post_order_descendant_iterator<Node,::boost::mpl::true_>(node);
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ITERATOR_POST_ORDER_DESCENDANT_HPP
+

Added: sandbox/tree_node/boost/tree_node/iterator/pre_order.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/iterator/pre_order.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,340 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ITERATOR_PRE_ORDER_HPP
+#define BOOST_TREE_NODE_ITERATOR_PRE_ORDER_HPP
+
+#include <deque>
+#include <boost/config.hpp>
+
+#if !defined BOOST_NO_SFINAE
+#include <boost/utility/enable_if.hpp>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/equal_to.hpp>
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/iterator/iterator_categories.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/tree_node/traversal_state.hpp>
+#include <boost/tree_node/iterator/dereference.hpp>
+#include <boost/detail/metafunction/container_pointer.hpp>
+#include <boost/detail/metafunction/container_iterator.hpp>
+#include <boost/detail/metafunction/container_reverse_iterator.hpp>
+
+//[reference__pre_order_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename IsReverse = ::boost::mpl::false_>
+ class pre_order_iterator
+ : public ::boost::iterator_adaptor<
+ pre_order_iterator<Node,IsReverse>
+//<-
+#if 0
+//->
+ , Node*
+ //<-
+#endif
+ , typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+ //->
+ , ::boost::use_default
+ , ::boost::forward_traversal_tag
+ >
+ {
+ //<-
+ typedef typename ::boost::mpl::eval_if<
+ IsReverse
+ , ::boost::detail::metafunction::container_reverse_iterator<
+ Node
+ >
+ , ::boost::detail::metafunction::container_iterator<Node>
+ >::type
+ child_iterator;
+ typedef ::boost::iterator_adaptor<
+ pre_order_iterator<Node,IsReverse>
+ , typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+ , ::boost::use_default
+ , ::boost::forward_traversal_tag
+ >
+ super_t;
+
+#if !defined BOOST_NO_SFINAE
+ //->
+ struct enabler
+ {
+ };
+ //<-
+#endif
+
+ public: // Should be private, but conversion ctor won't work.
+ ::std::deque<
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+ > _node_stack;
+ ::std::deque<child_iterator> _itr_stack;
+ child_iterator _current_itr;
+ ::boost::tree_node::traversal_state _state;
+ //->
+
+ public:
+ pre_order_iterator();
+
+ explicit pre_order_iterator(Node& node);
+
+ template <typename N, typename I>
+ pre_order_iterator(
+ pre_order_iterator<N,I> const& other
+//<-
+#if !defined BOOST_NO_SFINAE
+//->
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type = enabler()
+//<-
+#endif
+//->
+ );
+
+ operator ::boost::tree_node::traversal_state() const;
+
+ //<-
+#if !BOOST_WORKAROUND(__GNUC__, == 2)
+ private:
+ friend class ::boost::iterator_core_access;
+#endif
+
+ void increment();
+
+ template <typename N, typename I>
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if<
+ ::boost::mpl::equal_to<I,IsReverse>
+ , bool
+ >::type
+#endif
+ equal(pre_order_iterator<N,I> const& other) const;
+
+ private:
+ void _push(::boost::mpl::false_);
+
+ void _push(::boost::mpl::true_);
+
+ child_iterator _end(::boost::mpl::false_);
+
+ child_iterator _end(::boost::mpl::true_);
+ //->
+ };
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_pre_order_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ pre_order_iterator<Node> make_pre_order_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_post_order_reverse_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ pre_order_iterator<Node,::boost::mpl::true_>
+ make_post_order_reverse_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename IsReverse>
+ pre_order_iterator<Node,IsReverse>::pre_order_iterator()
+ : super_t()
+ , _node_stack()
+ , _itr_stack()
+ , _current_itr()
+ , _state(::boost::tree_node::no_traversal)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ pre_order_iterator<Node,IsReverse>::pre_order_iterator(Node& node)
+ : super_t(&node)
+ , _node_stack()
+ , _itr_stack()
+ , _current_itr()
+ , _state(::boost::tree_node::pre_order_traversal)
+ {
+ this->_push(IsReverse());
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ pre_order_iterator<Node,IsReverse>::pre_order_iterator(
+ pre_order_iterator<N,I> const& other
+#if !defined BOOST_NO_SFINAE
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type
+#endif
+ ) : super_t(other.base())
+ , _node_stack(other._node_stack.begin(), other._node_stack.end())
+ , _itr_stack(other._itr_stack.begin(), other._itr_stack.end())
+ , _current_itr(other._current_itr)
+ , _state(other._state)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ inline pre_order_iterator<Node,IsReverse>::operator
+ ::boost::tree_node::traversal_state() const
+ {
+ return this->_state;
+ }
+
+ template <typename Node, typename IsReverse>
+ void pre_order_iterator<Node,IsReverse>::increment()
+ {
+ if (this->_itr_stack.back() == this->_end(IsReverse()))
+ {
+ bool is_post_order = true;
+
+ while (is_post_order)
+ {
+ this->_itr_stack.pop_back();
+
+ if (this->_node_stack.empty())
+ {
+ this->_state = ::boost::tree_node::no_traversal;
+ this->_itr_stack.clear();
+ is_post_order = false;
+ }
+ else
+ {
+ this->base_reference() = this->_node_stack.back();
+ this->_node_stack.pop_back();
+
+ if (++this->_current_itr == this->_end(IsReverse()))
+ {
+ child_iterator itr = this->_itr_stack.back();
+
+ this->_itr_stack.pop_back();
+
+ if (!this->_itr_stack.empty())
+ {
+ this->_current_itr = this->_itr_stack.back();
+ }
+
+ this->_itr_stack.push_back(itr);
+ }
+ else
+ {
+ this->_itr_stack.pop_back();
+ this->_node_stack.push_back(this->base());
+ this->_itr_stack.push_back(this->_current_itr);
+ this->base_reference() = &(
+ dereference_iterator(this->_current_itr)
+ );
+ this->_push(IsReverse());
+ is_post_order = false;
+ }
+ }
+ }
+ }
+ else
+ {
+ this->_node_stack.push_back(this->base());
+ this->base_reference() = &dereference_iterator(
+ this->_current_itr = this->_itr_stack.back()
+ );
+ this->_push(IsReverse());
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ inline
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if<
+ ::boost::mpl::equal_to<I,IsReverse>
+ , bool
+ >::type
+#endif
+ pre_order_iterator<Node,IsReverse>::equal(
+ pre_order_iterator<N,I> const& other
+ ) const
+ {
+ if (this->_state == other._state)
+ {
+ return this->_state ? (*(*this) == *(*other)) : !other._state;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ inline void pre_order_iterator<Node,IsReverse>::_push(::boost::mpl::false_)
+ {
+ this->_itr_stack.push_back(this->base()->begin());
+ }
+
+ template <typename Node, typename IsReverse>
+ inline void pre_order_iterator<Node,IsReverse>::_push(::boost::mpl::true_)
+ {
+ this->_itr_stack.push_back(this->base()->rbegin());
+ }
+
+ template <typename Node, typename IsReverse>
+ inline typename pre_order_iterator<Node,IsReverse>::child_iterator
+ pre_order_iterator<Node,IsReverse>::_end(::boost::mpl::false_)
+ {
+ return this->base()->end();
+ }
+
+ template <typename Node, typename IsReverse>
+ inline typename pre_order_iterator<Node,IsReverse>::child_iterator
+ pre_order_iterator<Node,IsReverse>::_end(::boost::mpl::true_)
+ {
+ return this->base()->rend();
+ }
+
+ template <typename Node>
+ inline pre_order_iterator<Node> make_pre_order_iterator(Node& node)
+ {
+ return pre_order_iterator<Node>(node);
+ }
+
+ template <typename Node>
+ inline pre_order_iterator<Node,::boost::mpl::true_>
+ make_post_order_reverse_iterator(Node& node)
+ {
+ return pre_order_iterator<Node,::boost::mpl::true_>(node);
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ITERATOR_PRE_ORDER_HPP
+

Added: sandbox/tree_node/boost/tree_node/iterator/pre_order_descendant.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/iterator/pre_order_descendant.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,382 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_ITERATOR_PRE_ORDER_DESCENDANT_HPP
+#define BOOST_TREE_NODE_ITERATOR_PRE_ORDER_DESCENDANT_HPP
+
+#include <deque>
+#include <boost/config.hpp>
+
+#if !defined BOOST_NO_SFINAE
+#include <boost/utility/enable_if.hpp>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/equal_to.hpp>
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/iterator/iterator_categories.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/tree_node/traversal_state.hpp>
+#include <boost/tree_node/iterator/dereference.hpp>
+#include <boost/detail/metafunction/container_pointer.hpp>
+#include <boost/detail/metafunction/container_iterator.hpp>
+#include <boost/detail/metafunction/container_reverse_iterator.hpp>
+
+//[reference__pre_order_descendant_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename IsReverse = ::boost::mpl::false_>
+ class pre_order_descendant_iterator
+ : public ::boost::iterator_adaptor<
+ pre_order_descendant_iterator<Node,IsReverse>
+//<-
+#if 0
+//->
+ , typename ::boost::mpl::eval_if<
+ IsReverse
+ , ::boost::mpl::if_<
+ ::std::tr1::is_const<Node>
+ , typename Node::const_reverse_iterator
+ , typename Node::reverse_iterator
+ >
+ , ::boost::mpl::if_<
+ ::std::tr1::is_const<Node>
+ , typename Node::const_iterator
+ , typename Node::iterator
+ >
+ >::type
+ //<-
+#endif
+ , typename ::boost::mpl::eval_if<
+ IsReverse
+ , ::boost::detail::metafunction::container_reverse_iterator<Node>
+ , ::boost::detail::metafunction::container_iterator<Node>
+ >::type
+ //->
+ , ::boost::use_default
+ , ::boost::forward_traversal_tag
+ >
+ {
+ //<-
+ typedef typename ::boost::mpl::eval_if<
+ IsReverse
+ , ::boost::detail::metafunction::container_reverse_iterator<
+ Node
+ >
+ , ::boost::detail::metafunction::container_iterator<Node>
+ >::type
+ child_iterator;
+ typedef ::boost::iterator_adaptor<
+ pre_order_descendant_iterator<Node,IsReverse>
+ , child_iterator
+ , ::boost::use_default
+ , ::boost::forward_traversal_tag
+ >
+ super_t;
+
+#if !defined BOOST_NO_SFINAE
+ //->
+ struct enabler
+ {
+ };
+ //<-
+#endif
+
+ public: // Should be private, but conversion ctor won't work.
+ ::std::deque<
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type
+ > _node_stack;
+ ::std::deque<child_iterator> _itr_stack;
+ typename ::boost::detail::metafunction::container_pointer<
+ Node
+ >::type _current_node;
+ ::boost::tree_node::traversal_state _state;
+ //->
+
+ public:
+ pre_order_descendant_iterator();
+
+ explicit pre_order_descendant_iterator(Node& node);
+
+ template <typename N, typename I>
+ pre_order_descendant_iterator(
+ pre_order_descendant_iterator<N,I> const& other
+//<-
+#if !defined BOOST_NO_SFINAE
+//->
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type = enabler()
+//<-
+#endif
+//->
+ );
+
+ operator ::boost::tree_node::traversal_state() const;
+
+ //<-
+#if !BOOST_WORKAROUND(__GNUC__, == 2)
+ private:
+ friend class ::boost::iterator_core_access;
+#endif
+
+ void increment();
+
+ template <typename N, typename I>
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if<
+ ::boost::mpl::equal_to<I,IsReverse>
+ , bool
+ >::type
+#endif
+ equal(pre_order_descendant_iterator<N,I> const& other) const;
+
+ private:
+ void _push(::boost::mpl::false_);
+
+ void _push(::boost::mpl::true_);
+
+ child_iterator _end(::boost::mpl::false_);
+
+ child_iterator _end(::boost::mpl::true_);
+ //->
+ };
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_pre_order_descendant_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ pre_order_descendant_iterator<Node>
+ make_pre_order_descendant_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+//[reference__make_post_order_descendant_reverse_iterator
+namespace boost { namespace tree_node {
+
+ template <typename Node>
+ pre_order_descendant_iterator<Node,::boost::mpl::true_>
+ make_post_order_descendant_reverse_iterator(Node& node);
+}} // namespace boost::tree_node
+//]
+
+namespace boost { namespace tree_node {
+
+ template <typename Node, typename IsReverse>
+ pre_order_descendant_iterator<
+ Node
+ , IsReverse
+ >::pre_order_descendant_iterator()
+ : super_t()
+ , _node_stack()
+ , _itr_stack()
+ , _current_node()
+ , _state(::boost::tree_node::no_traversal)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ pre_order_descendant_iterator<
+ Node
+ , IsReverse
+ >::pre_order_descendant_iterator(Node& node)
+ : super_t()
+ , _node_stack()
+ , _itr_stack()
+ , _current_node(&node)
+ , _state(::boost::tree_node::pre_order_traversal)
+ {
+ this->_push(IsReverse());
+ this->increment();
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ pre_order_descendant_iterator<
+ Node
+ , IsReverse
+ >::pre_order_descendant_iterator(
+ pre_order_descendant_iterator<N,I> const& other
+#if !defined BOOST_NO_SFINAE
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_convertible<N,Node>
+ , ::boost::mpl::equal_to<I,IsReverse>
+ , ::boost::mpl::false_
+ >::type
+ , enabler
+ >::type
+#endif
+ ) : super_t(other.base())
+ , _node_stack(other._node_stack.begin(), other._node_stack.end())
+ , _itr_stack(other._itr_stack.begin(), other._itr_stack.end())
+ , _current_node(other._current_node)
+ , _state(other._state)
+ {
+ }
+
+ template <typename Node, typename IsReverse>
+ inline pre_order_descendant_iterator<Node,IsReverse>::operator
+ ::boost::tree_node::traversal_state() const
+ {
+ return this->_state;
+ }
+
+ template <typename Node, typename IsReverse>
+ void pre_order_descendant_iterator<Node,IsReverse>::increment()
+ {
+ if (this->_itr_stack.back() == this->_end(IsReverse()))
+ {
+ bool is_post_order = true;
+
+ while (is_post_order)
+ {
+ this->_itr_stack.pop_back();
+
+ if (this->_node_stack.empty())
+ {
+ this->_state = ::boost::tree_node::no_traversal;
+ this->_itr_stack.clear();
+ is_post_order = false;
+ }
+ else
+ {
+ this->_current_node = this->_node_stack.back();
+ this->_node_stack.pop_back();
+
+ if (++this->base_reference() == this->_end(IsReverse()))
+ {
+ child_iterator itr = this->_itr_stack.back();
+
+ this->_itr_stack.pop_back();
+
+ if (!this->_itr_stack.empty())
+ {
+ this->base_reference() = this->_itr_stack.back();
+ }
+
+ this->_itr_stack.push_back(itr);
+ }
+ else
+ {
+ this->_itr_stack.pop_back();
+ this->_node_stack.push_back(this->_current_node);
+ this->_itr_stack.push_back(this->base());
+ this->_current_node = &(
+ dereference_iterator(this->base())
+ );
+ this->_push(IsReverse());
+ is_post_order = false;
+ }
+ }
+ }
+ }
+ else
+ {
+ this->_node_stack.push_back(this->_current_node);
+ this->_current_node = &dereference_iterator(
+ this->base_reference() = this->_itr_stack.back()
+ );
+ this->_push(IsReverse());
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ template <typename N, typename I>
+ inline
+#if defined BOOST_NO_SFINAE
+ bool
+#else
+ typename ::boost::enable_if<
+ ::boost::mpl::equal_to<I,IsReverse>
+ , bool
+ >::type
+#endif
+ pre_order_descendant_iterator<Node,IsReverse>::equal(
+ pre_order_descendant_iterator<N,I> const& other
+ ) const
+ {
+ if (this->_state == other._state)
+ {
+ return this->_state ? (*(*this) == *(*other)) : !other._state;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ template <typename Node, typename IsReverse>
+ inline void
+ pre_order_descendant_iterator<Node,IsReverse>::_push(
+ ::boost::mpl::false_
+ )
+ {
+ this->_itr_stack.push_back(this->_current_node->begin());
+ }
+
+ template <typename Node, typename IsReverse>
+ inline void
+ pre_order_descendant_iterator<Node,IsReverse>::_push(
+ ::boost::mpl::true_
+ )
+ {
+ this->_itr_stack.push_back(this->_current_node->rbegin());
+ }
+
+ template <typename Node, typename IsReverse>
+ inline typename pre_order_descendant_iterator<
+ Node
+ , IsReverse
+ >::child_iterator
+ pre_order_descendant_iterator<Node,IsReverse>::_end(
+ ::boost::mpl::false_
+ )
+ {
+ return this->_current_node->end();
+ }
+
+ template <typename Node, typename IsReverse>
+ inline typename pre_order_descendant_iterator<
+ Node
+ , IsReverse
+ >::child_iterator
+ pre_order_descendant_iterator<Node,IsReverse>::_end(
+ ::boost::mpl::true_
+ )
+ {
+ return this->_current_node->rend();
+ }
+
+ template <typename Node>
+ inline pre_order_descendant_iterator<Node>
+ make_pre_order_descendant_iterator(Node& node)
+ {
+ return pre_order_descendant_iterator<Node>(node);
+ }
+
+ template <typename Node>
+ inline pre_order_descendant_iterator<Node,::boost::mpl::true_>
+ make_post_order_descendant_reverse_iterator(Node& node)
+ {
+ return pre_order_descendant_iterator<Node,::boost::mpl::true_>(node);
+ }
+}} // namespace boost::tree_node
+
+#endif // BOOST_TREE_NODE_ITERATOR_PRE_ORDER_DESCENDANT_HPP
+

Added: sandbox/tree_node/boost/tree_node/key/accumulation.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/key/accumulation.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,53 @@
+// Copyright (C) 2012-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_KEY_ACCUMULATION_HPP
+#define BOOST_TREE_NODE_KEY_ACCUMULATION_HPP
+
+#include <boost/config.hpp>
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#error boost::tree_node::with_accumulation uses Boost.Accumulators,
+#error which requires working partial template specialization.
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/accumulators/statistics/sum.hpp>
+#include <boost/tree_node/key/data.hpp>
+
+//[reference__accumulation_key
+namespace boost { namespace tree_node {
+
+ //<-
+ struct accumulation_key_base
+ {
+ };
+ //->
+
+ template <
+ typename Key = data_key
+ , typename Tag = ::boost::accumulators::tag::sum
+ , typename IncludesAllDescendants = ::boost::mpl::true_
+ , typename IncludesRoot = ::boost::mpl::true_
+ , typename Value = void
+ >
+ struct accumulation_key
+ //<-
+ : accumulation_key_base
+ //->
+ {
+ typedef Key key;
+ typedef Tag tag;
+ typedef IncludesAllDescendants includes_all_descendants;
+ typedef IncludesRoot includes_root;
+ typedef Value value;
+ };
+
+ typedef accumulation_key<> default_accumulation_key;
+}} // namespace boost::tree_node
+//]
+
+#endif // BOOST_TREE_NODE_KEY_ACCUMULATION_HPP
+

Added: sandbox/tree_node/boost/tree_node/key/count.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/key/count.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,19 @@
+// Copyright (C) 2012-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_KEY_COUNT_HPP
+#define BOOST_TREE_NODE_KEY_COUNT_HPP
+
+//[reference__count_key
+namespace boost { namespace tree_node {
+
+ struct count_key
+ {
+ };
+}} // namespace boost::tree_node
+//]
+
+#endif // BOOST_TREE_NODE_KEY_COUNT_HPP
+

Added: sandbox/tree_node/boost/tree_node/key/data.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/key/data.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,19 @@
+// Copyright (C) 2012-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_KEY_DATA_HPP
+#define BOOST_TREE_NODE_KEY_DATA_HPP
+
+//[reference__data_key
+namespace boost { namespace tree_node {
+
+ struct data_key
+ {
+ };
+}} // namespace boost::tree_node
+//]
+
+#endif // BOOST_TREE_NODE_KEY_DATA_HPP
+

Added: sandbox/tree_node/boost/tree_node/key/height.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/key/height.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,19 @@
+// Copyright (C) 2012-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_KEY_HEIGHT_HPP
+#define BOOST_TREE_NODE_KEY_HEIGHT_HPP
+
+//[reference__height_key
+namespace boost { namespace tree_node {
+
+ struct height_key
+ {
+ };
+}} // namespace boost::tree_node
+//]
+
+#endif // BOOST_TREE_NODE_KEY_HEIGHT_HPP
+

Added: sandbox/tree_node/boost/tree_node/key/position.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/key/position.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,19 @@
+// Copyright (C) 2012-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_KEY_POSITION_HPP
+#define BOOST_TREE_NODE_KEY_POSITION_HPP
+
+//[reference__position_key
+namespace boost { namespace tree_node {
+
+ struct position_key
+ {
+ };
+}} // namespace boost::tree_node
+//]
+
+#endif // BOOST_TREE_NODE_KEY_POSITION_HPP
+

Added: sandbox/tree_node/boost/tree_node/key/red_black_flag.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/key/red_black_flag.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,23 @@
+// Copyright (C) 2012-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_KEY_RED_BLACK_FLAG_HPP
+#define BOOST_TREE_NODE_KEY_RED_BLACK_FLAG_HPP
+
+//[reference__red_black_flag_key
+namespace boost { namespace tree_node {
+
+ struct red_flag_key
+ {
+ };
+
+ struct black_flag_key
+ {
+ };
+}} // namespace boost::tree_node
+//]
+
+#endif // BOOST_TREE_NODE_KEY_RED_BLACK_FLAG_HPP
+

Added: sandbox/tree_node/boost/tree_node/nary_node.hpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/tree_node/boost/tree_node/nary_node.hpp 2013-07-06 13:58:15 EDT (Sat, 06 Jul 2013) (r84958)
@@ -0,0 +1,2542 @@
+// Copyright (C) 2011-2013 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TREE_NODE_NARY_NODE_HPP_INCLUDED
+#define BOOST_TREE_NODE_NARY_NODE_HPP_INCLUDED
+
+#include <boost/config.hpp>
+
+#if !defined BOOST_NO_CXX11_NULLPTR
+#include <cstddef>
+#endif
+
+#include <utility>
+#include <deque>
+#include <algorithm>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/utility/value_init.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/range.hpp>
+#include <boost/container_gen/container_gen.hpp>
+#include <boost/container_gen/emplace_function_gen.hpp>
+#include <boost/container_gen/splice_function_gen.hpp>
+#include <boost/container_gen/insert_range_result_gen.hpp>
+#include <boost/container_gen/is_recursive_selector.hpp>
+#include <boost/container_gen/is_reversible_selector.hpp>
+#include <boost/container_gen/is_random_access_selector.hpp>
+#include <boost/container_gen/is_ptr_selector.hpp>
+#include <boost/container_gen/has_stable_iters_selector.hpp>
+#include <boost/tree_node/preprocessor.hpp>
+#include <boost/tree_node/base.hpp>
+#include <boost/tree_node/nary_node_fwd.hpp>
+#include <boost/tree_node/intrinsic/has_key.hpp>
+#include <boost/tree_node/intrinsic/get_keys.hpp>
+#include <boost/tree_node/iterator/depth_first_descendant.hpp>
+#include <boost/tree_node/iterator/post_order.hpp>
+#include <boost/detail/metafunction/container_reverse_iterator.hpp>
+#include <boost/assert.hpp>
+
+#include <boost/tree_node/_detail/config_begin.hpp>
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <boost/container_gen/insert_range_function_gen.hpp>
+#else
+#include <boost/type_traits/is_pod.hpp>
+#include <boost/move/move.hpp>
+#include <boost/container_gen/selectors.hpp>
+
+namespace boost {
+
+ template <typename Derived, typename T, typename Selector>
+ struct is_POD<
+ ::boost::tree_node::nary_node_base<Derived,T,Selector>
+ > : ::boost::false_type
+ {
+ };
+
+ template <typename Derived, typename T, typename Selector>
+ struct is_pod<
+ ::boost::tree_node::nary_node_base<Derived,T,Selector>
+ > : ::boost::false_type
+ {
+ };
+} // namespace boost
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/transform_view.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/iterator/key_of.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/support/category_of.hpp>
+
+namespace boost { namespace tree_node { namespace result_of {
+
+ template <
+ typename Derived
+ , typename T
+ , typename Selector
+ , typename FusionKey
+ >
+ struct has_key_impl<nary_node_base<Derived,T,Selector>,FusionKey>
+ : ::boost::mpl::eval_if<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::has_key<T,FusionKey>
+ , ::std::tr1::is_same<FusionKey,data_key>
+ >::type
+ {
+ };
+
+ template <typename Derived, typename T, typename Selector>
+ struct get_keys_impl<nary_node_base<Derived,T,Selector> >
+ : ::boost::mpl::eval_if<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::transform_view<
+ T
+ , ::boost::fusion::result_of::key_of< ::boost::mpl::_>
+ >
+ , ::boost::mpl::vector1<data_key>
+ >
+ {
+ };
+}}} // namespace boost::tree_node::result_of
+#endif // defined BOOST_TREE_NODE_CAN_USE_FUSION
+
+namespace boost { namespace tree_node {
+
+ template <typename Derived, typename T, typename Selector>
+ class nary_node_base
+ : public
+ //[reference__nary_node_base__bases
+ tree_node_base<Derived>
+ //]
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ , public data_key
+#endif
+ , private ::boost::noncopyable
+ {
+ BOOST_MPL_ASSERT((::boost::is_recursive_selector<Selector>));
+
+ typedef nary_node_base<Derived,T,Selector> self;
+
+ //[reference__nary_node_base__children
+ typedef typename ::boost::container_gen<Selector,Derived>::type
+ children;
+ //]
+
+ public:
+ //[reference__nary_node_base__super_t
+ typedef tree_node_base<Derived> super_t;
+ //]
+
+ //[reference__nary_node_base__traits
+ struct traits
+ {
+ typedef T data_type;
+ typedef typename children::allocator_type allocator;
+ typedef allocator const& allocator_reference;
+ };
+ //]
+
+ //[reference__nary_node_base__pointer
+ typedef typename super_t::pointer pointer;
+ //]
+
+ //[reference__nary_node_base__const_pointer
+ typedef typename super_t::const_pointer const_pointer;
+ //]
+
+ //[reference__nary_node_base__iterator
+ typedef typename children::iterator iterator;
+ //]
+
+ //[reference__nary_node_base__const_iterator
+ typedef typename children::const_iterator const_iterator;
+ //]
+
+ typedef typename ::boost::detail::metafunction
+ ::container_reverse_iterator<children>::type
+ reverse_iterator;
+ typedef typename ::boost::detail::metafunction
+ ::container_reverse_iterator<children const>::type
+ const_reverse_iterator;
+
+ //[reference__nary_node_base__size_type
+ typedef typename children::size_type size_type;
+ //]
+
+ private:
+ children _children;
+ typename traits::data_type _data;
+ pointer _parent;
+
+ protected:
+ //[reference__nary_node_base__derived_copy_ctor
+ nary_node_base(Derived const& copy);
+ //]
+
+ //[reference__nary_node_base__derived_copy_ctor_w_allocator
+ nary_node_base(
+ Derived const& copy
+ , typename traits::allocator_reference allocator
+ );
+ //]
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ BOOST_PP_FOR(
+ ((0), nary_node_base)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED_WITH_DATA
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC_WITH_DATA
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_FWD_DECL
+ )
+
+ BOOST_PP_FOR(
+ ((0), nary_node_base)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED_WITH_DATA
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC_WITH_DATA
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_W_ALLOC_FWD_DECL
+ )
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ nary_node_base(BOOST_RV_REF(Derived) source);
+
+ nary_node_base(
+ BOOST_RV_REF(Derived) source
+ , typename traits::allocator_reference allocator
+ );
+
+#if defined BOOST_CONTAINER_PERFECT_FORWARDING
+ //[reference__nary_node_base__emplacement_ctor
+ template <typename ...Args>
+ explicit nary_node_base(Args&& ...args);
+ //]
+
+ //[reference__nary_node_base__emplacement_ctor_w_allocator
+ template <typename ...Args>
+ explicit nary_node_base(
+ ::boost::container::allocator_arg_t
+ , typename traits::allocator_reference allocator
+ , Args&& ...args
+ );
+ //]
+#else // !defined BOOST_CONTAINER_PERFECT_FORWARDING
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_FWD_DECL
+ , nary_node_base
+ )
+
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_CTOR_W_ALLOC_FWD_DECL
+ , nary_node_base
+ )
+#endif // BOOST_CONTAINER_PERFECT_FORWARDING
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ ~nary_node_base();
+
+ //[reference__nary_node_base__clone_descendants
+ void clone_descendants(Derived const& copy);
+ //]
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ //[reference__nary_node_base__copy_assign
+ void copy_assign(Derived const& copy);
+ //]
+#else
+ void move_descendants(BOOST_RV_REF(Derived) source);
+
+ void copy_assign(BOOST_COPY_ASSIGN_REF(Derived) copy);
+
+ void move_assign(BOOST_RV_REF(Derived) source);
+#endif
+
+ //[reference__nary_node_base__on_post_assign
+ void on_post_assign();
+ //]
+
+ public:
+ //[reference__nary_node_base__data_key_value_operator__const
+ typename traits::data_type const& operator[](data_key const&) const;
+ //]
+
+ //[reference__nary_node_base__data_key_value_operator
+ typename traits::data_type& operator[](data_key const&);
+ //]
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+ //[reference__nary_node_base__key_value_operator__const
+ template <typename FusionKey>
+ typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ nary_node_base<Derived,T,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T const,FusionKey>
+ >::type
+ operator[](FusionKey const&) const;
+ //]
+
+ //[reference__nary_node_base__key_value_operator
+ template <typename FusionKey>
+ typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ nary_node_base<Derived,T,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T,FusionKey>
+ >::type
+ operator[](FusionKey const&);
+ //]
+#endif // defined BOOST_TREE_NODE_CAN_USE_FUSION
+
+ //[reference__nary_node_base__get_parent_ptr__const
+ const_pointer get_parent_ptr() const;
+ //]
+
+ //[reference__nary_node_base__get_parent_ptr
+ pointer get_parent_ptr();
+ //]
+
+ //[reference__nary_node_base__cbegin
+ const_iterator cbegin() const;
+ const_iterator begin() const;
+ //]
+
+ //[reference__nary_node_base__begin
+ iterator begin();
+ //]
+
+ //[reference__nary_node_base__cend
+ const_iterator cend() const;
+ const_iterator end() const;
+ //]
+
+ //[reference__nary_node_base__end
+ iterator end();
+ //]
+
+ //[reference__nary_node_base__crbegin
+ const_reverse_iterator crbegin() const;
+ const_reverse_iterator rbegin() const;
+ //]
+
+ //[reference__nary_node_base__rbegin
+ reverse_iterator rbegin();
+ //]
+
+ //[reference__nary_node_base__crend
+ const_reverse_iterator crend() const;
+ const_reverse_iterator rend() const;
+ //]
+
+ //[reference__nary_node_base__rend
+ reverse_iterator rend();
+ //]
+
+ //[reference__nary_node_base__size
+ size_type size() const;
+ //]
+
+ //[reference__nary_node_base__empty
+ bool empty() const;
+ //]
+
+ //[reference__nary_node_base__clear
+ void clear();
+ //]
+
+ //[reference__nary_node_base__insert
+ iterator insert(Derived const& child);
+ //]
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ iterator \
+ emplace( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ iterator insert(BOOST_RV_REF(Derived) child);
+
+#if defined BOOST_CONTAINER_PERFECT_FORWARDING
+ //[reference__nary_node_base__emplace
+ template <typename ...Args>
+ iterator emplace(Args&& ...args);
+ //]
+#else // !defined BOOST_CONTAINER_PERFECT_FORWARDING
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ iterator \
+ emplace( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // BOOST_CONTAINER_PERFECT_FORWARDING
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ //[reference__nary_node_base__splice
+ typename ::boost::insert_range_result_gen<Selector,Derived>::type
+ splice(iterator pos, Derived& node);
+ //]
+
+ //[reference__nary_node_base__splice_one
+ typename ::boost::insert_range_result_gen<Selector,Derived>::type
+ splice(iterator pos, Derived& node, iterator itr);
+ //]
+
+ //[reference__nary_node_base__splice_range
+ typename ::boost::insert_range_result_gen<Selector,Derived>::type
+ splice(
+ iterator pos
+ , Derived& node
+ , iterator itr
+ , iterator itr_end
+ );
+ //]
+
+ private:
+ static void
+ _link_children_to_parent(
+ pointer const& p
+ , iterator itr
+ , iterator itr_end
+ );
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ iterator \
+ _add_child( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ); \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#elif defined BOOST_CONTAINER_PERFECT_FORWARDING
+ template <typename ...Args>
+ iterator _add_child(Args&& ...args);
+#else // partial template specialization support, imperfect forwarding
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ iterator \
+ _add_child( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ); \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // compiler defect handling
+
+ void _clone_descendants(Derived const& copy);
+
+ void _clone_descendants(Derived const& copy, ::boost::mpl::true_);
+
+ void _clone_descendants(Derived const& copy, ::boost::mpl::false_);
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ void _move_descendants(BOOST_RV_REF(Derived) source);
+
+ void _move_descendants(Derived& source, ::boost::mpl::true_);
+
+ void _move_descendants(Derived& source, ::boost::mpl::false_);
+
+ void _move_descendants_non_ptr(Derived& source, ::boost::mpl::true_);
+
+ void _move_descendants_non_ptr(Derived& source, ::boost::mpl::false_);
+
+ template <typename A>
+ void
+ _on_post_insert(
+ iterator to_child
+ , ::boost::vector_selector< ::boost::mpl::true_,A>
+ );
+
+ template <typename A>
+ void _on_post_resize(::boost::vector_selector< ::boost::mpl::true_,A>);
+#endif // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <typename S>
+ void _on_post_insert(iterator to_child, S);
+
+ template <typename S>
+ void _on_post_resize(S);
+
+ void _on_post_clone_or_move(::boost::mpl::true_);
+
+ void _on_post_clone_or_move(::boost::mpl::false_);
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <typename A>
+ typename ::boost::insert_range_result_gen<Selector,Derived>::type
+ _splice_ra(
+ iterator pos
+ , Derived& node
+ , iterator itr
+ , iterator itr_end
+ , ::boost::vector_selector< ::boost::mpl::true_,A>
+ );
+
+ template <typename A>
+ typename ::boost::insert_range_result_gen<Selector,Derived>::type
+ _splice_ra(
+ iterator pos
+ , Derived& node
+ , iterator itr
+ , iterator itr_end
+ , ::boost::deque_selector< ::boost::mpl::true_,A>
+ );
+#endif // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <typename S>
+ typename ::boost::insert_range_result_gen<Selector,Derived>::type
+ _splice_ra(
+ iterator pos
+ , Derived& node
+ , iterator itr
+ , iterator itr_end
+ , S
+ );
+
+ typename ::boost::insert_range_result_gen<Selector,Derived>::type
+ _splice(
+ iterator pos
+ , Derived& node
+ , iterator itr
+ , iterator itr_end
+ , ::boost::mpl::true_
+ );
+
+ typename ::boost::insert_range_result_gen<Selector,Derived>::type
+ _splice(
+ iterator pos
+ , Derived& node
+ , iterator itr
+ , iterator itr_end
+ , ::boost::mpl::false_
+ );
+
+ template <typename D, typename T0, typename S, typename V>
+ friend void
+ put(
+ nary_node_base<D,T0,S>& node
+ , data_key const& key
+ , V const& value
+ );
+
+ void _on_post_modify_value(data_key const& key);
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+ template <typename FusionKey>
+ void _on_post_modify_value(FusionKey const& key);
+
+ template <
+ typename D
+ , typename T0
+ , typename S
+ , typename FusionKey
+ , typename V
+ >
+ friend void
+ put(
+ nary_node_base<D,T0,S>& node
+ , FusionKey const& key
+ , V const& value
+ , typename ::boost::enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T0>::type
+ , ::boost::fusion::traits::is_associative<T0>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<nary_node_base<D,T0,S>,FusionKey>
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::mpl::true_
+ >::type
+ );
+#endif // defined BOOST_TREE_NODE_CAN_USE_FUSION
+ };
+
+ template <typename Derived, typename T, typename Selector>
+ nary_node_base<Derived,T,Selector>::nary_node_base(Derived const& copy)
+ : _children(), _data(copy._data), _parent()
+ {
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ nary_node_base<Derived,T,Selector>::nary_node_base(
+ Derived const& copy
+ , typename traits::allocator_reference allocator
+ ) : _children(allocator), _data(copy._data), _parent()
+ {
+ }
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template <typename Derived, typename T, typename Selector> \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ nary_node_base<Derived,T,Selector>::nary_node_base( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) : _children() \
+ , _data(BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p)) \
+ , _parent() \
+ { \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template <typename Derived, typename T, typename Selector> \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ nary_node_base<Derived,T,Selector>::nary_node_base( \
+ ::boost::container::allocator_arg_t \
+ , typename traits::allocator_reference allocator \
+ , BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) : _children() \
+ , _data(BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), p)) \
+ , _parent() \
+ { \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <typename Derived, typename T, typename Selector>
+ nary_node_base<Derived,T,Selector>::nary_node_base(
+ BOOST_RV_REF(Derived) source
+ ) : _children(), _data(::boost::move(source._data)), _parent()
+ {
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ nary_node_base<Derived,T,Selector>::nary_node_base(
+ BOOST_RV_REF(Derived) source
+ , typename traits::allocator_reference allocator
+ ) : _children(allocator), _data(::boost::move(source._data)), _parent()
+ {
+ }
+
+#if defined BOOST_CONTAINER_PERFECT_FORWARDING
+ template <typename Derived, typename T, typename Selector>
+ template <typename ...Args>
+ nary_node_base<Derived,T,Selector>::nary_node_base(Args&& ...args)
+ : _children(), _data(::boost::forward<Args>(args)...), _parent()
+ {
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ template <typename ...Args>
+ nary_node_base<Derived,T,Selector>::nary_node_base(
+ ::boost::container::allocator_arg_t
+ , typename traits::allocator_reference allocator
+ , Args&& ...args
+ ) : _children(allocator), _data(::boost::forward<Args>(args)...), _parent()
+ {
+ }
+#else // !defined BOOST_CONTAINER_PERFECT_FORWARDING
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template <typename Derived, typename T, typename Selector> \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ nary_node_base<Derived,T,Selector>::nary_node_base( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) : _children() \
+ , _data( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ) \
+ , _parent() \
+ { \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template <typename Derived, typename T, typename Selector> \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ nary_node_base<Derived,T,Selector>::nary_node_base( \
+ ::boost::container::allocator_arg_t \
+ , typename traits::allocator_reference allocator \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) : _children(allocator) \
+ , _data( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ) \
+ , _parent() \
+ { \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // BOOST_CONTAINER_PERFECT_FORWARDING
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <typename Derived, typename T, typename Selector>
+ nary_node_base<Derived,T,Selector>::~nary_node_base()
+ {
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline void
+ nary_node_base<Derived,T,Selector>::clone_descendants(
+ Derived const& copy
+ )
+ {
+ this->_clone_descendants(copy);
+ this->_on_post_clone_or_move(
+ ::boost::is_reversible_selector<Selector>()
+ );
+ }
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <typename Derived, typename T, typename Selector>
+ inline void
+ nary_node_base<Derived,T,Selector>::copy_assign(Derived const& copy)
+ {
+ Derived twin(copy._data);
+
+ twin._clone_descendants(copy);
+ twin.clone_metadata(copy);
+ this->_children.clear();
+ this->_data = twin._data;
+ this->_clone_descendants(twin);
+ this->clone_metadata(twin);
+ }
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <typename Derived, typename T, typename Selector>
+ inline void
+ nary_node_base<Derived,T,Selector>::move_descendants(
+ BOOST_RV_REF(Derived) source
+ )
+ {
+#if defined BOOST_NO_RVALUE_REFERENCES
+ this->_move_descendants(source);
+#else
+ this->_move_descendants(static_cast<Derived&&>(source));
+#endif
+ this->_on_post_clone_or_move(
+ ::boost::is_reversible_selector<Selector>()
+ );
+ source.on_post_clear();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline void
+ nary_node_base<Derived,T,Selector>::copy_assign(
+ BOOST_COPY_ASSIGN_REF(Derived) copy
+ )
+ {
+ Derived twin(copy._data);
+
+ twin._clone_descendants(static_cast<Derived const&>(copy));
+ twin.clone_metadata(static_cast<Derived const&>(copy));
+ this->_children.clear();
+ this->_data = ::boost::move(twin._data);
+ this->_move_descendants(::boost::move(twin));
+ this->move_metadata(::boost::move(twin));
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline void
+ nary_node_base<Derived,T,Selector>::move_assign(
+ BOOST_RV_REF(Derived) source
+ )
+ {
+ this->_children.clear();
+ this->_data = ::boost::move(source._data);
+#if defined BOOST_NO_RVALUE_REFERENCES
+ this->_move_descendants(source);
+ this->move_metadata(source);
+#else
+ this->_move_descendants(static_cast<Derived&&>(source));
+ this->move_metadata(static_cast<Derived&&>(source));
+#endif
+ this->_on_post_clone_or_move(
+ ::boost::is_reversible_selector<Selector>()
+ );
+ source.on_post_clear();
+ }
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <typename Derived, typename T, typename Selector>
+ inline void nary_node_base<Derived,T,Selector>::on_post_assign()
+ {
+ if (this->_parent)
+ {
+ this->_parent->on_post_propagate_value(data_key());
+ }
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<
+ Derived
+ , T
+ , Selector
+ >::traits::data_type const&
+ nary_node_base<Derived,T,Selector>::operator[](data_key const&) const
+ {
+ return this->_data;
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::traits::data_type&
+ nary_node_base<Derived,T,Selector>::operator[](data_key const&)
+ {
+ return this->_data;
+ }
+
+#if defined BOOST_TREE_NODE_CAN_USE_FUSION
+ template <typename Derived, typename T, typename Selector>
+ template <typename FusionKey>
+ inline typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ nary_node_base<Derived,T,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T const,FusionKey>
+ >::type
+ nary_node_base<Derived,T,Selector>::operator[](FusionKey const&) const
+ {
+ return ::boost::fusion::at_key<FusionKey>(this->_data);
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ template <typename FusionKey>
+ inline typename ::boost::lazy_enable_if<
+ typename ::boost::mpl::if_<
+ typename ::boost::mpl::eval_if<
+ typename ::boost::fusion::traits::is_sequence<T>::type
+ , ::boost::fusion::traits::is_associative<T>
+ , ::boost::mpl::false_
+ >::type
+ , result_of::has_key<
+ nary_node_base<Derived,T,Selector>
+ , FusionKey
+ >
+ , ::boost::mpl::false_
+ >::type
+ , ::boost::fusion::result_of::at_key<T,FusionKey>
+ >::type
+ nary_node_base<Derived,T,Selector>::operator[](FusionKey const&)
+ {
+ return ::boost::fusion::at_key<FusionKey>(this->_data);
+ }
+#endif // defined BOOST_TREE_NODE_CAN_USE_FUSION
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::const_pointer
+ nary_node_base<Derived,T,Selector>::get_parent_ptr() const
+ {
+ return this->_parent;
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::pointer
+ nary_node_base<Derived,T,Selector>::get_parent_ptr()
+ {
+ return this->_parent;
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::const_iterator
+ nary_node_base<Derived,T,Selector>::cbegin() const
+ {
+ return this->_children.cbegin();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::const_iterator
+ nary_node_base<Derived,T,Selector>::begin() const
+ {
+ return this->_children.begin();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::iterator
+ nary_node_base<Derived,T,Selector>::begin()
+ {
+ return this->_children.begin();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::const_iterator
+ nary_node_base<Derived,T,Selector>::cend() const
+ {
+ return this->_children.cend();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::const_iterator
+ nary_node_base<Derived,T,Selector>::end() const
+ {
+ return this->_children.end();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::iterator
+ nary_node_base<Derived,T,Selector>::end()
+ {
+ return this->_children.end();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::const_reverse_iterator
+ nary_node_base<Derived,T,Selector>::crbegin() const
+ {
+ return this->_children.crbegin();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::const_reverse_iterator
+ nary_node_base<Derived,T,Selector>::rbegin() const
+ {
+ return this->_children.rbegin();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::reverse_iterator
+ nary_node_base<Derived,T,Selector>::rbegin()
+ {
+ return this->_children.rbegin();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::const_reverse_iterator
+ nary_node_base<Derived,T,Selector>::crend() const
+ {
+ return this->_children.crend();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::const_reverse_iterator
+ nary_node_base<Derived,T,Selector>::rend() const
+ {
+ return this->_children.rend();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::reverse_iterator
+ nary_node_base<Derived,T,Selector>::rend()
+ {
+ return this->_children.rend();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::size_type
+ nary_node_base<Derived,T,Selector>::size() const
+ {
+ return this->_children.size();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline bool nary_node_base<Derived,T,Selector>::empty() const
+ {
+ return this->_children.empty();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline void nary_node_base<Derived,T,Selector>::clear()
+ {
+ this->_children.clear();
+ this->on_post_clear();
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::iterator
+ nary_node_base<Derived,T,Selector>::insert(Derived const& child)
+ {
+ Derived twin(child._data);
+
+ twin._clone_descendants(child);
+ twin.clone_metadata(child);
+
+ typename ::boost::emplace_function_gen<Selector>::type emplacer;
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ ::std::pair<iterator,bool> p = emplacer(this->_children, twin._data);
+#else
+ ::std::pair<iterator,bool> p = emplacer(
+ this->_children
+ , ::boost::move(twin._data)
+ );
+#endif
+
+ if (p.second)
+ {
+ this->_on_post_insert(p.first, Selector());
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ (*p.first)._clone_descendants(twin);
+ (*p.first).move_metadata(twin);
+#else
+ (*p.first)._move_descendants(::boost::move(twin));
+ (*p.first).move_metadata(::boost::move(twin));
+#endif
+ (*p.first).on_post_inserted(
+ p.first
+ , ::boost::has_stable_iterators_selector<Selector>()
+ );
+ }
+ else
+ {
+ BOOST_ASSERT_MSG(
+ false
+ , "This type does not yet handle associative selectors."
+ );
+ }
+
+ return p.first;
+ }
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template <typename Derived, typename T, typename Selector> \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ inline typename nary_node_base<Derived,T,Selector>::iterator \
+ nary_node_base<Derived,T,Selector>::emplace( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ typename ::boost::emplace_function_gen<Selector>::type emplacer; \
+ ::std::pair<iterator,bool> p = emplacer( \
+ this->_children \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ if (p.second) \
+ { \
+ this->_on_post_insert(p.first, Selector()); \
+ (*p.first).on_post_inserted( \
+ p.first \
+ , ::boost::has_stable_iterators_selector<Selector>() \
+ ); \
+ } \
+ else \
+ { \
+ BOOST_ASSERT_MSG( \
+ false \
+ , "This type does not yet handle associative selectors." \
+ ); \
+ } \
+ return p.first; \
+ } \
+//!
+ BOOST_PP_FOR(
+ (0)
+ , BOOST_CONTAINER_GEN_PP_PARAM_PRED
+ , BOOST_CONTAINER_GEN_PP_PARAM_INC
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <typename Derived, typename T, typename Selector>
+ inline typename nary_node_base<Derived,T,Selector>::iterator
+ nary_node_base<Derived,T,Selector>::insert(BOOST_RV_REF(Derived) child)
+ {
+ typename ::boost::emplace_function_gen<Selector>::type emplacer;
+ ::std::pair<iterator,bool> p = emplacer(
+ this->_children
+ , ::boost::move(child._data)
+ );
+
+ if (p.second)
+ {
+ this->_on_post_insert(p.first, Selector());
+#if defined BOOST_NO_RVALUE_REFERENCES
+ (*p.first)._move_descendants(child);
+ (*p.first).move_metadata(child);
+#else
+ (*p.first)._move_descendants(static_cast<Derived&&>(child));
+ (*p.first).move_metadata(static_cast<Derived&&>(child));
+#endif
+ (*p.first).on_post_inserted(
+ p.first
+ , ::boost::has_stable_iterators_selector<Selector>()
+ );
+ }
+ else
+ {
+ BOOST_ASSERT_MSG(
+ false
+ , "This type does not yet handle associative selectors."
+ );
+ }
+
+ return p.first;
+ }
+
+#if defined BOOST_CONTAINER_PERFECT_FORWARDING
+ template <typename Derived, typename T, typename Selector>
+ template <typename ...Args>
+ inline typename nary_node_base<Derived,T,Selector>::iterator
+ nary_node_base<Derived,T,Selector>::emplace(Args&& ...args)
+ {
+ typename ::boost::emplace_function_gen<Selector>::type emplacer;
+ ::std::pair<iterator,bool> p = emplacer(
+ this->_children
+ , ::boost::forward<Args>(args)...
+ );
+
+ if (p.second)
+ {
+ this->_on_post_insert(p.first, Selector());
+ (*p.first).on_post_inserted(
+ p.first
+ , ::boost::has_stable_iterators_selector<Selector>()
+ );
+ }
+ else
+ {
+ BOOST_ASSERT_MSG(
+ false
+ , "This type does not yet handle associative selectors."
+ );
+ }
+
+ return p.first;
+ }
+#else // !defined BOOST_CONTAINER_PERFECT_FORWARDING
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(z, n, _) \
+ template <typename Derived, typename T, typename Selector> \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS_Z(z, n, typename P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ inline typename nary_node_base<Derived,T,Selector>::iterator \
+ nary_node_base<Derived,T,Selector>::emplace( \
+ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_LIST \
+ , _ \
+ ) \
+ ) \
+ { \
+ typename ::boost::emplace_function_gen<Selector>::type emplacer; \
+ ::std::pair<iterator,bool> p = emplacer( \
+ this->_children \
+ BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, z)( \
+ n \
+ , BOOST_CONTAINER_PP_PARAM_FORWARD \
+ , _ \
+ ) \
+ ); \
+ if (p.second) \
+ { \
+ this->_on_post_insert(p.first, Selector()); \
+ (*p.first).on_post_inserted( \
+ p.first \
+ , ::boost::has_stable_iterators_selector<Selector>() \
+ ); \
+ } \
+ else \
+ { \
+ BOOST_ASSERT_MSG( \
+ false \
+ , "This type does not yet handle associative selectors." \
+ ); \
+ } \
+ return p.first; \
+ } \
+//!
+ BOOST_PP_REPEAT(
+ BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
+ , BOOST_TREE_NODE_EMPLACEMENT_IMPL
+ , _
+ )
+#undef BOOST_TREE_NODE_EMPLACEMENT_IMPL
+#endif // BOOST_CONTAINER_PERFECT_FORWARDING
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename ::boost::insert_range_result_gen<Selector,Derived>::type
+ nary_node_base<Derived,T,Selector>::splice(iterator pos, Derived& node)
+ {
+#if 0
+ typename ::boost::insert_range_result_gen<
+ Selector
+ , Derived
+ >::type result = this->_splice(
+ pos
+ , node
+ , ::boost::begin(node._children)
+ , ::boost::end(node._children)
+ , ::boost::is_random_access_selector<Selector>()
+ );
+
+ node.on_post_clear();
+ this->on_post_insert(
+ ::boost::begin(result)
+ , ::boost::end(result)
+ , ::boost::has_stable_iterators_selector<Selector>()
+ );
+ return result;
+#endif
+ return this->splice(
+ pos
+ , node
+ , ::boost::begin(node._children)
+ , ::boost::end(node._children)
+ );
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename ::boost::insert_range_result_gen<Selector,Derived>::type
+ nary_node_base<Derived,T,Selector>::splice(
+ iterator pos
+ , Derived& node
+ , iterator itr
+ )
+ {
+ iterator itr_end = itr;
+ return this->splice(
+ pos
+ , node
+ , itr
+ , ++itr_end
+ );
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ inline typename ::boost::insert_range_result_gen<Selector,Derived>::type
+ nary_node_base<Derived,T,Selector>::splice(
+ iterator pos
+ , Derived& node
+ , iterator itr
+ , iterator itr_end
+ )
+ {
+ if ((pos == itr) || (pos == itr_end))
+ {
+ BOOST_ASSERT(this->get_derived() == node.get_derived());
+ return ::std::pair<iterator,iterator>(itr, itr_end);
+ }
+ else
+ {
+ return this->_splice(
+ pos
+ , node
+ , itr
+ , itr_end
+ , typename ::boost::mpl::if_<
+ ::boost::is_ptr_selector<Selector>
+ , ::boost::mpl::false_
+ , ::boost::is_random_access_selector<Selector>
+ >::type()
+ );
+ }
+ }
+
+ template <typename Derived, typename T, typename Selector>
+ void
+ nary_node_base<Derived,T,Selector>::_link_children_to_parent(
+ pointer const& p
+ , iterator itr
+ , iterator itr_end
+ )
+ {
+ for (; itr != itr_end; ++itr)
+ {
+ (*itr)._parent = p;
+ }
+ }
+
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#define BOOST_TREE_NODE_EMPLACEMENT_IMPL(r, seq) \
+ template <typename Derived, typename T, typename Selector> \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), template <) \
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(seq), typename P) \
+ BOOST_PP_EXPR_IF(BOOST_PP_SEQ_SIZE(seq), >) \
+ inline typename nary_node_base<Derived,T,Selector>::iterator \
+ nary_node_base<Derived,T,Selector>::_add_child( \
+ BOOST_DETAIL_PP_BINARY_SEQ_TO_PARAMS(seq, P, &, const&, p) \
+ ) \
+ { \
+ typename ::boost::emplace_function_gen<Selector>::type emplacer; \
+ ::std::pair<iterator,bool> p = emplacer( \
+ this->_children \
+ BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SEQ_SIZE(seq), p) \
+ ); \
+ if (p.second) \