summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/ext/pb_ds/detail
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-24 02:38:19 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-24 02:38:19 +0000
commit4f4a327e5b45f8ece94996e6c5f6f29ce1b3d43e (patch)
tree3a3e2385c96d7603cc7578228f954bd4d03d73a4 /libstdc++-v3/include/ext/pb_ds/detail
parent10c3b4fd04a0b42e09228dba893c4bb11c5f2d77 (diff)
downloadgcc-4f4a327e5b45f8ece94996e6c5f6f29ce1b3d43e.tar.gz
2011-05-23 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/37144 PR libstdc++/28457 Interface changes for ext/pb_ds. PB_DS_BASE_C_DEC to unique PB_DS_*_BASE macros. * include/ext/pb_ds/assoc_container.hpp (container_base): Remove. (basic_hash_table, basic_branch, list_update): Derive from container_base_dispatch. * include/ext/pb_ds/list_update_policy.hpp (null_lu_metadata): Remove. (move_to_front_lu_policy): To lu_move_to_front_policy. (counter_lu_policy): To lu_counter_policy. * include/ext/pb_ds/tree_policy.hpp (null_tree_node_update): Remove. * include/ext/pb_ds/tag_and_trait.hpp (container_base_dispatch): Adjust template parameters, declare here. (null_mapped_type) Remove. (null_type): Just use this for template tricks everywhere. * include/ext/pb_ds/hash_policy.hpp (null_hash_fn, null_probe_fn): Remove. * include/ext/pb_ds/trie_policy.hpp (null_trie_node_update): Remove. (string_trie_e_access_traits): To trie_string_access_traits. * include/ext/pb_ds/priority_queue.hpp: Use container_base_dispatch. File changes. * include/Makefile.am (pb_headers): Removed and changed file names. * include/Makefile.in: Regenerated. * include/ext/pb_ds/detail/basic_types.hpp: Remove. * include/ext/pb_ds/detail/bin_search_tree_/ cond_dtor_entry_dealtor.hpp: Remove. * include/ext/pb_ds/detail/bin_search_tree_/ cond_key_dtor_entry_dealtor.hpp: Remove. * include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp: Move.. * include/ext/pb_ds/detail/binary_heap_/ point_const_iterator.hpp: ..here. * include/ext/pb_ds/detail/basic_tree_policy: Move to... * include/ext/pb_ds/detail/branch_policy: This. * include/ext/pb_ds/detail/branch_policy/ basic_tree_policy_base.hpp: Move... * include/ext/pb_ds/detail/branch_policy/branch_policy.hpp: ...here. * include/ext/pb_ds/detail/branch_policy/null_node_metadata.hpp: Add. * include/ext/pb_ds/detail/branch_policy/traits.hpp: Add. * include/ext/pb_ds/detail/left_child_next_sibling_heap_/ null_metadata.hpp: Remove. * include/ext/pb_ds/detail/left_child_next_sibling_heap_/ const_point_iterator.hpp: Move... * include/ext/pb_ds/detail/left_child_next_sibling_heap_/ point_const_iterator.hpp: ...here. * include/ext/pb_ds/detail/list_update_policy/ counter_lu_metadata.hpp: Move.. * include/ext/pb_ds/detail/list_update_policy/ lu_counter_metadata.hpp: ...here. * include/ext/pb_ds/detail/list_update_policy/ counter_lu_policy_imp.hpp: Remove. * include/ext/pb_ds/detail/list_update_policy/ mtf_lu_policy_imp.hpp: Remove. * include/ext/pb_ds/detail/trie_policy/ string_trie_e_access_traits_imp.hpp: Move... * include/ext/pb_ds/detail/trie_policy/ sample_trie_access_traits.hpp: ...here. * include/ext/pb_ds/detail/trie_policy/ sample_trie_e_access_traits.hpp: Move... * include/ext/pb_ds/detail/trie_policy/ trie_string_access_traits_imp.hpp: ...here. * include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp: Remove. * include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp: Remove. * include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp: Remove. * include/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp: New, fold all types found in the following files into pat_trie_base. * include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp: Folded. * include/ext/pb_ds/detail/pat_trie_/ cond_dtor_entry_dealtor.hpp: Folded. * include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp: Folded. * include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp: Folded. * include/ext/pb_ds/detail/pat_trie_/head.hpp: Folded. * include/ext/pb_ds/detail/pat_trie_/leaf.hpp: Folded. * include/ext/pb_ds/detail/pat_trie_/node_base.hpp: Folded. * include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp: Folded. * include/ext/pb_ds/detail/pat_trie_/internal_node.hpp: Folded. * include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp: Folded. * include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp: Folded. * include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp: Move... * include/ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp: ...here. * include/ext/pb_ds/detail/unordered_iterator/ const_point_iterator.hpp: Move... * include/ext/pb_ds/detail/unordered_iterator/ point_const_iterator.hpp: ...here. Adjust for above changes. * include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp: Same. * include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp: Same. * include/ext/pb_ds/detail/resize_policy/ sample_resize_trigger.hpp: Same. * include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binomial_heap_base_/ binomial_heap_base_.hpp: Same. * include/ext/pb_ds/detail/binomial_heap_base_/ constructors_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binomial_heap_base_/ split_join_fn_imps.hpp: Same. * include/ext/pb_ds/detail/container_base_dispatch.hpp: Same. Adjust for template parameter ordering change. * include/ext/pb_ds/detail/cc_hash_table_map_/ erase_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ constructor_destructor_no_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ insert_no_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ policy_access_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ resize_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ constructor_destructor_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ insert_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ entry_list_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ find_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ debug_no_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ constructor_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ cond_key_dtor_entry_dealtor.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ debug_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ erase_no_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ iterators_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ resize_no_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/cc_hash_table_map_/ standard_policies.hpp: Same. * include/ext/pb_ds/detail/tree_trace_base.hpp: Same. * include/ext/pb_ds/detail/unordered_iterator/iterator.hpp: Same. * include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp: Same. * include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp: Same. * include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pat_trie_/ constructors_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp: Same. * include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pat_trie_/traits.hpp: Same. * include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp: Same. * include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp: Same. * include/ext/pb_ds/detail/bin_search_tree_/ policy_access_fn_imps.hpp: Same. * include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/bin_search_tree_/ constructors_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp: Same. * include/ext/pb_ds/detail/bin_search_tree_/traits.hpp: Same. * include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp: Same. * include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp: Same. * include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp: Same. * include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp: Same. * include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp: Same. * include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp: Same. * include/ext/pb_ds/detail/bin_search_tree_/ split_join_fn_imps.hpp: Same. * include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp: Same. * include/ext/pb_ds/detail/list_update_policy/ sample_update_policy.hpp: Same. * include/ext/pb_ds/detail/left_child_next_sibling_heap_/ trace_fn_imps.hpp: Same. * include/ext/pb_ds/detail/left_child_next_sibling_heap_/ erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ erase_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ constructor_destructor_no_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ insert_no_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ policy_access_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ resize_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ constructor_destructor_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ insert_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ iterator_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ find_no_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ find_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ debug_no_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ constructor_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ debug_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ erase_no_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ resize_no_store_hash_fn_imps.hpp: Same. * include/ext/pb_ds/detail/gp_hash_table_map_/ standard_policies.hpp: Same. * include/ext/pb_ds/detail/standard_policies.hpp: Same. * include/ext/pb_ds/detail/types_traits.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/ constructors_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp: Same. * include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp: Same. * include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp: Same. * include/ext/pb_ds/detail/tree_policy/ sample_tree_node_update.hpp: Same. * include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp: Same. * include/ext/pb_ds/detail/trie_policy/ sample_trie_node_update.hpp: Same. * include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp: Same. * include/ext/pb_ds/detail/trie_policy/ prefix_search_node_update_imp.hpp: Same. * include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp: Same. * include/ext/pb_ds/detail/cond_dealtor.hpp: Same. * include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp: Same. Adjust for template parameter change, fold into container_base_dispatch. * include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pairing_heap_/ constructors_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp: Same. * include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp: Same. * include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binomial_heap_/ constructors_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp: Same. * include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp: Same. * include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/type_utils.hpp: Same. * include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp: Same. * include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp: Same. * include/ext/pb_ds/detail/left_child_next_sibling_heap_/ policy_access_fn_imps.hpp: Same. * include/ext/pb_ds/detail/left_child_next_sibling_heap_/ left_child_next_sibling_heap_.hpp: Same. * include/ext/pb_ds/detail/left_child_next_sibling_heap_/ const_iterator.hpp: Same. * include/ext/pb_ds/detail/left_child_next_sibling_heap_/ insert_fn_imps.hpp: Same. * include/ext/pb_ds/detail/left_child_next_sibling_heap_/ constructors_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/left_child_next_sibling_heap_/ debug_fn_imps.hpp: Same. * include/ext/pb_ds/detail/left_child_next_sibling_heap_/ node.hpp: Same. * include/ext/pb_ds/detail/left_child_next_sibling_heap_/ info_fn_imps.hpp: Same. * include/ext/pb_ds/detail/left_child_next_sibling_heap_/ iterators_fn_imps.hpp: Same. * include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp: Same. * include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp: Same. * include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp: Same. * include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp: Same. * include/ext/pb_ds/detail/thin_heap_/ constructors_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp: Same. * include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp: Same. * include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp: Same. * include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp: Same. * include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp: Same. * include/ext/pb_ds/detail/ov_tree_map_/ constructors_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp: Same. * include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp: Same. * include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp: Same. * include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp: Same. * include/ext/pb_ds/detail/ov_tree_map_/traits.hpp: Same. * include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp: Same. * include/ext/pb_ds/detail/debug_map_base.hpp: Same. * include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp: Same. * include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp: Same. * include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp: Same. * include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp: Same. * include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp: Same. * include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp: Same. * include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp: Same. * include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp: Same. * include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp: Same. * include/ext/pb_ds/detail/splay_tree_/ constructors_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp: Same. * include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp: Same. * include/ext/pb_ds/detail/splay_tree_/node.hpp: Same. * include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp: Same. * include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp: Same. * include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp: Same. * include/ext/pb_ds/detail/splay_tree_/traits.hpp: Same. * include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp: Same. * include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/list_update_map_/ entry_metadata_base.hpp: Same. * include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp: Same. * include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp: Same. * include/ext/pb_ds/detail/list_update_map_/ constructor_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp: Same. * include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp: Same. * include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp: Same. * include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp: Same. * include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp: Same. * include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/rc_binomial_heap_/ rc_binomial_heap_.hpp: Same. * include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp: Same. * include/ext/pb_ds/detail/rc_binomial_heap_/ constructors_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp: Same. * include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp: Same. * include/ext/pb_ds/detail/rc_binomial_heap_/ split_join_fn_imps.hpp: Same. * include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp: Same. * include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp: Same. * include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp: Same. * include/ext/pb_ds/detail/rb_tree_map_/ constructors_destructor_fn_imps.hpp: Same. * include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp: Same. * include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp: Same. * include/ext/pb_ds/detail/rb_tree_map_/node.hpp: Same. * include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp: Same. * include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp: Same. * include/ext/pb_ds/detail/rb_tree_map_/traits.hpp: Same. Documentation changes. * include/ext/pb_ds/*: Add doxygen markup. * doc/doxygen/user.cfg.in: Add details for extracting comments from pb_ds. * scripts/run_doxygen: Fixup __gnu_pb_ds::detail. * scripts/make_graph.py: Move to svg output. Re-format generated tables. * doc/Makefile.am (stamp-html-copy): New rule. (stamp-html): Use it to copy non-generated files into html docs. * doc/Makefile.in: Regenerated. * doc/html/ext/pb_ds/sample_trie_e_access_traits.html: Move... * doc/html/ext/pb_ds/trie_string_access_traits.html: ...here. * doc/html/ext/pb_ds/string_trie_e_access_traits.html: Move.. * doc/html/ext/pb_ds/sample_trie_access_traits.html: ...here. * doc/html/ext/pb_ds/tree_text_lor_find_timing_test_local.png, hash_random_int_erase_mem_usage_test_local.png, multimap_text_insert_mem_usage_test_small_s2p_hash_local.png, tree_text_insert_timing_test_pat_trie_local.png , multimap_text_insert_mem_usage_test_small_s2p_tree_local.png , priority_queue_text_modify_down_timing_test_local.png, gp_hash_random_int_subscript_timing_test_find_local.png, text_find_timing_test_hash_local.png, multimap_text_insert_timing_test_small_s2p_hash_local.png, multimap_text_insert_timing_test_small_s2p_tree_local.png, multimap_text_insert_mem_usage_test_large_s2p_hash_local.png, multimap_text_insert_mem_usage_test_large_s2p_tree_local.png, multimap_text_insert_timing_test_large_s2p_hash_local.png, hash_zlob_random_int_find_timing_test_local.png, multimap_text_insert_timing_test_large_s2p_tree_local.png, binary_priority_queue_random_int_push_timing_test_local.png, priority_queue_text_pop_mem_usage_test_local.png, priority_queue_text_modify_down_timing_test_pairing_thin_local.png, tree_split_join_timing_test_local.png, multimap_text_find_timing_test_small_s2p_hash_local.png, ccgp_hash_random_int_subscript_timing_test_insert_local.png, priority_queue_random_int_push_pop_timing_test_local.png, multimap_text_find_timing_test_small_s2p_tree_local.png, gp_hash_random_int_subscript_timing_test_insert_local.png, priority_queue_text_push_timing_test_local.png, cc_hash_random_int_subscript_timing_test_find_local.png, tree_text_insert_timing_test_vector_tree_local.png, multimap_text_find_timing_test_large_s2p_hash_local.png, pairing_priority_queue_text_push_timing_test_local.png, tree_order_statistics_timing_test_local.png, priority_queue_text_push_pop_timing_test_local.png, text_find_timing_test_tree_like_local.png, multimap_text_find_timing_test_large_s2p_tree_local.png, priority_queue_text_modify_up_timing_test_pairing_thin_local.png, cc_hash_random_int_subscript_timing_test_insert_local.png, priority_queue_text_modify_up_timing_test_local.png, random_int_find_find_timing_test_tree_local.png, priority_queue_random_int_push_timing_test_local.png, tree_text_insert_timing_test_node_tree_local.png, pairing_priority_queue_text_push_pop_timing_test_local.png, gp_hash_random_int_find_timing_test_local.png, cc_hash_random_int_find_timing_test_local.png, priority_queue_text_join_timing_test_local.png: Update local pngs. Testsuite changes. * testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc: New. * testsuite/ext/pb_ds/regression/tree_data_map_rand_debug.cc: New. * testsuite/ext/pb_ds/regression/priority_queue_rand_debug.cc: New. * testsuite/ext/pb_ds/regression/trie_no_data_map_rand_debug.cc: New. * testsuite/ext/pb_ds/regression/trie_data_map_rand_debug.cc: New. * testsuite/ext/pb_ds/regression/list_update_no_data_map_rand_debug.cc: New. * testsuite/ext/pb_ds/regression/list_update_data_map_rand_debug.cc: New. * testsuite/ext/pb_ds/regression/hash_no_data_map_rand_debug.cc: New. * testsuite/ext/pb_ds/regression/hash_data_map_rand_debug.cc: New. * testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc: Fix typo. * testsuite/ext/pb_ds/example/basic_set.cc: Update. * testsuite/ext/pb_ds/example/ranged_hash.cc: Same. * testsuite/ext/pb_ds/example/tree_order_statistics.cc: Same. * testsuite/ext/pb_ds/example/trie_prefix_search.cc: Same. * testsuite/ext/pb_ds/example/trie_dna.cc: Same. * testsuite/ext/pb_ds/example/tree_intervals.cc: Same. * testsuite/ext/pb_ds/example/basic_multimap.cc: Same. * testsuite/performance/ext/pb_ds/hash_random_int_erase_mem_usage.cc: Same. * testsuite/performance/ext/pb_ds/tree_split_join_timing.cc: Same. * testsuite/performance/ext/pb_ds/tree_order_statistics_timing.cc: Same. * testsuite/data/make_graph_test_infos.xml: Same. * testsuite/util/regression/common_type.hpp: Same. * testsuite/util/regression/trait/assoc/native_type_trait.hpp: Same. * testsuite/util/regression/trait/assoc/trait.hpp: Same. * testsuite/util/regression/trait/assoc/type_trait.hpp: Same. * testsuite/util/regression/rand/priority_queue/ rand_regression_test.hpp: Same. * testsuite/util/regression/rand/priority_queue/ container_rand_regression_test.tcc: Same. * testsuite/util/regression/rand/assoc/rand_regression_test.hpp: Same. * testsuite/util/regression/rand/assoc/container_rand_regression_test.h * testsuite/util/regression/rand/assoc/ container_rand_regression_test.tcc: Same. * testsuite/util/native_type/native_priority_queue.hpp: Same. * testsuite/util/native_type/native_multimap.hpp: Same. * testsuite/util/native_type/native_hash_multimap.hpp: Same. * testsuite/util/native_type/native_set.hpp: Same. * testsuite/util/native_type/native_map.hpp: Same. * testsuite/util/native_type/native_hash_set.hpp: Same. * testsuite/util/native_type/native_hash_map.hpp: Same. * testsuite/util/testsuite_containers.h * testsuite/util/common_type/priority_queue/common_type.hpp: Same. * testsuite/util/common_type/assoc/common_type.hpp: Same. * testsuite/util/common_type/assoc/string_form.hpp: Same. * testsuite/util/common_type/assoc/template_policy.hpp: Same. * testsuite/util/common_type/assoc/detail/ trigger_policy_string_form.hpp: Same. * testsuite/util/common_type/assoc/detail/ds_string_form.hpp: Same. * testsuite/util/common_type/assoc/detail/ size_policy_string_form.hpp: Same. * testsuite/util/common_type/assoc/detail/ probe_fn_string_form.hpp: Same. * testsuite/util/common_type/assoc/detail/ tree_supports_order_statistics.hpp: Same. * testsuite/util/common_type/assoc/detail/ trie_supports_prefix_search.hpp: Same. * testsuite/util/common_type/assoc/detail/ list_update_policy_string_form.hpp: Same. * testsuite/util/common_type/assoc/detail/ trie_supports_order_statistics.hpp: Same. * testsuite/util/common_type/assoc/native_set.hpp: Same. * testsuite/util/performance/assoc/timing/common_type.hpp: Same. * testsuite/util/performance/assoc/timing/multimap_find_test.hpp: Same. * testsuite/util/performance/assoc/multimap_common_type.hpp: Same. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174100 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/ext/pb_ds/detail')
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/basic_types.hpp211
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp392
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp70
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp81
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp12
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp21
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp87
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp28
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp10
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp48
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp48
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp10
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp21
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp111
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp277
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp65
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp48
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp8
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp68
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp68
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp71
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp24
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp14
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp85
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp18
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp (renamed from libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp)28
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp187
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp52
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp64
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp15
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp151
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp30
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp35
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp5
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp66
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp69
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/branch_policy/branch_policy.hpp124
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/branch_policy/null_node_metadata.hpp (renamed from libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp)31
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/branch_policy/traits.hpp (renamed from libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp)85
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp273
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp77
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp27
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp23
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp21
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp10
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/cond_dealtor.hpp111
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/container_base_dispatch.hpp209
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/debug_map_base.hpp139
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp3
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp152
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp20
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp10
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp259
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp83
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp71
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp51
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp61
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp48
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp50
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp57
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp12
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp16
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp246
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp79
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp (renamed from libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp)30
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp13
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp22
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp8
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp166
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp51
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp (renamed from libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp)64
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp55
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp52
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp74
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp92
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp5
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp36
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp14
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp45
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp322
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp15
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp78
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp31
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp3
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp15
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp139
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp19
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp93
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp79
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp111
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp58
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp25
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp114
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp134
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/head.hpp129
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp209
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp603
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp12
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/leaf.hpp169
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp131
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp338
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp482
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp1357
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp484
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp12
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp10
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp160
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp93
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp (renamed from libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp)149
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp16
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/traits.hpp328
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp8
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp61
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp10
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/node.hpp67
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp166
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp86
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp17
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp14
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp134
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp124
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp8
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp3
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp162
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp185
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp58
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp10
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp6
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp12
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/node.hpp27
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp62
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp160
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp8
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/traits.hpp82
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/standard_policies.hpp24
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp19
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp58
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp54
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp20
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp185
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp4
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp85
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp50
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp58
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp46
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/tree_trace_base.hpp114
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp85
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp50
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp93
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp62
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_access_traits.hpp (renamed from libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp)78
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp48
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp156
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp (renamed from libstdc++-v3/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp)14
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/type_utils.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/types_traits.hpp264
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp12
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp2
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp (renamed from libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp)16
-rw-r--r--libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp6
244 files changed, 6104 insertions, 8830 deletions
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/basic_types.hpp b/libstdc++-v3/include/ext/pb_ds/detail/basic_types.hpp
deleted file mode 100644
index aac1397ddfb..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/basic_types.hpp
+++ /dev/null
@@ -1,211 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file basic_types.hpp
- * Contains basic types used by containers.
- */
-
-#ifndef PB_DS_BASIC_TYPES_HPP
-#define PB_DS_BASIC_TYPES_HPP
-
-#include <algorithm>
-#include <utility>
-#include <ext/pb_ds/tag_and_trait.hpp>
-#include <ext/pb_ds/detail/type_utils.hpp>
-
-namespace __gnu_pbds
-{
- namespace detail
- {
- template<typename Key, typename Mapped, typename Allocator, bool Store_Hash>
- struct value_type_base;
-
- /**
- * Specialization of value_type_base for the case where the hash value
- * is not stored alongside each value.
- **/
- template<typename Key, typename Mapped, typename Allocator>
- struct value_type_base<Key, Mapped, Allocator, false>
- {
- typedef typename Allocator::template rebind<Mapped>::other mapped_type_allocator;
- typedef typename mapped_type_allocator::value_type mapped_type;
- typedef typename mapped_type_allocator::pointer mapped_pointer;
- typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
- typedef typename mapped_type_allocator::reference mapped_reference;
- typedef typename mapped_type_allocator::const_reference const_mapped_reference;
-
- typedef typename Allocator::template rebind<std::pair<const Key, Mapped> >::other value_type_allocator;
- typedef typename value_type_allocator::value_type value_type;
- typedef typename value_type_allocator::pointer pointer;
- typedef typename value_type_allocator::const_pointer const_pointer;
- typedef typename value_type_allocator::reference reference;
- typedef typename value_type_allocator::const_reference const_reference;
-
- struct stored_value_type
- {
- value_type m_value;
- };
- };
-
- /**
- * Specialization of value_type_base for the case where the hash value
- * is stored alongside each value.
- **/
- template<typename Key, typename Mapped, typename Allocator>
- struct value_type_base<Key, Mapped, Allocator, true>
- {
- typedef typename Allocator::template rebind<Mapped>::other mapped_type_allocator;
- typedef typename mapped_type_allocator::value_type mapped_type;
- typedef typename mapped_type_allocator::pointer mapped_pointer;
- typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
- typedef typename mapped_type_allocator::reference mapped_reference;
- typedef typename mapped_type_allocator::const_reference const_mapped_reference;
-
- typedef typename Allocator::template rebind<std::pair<const Key, Mapped> >::other value_type_allocator;
- typedef typename value_type_allocator::value_type value_type;
- typedef typename value_type_allocator::pointer pointer;
- typedef typename value_type_allocator::const_pointer const_pointer;
- typedef typename value_type_allocator::reference reference;
- typedef typename value_type_allocator::const_reference const_reference;
-
- struct stored_value_type
- {
- value_type m_value;
- typename Allocator::size_type m_hash;
- };
- };
-
-#define PB_DS_CLASS_T_DEC \
- template<typename Key, typename Allocator>
-
-#define PB_DS_CLASS_C_DEC \
- value_type_base<Key, null_mapped_type, Allocator, false>
-
- /**
- * Specialization of value_type_base for the case where the hash value
- * is not stored alongside each value.
- **/
- template<typename Key, typename Allocator>
- struct value_type_base<Key, null_mapped_type, Allocator, false>
- {
- typedef typename Allocator::template rebind<null_mapped_type>::other mapped_type_allocator;
- typedef typename mapped_type_allocator::value_type mapped_type;
- typedef typename mapped_type_allocator::pointer mapped_pointer;
- typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
- typedef typename mapped_type_allocator::reference mapped_reference;
- typedef typename mapped_type_allocator::const_reference const_mapped_reference;
-
- typedef Key value_type;
-
- typedef typename Allocator::template rebind<value_type>::other value_type_allocator;
- typedef typename value_type_allocator::pointer pointer;
- typedef typename value_type_allocator::const_pointer const_pointer;
- typedef typename value_type_allocator::reference reference;
- typedef typename value_type_allocator::const_reference const_reference;
-
- struct stored_value_type
- {
- value_type m_value;
- };
-
- static null_mapped_type s_null_mapped;
- };
-
- PB_DS_CLASS_T_DEC
- null_mapped_type PB_DS_CLASS_C_DEC::s_null_mapped;
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
-#define PB_DS_CLASS_T_DEC \
- template<typename Key, typename Allocator>
-
-#define PB_DS_CLASS_C_DEC \
- value_type_base<Key, null_mapped_type, Allocator, true>
-
- /**
- * Specialization of value_type_base for the case where the hash value
- * is stored alongside each value.
- **/
- template<typename Key, typename Allocator>
- struct value_type_base<Key, null_mapped_type, Allocator, true>
- {
- typedef typename Allocator::template rebind<null_mapped_type>::other mapped_type_allocator;
- typedef typename mapped_type_allocator::value_type mapped_type;
- typedef typename mapped_type_allocator::pointer mapped_pointer;
- typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
- typedef typename mapped_type_allocator::reference mapped_reference;
- typedef typename mapped_type_allocator::const_reference const_mapped_reference;
-
- typedef Key value_type;
-
- typedef typename Allocator::template rebind<value_type>::other value_type_allocator;
- typedef typename value_type_allocator::pointer pointer;
- typedef typename value_type_allocator::const_pointer const_pointer;
- typedef typename value_type_allocator::reference reference;
- typedef typename value_type_allocator::const_reference const_reference;
-
- struct stored_value_type
- {
- value_type m_value;
- typename Allocator::size_type m_hash;
- };
-
- static null_mapped_type s_null_mapped;
- };
-
- PB_DS_CLASS_T_DEC
- null_mapped_type PB_DS_CLASS_C_DEC::s_null_mapped;
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
- template<typename Key, typename Mapped>
- struct no_throw_copies
- {
- typedef integral_constant<int, is_simple<Key>::value && is_simple<Mapped>::value> indicator;
- };
-
- template<typename Key>
- struct no_throw_copies<Key, null_mapped_type>
- {
- typedef integral_constant<int, is_simple<Key>::value> indicator;
- };
- } // namespace detail
-} // namespace __gnu_pbds
-
-#endif
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp
index a73414a0fcc..a875e300d4d 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp
@@ -34,22 +34,20 @@
// warranty.
/**
- * @file bin_search_tree_.hpp
- * Contains an implementation class for bin_search_tree_.
- */
-/*
- * This implementation uses an idea from the SGI STL (using a @a header node
- * which is needed for efficient iteration).
+ * @file bin_search_tree_/bin_search_tree_.hpp
+ * Contains an implementation class for binary search tree.
*/
#include <ext/pb_ds/exception.hpp>
+#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
#include <ext/pb_ds/detail/types_traits.hpp>
-#include <ext/pb_ds/detail/debug_map_base.hpp>
-#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/tree_trace_base.hpp>
+#ifdef _GLIBCXX_DEBUG
+#include <ext/pb_ds/detail/debug_map_base.hpp>
+#endif
#include <utility>
#include <functional>
#include <debug/debug.h>
@@ -58,201 +56,129 @@ namespace __gnu_pbds
{
namespace detail
{
-
-#define PB_DS_CLASS_T_DEC \
- template<typename Key, typename Mapped, class Cmp_Fn, \
- class Node_And_It_Traits, class Allocator>
-
#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CLASS_NAME \
- bin_search_tree_data_
-#endif
+#define PB_DS_BIN_TREE_NAME bin_search_tree_map
+#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_CLASS_NAME \
- bin_search_tree_no_data_
-#endif
-
-#define PB_DS_CLASS_C_DEC \
- PB_DS_CLASS_NAME< \
- Key, \
- Mapped, \
- Cmp_Fn, \
- Node_And_It_Traits, \
- Allocator>
-
-#define PB_DS_TYPES_TRAITS_C_DEC \
- types_traits< \
- Key, \
- Mapped, \
- Allocator, \
- false>
+#define PB_DS_BIN_TREE_NAME bin_search_tree_set
+#endif
-#ifdef _GLIBCXX_DEBUG
-#define PB_DS_DEBUG_MAP_BASE_C_DEC \
- debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \
- typename Allocator::template rebind<Key>::other::const_reference>
-#endif
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Mapped, typename Cmp_Fn, \
+ typename Node_And_It_Traits, typename _Alloc>
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#define PB_DS_EP2VP(X)& ((X)->m_value)
-#endif
+#define PB_DS_CLASS_C_DEC \
+ PB_DS_BIN_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped_Data()
-#define PB_DS_EP2VP(X)& ((X)->m_value.first)
-#endif
+#define PB_DS_BIN_TREE_TRAITS_BASE \
+ types_traits<Key, Mapped, _Alloc, false>
+
+#ifdef _GLIBCXX_DEBUG
+#define PB_DS_DEBUG_MAP_BASE_C_DEC \
+ debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \
+ typename _Alloc::template rebind<Key>::other::const_reference>
+#endif
#ifdef PB_DS_TREE_TRACE
-#define PB_DS_TREE_TRACE_BASE_C_DEC \
- tree_trace_base< \
- typename Node_And_It_Traits::const_node_iterator, \
- typename Node_And_It_Traits::node_iterator, \
- Cmp_Fn, \
- true, \
- Allocator>
-#endif
-
- /**
- * class description = "8i|\|4ree $34rc|-| 7r33 74813.">
- **/
- template<typename Key,
- typename Mapped,
- class Cmp_Fn,
- class Node_And_It_Traits,
- class Allocator>
- class PB_DS_CLASS_NAME :
+#define PB_DS_TREE_TRACE_BASE_C_DEC \
+ tree_trace_base<typename Node_And_It_Traits::node_const_iterator, \
+ typename Node_And_It_Traits::node_iterator, \
+ Cmp_Fn, true, _Alloc>
+#endif
+
+
+ /*
+ * @brief Binary search tree (BST).
+ *
+ * This implementation uses an idea from the SGI STL (using a @a
+ * header node which is needed for efficient iteration).
+ */
+ template<typename Key, typename Mapped, typename Cmp_Fn,
+ typename Node_And_It_Traits, typename _Alloc>
+ class PB_DS_BIN_TREE_NAME :
#ifdef _GLIBCXX_DEBUG
public PB_DS_DEBUG_MAP_BASE_C_DEC,
-#endif
+#endif
#ifdef PB_DS_TREE_TRACE
public PB_DS_TREE_TRACE_BASE_C_DEC,
-#endif
+#endif
public Cmp_Fn,
- public PB_DS_TYPES_TRAITS_C_DEC,
+ public PB_DS_BIN_TREE_TRAITS_BASE,
public Node_And_It_Traits::node_update
{
+ typedef Node_And_It_Traits traits_type;
protected:
+ typedef PB_DS_BIN_TREE_TRAITS_BASE traits_base;
+
typedef
- typename Allocator::template rebind<
- typename Node_And_It_Traits::node>::other
+ typename _Alloc::template rebind<typename traits_type::node>::other
node_allocator;
- typedef typename node_allocator::value_type node;
-
- typedef typename node_allocator::pointer node_pointer;
+ typedef typename node_allocator::value_type node;
+ typedef typename node_allocator::pointer node_pointer;
- typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
-
- typedef
- typename Node_And_It_Traits::null_node_update_pointer
+ typedef typename traits_type::null_node_update_pointer
null_node_update_pointer;
private:
- typedef cond_dealtor< node, Allocator> cond_dealtor_t;
+ typedef cond_dealtor<node, _Alloc> cond_dealtor_t;
#ifdef _GLIBCXX_DEBUG
- typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
-#endif
+ typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
+#endif
public:
-
- typedef typename Allocator::size_type size_type;
-
- typedef typename Allocator::difference_type difference_type;
-
- typedef typename PB_DS_TYPES_TRAITS_C_DEC::key_type key_type;
-
- typedef typename PB_DS_TYPES_TRAITS_C_DEC::key_pointer key_pointer;
-
- typedef
- typename PB_DS_TYPES_TRAITS_C_DEC::const_key_pointer
- const_key_pointer;
-
- typedef typename PB_DS_TYPES_TRAITS_C_DEC::key_reference key_reference;
-
- typedef
- typename PB_DS_TYPES_TRAITS_C_DEC::const_key_reference
- const_key_reference;
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef typename traits_base::key_type key_type;
+ typedef typename traits_base::key_pointer key_pointer;
+ typedef typename traits_base::key_const_pointer key_const_pointer;
+ typedef typename traits_base::key_reference key_reference;
+ typedef typename traits_base::key_const_reference key_const_reference;
#ifdef PB_DS_DATA_TRUE_INDICATOR
- typedef typename PB_DS_TYPES_TRAITS_C_DEC::mapped_type mapped_type;
-
- typedef
- typename PB_DS_TYPES_TRAITS_C_DEC::mapped_pointer
- mapped_pointer;
+ typedef typename traits_base::mapped_type mapped_type;
+ typedef typename traits_base::mapped_pointer mapped_pointer;
+ typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
+ typedef typename traits_base::mapped_reference mapped_reference;
+ typedef typename traits_base::mapped_const_reference mapped_const_reference;
+#endif
- typedef
- typename PB_DS_TYPES_TRAITS_C_DEC::const_mapped_pointer
- const_mapped_pointer;
-
- typedef
- typename PB_DS_TYPES_TRAITS_C_DEC::mapped_reference
- mapped_reference;
-
- typedef
- typename PB_DS_TYPES_TRAITS_C_DEC::const_mapped_reference
- const_mapped_reference;
-#endif
-
- typedef typename PB_DS_TYPES_TRAITS_C_DEC::value_type value_type;
-
- typedef typename PB_DS_TYPES_TRAITS_C_DEC::pointer pointer;
-
- typedef typename PB_DS_TYPES_TRAITS_C_DEC::const_pointer const_pointer;
-
- typedef typename PB_DS_TYPES_TRAITS_C_DEC::reference reference;
-
- typedef
- typename PB_DS_TYPES_TRAITS_C_DEC::const_reference
- const_reference;
-
- typedef
- typename Node_And_It_Traits::const_point_iterator
- const_point_iterator;
-
- typedef const_point_iterator const_iterator;
-
- typedef typename Node_And_It_Traits::point_iterator point_iterator;
+ typedef typename traits_base::value_type value_type;
+ typedef typename traits_base::pointer pointer;
+ typedef typename traits_base::const_pointer const_pointer;
+ typedef typename traits_base::reference reference;
+ typedef typename traits_base::const_reference const_reference;
+ typedef typename traits_type::point_const_iterator point_const_iterator;
- typedef point_iterator iterator;
+ typedef point_const_iterator const_iterator;
+ typedef typename traits_type::point_iterator point_iterator;
+ typedef point_iterator iterator;
- typedef
- typename Node_And_It_Traits::const_reverse_iterator
- const_reverse_iterator;
-
- typedef typename Node_And_It_Traits::reverse_iterator reverse_iterator;
-
- typedef
- typename Node_And_It_Traits::const_node_iterator
- const_node_iterator;
+ typedef typename traits_type::const_reverse_iterator const_reverse_iterator;
- typedef typename Node_And_It_Traits::node_iterator node_iterator;
+ typedef typename traits_type::reverse_iterator reverse_iterator;
+ typedef typename traits_type::node_const_iterator node_const_iterator;
+ typedef typename traits_type::node_iterator node_iterator;
+ typedef typename traits_type::node_update node_update;
- typedef Cmp_Fn cmp_fn;
-
- typedef Allocator allocator_type;
-
- typedef typename Node_And_It_Traits::node_update node_update;
-
- public:
+ typedef Cmp_Fn cmp_fn;
+ typedef _Alloc allocator_type;
- PB_DS_CLASS_NAME();
+ PB_DS_BIN_TREE_NAME();
- PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn);
+ PB_DS_BIN_TREE_NAME(const Cmp_Fn&);
- PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_update);
+ PB_DS_BIN_TREE_NAME(const Cmp_Fn&, const node_update&);
- PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other);
+ PB_DS_BIN_TREE_NAME(const PB_DS_CLASS_C_DEC&);
void
- swap(PB_DS_CLASS_C_DEC& other);
+ swap(PB_DS_CLASS_C_DEC&);
- ~PB_DS_CLASS_NAME();
+ ~PB_DS_BIN_TREE_NAME();
inline bool
empty() const;
@@ -263,29 +189,29 @@ namespace __gnu_pbds
inline size_type
max_size() const;
- Cmp_Fn&
+ Cmp_Fn&
get_cmp_fn();
- const Cmp_Fn&
+ const Cmp_Fn&
get_cmp_fn() const;
inline point_iterator
- lower_bound(const_key_reference r_key);
+ lower_bound(key_const_reference);
- inline const_point_iterator
- lower_bound(const_key_reference r_key) const;
+ inline point_const_iterator
+ lower_bound(key_const_reference) const;
inline point_iterator
- upper_bound(const_key_reference r_key);
+ upper_bound(key_const_reference);
- inline const_point_iterator
- upper_bound(const_key_reference r_key) const;
+ inline point_const_iterator
+ upper_bound(key_const_reference) const;
inline point_iterator
- find(const_key_reference r_key);
+ find(key_const_reference);
- inline const_point_iterator
- find(const_key_reference r_key) const;
+ inline point_const_iterator
+ find(key_const_reference) const;
inline iterator
begin();
@@ -311,13 +237,13 @@ namespace __gnu_pbds
inline const_reverse_iterator
rend() const;
- inline const_node_iterator
+ inline node_const_iterator
node_begin() const;
inline node_iterator
node_begin();
- inline const_node_iterator
+ inline node_const_iterator
node_end() const;
inline node_iterator
@@ -327,148 +253,139 @@ namespace __gnu_pbds
clear();
protected:
-
void
- value_swap(PB_DS_CLASS_C_DEC& other);
+ value_swap(PB_DS_CLASS_C_DEC&);
void
initialize_min_max();
inline iterator
- insert_imp_empty(const_reference r_value);
+ insert_imp_empty(const_reference);
inline iterator
- insert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd);
+ insert_leaf_new(const_reference, node_pointer, bool);
inline node_pointer
- get_new_node_for_leaf_insert(const_reference r_val, false_type);
+ get_new_node_for_leaf_insert(const_reference, false_type);
inline node_pointer
- get_new_node_for_leaf_insert(const_reference r_val, true_type);
+ get_new_node_for_leaf_insert(const_reference, true_type);
inline void
- actual_erase_node(node_pointer p_nd);
+ actual_erase_node(node_pointer);
inline std::pair<node_pointer, bool>
- erase(node_pointer p_nd);
+ erase(node_pointer);
inline void
- update_min_max_for_erased_node(node_pointer p_nd);
+ update_min_max_for_erased_node(node_pointer);
static void
- clear_imp(node_pointer p_nd);
+ clear_imp(node_pointer);
- inline std::pair<
- point_iterator,
- bool>
- insert_leaf(const_reference r_value);
+ inline std::pair<point_iterator, bool>
+ insert_leaf(const_reference);
inline void
- rotate_left(node_pointer p_x);
+ rotate_left(node_pointer);
inline void
- rotate_right(node_pointer p_y);
+ rotate_right(node_pointer);
inline void
- rotate_parent(node_pointer p_nd);
+ rotate_parent(node_pointer);
inline void
- apply_update(node_pointer p_nd, null_node_update_pointer);
+ apply_update(node_pointer, null_node_update_pointer);
template<typename Node_Update_>
- inline void
- apply_update(node_pointer p_nd, Node_Update_* p_update);
+ inline void
+ apply_update(node_pointer, Node_Update_*);
inline void
- update_to_top(node_pointer p_nd, null_node_update_pointer);
+ update_to_top(node_pointer, null_node_update_pointer);
template<typename Node_Update_>
- inline void
- update_to_top(node_pointer p_nd, Node_Update_* p_update);
+ inline void
+ update_to_top(node_pointer, Node_Update_*);
bool
- join_prep(PB_DS_CLASS_C_DEC& other);
+ join_prep(PB_DS_CLASS_C_DEC&);
void
- join_finish(PB_DS_CLASS_C_DEC& other);
+ join_finish(PB_DS_CLASS_C_DEC&);
bool
- split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other);
+ split_prep(key_const_reference, PB_DS_CLASS_C_DEC&);
void
- split_finish(PB_DS_CLASS_C_DEC& other);
+ split_finish(PB_DS_CLASS_C_DEC&);
size_type
- recursive_count(node_pointer p_nd) const;
+ recursive_count(node_pointer) const;
#ifdef _GLIBCXX_DEBUG
void
- assert_valid(const char* file, int line) const;
+ assert_valid(const char*, int) const;
void
- structure_only_assert_valid(const char* file, int line) const;
+ structure_only_assert_valid(const char*, int) const;
void
- assert_node_consistent(const node_pointer p_nd,
- const char* file, int line) const;
-#endif
+ assert_node_consistent(const node_pointer, const char*, int) const;
+#endif
private:
#ifdef _GLIBCXX_DEBUG
void
- assert_iterators(const char* file, int line) const;
+ assert_iterators(const char*, int) const;
void
- assert_consistent_with_debug_base(const char* file, int line) const;
+ assert_consistent_with_debug_base(const char*, int) const;
void
- assert_node_consistent_with_left(const node_pointer p_nd,
- const char* file, int line) const;
+ assert_node_consistent_with_left(const node_pointer,
+ const char*, int) const;
void
- assert_node_consistent_with_right(const node_pointer p_nd,
- const char* file, int line) const;
+ assert_node_consistent_with_right(const node_pointer,
+ const char*, int) const;
void
- assert_consistent_with_debug_base(const node_pointer p_nd,
- const char* file, int line) const;
+ assert_consistent_with_debug_base(const node_pointer,
+ const char*, int) const;
void
- assert_min(const char* file, int line) const;
+ assert_min(const char*, int) const;
void
- assert_min_imp(const node_pointer p_nd,
- const char* file, int line) const;
+ assert_min_imp(const node_pointer, const char*, int) const;
void
- assert_max(const char* file, int line) const;
+ assert_max(const char*, int) const;
void
- assert_max_imp(const node_pointer p_nd,
- const char* file, int line) const;
+ assert_max_imp(const node_pointer, const char*, int) const;
void
- assert_size(const char* file, int line) const;
+ assert_size(const char*, int) const;
- typedef std::pair< const_pointer, const_pointer> node_consistent_t;
+ typedef std::pair<const_pointer, const_pointer> node_consistent_t;
node_consistent_t
- assert_node_consistent_(const node_pointer p_nd,
- const char* file, int line) const;
-#endif
+ assert_node_consistent_(const node_pointer, const char*, int) const;
+#endif
void
initialize();
node_pointer
- recursive_copy_node(const node_pointer p_nd);
+ recursive_copy_node(const node_pointer);
protected:
- node_pointer m_p_head;
-
- size_type m_size;
-
- static node_allocator s_node_allocator;
+ node_pointer m_p_head;
+ size_type m_size;
+ static node_allocator s_node_allocator;
};
#define PB_DS_STRUCT_ONLY_ASSERT_VALID(X) \
@@ -492,17 +409,12 @@ namespace __gnu_pbds
#undef PB_DS_STRUCT_ONLY_ASSERT_VALID
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_NAME
-#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_BIN_TREE_NAME
+#undef PB_DS_BIN_TREE_TRAITS_BASE
#undef PB_DS_DEBUG_MAP_BASE_C_DEC
#ifdef PB_DS_TREE_TRACE
#undef PB_DS_TREE_TRACE_BASE_C_DEC
-#endif
-
-#undef PB_DS_V2F
-#undef PB_DS_EP2VP
-#undef PB_DS_V2S
-
+#endif
} // namespace detail
} // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
deleted file mode 100644
index 370574c9087..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
+++ /dev/null
@@ -1,70 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file cond_dtor_entry_dealtor.hpp
- * Contains a binary tree container conditional deallocator
- */
-
-class bin_search_tree_cond_dtor_entry_dealtor_
-{
-public:
- inline
- bin_search_tree_cond_dtor_entry_dealtor_(node_pointer p_nd) : m_p_nd(p_nd),
- m_no_action_dtor(false)
- { }
-
- inline void
- set_no_action_dtor()
- {
- m_no_action_dtor = true;
- }
-
- inline
- ~bin_search_tree_cond_dtor_entry_dealtor_()
- {
- if (m_no_action_dtor)
- return;
-
- typename Allocator::template rebind<Node>::other().
- deallocate(m_p_nd, 1);
- }
-
-protected:
- node_pointer m_p_nd;
-
- bool m_no_action_dtor;
-};
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
deleted file mode 100644
index 612ecebbe94..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
+++ /dev/null
@@ -1,81 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file cond_key_dtor_entry_dealtor.hpp
- * Contains a binary tree container conditional deallocator
- */
-
-class bin_seach_tree_cond_key_dtor_entry_dealtor_
-{
-public:
- inline
- bin_seach_tree_cond_key_dtor_entry_dealtor_(node_pointer p_nd) : m_p_nd(p_nd),
- m_no_action_dtor(false),
- m_key_destruct(false)
- { }
-
- inline void
- set_no_action_dtor()
- {
- m_no_action_dtor = true;
- }
-
- inline void
- set_key_destruct()
- {
- m_key_destruct = true;
- }
-
- inline
- ~bin_seach_tree_cond_key_dtor_entry_dealtor_()
- {
- if (m_no_action_dtor)
- return;
-
- if (m_key_destruct)
- m_p_nd->m_value.first.~Key();
-
- bin_tree_base::s_alloc.deallocate(m_p_nd, 1);
- }
-
-protected:
- node_pointer m_p_nd;
-
- bool m_no_action_dtor;
-
- bool m_key_destruct;
-};
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
index d7b5985cc6d..2815b4274a9 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
@@ -35,7 +35,7 @@
// warranty.
/**
- * @file constructors_destructor_fn_imps.hpp
+ * @file bin_search_tree_/constructors_destructor_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
@@ -45,7 +45,7 @@ PB_DS_CLASS_C_DEC::s_node_allocator;
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME() : m_p_head(s_node_allocator.allocate(1)), m_size(0)
+PB_DS_BIN_TREE_NAME() : m_p_head(s_node_allocator.allocate(1)), m_size(0)
{
initialize();
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
@@ -53,7 +53,7 @@ PB_DS_CLASS_NAME() : m_p_head(s_node_allocator.allocate(1)), m_size(0)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
+PB_DS_BIN_TREE_NAME(const Cmp_Fn& r_cmp_fn) :
Cmp_Fn(r_cmp_fn), m_p_head(s_node_allocator.allocate(1)), m_size(0)
{
initialize();
@@ -62,7 +62,7 @@ PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
+PB_DS_BIN_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
Cmp_Fn(r_cmp_fn),
node_update(r_node_update),
m_p_head(s_node_allocator.allocate(1)),
@@ -74,7 +74,7 @@ PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+PB_DS_BIN_TREE_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG
debug_base(other),
#endif
@@ -132,7 +132,7 @@ value_swap(PB_DS_CLASS_C_DEC& other)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-~PB_DS_CLASS_NAME()
+~PB_DS_BIN_TREE_NAME()
{
clear();
s_node_allocator.deallocate(m_p_head, 1);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
index 86d5c2e87f7..1f77e31cf39 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_fn_imps.hpp
+ * @file bin_search_tree_/debug_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
@@ -272,8 +272,6 @@ PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
assert_size(const char* __file, int __line) const
-{
- PB_DS_DEBUG_VERIFY(recursive_count(m_p_head->m_p_parent) == m_size);
-}
+{ PB_DS_DEBUG_VERIFY(recursive_count(m_p_head->m_p_parent) == m_size); }
#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
index 60a54903458..1d1b17040d0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file erase_fn_imps.hpp
+ * @file bin_search_tree_/erase_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
@@ -45,11 +45,8 @@ actual_erase_node(node_pointer p_z)
{
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
--m_size;
-
- _GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_z->m_value));)
-
+ _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_z->m_value));)
p_z->~node();
-
s_node_allocator.deallocate(p_z, 1);
}
@@ -61,24 +58,19 @@ update_min_max_for_erased_node(node_pointer p_z)
if (m_size == 1)
{
m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;
-
return;
}
if (m_p_head->m_p_left == p_z)
{
iterator it(p_z);
-
++it;
-
m_p_head->m_p_left = it.m_p_nd;
}
else if (m_p_head->m_p_right == p_z)
{
iterator it(p_z);
-
--it;
-
m_p_head->m_p_right = it.m_p_nd;
}
}
@@ -89,15 +81,10 @@ PB_DS_CLASS_C_DEC::
clear()
{
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
-
clear_imp(m_p_head->m_p_parent);
-
m_size = 0;
-
initialize();
-
_GLIBCXX_DEBUG_ONLY(debug_base::clear();)
-
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
}
@@ -110,11 +97,7 @@ clear_imp(node_pointer p_nd)
return;
clear_imp(p_nd->m_p_left);
-
clear_imp(p_nd->m_p_right);
-
p_nd->~node();
-
s_node_allocator.deallocate(p_nd, 1);
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
index 6b50dc8c594..03b7fe89416 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
@@ -34,107 +34,92 @@
// warranty.
/**
- * @file find_fn_imps.hpp
+ * @file bin_search_tree_/find_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
-lower_bound(const_key_reference r_key) const
+lower_bound(key_const_reference r_key) const
{
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
while (p_nd != 0)
- if (Cmp_Fn::operator()(
- PB_DS_V2F(p_nd->m_value),
- r_key))
+ if (Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
p_nd = p_nd->m_p_right;
else
{
p_pot = p_nd;
-
p_nd = p_nd->m_p_left;
}
-
- return (iterator(p_pot));
+ return iterator(p_pot);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
-lower_bound(const_key_reference r_key)
+lower_bound(key_const_reference r_key)
{
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
while (p_nd != 0)
- if (Cmp_Fn::operator()(
- PB_DS_V2F(p_nd->m_value),
- r_key))
+ if (Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
p_nd = p_nd->m_p_right;
else
{
p_pot = p_nd;
-
p_nd = p_nd->m_p_left;
}
-
- return (iterator(p_pot));
+ return iterator(p_pot);
}
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
-upper_bound(const_key_reference r_key) const
+upper_bound(key_const_reference r_key) const
{
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
while (p_nd != 0)
- if (Cmp_Fn::operator()(r_key,
- PB_DS_V2F(p_nd->m_value)))
+ if (Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))
{
- p_pot = p_nd,
-
- p_nd = p_nd->m_p_left;
+ p_pot = p_nd;
+ p_nd = p_nd->m_p_left;
}
else
p_nd = p_nd->m_p_right;
-
- return (const_iterator(p_pot));
+ return const_iterator(p_pot);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
-upper_bound(const_key_reference r_key)
+upper_bound(key_const_reference r_key)
{
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
while (p_nd != 0)
- if (Cmp_Fn::operator()(r_key,
- PB_DS_V2F(p_nd->m_value)))
+ if (Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))
{
- p_pot = p_nd,
-
- p_nd = p_nd->m_p_left;
+ p_pot = p_nd;
+ p_nd = p_nd->m_p_left;
}
else
p_nd = p_nd->m_p_right;
-
- return (point_iterator(p_pot));
+ return point_iterator(p_pot);
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key)
+find(key_const_reference r_key)
{
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
-
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
@@ -142,25 +127,27 @@ find(const_key_reference r_key)
if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
{
p_pot = p_nd;
-
p_nd = p_nd->m_p_left;
}
else
p_nd = p_nd->m_p_right;
- return point_iterator((p_pot != m_p_head
- && Cmp_Fn::operator()(r_key,
- PB_DS_V2F(p_pot->m_value)))
- ? m_p_head : p_pot);
+ node_pointer ret = p_pot;
+ if (p_pot != m_p_head)
+ {
+ const bool __cmp = Cmp_Fn::operator()(r_key, PB_DS_V2F(p_pot->m_value));
+ if (__cmp)
+ ret = m_p_head;
+ }
+ return point_iterator(ret);
}
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key) const
+find(key_const_reference r_key) const
{
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
-
node_pointer p_pot = m_p_head;
node_pointer p_nd = m_p_head->m_p_parent;
@@ -168,15 +155,17 @@ find(const_key_reference r_key) const
if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
{
p_pot = p_nd;
-
p_nd = p_nd->m_p_left;
}
else
p_nd = p_nd->m_p_right;
- return const_point_iterator((p_pot != m_p_head
- && Cmp_Fn::operator()(r_key,
- PB_DS_V2F(p_pot->m_value)))
- ? m_p_head : p_pot);
+ node_pointer ret = p_pot;
+ if (p_pot != m_p_head)
+ {
+ const bool __cmp = Cmp_Fn::operator()(r_key, PB_DS_V2F(p_pot->m_value));
+ if (__cmp)
+ ret = m_p_head;
+ }
+ return point_const_iterator(ret);
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
index b3e46112fb6..54cd52e04ba 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file info_fn_imps.hpp
+ * @file bin_search_tree_/info_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
index eb0f76d0ea2..5a9a03e867e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_fn_imps.hpp
+ * @file bin_search_tree_/insert_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
@@ -101,38 +101,30 @@ insert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd)
if (left_nd)
{
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == 0);
- _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(
- PB_DS_V2F(r_value),
- PB_DS_V2F(p_nd->m_value)));
+ _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(r_value),
+ PB_DS_V2F(p_nd->m_value)));
p_nd->m_p_left = p_new_nd;
-
if (m_p_head->m_p_left == p_nd)
m_p_head->m_p_left = p_new_nd;
}
else
{
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_right == 0);
- _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(
- PB_DS_V2F(p_nd->m_value),
- PB_DS_V2F(r_value)));
+ _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),
+ PB_DS_V2F(r_value)));
p_nd->m_p_right = p_new_nd;
-
if (m_p_head->m_p_right == p_nd)
m_p_head->m_p_right = p_new_nd;
}
p_new_nd->m_p_parent = p_nd;
-
p_new_nd->m_p_left = p_new_nd->m_p_right = 0;
-
PB_DS_ASSERT_NODE_CONSISTENT(p_nd)
update_to_top(p_new_nd, (node_update* )this);
-
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_value));)
-
return iterator(p_new_nd);
}
@@ -148,13 +140,10 @@ insert_imp_empty(const_reference r_value)
m_p_head->m_p_parent = p_new_node;
p_new_node->m_p_parent = m_p_head;
-
p_new_node->m_p_left = p_new_node->m_p_right = 0;
-
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_value));)
update_to_top(m_p_head->m_p_parent, (node_update*)this);
-
return iterator(p_new_node);
}
@@ -164,18 +153,14 @@ PB_DS_CLASS_C_DEC::
get_new_node_for_leaf_insert(const_reference r_val, false_type)
{
node_pointer p_new_nd = s_node_allocator.allocate(1);
-
cond_dealtor_t cond(p_new_nd);
new (const_cast<void* >(static_cast<const void* >(&p_new_nd->m_value)))
typename node::value_type(r_val);
cond.set_no_action();
-
p_new_nd->m_p_left = p_new_nd->m_p_right = 0;
-
++m_size;
-
return p_new_nd;
}
@@ -190,9 +175,6 @@ get_new_node_for_leaf_insert(const_reference r_val, true_type)
typename node::value_type(r_val);
p_new_nd->m_p_left = p_new_nd->m_p_right = 0;
-
++m_size;
-
return p_new_nd;
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
index e5f6a4d7361..8076084aefd 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file iterators_fn_imps.hpp
+ * @file bin_search_tree_/iterators_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
@@ -103,11 +103,11 @@ rend() const
}
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
node_begin() const
{
- return (const_node_iterator(m_p_head->m_p_parent));
+ return (node_const_iterator(m_p_head->m_p_parent));
}
PB_DS_CLASS_T_DEC
@@ -119,11 +119,11 @@ node_begin()
}
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
node_end() const
{
- return (const_node_iterator(0));
+ return (node_const_iterator(0));
}
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
index b4ea45376a8..d64bdf75d9c 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file node_iterators.hpp
+ * @file bin_search_tree_/node_iterators.hpp
* Contains an implementation class for bin_search_tree_.
*/
@@ -47,31 +47,27 @@ namespace __gnu_pbds
{
namespace detail
{
-
#define PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC \
bin_search_tree_const_node_it_< \
Node, \
Const_Iterator, \
Iterator, \
- Allocator>
+ _Alloc>
- // Const node iterator.
+ /// Const node iterator.
template<typename Node,
class Const_Iterator,
class Iterator,
- class Allocator>
+ typename _Alloc>
class bin_search_tree_const_node_it_
{
private:
-
- private:
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
Node>::other::pointer
node_pointer;
public:
-
// Category.
typedef trivial_iterator_tag iterator_category;
@@ -92,11 +88,9 @@ namespace __gnu_pbds
// Const metadata reference type.
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
metadata_type>::other::const_reference
- const_metadata_reference;
-
- public:
+ metadata_const_reference;
// Default constructor.
/*
@@ -105,7 +99,8 @@ namespace __gnu_pbds
*/
inline
- bin_search_tree_const_node_it_(const node_pointer p_nd = 0) : m_p_nd(const_cast<node_pointer>(p_nd))
+ bin_search_tree_const_node_it_(const node_pointer p_nd = 0)
+ : m_p_nd(const_cast<node_pointer>(p_nd))
{ }
// Access.
@@ -116,7 +111,7 @@ namespace __gnu_pbds
}
// Metadata access.
- inline const_metadata_reference
+ inline metadata_const_reference
get_metadata() const
{
return (m_p_nd->get_metadata());
@@ -150,7 +145,6 @@ namespace __gnu_pbds
return (m_p_nd != other.m_p_nd);
}
- public:
node_pointer m_p_nd;
};
@@ -159,26 +153,23 @@ namespace __gnu_pbds
Node, \
Const_Iterator, \
Iterator, \
- Allocator>
+ _Alloc>
- // Node iterator.
+ /// Node iterator.
template<typename Node,
class Const_Iterator,
class Iterator,
- class Allocator>
- class bin_search_tree_node_it_ :
- public PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
-
+ typename _Alloc>
+ class bin_search_tree_node_it_
+ : public PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
{
-
private:
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
Node>::other::pointer
node_pointer;
public:
-
// __Iterator's value type.
typedef Iterator value_type;
@@ -188,8 +179,6 @@ namespace __gnu_pbds
// __Iterator's __const reference type.
typedef Iterator const_reference;
- public:
-
// Default constructor.
/*
inline
@@ -197,8 +186,8 @@ namespace __gnu_pbds
*/
inline
- bin_search_tree_node_it_(const node_pointer p_nd = 0) : PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(
- const_cast<node_pointer>(p_nd))
+ bin_search_tree_node_it_(const node_pointer p_nd = 0)
+ : PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(const_cast<node_pointer>(p_nd))
{ }
// Access.
@@ -227,7 +216,6 @@ namespace __gnu_pbds
};
#undef PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
-
#undef PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC
} // namespace detail
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
index 959df68a168..d99924878c3 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file point_iterators.hpp
+ * @file bin_search_tree_/point_iterators.hpp
* Contains an implementation class for bin_search_tree_.
*/
@@ -58,7 +58,7 @@ namespace __gnu_pbds
Reference, \
Const_Reference, \
Is_Forward_Iterator, \
- Allocator>
+ _Alloc>
#define PB_DS_TREE_CONST_ODIR_IT_C_DEC \
bin_search_tree_const_it_< \
@@ -69,7 +69,7 @@ namespace __gnu_pbds
Reference, \
Const_Reference, \
!Is_Forward_Iterator, \
- Allocator>
+ _Alloc>
#define PB_DS_TREE_IT_C_DEC \
bin_search_tree_it_< \
@@ -80,7 +80,7 @@ namespace __gnu_pbds
Reference, \
Const_Reference, \
Is_Forward_Iterator, \
- Allocator>
+ _Alloc>
#define PB_DS_TREE_ODIR_IT_C_DEC \
bin_search_tree_it_< \
@@ -91,9 +91,9 @@ namespace __gnu_pbds
Reference, \
Const_Reference, \
!Is_Forward_Iterator, \
- Allocator>
+ _Alloc>
- // Const iterator.
+ /// Const iterator.
template<typename Node_Pointer,
typename Value_Type,
typename Pointer,
@@ -101,27 +101,17 @@ namespace __gnu_pbds
typename Reference,
typename Const_Reference,
bool Is_Forward_Iterator,
- class Allocator>
+ typename _Alloc>
class bin_search_tree_const_it_
{
-
- public:
-
- typedef std::bidirectional_iterator_tag iterator_category;
-
- typedef typename Allocator::difference_type difference_type;
-
- typedef Value_Type value_type;
-
- typedef Pointer pointer;
-
- typedef Const_Pointer const_pointer;
-
- typedef Reference reference;
-
- typedef Const_Reference const_reference;
-
public:
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef Value_Type value_type;
+ typedef Pointer pointer;
+ typedef Const_Pointer const_pointer;
+ typedef Reference reference;
+ typedef Const_Reference const_reference;
inline
bin_search_tree_const_it_(const Node_Pointer p_nd = 0)
@@ -280,7 +270,7 @@ namespace __gnu_pbds
Node_Pointer m_p_nd;
};
- // Iterator.
+ /// Iterator.
template<typename Node_Pointer,
typename Value_Type,
typename Pointer,
@@ -288,14 +278,10 @@ namespace __gnu_pbds
typename Reference,
typename Const_Reference,
bool Is_Forward_Iterator,
- class Allocator>
- class bin_search_tree_it_ :
- public PB_DS_TREE_CONST_IT_C_DEC
-
+ typename _Alloc>
+ class bin_search_tree_it_ : public PB_DS_TREE_CONST_IT_C_DEC
{
-
public:
-
inline
bin_search_tree_it_(const Node_Pointer p_nd = 0)
: PB_DS_TREE_CONST_IT_C_DEC((Node_Pointer)p_nd)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
index 63f307d39d9..5b71c407f7f 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file policy_access_fn_imps.hpp
+ * @file bin_search_tree_/policy_access_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
@@ -42,15 +42,11 @@ PB_DS_CLASS_T_DEC
Cmp_Fn&
PB_DS_CLASS_C_DEC::
get_cmp_fn()
-{
- return (*this);
-}
+{ return (*this); }
PB_DS_CLASS_T_DEC
const Cmp_Fn&
PB_DS_CLASS_C_DEC::
get_cmp_fn() const
-{
- return (*this);
-}
+{ return (*this); }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
index bcf3ce6321f..cfcccadb182 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file r_erase_fn_imps.hpp
+ * @file bin_search_tree_/r_erase_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
@@ -45,11 +45,8 @@ actual_erase_node(node_pointer p_z)
{
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
--m_size;
-
_GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_z->m_value));)
-
p_z->~node();
-
s_node_allocator.deallocate(p_z, 1);
}
@@ -61,24 +58,19 @@ update_min_max_for_erased_node(node_pointer p_z)
if (m_size == 1)
{
m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;
-
return;
}
if (m_p_head->m_p_left == p_z)
{
iterator it(p_z);
-
++it;
-
m_p_head->m_p_left = it.m_p_nd;
}
else if (m_p_head->m_p_right == p_z)
{
iterator it(p_z);
-
--it;
-
m_p_head->m_p_right = it.m_p_nd;
}
}
@@ -89,15 +81,10 @@ PB_DS_CLASS_C_DEC::
clear()
{
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
-
- clear_imp(m_p_head->m_p_parent);
-
+ clear_imp(m_p_head->m_p_parent);
m_size = 0;
-
initialize();
-
_GLIBCXX_DEBUG_ONLY(debug_base::clear();)
-
PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
}
@@ -110,11 +97,7 @@ clear_imp(node_pointer p_nd)
return;
clear_imp(p_nd->m_p_left);
-
clear_imp(p_nd->m_p_right);
-
p_nd->~Node();
-
s_node_allocator.deallocate(p_nd, 1);
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
index c2090a17842..63c757cc136 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file rotate_fn_imps.hpp
+ * @file bin_search_tree_/rotate_fn_imps.hpp
* Contains imps for rotating nodes.
*/
@@ -130,7 +130,7 @@ PB_DS_CLASS_C_DEC::
apply_update(node_pointer p_nd, Node_Update_* /*p_update*/)
{
node_update::operator()(node_iterator(p_nd),
- const_node_iterator(static_cast<node_pointer>(0)));
+ node_const_iterator(static_cast<node_pointer>(0)));
}
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
index 00fbdf42612..be2fd344ccf 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file split_join_fn_imps.hpp
+ * @file bin_search_tree_/split_join_fn_imps.hpp
* Contains an implementation class for bin_search_tree_.
*/
@@ -85,7 +85,7 @@ join_finish(PB_DS_CLASS_C_DEC& other)
PB_DS_CLASS_T_DEC
bool
PB_DS_CLASS_C_DEC::
-split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
+split_prep(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
index 58c30c3fe52..3066c381f42 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file traits.hpp
+ * @file bin_search_tree_/traits.hpp
* Contains an implementation for bin_search_tree_.
*/
@@ -48,34 +48,28 @@ namespace __gnu_pbds
{
namespace detail
{
-
+ /// Binary search tree traits, primary template.
template<typename Key,
typename Mapped,
class Cmp_Fn,
- template<typename Const_Node_Iterator,
- class Node_Iterator,
+ template<typename Node_CItr,
+ class Node_Itr,
class Cmp_Fn,
- class Allocator>
+ typename _Alloc>
class Node_Update,
class Node,
- class Allocator>
+ typename _Alloc>
struct bin_search_tree_traits
{
private:
- typedef
- types_traits<
- Key,
- Mapped,
- Allocator,
- false>
- type_traits;
+ typedef types_traits<Key, Mapped, _Alloc, false> type_traits;
public:
typedef Node node;
typedef
bin_search_tree_const_it_<
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
node>::other::pointer,
typename type_traits::value_type,
typename type_traits::pointer,
@@ -83,12 +77,12 @@ namespace __gnu_pbds
typename type_traits::reference,
typename type_traits::const_reference,
true,
- Allocator>
- const_point_iterator;
+ _Alloc>
+ point_const_iterator;
typedef
bin_search_tree_it_<
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
node>::other::pointer,
typename type_traits::value_type,
typename type_traits::pointer,
@@ -96,12 +90,12 @@ namespace __gnu_pbds
typename type_traits::reference,
typename type_traits::const_reference,
true,
- Allocator>
+ _Alloc>
point_iterator;
typedef
bin_search_tree_const_it_<
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
node>::other::pointer,
typename type_traits::value_type,
typename type_traits::pointer,
@@ -109,12 +103,12 @@ namespace __gnu_pbds
typename type_traits::reference,
typename type_traits::const_reference,
false,
- Allocator>
+ _Alloc>
const_reverse_iterator;
typedef
bin_search_tree_it_<
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
node>::other::pointer,
typename type_traits::value_type,
typename type_traits::pointer,
@@ -122,74 +116,69 @@ namespace __gnu_pbds
typename type_traits::reference,
typename type_traits::const_reference,
false,
- Allocator>
+ _Alloc>
reverse_iterator;
typedef
bin_search_tree_const_node_it_<
Node,
- const_point_iterator,
+ point_const_iterator,
point_iterator,
- Allocator>
- const_node_iterator;
+ _Alloc>
+ node_const_iterator;
typedef
bin_search_tree_node_it_<
Node,
- const_point_iterator,
+ point_const_iterator,
point_iterator,
- Allocator>
+ _Alloc>
node_iterator;
typedef
Node_Update<
- const_node_iterator,
+ node_const_iterator,
node_iterator,
Cmp_Fn,
- Allocator>
+ _Alloc>
node_update;
typedef
- __gnu_pbds::null_tree_node_update<
- const_node_iterator,
+ __gnu_pbds::null_node_update<
+ node_const_iterator,
node_iterator,
Cmp_Fn,
- Allocator>*
+ _Alloc>*
null_node_update_pointer;
};
+ /// Specialization.
template<typename Key,
class Cmp_Fn,
- template<typename Const_Node_Iterator,
- class Node_Iterator,
+ template<typename Node_CItr,
+ class Node_Itr,
class Cmp_Fn,
- class Allocator>
+ typename _Alloc>
class Node_Update,
class Node,
- class Allocator>
+ typename _Alloc>
struct bin_search_tree_traits<
Key,
- null_mapped_type,
+ null_type,
Cmp_Fn,
Node_Update,
Node,
- Allocator>
+ _Alloc>
{
private:
- typedef
- types_traits<
- Key,
- null_mapped_type,
- Allocator,
- false>
- type_traits;
+ typedef types_traits<Key, null_type, _Alloc, false> type_traits;
public:
typedef Node node;
typedef
bin_search_tree_const_it_<
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
node>::other::pointer,
typename type_traits::value_type,
typename type_traits::pointer,
@@ -197,14 +186,14 @@ namespace __gnu_pbds
typename type_traits::reference,
typename type_traits::const_reference,
true,
- Allocator>
- const_point_iterator;
+ _Alloc>
+ point_const_iterator;
- typedef const_point_iterator point_iterator;
+ typedef point_const_iterator point_iterator;
typedef
bin_search_tree_const_it_<
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
node>::other::pointer,
typename type_traits::value_type,
typename type_traits::pointer,
@@ -212,7 +201,7 @@ namespace __gnu_pbds
typename type_traits::reference,
typename type_traits::const_reference,
false,
- Allocator>
+ _Alloc>
const_reverse_iterator;
typedef const_reverse_iterator reverse_iterator;
@@ -220,27 +209,23 @@ namespace __gnu_pbds
typedef
bin_search_tree_const_node_it_<
Node,
- const_point_iterator,
+ point_const_iterator,
point_iterator,
- Allocator>
- const_node_iterator;
+ _Alloc>
+ node_const_iterator;
- typedef const_node_iterator node_iterator;
+ typedef node_const_iterator node_iterator;
typedef
- Node_Update<
- const_node_iterator,
- node_iterator,
- Cmp_Fn,
- Allocator>
+ Node_Update<node_const_iterator, node_iterator, Cmp_Fn, _Alloc>
node_update;
typedef
- __gnu_pbds::null_tree_node_update<
- const_node_iterator,
+ __gnu_pbds::null_node_update<
+ node_const_iterator,
node_iterator,
Cmp_Fn,
- Allocator>*
+ _Alloc>*
null_node_update_pointer;
};
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
index 4d65d2b6826..ee408e8ea02 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
@@ -34,17 +34,13 @@
// warranty.
/**
- * @file binary_heap_.hpp
+ * @file binary_heap_/binary_heap_.hpp
* Contains an implementation class for a binary heap.
*/
#ifndef PB_DS_BINARY_HEAP_HPP
#define PB_DS_BINARY_HEAP_HPP
-/*
- * Based on CLRS.
- */
-
#include <queue>
#include <algorithm>
#include <ext/pb_ds/detail/cond_dealtor.hpp>
@@ -53,7 +49,7 @@
#include <ext/pb_ds/detail/binary_heap_/entry_cmp.hpp>
#include <ext/pb_ds/detail/binary_heap_/entry_pred.hpp>
#include <ext/pb_ds/detail/binary_heap_/resize_policy.hpp>
-#include <ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp>
#include <ext/pb_ds/detail/binary_heap_/const_iterator.hpp>
#ifdef PB_DS_BINARY_HEAP_TRACE_
#include <iostream>
@@ -66,126 +62,85 @@ namespace __gnu_pbds
namespace detail
{
#define PB_DS_CLASS_T_DEC \
- template<typename Value_Type, class Cmp_Fn, class Allocator>
+ template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
- binary_heap_<Value_Type, Cmp_Fn, Allocator>
+ binary_heap<Value_Type, Cmp_Fn, _Alloc>
#define PB_DS_ENTRY_CMP_DEC \
- entry_cmp<Value_Type, Cmp_Fn, is_simple<Value_Type>::value, Allocator>::type
+ entry_cmp<Value_Type, Cmp_Fn, _Alloc, is_simple<Value_Type>::value>::type
#define PB_DS_RESIZE_POLICY_DEC \
- __gnu_pbds::detail::resize_policy<typename Allocator::size_type>
+ __gnu_pbds::detail::resize_policy<typename _Alloc::size_type>
/**
- * class description = "Base class for some types of h3ap$">
- **/
- template<typename Value_Type, class Cmp_Fn, class Allocator>
- class binary_heap_ : public PB_DS_ENTRY_CMP_DEC,
- public PB_DS_RESIZE_POLICY_DEC
+ * @brief Binary heaps composed of resize and compare policies.
+ *
+ * Based on CLRS.
+ */
+ template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
+ class binary_heap
+ : public PB_DS_ENTRY_CMP_DEC, public PB_DS_RESIZE_POLICY_DEC
{
+ public:
+ typedef Value_Type value_type;
+ typedef Cmp_Fn cmp_fn;
+ typedef _Alloc allocator_type;
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef typename PB_DS_ENTRY_CMP_DEC entry_cmp;
+ typedef PB_DS_RESIZE_POLICY_DEC resize_policy;
+ typedef cond_dealtor<value_type, _Alloc> cond_dealtor_t;
private:
enum
{
- simple_value = is_simple<Value_Type>::value
+ simple_value = is_simple<value_type>::value
};
- typedef integral_constant<int, simple_value> no_throw_copies_t;
-
- typedef
- typename Allocator::template rebind<
- Value_Type>::other
- value_allocator;
-
- typedef
- typename __conditional_type<
- simple_value,
- Value_Type,
- typename value_allocator::pointer>::__type
- entry;
+ typedef integral_constant<int, simple_value> no_throw_copies_t;
- typedef
- typename Allocator::template rebind<
- entry>::other
- entry_allocator;
-
- typedef typename entry_allocator::pointer entry_pointer;
-
- typedef typename PB_DS_ENTRY_CMP_DEC entry_cmp;
-
- typedef PB_DS_RESIZE_POLICY_DEC resize_policy;
-
- typedef
- cond_dealtor<
- Value_Type,
- Allocator>
- cond_dealtor_t;
+ typedef typename _Alloc::template rebind<value_type> __rebind_v;
+ typedef typename __rebind_v::other value_allocator;
public:
+ typedef typename value_allocator::pointer pointer;
+ typedef typename value_allocator::const_pointer const_pointer;
+ typedef typename value_allocator::reference reference;
+ typedef typename value_allocator::const_reference const_reference;
- typedef typename Allocator::size_type size_type;
-
- typedef typename Allocator::difference_type difference_type;
+ typedef typename __conditional_type<simple_value,
+ value_type, pointer>::__type
+ entry;
- typedef Value_Type value_type;
+ typedef typename _Alloc::template rebind<entry>::other
+ entry_allocator;
- typedef
- typename Allocator::template rebind<
- value_type>::other::pointer
- pointer;
+ typedef typename entry_allocator::pointer entry_pointer;
- typedef
- typename Allocator::template rebind<
- value_type>::other::const_pointer
- const_pointer;
+ typedef binary_heap_point_const_iterator_<value_type, entry,
+ simple_value, _Alloc>
+ point_const_iterator;
- typedef
- typename Allocator::template rebind<
- value_type>::other::reference
- reference;
+ typedef point_const_iterator point_iterator;
- typedef
- typename Allocator::template rebind<
- value_type>::other::const_reference
- const_reference;
+ typedef binary_heap_const_iterator_<value_type, entry,
+ simple_value, _Alloc>
+ const_iterator;
- typedef
- binary_heap_const_point_iterator_<
- value_type,
- entry,
- simple_value,
- Allocator>
- const_point_iterator;
+ typedef const_iterator iterator;
- typedef const_point_iterator point_iterator;
- typedef
- binary_heap_const_iterator_<
- value_type,
- entry,
- simple_value,
- Allocator>
- const_iterator;
+ binary_heap();
- typedef const_iterator iterator;
+ binary_heap(const cmp_fn&);
- typedef Cmp_Fn cmp_fn;
-
- typedef Allocator allocator_type;
-
- public:
-
- binary_heap_();
-
- binary_heap_(const Cmp_Fn& r_cmp_fn);
-
- binary_heap_(const PB_DS_CLASS_C_DEC& other);
+ binary_heap(const binary_heap&);
void
- swap(PB_DS_CLASS_C_DEC& other);
+ swap(binary_heap&);
- ~binary_heap_();
+ ~binary_heap();
inline bool
empty() const;
@@ -196,17 +151,17 @@ namespace __gnu_pbds
inline size_type
max_size() const;
- Cmp_Fn&
+ Cmp_Fn&
get_cmp_fn();
- const Cmp_Fn&
+ const Cmp_Fn&
get_cmp_fn() const;
inline point_iterator
- push(const_reference r_val);
+ push(const_reference);
void
- modify(point_iterator it, const_reference r_new_val);
+ modify(point_iterator, const_reference);
inline const_reference
top() const;
@@ -215,17 +170,17 @@ namespace __gnu_pbds
pop();
inline void
- erase(point_iterator it);
+ erase(point_iterator);
template<typename Pred>
- typename PB_DS_CLASS_C_DEC::size_type
- erase_if(Pred pred);
+ size_type
+ erase_if(Pred);
- inline static void
- erase_at(entry_pointer a_entries, size_type size, false_type);
+ inline void
+ erase_at(entry_pointer, size_type, false_type);
- inline static void
- erase_at(entry_pointer a_entries, size_type size, true_type);
+ inline void
+ erase_at(entry_pointer, size_type, true_type);
inline iterator
begin();
@@ -243,48 +198,43 @@ namespace __gnu_pbds
clear();
template<typename Pred>
- void
- split(Pred pred, PB_DS_CLASS_C_DEC& other);
+ void
+ split(Pred, binary_heap&);
void
- join(PB_DS_CLASS_C_DEC& other);
+ join(binary_heap&);
#ifdef PB_DS_BINARY_HEAP_TRACE_
void
trace() const;
-#endif
+#endif
protected:
-
template<typename It>
- void
- copy_from_range(It first_it, It last_it);
+ void
+ copy_from_range(It, It);
private:
-
void
- value_swap(PB_DS_CLASS_C_DEC& other);
-
- inline void
- insert_value(const_reference r_val, false_type);
+ value_swap(binary_heap&);
inline void
- insert_value(value_type val, true_type);
+ insert_value(const_reference, false_type);
inline void
- insert_entry(entry e);
+ insert_value(value_type, true_type);
inline void
resize_for_insert_if_needed();
inline void
- swap_value_imp(entry_pointer p_e, value_type new_val, true_type);
+ swap_value_imp(entry_pointer, value_type, true_type);
inline void
- swap_value_imp(entry_pointer p_e, const_reference r_new_val, false_type);
+ swap_value_imp(entry_pointer, const_reference, false_type);
void
- fix(entry_pointer p_e);
+ fix(entry_pointer);
inline const_reference
top_imp(true_type) const;
@@ -293,48 +243,91 @@ namespace __gnu_pbds
top_imp(false_type) const;
inline static size_type
- left_child(size_type i);
+ left_child(size_type);
inline static size_type
- right_child(size_type i);
+ right_child(size_type);
inline static size_type
- parent(size_type i);
+ parent(size_type);
inline void
resize_for_erase_if_needed();
template<typename Pred>
size_type
- partition(Pred pred);
+ partition(Pred);
-#ifdef _GLIBCXX_DEBUG
void
- assert_valid(const char* file, int line) const;
-#endif
+ make_heap()
+ {
+ const entry_cmp& m_cmp = static_cast<entry_cmp&>(*this);
+ entry_pointer end = m_a_entries + m_size;
+ std::make_heap(m_a_entries, end, m_cmp);
+ _GLIBCXX_DEBUG_ASSERT(is_heap());
+ }
-#ifdef PB_DS_BINARY_HEAP_TRACE_
void
- trace_entry(const entry& r_e, false_type) const;
+ push_heap()
+ {
+ if (!is_heap())
+ make_heap();
+ else
+ {
+ const entry_cmp& m_cmp = static_cast<entry_cmp&>(*this);
+ entry_pointer end = m_a_entries + m_size;
+ std::push_heap(m_a_entries, end, m_cmp);
+ }
+ }
void
- trace_entry(const entry& r_e, true_type) const;
-#endif
+ pop_heap()
+ {
+ const entry_cmp& m_cmp = static_cast<entry_cmp&>(*this);
+ entry_pointer end = m_a_entries + m_size;
+ std::pop_heap(m_a_entries, end, m_cmp);
+ }
+
+ bool
+ is_heap()
+ {
+ const entry_cmp& m_cmp = static_cast<entry_cmp&>(*this);
+ entry_pointer end = m_a_entries + m_size;
+ bool p = std::__is_heap(m_a_entries, end, m_cmp);
+ return p;
+ }
- private:
- static entry_allocator s_entry_allocator;
-
- static value_allocator s_value_allocator;
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid(const char*, int) const;
+#endif
- static no_throw_copies_t s_no_throw_copies_ind;
+#ifdef PB_DS_BINARY_HEAP_TRACE_
+ void
+ trace_entry(const entry&, false_type) const;
- size_type m_size;
+ void
+ trace_entry(const entry&, true_type) const;
+#endif
- size_type m_actual_size;
+ static entry_allocator s_entry_allocator;
+ static value_allocator s_value_allocator;
+ static no_throw_copies_t s_no_throw_copies_ind;
- entry_pointer m_a_entries;
+ size_type m_size;
+ size_type m_actual_size;
+ entry_pointer m_a_entries;
};
+#define PB_DS_ASSERT_VALID(X) \
+ _GLIBCXX_DEBUG_ONLY(X.assert_valid(__FILE__, __LINE__);)
+
+#define PB_DS_DEBUG_VERIFY(_Cond) \
+ _GLIBCXX_DEBUG_VERIFY_AT(_Cond, \
+ _M_message(#_Cond" assertion from %1;:%2;") \
+ ._M_string(__FILE__)._M_integer(__LINE__) \
+ ,__file,__line)
+
#include <ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp>
#include <ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp>
@@ -354,4 +347,4 @@ namespace __gnu_pbds
} // namespace detail
} // namespace __gnu_pbds
-#endif
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
index aa86f5ea4f5..a6ac261b9ba 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file const_iterator.hpp
+ * @file binary_heap_/const_iterator.hpp
* Contains an iterator class returned by the table's const find and insert
* methods.
*/
@@ -42,57 +42,48 @@
#ifndef PB_DS_BINARY_HEAP_CONST_ITERATOR_HPP
#define PB_DS_BINARY_HEAP_CONST_ITERATOR_HPP
-#include <ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
+#define PB_DS_BIN_HEAP_CIT_BASE \
+ binary_heap_point_const_iterator_<Value_Type, Entry, Simple, _Alloc>
-#define PB_DS_CLASS_C_DEC \
- binary_heap_const_iterator_<Value_Type, Entry, Simple, Allocator>
-
-#define PB_DS_BASE_C_DEC \
- binary_heap_const_point_iterator_<Value_Type, Entry, Simple, Allocator>
-
- // Const point-type iterator.
+ /// Const point-type iterator.
template<typename Value_Type,
typename Entry,
bool Simple,
- class Allocator>
- class binary_heap_const_iterator_ : public PB_DS_BASE_C_DEC
+ typename _Alloc>
+ class binary_heap_const_iterator_ : public PB_DS_BIN_HEAP_CIT_BASE
{
-
private:
- typedef typename PB_DS_BASE_C_DEC::entry_pointer entry_pointer;
-
- typedef PB_DS_BASE_C_DEC base_type;
+ typedef PB_DS_BIN_HEAP_CIT_BASE base_type;
+ typedef typename base_type::entry_pointer entry_pointer;
public:
-
// Category.
- typedef std::forward_iterator_tag iterator_category;
+ typedef std::forward_iterator_tag iterator_category;
// Difference type.
- typedef typename Allocator::difference_type difference_type;
+ typedef typename _Alloc::difference_type difference_type;
// Iterator's value type.
- typedef typename base_type::value_type value_type;
+ typedef typename base_type::value_type value_type;
// Iterator's pointer type.
- typedef typename base_type::pointer pointer;
+ typedef typename base_type::pointer pointer;
// Iterator's const pointer type.
- typedef typename base_type::const_pointer const_pointer;
+ typedef typename base_type::const_pointer const_pointer;
// Iterator's reference type.
- typedef typename base_type::reference reference;
+ typedef typename base_type::reference reference;
// Iterator's const reference type.
- typedef typename base_type::const_reference const_reference;
-
- public:
+ typedef typename base_type::const_reference const_reference;
inline
binary_heap_const_iterator_(entry_pointer p_e) : base_type(p_e)
@@ -105,24 +96,21 @@ namespace __gnu_pbds
// Copy constructor.
inline
- binary_heap_const_iterator_(const PB_DS_CLASS_C_DEC& other) : base_type(other)
+ binary_heap_const_iterator_(const binary_heap_const_iterator_& other)
+ : base_type(other)
{ }
// Compares content to a different iterator object.
inline bool
- operator==(const PB_DS_CLASS_C_DEC& other) const
- {
- return base_type::m_p_e == other.m_p_e;
- }
+ operator==(const binary_heap_const_iterator_& other) const
+ { return base_type::m_p_e == other.m_p_e; }
// Compares content (negatively) to a different iterator object.
inline bool
- operator!=(const PB_DS_CLASS_C_DEC& other) const
- {
- return base_type::m_p_e != other.m_p_e;
- }
+ operator!=(const binary_heap_const_iterator_& other) const
+ { return base_type::m_p_e != other.m_p_e; }
- inline PB_DS_CLASS_C_DEC&
+ inline binary_heap_const_iterator_&
operator++()
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_p_e != 0);
@@ -130,10 +118,10 @@ namespace __gnu_pbds
return *this;
}
- inline PB_DS_CLASS_C_DEC
+ inline binary_heap_const_iterator_
operator++(int)
{
- PB_DS_CLASS_C_DEC ret_it(base_type::m_p_e);
+ binary_heap_const_iterator_ ret_it(base_type::m_p_e);
operator++();
return ret_it;
}
@@ -144,8 +132,7 @@ namespace __gnu_pbds
{ ++base_type::m_p_e; }
};
-#undef PB_DS_CLASS_C_DEC
-#undef PB_DS_BASE_C_DEC
+#undef PB_DS_BIN_HEAP_CIT_BASE
} // namespace detail
} // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
index bdaa7ff7806..9602385fbb1 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
@@ -35,7 +35,7 @@
// warranty.
/**
- * @file constructors_destructor_fn_imps.hpp
+ * @file binary_heap_/constructors_destructor_fn_imps.hpp
* Contains an implementation class for binary_heap_.
*/
@@ -62,55 +62,37 @@ copy_from_range(It first_it, It last_it)
insert_value(*first_it, s_no_throw_copies_ind);
++first_it;
}
-
- std::make_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));
-
- PB_DS_ASSERT_VALID((*this))
+ make_heap();
+ PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-binary_heap_() :
- m_size(0),
- m_actual_size(resize_policy::min_size),
+binary_heap()
+: m_size(0), m_actual_size(resize_policy::min_size),
m_a_entries(s_entry_allocator.allocate(m_actual_size))
-{
- PB_DS_ASSERT_VALID((*this))
-}
+{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-binary_heap_(const Cmp_Fn& r_cmp_fn) :
- entry_cmp(r_cmp_fn),
- m_size(0),
- m_actual_size(resize_policy::min_size),
+binary_heap(const Cmp_Fn& r_cmp_fn)
+: entry_cmp(r_cmp_fn), m_size(0), m_actual_size(resize_policy::min_size),
m_a_entries(s_entry_allocator.allocate(m_actual_size))
-{
- PB_DS_ASSERT_VALID((*this))
-}
+{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-binary_heap_(const PB_DS_CLASS_C_DEC& other) :
- entry_cmp(other),
- resize_policy(other),
- m_size(0),
+binary_heap(const PB_DS_CLASS_C_DEC& other)
+: entry_cmp(other), resize_policy(other), m_size(0),
m_actual_size(other.m_actual_size),
m_a_entries(s_entry_allocator.allocate(m_actual_size))
{
PB_DS_ASSERT_VALID(other)
_GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries);
- const_iterator first_it = other.begin();
- const_iterator last_it = other.end();
-
__try
{
- while (first_it != last_it)
- {
- insert_value(*first_it, s_no_throw_copies_ind);
- ++first_it;
- }
+ copy_from_range(other.begin(), other.end());
}
__catch(...)
{
@@ -131,9 +113,8 @@ swap(PB_DS_CLASS_C_DEC& other)
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
_GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries);
-
value_swap(other);
- std::swap((entry_cmp& )(*this), (entry_cmp& )other);
+ std::swap((entry_cmp&)(*this), (entry_cmp&)other);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
@@ -151,10 +132,9 @@ value_swap(PB_DS_CLASS_C_DEC& other)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-~binary_heap_()
+~binary_heap()
{
for (size_type i = 0; i < m_size; ++i)
erase_at(m_a_entries, i, s_no_throw_copies_ind);
s_entry_allocator.deallocate(m_a_entries, m_actual_size);
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
index a2c6f307f17..b1b0f5ba1b9 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_fn_imps.hpp
+ * @file binary_heap_/debug_fn_imps.hpp
* Contains an implementation class for a binary_heap.
*/
@@ -47,7 +47,7 @@ assert_valid(const char* __file, int __line) const
{
#ifdef PB_DS_REGRESSION
s_entry_allocator.check_allocated(m_a_entries, m_actual_size);
-#endif
+#endif
resize_policy::assert_valid(__file, __line);
PB_DS_DEBUG_VERIFY(m_size <= m_actual_size);
@@ -55,7 +55,7 @@ assert_valid(const char* __file, int __line) const
{
#ifdef PB_DS_REGRESSION
s_value_allocator.check_allocated(m_a_entries[i], 1);
-#endif
+#endif
if (left_child(i) < m_size)
PB_DS_DEBUG_VERIFY(!entry_cmp::operator()(m_a_entries[i], m_a_entries[left_child(i)]));
@@ -69,4 +69,4 @@ assert_valid(const char* __file, int __line) const
}
}
-#endif
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
index b0a9b5b0d92..42e799fc8bd 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file entry_cmp.hpp
+ * @file binary_heap_/entry_cmp.hpp
* Contains an implementation class for a binary_heap.
*/
@@ -45,48 +45,40 @@ namespace __gnu_pbds
{
namespace detail
{
+ /// Entry compare, primary template.
+ template<typename _VTp, typename Cmp_Fn, typename _Alloc, bool No_Throw>
+ struct entry_cmp;
- template<typename Value_Type,
- class Cmp_Fn,
- bool No_Throw,
- class Allocator>
- struct entry_cmp
- {
- typedef Cmp_Fn type;
- };
-
- template<typename Value_Type, class Cmp_Fn, class Allocator>
- struct entry_cmp<
- Value_Type,
- Cmp_Fn,
- false,
- Allocator>
- {
- public:
- typedef
- typename Allocator::template rebind<
- Value_Type>::other::const_pointer
- entry;
-
- struct type : public Cmp_Fn
+ /// Specialization, true.
+ template<typename _VTp, typename Cmp_Fn, typename _Alloc>
+ struct entry_cmp<_VTp, Cmp_Fn, _Alloc, true>
{
- public:
- inline
- type()
- { }
+ /// Compare.
+ typedef Cmp_Fn type;
+ };
+
+ /// Specialization, false.
+ template<typename _VTp, typename Cmp_Fn, typename _Alloc>
+ struct entry_cmp<_VTp, Cmp_Fn, _Alloc, false>
+ {
+ private:
+ typedef typename _Alloc::template rebind<_VTp> __rebind_v;
- inline
- type(const Cmp_Fn& other) : Cmp_Fn(other)
- { }
+ public:
+ typedef typename __rebind_v::other::const_pointer entry;
- inline bool
- operator()(entry p_lhs, entry p_rhs) const
+ /// Compare plus entry.
+ struct type : public Cmp_Fn
{
- return Cmp_Fn::operator()(*p_lhs, * p_rhs);
- }
- };
- };
+ type() { }
+ type(const Cmp_Fn& other) : Cmp_Fn(other) { }
+
+ bool
+ operator()(entry lhs, entry rhs) const
+ { return Cmp_Fn::operator()(*lhs, *rhs); }
+ };
+ };
} // namespace detail
} // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
index 185529e15e3..001876ef1f0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file entry_pred.hpp
+ * @file binary_heap_/entry_pred.hpp
* Contains an implementation class for a binary_heap.
*/
@@ -45,48 +45,40 @@ namespace __gnu_pbds
{
namespace detail
{
+ /// Entry predicate primary class template.
+ template<typename _VTp, typename Pred, typename _Alloc, bool No_Throw>
+ struct entry_pred;
- template<typename Value_Type,
- class Pred,
- bool No_Throw,
- class Allocator>
- struct entry_pred
- {
- typedef Pred type;
- };
-
- template<typename Value_Type, class Pred, class Allocator>
- struct entry_pred<
- Value_Type,
- Pred,
- false,
- Allocator>
- {
- public:
- typedef
- typename Allocator::template rebind<
- Value_Type>::other::const_pointer
- entry;
-
- struct type : public Pred
+ /// Specialization, true.
+ template<typename _VTp, typename Pred, typename _Alloc>
+ struct entry_pred<_VTp, Pred, _Alloc, true>
{
- public:
- inline
- type()
- { }
+ typedef Pred type;
+ };
+
+ /// Specialization, false.
+ template<typename _VTp, typename Pred, typename _Alloc>
+ struct entry_pred<_VTp, Pred, _Alloc, false>
+ {
+ private:
+ typedef typename _Alloc::template rebind<_VTp> __rebind_v;
- inline
- type(const Pred& other) : Pred(other)
- { }
+ public:
+ typedef typename __rebind_v::other::const_pointer entry;
- inline bool
- operator()(entry p_v) const
+ struct type : public Pred
{
- return Pred::operator()(*p_v);
- }
- };
- };
+ inline
+ type() { }
+ inline
+ type(const Pred& other) : Pred(other) { }
+
+ inline bool
+ operator()(entry p_v) const
+ { return Pred::operator()(*p_v); }
+ };
+ };
} // namespace detail
} // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp
index 2b6c9b79849..f204d81f603 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp
@@ -35,7 +35,7 @@
// warranty.
/**
- * @file erase_fn_imps.hpp
+ * @file binary_heap_/erase_fn_imps.hpp
* Contains an implementation class for a binary_heap.
*/
@@ -49,23 +49,17 @@ clear()
__try
{
- const size_type actual_size = resize_policy::get_new_size_for_arbitrary(0);
-
- entry_pointer a_entries = s_entry_allocator.allocate(actual_size);
-
- resize_policy::notify_arbitrary(actual_size);
-
+ const size_type new_size = resize_policy::get_new_size_for_arbitrary(0);
+ entry_pointer new_entries = s_entry_allocator.allocate(new_size);
+ resize_policy::notify_arbitrary(new_size);
s_entry_allocator.deallocate(m_a_entries, m_actual_size);
-
- m_actual_size = actual_size;
-
- m_a_entries = a_entries;
+ m_actual_size = new_size;
+ m_a_entries = new_entries;
}
__catch(...)
{ }
m_size = 0;
-
PB_DS_ASSERT_VALID((*this))
}
@@ -92,13 +86,9 @@ pop()
PB_DS_ASSERT_VALID((*this))
_GLIBCXX_DEBUG_ASSERT(!empty());
- erase_at(m_a_entries, 0, s_no_throw_copies_ind);
-
- std::pop_heap(m_a_entries, m_a_entries + m_size,
- static_cast<entry_cmp& >(*this));
-
+ pop_heap();
+ erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind);
resize_for_erase_if_needed();
-
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
--m_size;
@@ -113,43 +103,32 @@ erase_if(Pred pred)
{
PB_DS_ASSERT_VALID((*this))
- typedef typename entry_pred<value_type, Pred, simple_value, Allocator>::type
+ typedef typename entry_pred<value_type, Pred, _Alloc, simple_value>::type
pred_t;
const size_type left = partition(pred_t(pred));
-
_GLIBCXX_DEBUG_ASSERT(m_size >= left);
-
const size_type ersd = m_size - left;
-
for (size_type i = left; i < m_size; ++i)
erase_at(m_a_entries, i, s_no_throw_copies_ind);
__try
{
- const size_type actual_size =
+ const size_type new_size =
resize_policy::get_new_size_for_arbitrary(left);
- entry_pointer a_entries = s_entry_allocator.allocate(actual_size);
-
- std::copy(m_a_entries, m_a_entries + left, a_entries);
-
+ entry_pointer new_entries = s_entry_allocator.allocate(new_size);
+ std::copy(m_a_entries, m_a_entries + left, new_entries);
s_entry_allocator.deallocate(m_a_entries, m_actual_size);
-
- m_actual_size = actual_size;
-
+ m_actual_size = new_size;
resize_policy::notify_arbitrary(m_actual_size);
}
__catch(...)
{ };
m_size = left;
-
- std::make_heap(m_a_entries, m_a_entries + m_size,
- static_cast<entry_cmp& >(*this));
-
+ make_heap();
PB_DS_ASSERT_VALID((*this))
-
return ersd;
}
@@ -162,16 +141,12 @@ erase(point_iterator it)
_GLIBCXX_DEBUG_ASSERT(!empty());
const size_type fix_pos = it.m_p_e - m_a_entries;
-
std::swap(*it.m_p_e, m_a_entries[m_size - 1]);
-
erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind);
-
resize_for_erase_if_needed();
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
--m_size;
-
_GLIBCXX_DEBUG_ASSERT(fix_pos <= m_size);
if (fix_pos != m_size)
@@ -190,21 +165,15 @@ resize_for_erase_if_needed()
__try
{
- const size_type new_actual_size =
- resize_policy::get_new_size_for_shrink();
-
- entry_pointer a_new_entries = s_entry_allocator.allocate(new_actual_size);
-
+ const size_type new_size = resize_policy::get_new_size_for_shrink();
+ entry_pointer new_entries = s_entry_allocator.allocate(new_size);
resize_policy::notify_shrink_resize();
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
- std::copy(m_a_entries, m_a_entries + m_size - 1, a_new_entries);
-
+ std::copy(m_a_entries, m_a_entries + m_size - 1, new_entries);
s_entry_allocator.deallocate(m_a_entries, m_actual_size);
-
- m_actual_size = new_actual_size;
-
- m_a_entries = a_new_entries;
+ m_actual_size = new_size;
+ m_a_entries = new_entries;
}
__catch(...)
{ }
@@ -230,9 +199,7 @@ partition(Pred pred)
else
{
_GLIBCXX_DEBUG_ASSERT(left < right);
-
std::swap(m_a_entries[left], m_a_entries[right]);
-
++left;
--right;
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
index 116e9bcddaa..c445dc0c31f 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file find_fn_imps.hpp
+ * @file binary_heap_/find_fn_imps.hpp
* Contains an implementation class for a binary_heap.
*/
@@ -45,7 +45,6 @@ top() const
{
PB_DS_ASSERT_VALID((*this))
_GLIBCXX_DEBUG_ASSERT(!empty());
-
return top_imp(s_no_throw_copies_ind);
}
@@ -53,39 +52,28 @@ PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_reference
PB_DS_CLASS_C_DEC::
top_imp(true_type) const
-{
- return* m_a_entries;
-}
+{ return *m_a_entries; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_reference
PB_DS_CLASS_C_DEC::
top_imp(false_type) const
-{
- return** m_a_entries;
-}
+{ return **m_a_entries; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
left_child(size_type i)
-{
- return i* 2 + 1;
-}
+{ return i * 2 + 1; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
right_child(size_type i)
-{
- return i* 2 + 2;
-}
+{ return i * 2 + 2; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
parent(size_type i)
-{
- return (i - 1) / 2;
-}
-
+{ return (i - 1) / 2; }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
index d29279318fc..ae36d3181a1 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file info_fn_imps.hpp
+ * @file binary_heap_/info_fn_imps.hpp
* Contains an implementation class for a binary_heap.
*/
@@ -42,23 +42,17 @@ PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
empty() const
-{
- return (m_size == 0);
-}
+{ return m_size == 0; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
size() const
-{
- return (m_size);
-}
+{ return m_size; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
max_size() const
-{
- return (s_entry_allocator.max_size());
-}
+{ return s_entry_allocator.max_size(); }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
index c6c41e57264..1e1ed969e72 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_fn_imps.hpp
+ * @file binary_heap_/insert_fn_imps.hpp
* Contains an implementation class for a binary_heap.
*/
@@ -45,8 +45,7 @@ push(const_reference r_val)
{
PB_DS_ASSERT_VALID((*this))
insert_value(r_val, s_no_throw_copies_ind);
- std::push_heap(m_a_entries, m_a_entries + m_size,
- static_cast<entry_cmp&>(*this));
+ push_heap();
PB_DS_ASSERT_VALID((*this))
return point_iterator(m_a_entries);
}
@@ -57,7 +56,6 @@ PB_DS_CLASS_C_DEC::
insert_value(value_type val, true_type)
{
resize_for_insert_if_needed();
-
m_a_entries[m_size++] = val;
}
@@ -77,15 +75,6 @@ insert_value(const_reference r_val, false_type)
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
-insert_entry(entry e)
-{
- resize_for_insert_if_needed();
- m_a_entries[m_size++] = e;
-}
-
-PB_DS_CLASS_T_DEC
-inline void
-PB_DS_CLASS_C_DEC::
resize_for_insert_if_needed()
{
if (!resize_policy::resize_needed_for_grow(m_size))
@@ -94,13 +83,15 @@ resize_for_insert_if_needed()
return;
}
- const size_type new_actual_size = resize_policy::get_new_size_for_grow();
- entry_pointer a_new_entries = s_entry_allocator.allocate(new_actual_size);
+ const size_type new_size = resize_policy::get_new_size_for_grow();
+ entry_pointer new_entries = s_entry_allocator.allocate(new_size);
resize_policy::notify_grow_resize();
- std::copy(m_a_entries, m_a_entries + m_size, a_new_entries);
+
+ std::copy(m_a_entries, m_a_entries + m_size, new_entries);
s_entry_allocator.deallocate(m_a_entries, m_actual_size);
- m_actual_size = new_actual_size;
- m_a_entries = a_new_entries;
+ m_actual_size = new_size;
+ m_a_entries = new_entries;
+ make_heap();
}
PB_DS_CLASS_T_DEC
@@ -112,6 +103,7 @@ modify(point_iterator it, const_reference r_new_val)
swap_value_imp(it.m_p_e, r_new_val, s_no_throw_copies_ind);
fix(it.m_p_e);
PB_DS_ASSERT_VALID((*this))
+ _GLIBCXX_DEBUG_ASSERT(is_heap());
}
PB_DS_CLASS_T_DEC
@@ -123,13 +115,13 @@ fix(entry_pointer p_e)
if (i > 0 && entry_cmp::operator()(m_a_entries[parent(i)], m_a_entries[i]))
{
size_type parent_i = parent(i);
- while (i > 0
+ while (i > 0
&& entry_cmp::operator()(m_a_entries[parent_i], m_a_entries[i]))
- {
+ {
std::swap(m_a_entries[i], m_a_entries[parent_i]);
i = parent_i;
parent_i = parent(i);
- }
+ }
PB_DS_ASSERT_VALID((*this))
return;
@@ -137,29 +129,30 @@ fix(entry_pointer p_e)
while (i < m_size)
{
- const size_type left_child_i = left_child(i);
- const size_type right_child_i = right_child(i);
- _GLIBCXX_DEBUG_ASSERT(right_child_i > left_child_i);
- const bool smaller_than_left_child = left_child_i < m_size &&
- entry_cmp::operator()(m_a_entries[i], m_a_entries[left_child_i]);
-
- const bool smaller_than_right_child = right_child_i < m_size &&
- entry_cmp::operator()(m_a_entries[i], m_a_entries[right_child_i]);
-
- const bool swap_with_r_child = smaller_than_right_child && (!smaller_than_left_child || entry_cmp::operator()(m_a_entries[left_child_i], m_a_entries[right_child_i]));
-
- const bool swap_with_l_child = !swap_with_r_child && smaller_than_left_child;
-
- if (swap_with_l_child)
- {
- std::swap(m_a_entries[i], m_a_entries[left_child_i]);
- i = left_child_i;
- }
- else if (swap_with_r_child)
- {
- std::swap(m_a_entries[i], m_a_entries[right_child_i]);
- i = right_child_i;
- }
+ const size_type lchild_i = left_child(i);
+ const size_type rchild_i = right_child(i);
+ _GLIBCXX_DEBUG_ASSERT(rchild_i > lchild_i);
+
+ const bool smaller_than_lchild = lchild_i < m_size &&
+ entry_cmp::operator()(m_a_entries[i], m_a_entries[lchild_i]);
+
+ const bool smaller_than_rchild = rchild_i < m_size &&
+ entry_cmp::operator()(m_a_entries[i], m_a_entries[rchild_i]);
+
+ const bool swap_with_rchild = smaller_than_rchild && (!smaller_than_lchild || entry_cmp::operator()(m_a_entries[lchild_i], m_a_entries[rchild_i]));
+
+ const bool swap_with_lchild = !swap_with_rchild && smaller_than_lchild;
+
+ if (swap_with_lchild)
+ {
+ std::swap(m_a_entries[i], m_a_entries[lchild_i]);
+ i = lchild_i;
+ }
+ else if (swap_with_rchild)
+ {
+ std::swap(m_a_entries[i], m_a_entries[rchild_i]);
+ i = rchild_i;
+ }
else
i = m_size;
}
@@ -169,9 +162,7 @@ PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
swap_value_imp(entry_pointer p_e, value_type new_val, true_type)
-{
- * p_e = new_val;
-}
+{ *p_e = new_val; }
PB_DS_CLASS_T_DEC
inline void
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
index db0a64ea899..daaf2e4a7f8 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file iterators_fn_imps.hpp
+ * @file binary_heap_/iterators_fn_imps.hpp
* Contains an implementation class for a binary_heap.
*/
@@ -42,31 +42,23 @@ PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
begin()
-{
- return (iterator(m_a_entries));
-}
+{ return iterator(m_a_entries); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
begin() const
-{
- return (const_iterator(m_a_entries));
-}
+{ return const_iterator(m_a_entries); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
end()
-{
- return (iterator(m_a_entries + m_size));
-}
+{ return iterator(m_a_entries + m_size); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
end() const
-{
- return (const_iterator(m_a_entries + m_size));
-}
+{ return const_iterator(m_a_entries + m_size); }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp
index 3d75e86d45a..87362607387 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp
@@ -34,9 +34,9 @@
// warranty.
/**
- * @file const_point_iterator.hpp
+ * @file binary_heap_/point_const_iterator.hpp
* Contains an iterator class returned by the table's const find and insert
- * methods.
+ * methods.
*/
#ifndef PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP
@@ -51,11 +51,11 @@ namespace __gnu_pbds
{
// Const point-type iterator.
template<typename Value_Type, typename Entry, bool Simple,
- typename Allocator>
- class binary_heap_const_point_iterator_
+ typename _Alloc>
+ class binary_heap_point_const_iterator_
{
protected:
- typedef typename Allocator::template rebind<Entry>::other::pointer entry_pointer;
+ typedef typename _Alloc::template rebind<Entry>::other::pointer entry_pointer;
public:
// Category.
@@ -68,35 +68,35 @@ namespace __gnu_pbds
typedef Value_Type value_type;
// Iterator's pointer type.
- typedef typename Allocator::template rebind<value_type>::other::pointer
+ typedef typename _Alloc::template rebind<value_type>::other::pointer
pointer;
// Iterator's const pointer type.
typedef
- typename Allocator::template rebind<value_type>::other::const_pointer
+ typename _Alloc::template rebind<value_type>::other::const_pointer
const_pointer;
// Iterator's reference type.
typedef
- typename Allocator::template rebind<value_type>::other::reference
+ typename _Alloc::template rebind<value_type>::other::reference
reference;
// Iterator's const reference type.
typedef
- typename Allocator::template rebind<value_type>::other::const_reference
+ typename _Alloc::template rebind<value_type>::other::const_reference
const_reference;
inline
- binary_heap_const_point_iterator_(entry_pointer p_e) : m_p_e(p_e)
+ binary_heap_point_const_iterator_(entry_pointer p_e) : m_p_e(p_e)
{ }
// Default constructor.
inline
- binary_heap_const_point_iterator_() : m_p_e(0) { }
+ binary_heap_point_const_iterator_() : m_p_e(0) { }
// Copy constructor.
inline
- binary_heap_const_point_iterator_(const binary_heap_const_point_iterator_& other)
+ binary_heap_point_const_iterator_(const binary_heap_point_const_iterator_& other)
: m_p_e(other.m_p_e)
{ }
@@ -118,12 +118,12 @@ namespace __gnu_pbds
// Compares content to a different iterator object.
inline bool
- operator==(const binary_heap_const_point_iterator_& other) const
+ operator==(const binary_heap_point_const_iterator_& other) const
{ return m_p_e == other.m_p_e; }
// Compares content (negatively) to a different iterator object.
inline bool
- operator!=(const binary_heap_const_point_iterator_& other) const
+ operator!=(const binary_heap_point_const_iterator_& other) const
{ return m_p_e != other.m_p_e; }
private:
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
index 11a7b89158a..f3782221b49 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file policy_access_fn_imps.hpp
+ * @file binary_heap_/policy_access_fn_imps.hpp
* Contains an implementation class for a binary_heap.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
index c5893872e5c..e3d74bffd69 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file resize_policy.hpp
+ * @file binary_heap_/resize_policy.hpp
* Contains an implementation class for a binary_heap.
*/
@@ -47,40 +47,49 @@ namespace __gnu_pbds
{
namespace detail
{
-
-#define PB_DS_CLASS_T_DEC template<typename Size_Type>
-
-#define PB_DS_CLASS_C_DEC resize_policy<Size_Type>
-
- template<typename Size_Type>
+ /// Resize policy for binary heap.
+ template<typename _Tp>
class resize_policy
{
- public:
- typedef Size_Type size_type;
-
+ private:
enum
{
- min_size = 16
+ ratio = 8,
+ factor = 2
};
+ // Next shrink size.
+ _Tp m_shrink_size;
+
+ // Next grow size.
+ _Tp m_grow_size;
+
public:
- inline
- resize_policy();
+ typedef _Tp size_type;
+
+ static const _Tp min_size = 16;
+
+ resize_policy() : m_shrink_size(0), m_grow_size(min_size)
+ { PB_DS_ASSERT_VALID((*this)) }
+
+ resize_policy(const resize_policy& other)
+ : m_shrink_size(other.m_shrink_size), m_grow_size(other.m_grow_size)
+ { PB_DS_ASSERT_VALID((*this)) }
inline void
- swap(PB_DS_CLASS_C_DEC& other);
+ swap(resize_policy<_Tp>&);
inline bool
- resize_needed_for_grow(size_type size) const;
+ resize_needed_for_grow(size_type) const;
inline bool
- resize_needed_for_shrink(size_type size) const;
+ resize_needed_for_shrink(size_type) const;
inline bool
- grow_needed(size_type size) const;
+ grow_needed(size_type) const;
inline bool
- shrink_needed(size_type size) const;
+ shrink_needed(size_type) const;
inline size_type
get_new_size_for_grow() const;
@@ -88,8 +97,8 @@ namespace __gnu_pbds
inline size_type
get_new_size_for_shrink() const;
- size_type
- get_new_size_for_arbitrary(size_type size) const;
+ inline size_type
+ get_new_size_for_arbitrary(size_type) const;
inline void
notify_grow_resize();
@@ -98,83 +107,67 @@ namespace __gnu_pbds
notify_shrink_resize();
void
- notify_arbitrary(size_type actual_size);
+ notify_arbitrary(size_type);
#ifdef _GLIBCXX_DEBUG
void
- assert_valid(const char* file, int line) const;
-#endif
+ assert_valid(const char*, int) const;
+#endif
#ifdef PB_DS_BINARY_HEAP_TRACE_
void
trace() const;
-#endif
-
- private:
- enum
- {
- ratio = 8,
- factor = 2
- };
-
- private:
- size_type m_next_shrink_size;
- size_type m_next_grow_size;
+#endif
};
- PB_DS_CLASS_T_DEC
- inline
- PB_DS_CLASS_C_DEC::
- resize_policy() :
- m_next_shrink_size(0),
- m_next_grow_size(min_size)
- { PB_DS_ASSERT_VALID((*this)) }
+ template<typename _Tp>
+ const _Tp resize_policy<_Tp>::min_size;
- PB_DS_CLASS_T_DEC
+ template<typename _Tp>
inline void
- PB_DS_CLASS_C_DEC::
- swap(PB_DS_CLASS_C_DEC& other)
+ resize_policy<_Tp>::
+ swap(resize_policy<_Tp>& other)
{
- std::swap(m_next_shrink_size, other.m_next_shrink_size);
- std::swap(m_next_grow_size, other.m_next_grow_size);
+ std::swap(m_shrink_size, other.m_shrink_size);
+ std::swap(m_grow_size, other.m_grow_size);
}
- PB_DS_CLASS_T_DEC
+ template<typename _Tp>
inline bool
- PB_DS_CLASS_C_DEC::
+ resize_policy<_Tp>::
resize_needed_for_grow(size_type size) const
{
- _GLIBCXX_DEBUG_ASSERT(size <= m_next_grow_size);
- return size == m_next_grow_size;
+ _GLIBCXX_DEBUG_ASSERT(size <= m_grow_size);
+ return size == m_grow_size;
}
- PB_DS_CLASS_T_DEC
+ template<typename _Tp>
inline bool
- PB_DS_CLASS_C_DEC::
+ resize_policy<_Tp>::
resize_needed_for_shrink(size_type size) const
{
- _GLIBCXX_DEBUG_ASSERT(size <= m_next_grow_size);
- return size == m_next_shrink_size;
+ _GLIBCXX_DEBUG_ASSERT(size <= m_grow_size);
+ return size == m_shrink_size;
}
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::size_type
- PB_DS_CLASS_C_DEC::
+ template<typename _Tp>
+ inline typename resize_policy<_Tp>::size_type
+ resize_policy<_Tp>::
get_new_size_for_grow() const
- { return m_next_grow_size* factor; }
+ { return m_grow_size * factor; }
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::size_type
- PB_DS_CLASS_C_DEC::
+ template<typename _Tp>
+ inline typename resize_policy<_Tp>::size_type
+ resize_policy<_Tp>::
get_new_size_for_shrink() const
{
- const size_type half_size = m_next_grow_size / factor;
- return std::max(static_cast<size_type>(min_size), half_size);
+ const size_type half_size = m_grow_size / factor;
+ return std::max(min_size, half_size);
}
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::size_type
- PB_DS_CLASS_C_DEC::
+ template<typename _Tp>
+ inline typename resize_policy<_Tp>::size_type
+ resize_policy<_Tp>::
get_new_size_for_arbitrary(size_type size) const
{
size_type ret = min_size;
@@ -183,71 +176,65 @@ namespace __gnu_pbds
return ret;
}
- PB_DS_CLASS_T_DEC
+ template<typename _Tp>
inline void
- PB_DS_CLASS_C_DEC::
+ resize_policy<_Tp>::
notify_grow_resize()
{
PB_DS_ASSERT_VALID((*this))
- _GLIBCXX_DEBUG_ASSERT(m_next_grow_size >= min_size);
- m_next_grow_size *= factor;
- m_next_shrink_size = m_next_grow_size / ratio;
+ _GLIBCXX_DEBUG_ASSERT(m_grow_size >= min_size);
+ m_grow_size *= factor;
+ m_shrink_size = m_grow_size / ratio;
PB_DS_ASSERT_VALID((*this))
}
- PB_DS_CLASS_T_DEC
+ template<typename _Tp>
inline void
- PB_DS_CLASS_C_DEC::
+ resize_policy<_Tp>::
notify_shrink_resize()
{
PB_DS_ASSERT_VALID((*this))
- m_next_shrink_size /= factor;
- if (m_next_shrink_size == 1)
- m_next_shrink_size = 0;
-
- m_next_grow_size =
- std::max(m_next_grow_size / factor, static_cast<size_type>(min_size));
+ m_shrink_size /= factor;
+ if (m_shrink_size == 1)
+ m_shrink_size = 0;
+ m_grow_size = std::max(m_grow_size / factor, min_size);
PB_DS_ASSERT_VALID((*this))
}
- PB_DS_CLASS_T_DEC
+ template<typename _Tp>
inline void
- PB_DS_CLASS_C_DEC::
+ resize_policy<_Tp>::
notify_arbitrary(size_type actual_size)
{
- m_next_grow_size = actual_size;
- m_next_shrink_size = m_next_grow_size / ratio;
+ m_grow_size = actual_size;
+ m_shrink_size = m_grow_size / ratio;
PB_DS_ASSERT_VALID((*this))
}
#ifdef _GLIBCXX_DEBUG
- PB_DS_CLASS_T_DEC
+ template<typename _Tp>
void
- PB_DS_CLASS_C_DEC::
+ resize_policy<_Tp>::
assert_valid(const char* __file, int __line) const
{
- PB_DS_DEBUG_VERIFY(m_next_shrink_size == 0 ||
- m_next_shrink_size* ratio == m_next_grow_size);
-
- PB_DS_DEBUG_VERIFY(m_next_grow_size >= min_size);
+ PB_DS_DEBUG_VERIFY(m_shrink_size == 0
+ || m_shrink_size * ratio == m_grow_size);
+ PB_DS_DEBUG_VERIFY(m_grow_size >= min_size);
}
-#endif
+#endif
#ifdef PB_DS_BINARY_HEAP_TRACE_
- PB_DS_CLASS_T_DEC
+ template<typename _Tp>
void
- PB_DS_CLASS_C_DEC::
+ resize_policy<_Tp>::
trace() const
{
- std::cerr << "shrink = " << m_next_shrink_size <<
- " grow = " << m_next_grow_size << std::endl;
+ std::cerr << "shrink = " << m_shrink_size
+ << " grow = " << m_grow_size << std::endl;
}
-#endif
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
+#endif
} // namespace detail
} // namespace __gnu_pbds
-#endif
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
index 675b4ec40db..0d09b535730 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
@@ -35,7 +35,7 @@
// warranty.
/**
- * @file split_join_fn_imps.hpp
+ * @file binary_heap_/split_join_fn_imps.hpp
* Contains an implementation class for a binary_heap.
*/
@@ -48,40 +48,30 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
PB_DS_ASSERT_VALID((*this))
typedef
- typename entry_pred<
- value_type,
- Pred,
- simple_value,
- Allocator>::type
+ typename entry_pred<value_type, Pred, _Alloc, simple_value>::type
pred_t;
const size_type left = partition(pred_t(pred));
-
_GLIBCXX_DEBUG_ASSERT(m_size >= left);
const size_type ersd = m_size - left;
-
_GLIBCXX_DEBUG_ASSERT(m_size >= ersd);
- const size_type actual_size =
- resize_policy::get_new_size_for_arbitrary(left);
-
- const size_type other_actual_size =
- other.get_new_size_for_arbitrary(ersd);
+ const size_type new_size = resize_policy::get_new_size_for_arbitrary(left);
+ const size_type other_actual_size = other.get_new_size_for_arbitrary(ersd);
entry_pointer a_entries = 0;
entry_pointer a_other_entries = 0;
__try
{
- a_entries = s_entry_allocator.allocate(actual_size);
-
+ a_entries = s_entry_allocator.allocate(new_size);
a_other_entries = s_entry_allocator.allocate(other_actual_size);
}
__catch(...)
{
if (a_entries != 0)
- s_entry_allocator.deallocate(a_entries, actual_size);
+ s_entry_allocator.deallocate(a_entries, new_size);
if (a_other_entries != 0)
s_entry_allocator.deallocate(a_other_entries, other_actual_size);
@@ -92,14 +82,14 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
for (size_type i = 0; i < other.m_size; ++i)
erase_at(other.m_a_entries, i, s_no_throw_copies_ind);
- _GLIBCXX_DEBUG_ASSERT(actual_size >= left);
+ _GLIBCXX_DEBUG_ASSERT(new_size >= left);
std::copy(m_a_entries, m_a_entries + left, a_entries);
std::copy(m_a_entries + left, m_a_entries + m_size, a_other_entries);
s_entry_allocator.deallocate(m_a_entries, m_actual_size);
s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);
- m_actual_size = actual_size;
+ m_actual_size = new_size;
other.m_actual_size = other_actual_size;
m_size = left;
@@ -108,8 +98,8 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
m_a_entries = a_entries;
other.m_a_entries = a_other_entries;
- std::make_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));
- std::make_heap(other.m_a_entries, other.m_a_entries + other.m_size, static_cast<entry_cmp& >(other));
+ make_heap();
+ other.make_heap();
resize_policy::notify_arbitrary(m_actual_size);
other.notify_arbitrary(other.m_actual_size);
@@ -127,20 +117,20 @@ join(PB_DS_CLASS_C_DEC& other)
PB_DS_ASSERT_VALID(other)
const size_type len = m_size + other.m_size;
- const size_type actual_size = resize_policy::get_new_size_for_arbitrary(len);
+ const size_type new_size = resize_policy::get_new_size_for_arbitrary(len);
entry_pointer a_entries = 0;
entry_pointer a_other_entries = 0;
__try
{
- a_entries = s_entry_allocator.allocate(actual_size);
+ a_entries = s_entry_allocator.allocate(new_size);
a_other_entries = s_entry_allocator.allocate(resize_policy::min_size);
}
__catch(...)
{
if (a_entries != 0)
- s_entry_allocator.deallocate(a_entries, actual_size);
+ s_entry_allocator.deallocate(a_entries, new_size);
if (a_other_entries != 0)
s_entry_allocator.deallocate(a_other_entries, resize_policy::min_size);
@@ -149,25 +139,23 @@ join(PB_DS_CLASS_C_DEC& other)
}
std::copy(m_a_entries, m_a_entries + m_size, a_entries);
- std::copy(other.m_a_entries, other.m_a_entries + other.m_size, a_entries + m_size);
+ std::copy(other.m_a_entries, other.m_a_entries + other.m_size,
+ a_entries + m_size);
s_entry_allocator.deallocate(m_a_entries, m_actual_size);
m_a_entries = a_entries;
m_size = len;
- m_actual_size = actual_size;
-
- resize_policy::notify_arbitrary(actual_size);
-
- std::make_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));
+ m_actual_size = new_size;
+ resize_policy::notify_arbitrary(new_size);
+ make_heap();
s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);
other.m_a_entries = a_other_entries;
other.m_size = 0;
other.m_actual_size = resize_policy::min_size;
-
other.notify_arbitrary(resize_policy::min_size);
-
+ other.make_heap();
+
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
index 36bd66f7553..2704ec65c1b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file trace_fn_imps.hpp
+ * @file binary_heap_/trace_fn_imps.hpp
* Contains an implementation class for a binary_heap.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
index a6d6098fd37..d8704f65c41 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
@@ -53,64 +53,56 @@ namespace __gnu_pbds
{
namespace detail
{
-
#define PB_DS_CLASS_T_DEC \
- template<typename Value_Type, class Cmp_Fn, class Allocator>
+ template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
- binomial_heap_<Value_Type, Cmp_Fn, Allocator>
-
-#define PB_DS_BASE_C_DEC \
- binomial_heap_base_<Value_Type, Cmp_Fn, Allocator>
+ binomial_heap<Value_Type, Cmp_Fn, _Alloc>
- /**
- * class description = "8y|\|0|\/|i41 h34p 74813">
- **/
- template<typename Value_Type, class Cmp_Fn, class Allocator>
- class binomial_heap_ : public PB_DS_BASE_C_DEC
+ /// Binomial heap.
+ template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
+ class binomial_heap
+ : public binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>
{
private:
- typedef PB_DS_BASE_C_DEC base_type;
- typedef typename base_type::node_pointer node_pointer;
- typedef typename base_type::const_node_pointer const_node_pointer;
+ typedef binomial_heap_base<Value_Type, Cmp_Fn, _Alloc> base_type;
+ typedef typename base_type::node_pointer node_pointer;
+ typedef typename base_type::node_const_pointer node_const_pointer;
public:
- typedef Value_Type value_type;
- typedef typename Allocator::size_type size_type;
- typedef typename Allocator::difference_type difference_type;
- typedef typename base_type::pointer pointer;
- typedef typename base_type::const_pointer const_pointer;
- typedef typename base_type::reference reference;
- typedef typename base_type::const_reference const_reference;
- typedef typename base_type::const_point_iterator const_point_iterator;
- typedef typename base_type::point_iterator point_iterator;
- typedef typename base_type::const_iterator const_iterator;
- typedef typename base_type::iterator iterator;
- typedef typename base_type::cmp_fn cmp_fn;
- typedef typename base_type::allocator_type allocator_type;
+ typedef Value_Type value_type;
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef typename base_type::pointer pointer;
+ typedef typename base_type::const_pointer const_pointer;
+ typedef typename base_type::reference reference;
+ typedef typename base_type::const_reference const_reference;
+ typedef typename base_type::point_const_iterator point_const_iterator;
+ typedef typename base_type::point_iterator point_iterator;
+ typedef typename base_type::const_iterator const_iterator;
+ typedef typename base_type::iterator iterator;
+ typedef typename base_type::cmp_fn cmp_fn;
+ typedef typename base_type::allocator_type allocator_type;
- binomial_heap_();
+ binomial_heap();
- binomial_heap_(const Cmp_Fn& r_cmp_fn);
+ binomial_heap(const Cmp_Fn&);
- binomial_heap_(const PB_DS_CLASS_C_DEC& other);
+ binomial_heap(const binomial_heap&);
- ~binomial_heap_();
+ ~binomial_heap();
protected:
#ifdef _GLIBCXX_DEBUG
void
- assert_valid(const char* file, int line) const;
-#endif
+ assert_valid(const char*, int) const;
+#endif
};
#include <ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp>
#undef PB_DS_CLASS_C_DEC
-
#undef PB_DS_CLASS_T_DEC
-
-#undef PB_DS_BASE_C_DEC
} // namespace detail
} // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
index ebe1f2e9ea8..ee8d89c9dfb 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
@@ -34,28 +34,27 @@
// warranty.
/**
- * @file constructors_destructor_fn_imps.hpp
+ * @file detail/binomial_heap_/constructors_destructor_fn_imps.hpp
* Contains an implementation for binomial_heap_.
*/
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-binomial_heap_()
+binomial_heap()
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-binomial_heap_(const Cmp_Fn& r_cmp_fn) :
- PB_DS_BASE_C_DEC(r_cmp_fn)
+binomial_heap(const Cmp_Fn& r_cmp_fn)
+: base_type(r_cmp_fn)
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-binomial_heap_(const PB_DS_CLASS_C_DEC& other) :
- PB_DS_BASE_C_DEC(other)
+binomial_heap(const PB_DS_CLASS_C_DEC& other)
+: base_type(other)
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-~binomial_heap_() { }
-
+~binomial_heap() { }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
index 80c0b048632..12949aedb2b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_fn_imps.hpp
+ * @file detail/binomial_heap_/debug_fn_imps.hpp
* Contains an implementation for binomial_heap_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
index b2add18e7a0..9d260d0e17e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file binomial_heap_base_.hpp
+ * @file binomial_heap_base_/binomial_heap_base_.hpp
* Contains an implementation class for a base of binomial heaps.
*/
@@ -51,96 +51,65 @@
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>
-#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>
namespace __gnu_pbds
{
namespace detail
{
-
#define PB_DS_CLASS_T_DEC \
- template<typename Value_Type, class Cmp_Fn, class Allocator>
+ template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
- binomial_heap_base_<Value_Type, Cmp_Fn, Allocator>
+ binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>
#ifdef _GLIBCXX_DEBUG
-#define PB_DS_BASE_C_DEC \
- left_child_next_sibling_heap_<Value_Type, Cmp_Fn, \
- typename Allocator::size_type, \
- Allocator, false>
-#else
-#define PB_DS_BASE_C_DEC \
- left_child_next_sibling_heap_<Value_Type, Cmp_Fn, \
- typename Allocator::size_type, Allocator>
-#endif
-
- /**
- * class description = "8y|\|0|\/|i41 h34p 74813">
- **/
- template<typename Value_Type, class Cmp_Fn, class Allocator>
- class binomial_heap_base_ : public PB_DS_BASE_C_DEC
- {
+#define PB_DS_B_HEAP_BASE \
+ left_child_next_sibling_heap<Value_Type, Cmp_Fn, \
+ typename _Alloc::size_type, _Alloc, false>
+#else
+#define PB_DS_B_HEAP_BASE \
+ left_child_next_sibling_heap<Value_Type, Cmp_Fn, \
+ typename _Alloc::size_type, _Alloc>
+#endif
+ /// Base class for binomial heap.
+ template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
+ class binomial_heap_base
+ : public PB_DS_B_HEAP_BASE
+ {
private:
- typedef PB_DS_BASE_C_DEC base_type;
+ typedef typename _Alloc::template rebind<Value_Type>::other __rebind_v;
+ typedef PB_DS_B_HEAP_BASE base_type;
protected:
- typedef typename base_type::node node;
-
- typedef typename base_type::node_pointer node_pointer;
-
- typedef typename base_type::const_node_pointer const_node_pointer;
+ typedef typename base_type::node node;
+ typedef typename base_type::node_pointer node_pointer;
+ typedef typename base_type::node_const_pointer node_const_pointer;
public:
-
- typedef typename Allocator::size_type size_type;
-
- typedef typename Allocator::difference_type difference_type;
-
- typedef Value_Type value_type;
-
- typedef
- typename Allocator::template rebind<
- value_type>::other::pointer
- pointer;
-
- typedef
- typename Allocator::template rebind<
- value_type>::other::const_pointer
- const_pointer;
-
- typedef
- typename Allocator::template rebind<
- value_type>::other::reference
- reference;
-
- typedef
- typename Allocator::template rebind<
- value_type>::other::const_reference
- const_reference;
-
- typedef
- typename PB_DS_BASE_C_DEC::const_point_iterator
- const_point_iterator;
-
- typedef typename PB_DS_BASE_C_DEC::point_iterator point_iterator;
-
- typedef typename PB_DS_BASE_C_DEC::const_iterator const_iterator;
-
- typedef typename PB_DS_BASE_C_DEC::iterator iterator;
-
- typedef Cmp_Fn cmp_fn;
-
- typedef Allocator allocator_type;
+ typedef Value_Type value_type;
+ typedef Cmp_Fn cmp_fn;
+ typedef _Alloc allocator_type;
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
+
+ typedef typename __rebind_v::pointer pointer;
+ typedef typename __rebind_v::const_pointer const_pointer;
+ typedef typename __rebind_v::reference reference;
+ typedef typename __rebind_v::const_reference const_reference;
+
+ typedef typename base_type::point_const_iterator point_const_iterator;
+ typedef typename base_type::point_iterator point_iterator;
+ typedef typename base_type::const_iterator const_iterator;
+ typedef typename base_type::iterator iterator;
public:
inline point_iterator
- push(const_reference r_val);
+ push(const_reference);
void
- modify(point_iterator it, const_reference r_new_val);
+ modify(point_iterator, const_reference);
inline const_reference
top() const;
@@ -149,72 +118,72 @@ namespace __gnu_pbds
pop();
void
- erase(point_iterator it);
+ erase(point_iterator);
inline void
clear();
template<typename Pred>
size_type
- erase_if(Pred pred);
+ erase_if(Pred);
template<typename Pred>
void
- split(Pred pred, PB_DS_CLASS_C_DEC& other);
+ split(Pred, PB_DS_CLASS_C_DEC&);
void
- join(PB_DS_CLASS_C_DEC& other);
+ join(PB_DS_CLASS_C_DEC&);
protected:
- binomial_heap_base_();
+ binomial_heap_base();
- binomial_heap_base_(const Cmp_Fn& r_cmp_fn);
+ binomial_heap_base(const Cmp_Fn&);
- binomial_heap_base_(const PB_DS_CLASS_C_DEC& other);
+ binomial_heap_base(const PB_DS_CLASS_C_DEC&);
void
- swap(PB_DS_CLASS_C_DEC& other);
+ swap(PB_DS_CLASS_C_DEC&);
- ~binomial_heap_base_();
+ ~binomial_heap_base();
template<typename It>
void
- copy_from_range(It first_it, It last_it);
+ copy_from_range(It, It);
inline void
find_max();
#ifdef _GLIBCXX_DEBUG
void
- assert_valid(bool strictly_binomial, const char* file, int line) const;
+ assert_valid(bool, const char*, int) const;
void
- assert_max(const char* file, int line) const;
-#endif
+ assert_max(const char*, int) const;
+#endif
private:
inline node_pointer
- fix(node_pointer p_nd) const;
+ fix(node_pointer) const;
inline void
- insert_node(node_pointer p_nd);
+ insert_node(node_pointer);
inline void
- remove_parentless_node(node_pointer p_nd);
+ remove_parentless_node(node_pointer);
inline node_pointer
- join(node_pointer p_lhs, node_pointer p_rhs) const;
+ join(node_pointer, node_pointer) const;
#ifdef _GLIBCXX_DEBUG
void
- assert_node_consistent(const_node_pointer, bool, bool,
+ assert_node_consistent(node_const_pointer, bool, bool,
const char*, int) const;
#endif
protected:
- node_pointer m_p_max;
+ node_pointer m_p_max;
};
#define PB_DS_ASSERT_VALID_COND(X, _StrictlyBinomial) \
@@ -235,10 +204,8 @@ namespace __gnu_pbds
#undef PB_DS_ASSERT_VALID_COND
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_BASE_C_DEC
-
-
+#undef PB_DS_B_HEAP_BASE
} // namespace detail
} // namespace __gnu_pbds
-#endif
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
index fa86c230cd2..ef9d0e3b300 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file constructors_destructor_fn_imps.hpp
+ * @file binomial_heap_base_/constructors_destructor_fn_imps.hpp
* Contains an implementation class for a base of binomial heaps.
*/
@@ -46,35 +46,27 @@ copy_from_range(It first_it, It last_it)
{
while (first_it != last_it)
push(*(first_it++));
-
PB_DS_ASSERT_VALID_COND((*this),false)
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-binomial_heap_base_() :
- m_p_max(0)
+binomial_heap_base() : m_p_max(0)
{
PB_DS_ASSERT_VALID_COND((*this),false)
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-binomial_heap_base_(const Cmp_Fn& r_cmp_fn) :
- PB_DS_BASE_C_DEC(r_cmp_fn),
- m_p_max(0)
-{
- PB_DS_ASSERT_VALID_COND((*this),false)
-}
+binomial_heap_base(const Cmp_Fn& r_cmp_fn)
+: base_type(r_cmp_fn), m_p_max(0)
+{ PB_DS_ASSERT_VALID_COND((*this),false) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-binomial_heap_base_(const PB_DS_CLASS_C_DEC& other) :
- PB_DS_BASE_C_DEC(other),
- m_p_max(0)
-{
- PB_DS_ASSERT_VALID_COND((*this),false)
-}
+binomial_heap_base(const PB_DS_CLASS_C_DEC& other)
+: base_type(other), m_p_max(0)
+{ PB_DS_ASSERT_VALID_COND((*this),false) }
PB_DS_CLASS_T_DEC
void
@@ -82,16 +74,12 @@ PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID_COND((*this),false)
-
base_type::swap(other);
-
std::swap(m_p_max, other.m_p_max);
-
PB_DS_ASSERT_VALID_COND((*this),false)
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-~binomial_heap_base_()
+~binomial_heap_base()
{ }
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
index 6f2aa2a7983..137ec4b0c6e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
@@ -35,7 +35,7 @@
// warranty.
/**
- * @file debug_fn_imps.hpp
+ * @file binomial_heap_base_/debug_fn_imps.hpp
* Contains an implementation class for a base of binomial heaps.
*/
@@ -68,7 +68,7 @@ assert_max(const char* __file, int __line) const
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-assert_node_consistent(const_node_pointer p_nd, bool strictly_binomial,
+assert_node_consistent(node_const_pointer p_nd, bool strictly_binomial,
bool increasing, const char* __file, int __line) const
{
PB_DS_DEBUG_VERIFY(increasing || strictly_binomial);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
index e7a2dc4f6fd..2cdc456dd7d 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file erase_fn_imps.hpp
+ * @file binomial_heap_base_/erase_fn_imps.hpp
* Contains an implementation class for a base of binomial heaps.
*/
@@ -50,15 +50,10 @@ pop()
find_max();
_GLIBCXX_DEBUG_ASSERT(m_p_max != 0);
-
node_pointer p_nd = m_p_max;
-
remove_parentless_node(m_p_max);
-
base_type::actual_erase_node(p_nd);
-
m_p_max = 0;
-
PB_DS_ASSERT_VALID_COND((*this),true)
}
@@ -71,8 +66,7 @@ remove_parentless_node(node_pointer p_nd)
_GLIBCXX_DEBUG_ASSERT(base_type::parent(p_nd) == 0);
node_pointer p_cur_root = p_nd == base_type::m_p_root?
- p_nd->m_p_next_sibling :
- base_type::m_p_root;
+ p_nd->m_p_next_sibling : base_type::m_p_root;
if (p_cur_root != 0)
p_cur_root->m_p_prev_or_parent = 0;
@@ -84,17 +78,14 @@ remove_parentless_node(node_pointer p_nd)
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
node_pointer p_child = p_nd->m_p_l_child;
-
if (p_child != 0)
{
p_child->m_p_prev_or_parent = 0;
-
while (p_child->m_p_next_sibling != 0)
p_child = p_child->m_p_next_sibling;
}
m_p_max = 0;
-
base_type::m_p_root = join(p_cur_root, p_child);
}
@@ -104,7 +95,6 @@ PB_DS_CLASS_C_DEC::
clear()
{
base_type::clear();
-
m_p_max = 0;
}
@@ -117,13 +107,9 @@ erase(point_iterator it)
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
base_type::bubble_to_top(it.m_p_nd);
-
remove_parentless_node(it.m_p_nd);
-
base_type::actual_erase_node(it.m_p_nd);
-
m_p_max = 0;
-
PB_DS_ASSERT_VALID_COND((*this),true)
}
@@ -138,55 +124,38 @@ erase_if(Pred pred)
if (base_type::empty())
{
PB_DS_ASSERT_VALID_COND((*this),true)
-
return 0;
}
base_type::to_linked_list();
-
node_pointer p_out = base_type::prune(pred);
-
size_type ersd = 0;
-
while (p_out != 0)
{
++ersd;
-
node_pointer p_next = p_out->m_p_next_sibling;
-
base_type::actual_erase_node(p_out);
-
p_out = p_next;
}
node_pointer p_cur = base_type::m_p_root;
-
base_type::m_p_root = 0;
-
while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
-
p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = 0;
-
p_cur->m_metadata = 0;
-
p_cur->m_p_next_sibling = base_type::m_p_root;
if (base_type::m_p_root != 0)
base_type::m_p_root->m_p_prev_or_parent = p_cur;
base_type::m_p_root = p_cur;
-
base_type::m_p_root = fix(base_type::m_p_root);
-
p_cur = p_next;
}
m_p_max = 0;
-
PB_DS_ASSERT_VALID_COND((*this),true)
-
return ersd;
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
index f832cb60c7d..8059917f9df 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file find_fn_imps.hpp
+ * @file binomial_heap_base_/find_fn_imps.hpp
* Contains an implementation class for a base of binomial heaps.
*/
@@ -59,14 +59,11 @@ PB_DS_CLASS_C_DEC::
find_max()
{
node_pointer p_cur = base_type::m_p_root;
-
m_p_max = p_cur;
-
while (p_cur != 0)
{
if (Cmp_Fn::operator()(m_p_max->m_value, p_cur->m_value))
m_p_max = p_cur;
-
p_cur = p_cur->m_p_next_sibling;
}
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
index 11bd5e1444f..30f49db0635 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_fn_imps.hpp
+ * @file binomial_heap_base_/insert_fn_imps.hpp
* Contains an implementation class for a base of binomial heaps.
*/
@@ -44,15 +44,10 @@ PB_DS_CLASS_C_DEC::
push(const_reference r_val)
{
PB_DS_ASSERT_VALID_COND((*this),true)
-
node_pointer p_nd = base_type::get_new_node_for_insert(r_val);
-
insert_node(p_nd);
-
m_p_max = 0;
-
PB_DS_ASSERT_VALID_COND((*this),true)
-
return point_iterator(p_nd);
}
@@ -63,60 +58,42 @@ insert_node(node_pointer p_nd)
{
if (base_type::m_p_root == 0)
{
- p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent =
- p_nd->m_p_l_child = 0;
-
+ p_nd->m_p_next_sibling = 0;
+ p_nd->m_p_prev_or_parent = 0;
+ p_nd->m_p_l_child = 0;
p_nd->m_metadata = 0;
-
base_type::m_p_root = p_nd;
-
return;
}
if (base_type::m_p_root->m_metadata > 0)
{
p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = 0;
-
p_nd->m_p_next_sibling = base_type::m_p_root;
-
base_type::m_p_root->m_p_prev_or_parent = p_nd;
-
base_type::m_p_root = p_nd;
-
p_nd->m_metadata = 0;
-
return;
}
if (Cmp_Fn::operator()(base_type::m_p_root->m_value, p_nd->m_value))
{
p_nd->m_p_next_sibling = base_type::m_p_root->m_p_next_sibling;
-
p_nd->m_p_prev_or_parent = 0;
-
p_nd->m_metadata = 1;
-
p_nd->m_p_l_child = base_type::m_p_root;
-
base_type::m_p_root->m_p_prev_or_parent = p_nd;
-
base_type::m_p_root->m_p_next_sibling = 0;
-
base_type::m_p_root = p_nd;
}
else
{
p_nd->m_p_next_sibling = 0;
-
p_nd->m_p_l_child = 0;
-
p_nd->m_p_prev_or_parent = base_type::m_p_root;
-
p_nd->m_metadata = 0;
-
_GLIBCXX_DEBUG_ASSERT(base_type::m_p_root->m_p_l_child == 0);
base_type::m_p_root->m_p_l_child = p_nd;
-
base_type::m_p_root->m_metadata = 1;
}
@@ -128,36 +105,31 @@ inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
fix(node_pointer p_nd) const
{
- while (p_nd->m_p_next_sibling != 0&&
+ while (p_nd->m_p_next_sibling != 0 &&
p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata)
{
node_pointer p_next = p_nd->m_p_next_sibling;
-
if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))
- {
- p_next->m_p_prev_or_parent =
- p_nd->m_p_prev_or_parent;
+ {
+ p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
if (p_nd->m_p_prev_or_parent != 0)
p_nd->m_p_prev_or_parent->m_p_next_sibling = p_next;
base_type::make_child_of(p_nd, p_next);
-
++p_next->m_metadata;
-
p_nd = p_next;
- }
+ }
else
- {
+ {
p_nd->m_p_next_sibling = p_next->m_p_next_sibling;
if (p_nd->m_p_next_sibling != 0)
p_next->m_p_next_sibling = 0;
base_type::make_child_of(p_next, p_nd);
-
++p_nd->m_metadata;
- }
+ }
}
if (p_nd->m_p_next_sibling != 0)
@@ -178,39 +150,29 @@ modify(point_iterator it, const_reference r_new_val)
PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_nd, false)
const bool bubble_up = Cmp_Fn::operator()(p_nd->m_value, r_new_val);
-
p_nd->m_value = r_new_val;
if (bubble_up)
{
node_pointer p_parent = base_type::parent(p_nd);
-
- while (p_parent != 0&&
+ while (p_parent != 0 &&
Cmp_Fn::operator()(p_parent->m_value, p_nd->m_value))
- {
+ {
base_type::swap_with_parent(p_nd, p_parent);
-
p_parent = base_type::parent(p_nd);
- }
+ }
if (p_nd->m_p_prev_or_parent == 0)
base_type::m_p_root = p_nd;
m_p_max = 0;
-
PB_DS_ASSERT_VALID_COND((*this),true)
-
- return;
+ return;
}
base_type::bubble_to_top(p_nd);
-
remove_parentless_node(p_nd);
-
insert_node(p_nd);
-
m_p_max = 0;
-
PB_DS_ASSERT_VALID_COND((*this),true)
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
index 6564c54a21a..44bc4ed7c4d 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file split_join_fn_imps.hpp
+ * @file binomial_heap_base_/split_join_fn_imps.hpp
* Contains an implementation class for a base of binomial heaps.
*/
@@ -48,72 +48,54 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
PB_DS_ASSERT_VALID_COND(other,true)
other.clear();
-
if (base_type::empty())
{
PB_DS_ASSERT_VALID_COND((*this),true)
PB_DS_ASSERT_VALID_COND(other,true)
-
return;
}
base_type::to_linked_list();
-
node_pointer p_out = base_type::prune(pred);
-
while (p_out != 0)
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);
--base_type::m_size;
-
++other.m_size;
node_pointer p_next = p_out->m_p_next_sibling;
-
p_out->m_p_l_child = p_out->m_p_prev_or_parent = 0;
-
p_out->m_metadata = 0;
p_out->m_p_next_sibling = other.m_p_root;
-
if (other.m_p_root != 0)
other.m_p_root->m_p_prev_or_parent = p_out;
other.m_p_root = p_out;
-
other.m_p_root = other.fix(other.m_p_root);
-
p_out = p_next;
}
PB_DS_ASSERT_VALID_COND(other,true)
-
node_pointer p_cur = base_type::m_p_root;
-
base_type::m_p_root = 0;
while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
-
p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = 0;
-
p_cur->m_metadata = 0;
-
p_cur->m_p_next_sibling = base_type::m_p_root;
if (base_type::m_p_root != 0)
base_type::m_p_root->m_p_prev_or_parent = p_cur;
base_type::m_p_root = p_cur;
-
base_type::m_p_root = fix(base_type::m_p_root);
-
p_cur = p_next;
}
m_p_max = 0;
-
PB_DS_ASSERT_VALID_COND((*this),true)
PB_DS_ASSERT_VALID_COND(other,true)
}
@@ -127,14 +109,11 @@ join(PB_DS_CLASS_C_DEC& other)
PB_DS_ASSERT_VALID_COND(other,true)
node_pointer p_other = other.m_p_root;
-
if (p_other != 0)
do
{
node_pointer p_next = p_other->m_p_next_sibling;
-
std::swap(p_other->m_p_next_sibling, p_other->m_p_prev_or_parent);
-
p_other = p_next;
}
while (p_other != 0);
@@ -157,68 +136,55 @@ PB_DS_CLASS_C_DEC::
join(node_pointer p_lhs, node_pointer p_rhs) const
{
node_pointer p_ret = 0;
-
node_pointer p_cur = 0;
while (p_lhs != 0 || p_rhs != 0)
{
if (p_rhs == 0)
- {
+ {
if (p_cur == 0)
p_ret = p_cur = p_lhs;
else
- {
+ {
p_cur->m_p_next_sibling = p_lhs;
-
p_lhs->m_p_prev_or_parent = p_cur;
- }
-
+ }
p_cur = p_lhs = 0;
- }
+ }
else if (p_lhs == 0 || p_rhs->m_metadata < p_lhs->m_metadata)
- {
+ {
if (p_cur == 0)
- {
+ {
p_ret = p_cur = p_rhs;
-
p_rhs = p_rhs->m_p_prev_or_parent;
- }
+ }
else
- {
+ {
p_cur->m_p_next_sibling = p_rhs;
-
p_rhs = p_rhs->m_p_prev_or_parent;
-
p_cur->m_p_next_sibling->m_p_prev_or_parent = p_cur;
-
p_cur = p_cur->m_p_next_sibling;
- }
- }
+ }
+ }
else if (p_lhs->m_metadata < p_rhs->m_metadata)
- {
+ {
if (p_cur == 0)
p_ret = p_cur = p_lhs;
else
- {
+ {
p_cur->m_p_next_sibling = p_lhs;
-
p_lhs->m_p_prev_or_parent = p_cur;
-
p_cur = p_cur->m_p_next_sibling;
- }
-
+ }
p_lhs = p_cur->m_p_next_sibling;
- }
+ }
else
- {
+ {
node_pointer p_next_rhs = p_rhs->m_p_prev_or_parent;
-
p_rhs->m_p_next_sibling = p_lhs;
-
p_lhs = fix(p_rhs);
-
p_rhs = p_next_rhs;
- }
+ }
}
if (p_cur != 0)
@@ -229,4 +195,3 @@ join(node_pointer p_lhs, node_pointer p_rhs) const
return p_ret;
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/branch_policy/branch_policy.hpp b/libstdc++-v3/include/ext/pb_ds/detail/branch_policy/branch_policy.hpp
new file mode 100644
index 00000000000..efe39f2fe4a
--- /dev/null
+++ b/libstdc++-v3/include/ext/pb_ds/detail/branch_policy/branch_policy.hpp
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file branch_policy/branch_policy.hpp
+ * Contains a base class for branch policies.
+ */
+
+#ifndef PB_DS_BRANCH_POLICY_BASE_HPP
+#define PB_DS_BRANCH_POLICY_BASE_HPP
+
+#include <ext/pb_ds/tag_and_trait.hpp>
+
+namespace __gnu_pbds
+{
+ /// A null node updator, indicating that no node updates are required.
+ template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
+ struct null_node_update : public null_type
+ { };
+
+ namespace detail
+ {
+ /// Primary template, base class for branch structure policies.
+ template<typename Node_CItr, typename Node_Itr, typename _Alloc>
+ struct branch_policy
+ {
+ protected:
+ typedef typename Node_Itr::value_type it_type;
+ typedef typename std::iterator_traits<it_type>::value_type value_type;
+ typedef typename value_type::first_type key_type;
+
+ typedef typename remove_const<value_type>::type rcvalue_type;
+ typedef typename remove_const<key_type>::type rckey_type;
+
+ typedef typename _Alloc::template rebind<rcvalue_type>::other rebind_v;
+ typedef typename _Alloc::template rebind<rckey_type>::other rebind_k;
+
+ typedef typename rebind_v::reference reference;
+ typedef typename rebind_v::const_reference const_reference;
+ typedef typename rebind_v::const_pointer const_pointer;
+
+ typedef typename rebind_k::const_reference key_const_reference;
+
+ static inline key_const_reference
+ extract_key(const_reference r_val)
+ { return r_val.first; }
+
+ virtual it_type
+ end() = 0;
+
+ it_type
+ end_iterator() const
+ { return const_cast<branch_policy*>(this)->end(); }
+
+ virtual
+ ~branch_policy() { }
+ };
+
+ /// Specialization for const iterators.
+ template<typename Node_CItr, typename _Alloc>
+ struct branch_policy<Node_CItr, Node_CItr, _Alloc>
+ {
+ protected:
+ typedef typename Node_CItr::value_type it_type;
+ typedef typename std::iterator_traits<it_type>::value_type value_type;
+ typedef typename remove_const<value_type>::type rcvalue_type;
+ typedef typename _Alloc::template rebind<rcvalue_type>::other rebind_v;
+ typedef typename rebind_v::reference reference;
+ typedef typename rebind_v::const_reference const_reference;
+ typedef typename rebind_v::const_pointer const_pointer;
+
+ typedef value_type key_type;
+ typedef typename rebind_v::const_reference key_const_reference;
+
+ static inline key_const_reference
+ extract_key(const_reference r_val)
+ { return r_val; }
+
+ virtual it_type
+ end() const = 0;
+
+ it_type
+ end_iterator() const
+ { return end(); }
+
+ virtual
+ ~branch_policy() { }
+ };
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_BRANCH_POLICY_BASE_HPP
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp b/libstdc++-v3/include/ext/pb_ds/detail/branch_policy/null_node_metadata.hpp
index 5f04e14b470..caa8dd738d3 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/branch_policy/null_node_metadata.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,22 +34,33 @@
// warranty.
/**
- * @file null_metadata.hpp
- * Contains an implementation struct for this type of heap's node.
+ * @file branch_policy/null_node_metadata.hpp
+ * Contains an implementation class for tree-like classes.
*/
-#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_0_METADATA_HPP
-#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_0_METADATA_HPP
+#ifndef PB_DS_0_NODE_METADATA_HPP
+#define PB_DS_0_NODE_METADATA_HPP
+
+#include <ext/pb_ds/detail/types_traits.hpp>
namespace __gnu_pbds
{
namespace detail
{
-
- struct null_left_child_next_sibling_heap_node_metadata
- { };
-
+ /// Constant node iterator.
+ template<typename Key, typename Data, typename _Alloc>
+ struct dumnode_const_iterator
+ {
+ private:
+ typedef types_traits<Key, Data, _Alloc, false> __traits_type;
+ typedef typename __traits_type::pointer const_iterator;
+
+ public:
+ typedef const_iterator value_type;
+ typedef const_iterator const_reference;
+ typedef const_reference reference;
+ };
} // namespace detail
} // namespace __gnu_pbds
-#endif // #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_0_METADATA_HPP
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp b/libstdc++-v3/include/ext/pb_ds/detail/branch_policy/traits.hpp
index 36272eda822..92f9f444453 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/branch_policy/traits.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,53 +34,62 @@
// warranty.
/**
- * @file node_metadata_base.hpp
- * Contains an internal PB_DS_BASE_C_DEC for a patricia tree.
+ * @file branch_policy/traits.hpp
+ * Contains an implementation class for tree-like classes.
*/
-#ifndef PB_DS_PAT_TRIE_NODE_METADATA_BASE_HPP
-#define PB_DS_PAT_TRIE_NODE_METADATA_BASE_HPP
+#ifndef PB_DS_NODE_AND_IT_TRAITS_HPP
+#define PB_DS_NODE_AND_IT_TRAITS_HPP
-#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+#include <ext/pb_ds/detail/types_traits.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/traits.hpp>
+#include <ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp>
+#include <ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp>
+
+#define PB_DS_DEBUG_VERIFY(_Cond) \
+ _GLIBCXX_DEBUG_VERIFY_AT(_Cond, \
+ _M_message(#_Cond" assertion from %1;:%2;") \
+ ._M_string(__FILE__)._M_integer(__LINE__) \
+ ,__file,__line)
namespace __gnu_pbds
{
namespace detail
{
-
- template<typename Metadata, class Allocator>
- struct pat_trie_node_metadata_base
- {
- public:
- typedef Metadata metadata_type;
-
- typedef
- typename Allocator::template rebind<
- metadata_type>::other::const_reference
- const_metadata_reference;
-
- public:
- inline const_metadata_reference
- get_metadata() const
- {
- return (m_metadata);
- }
-
- public:
- metadata_type m_metadata;
- };
-
- template<typename Allocator>
- struct pat_trie_node_metadata_base<
- null_node_metadata,
- Allocator>
- {
- public:
- typedef null_node_metadata metadata_type;
- };
+ /// Tree traits class, primary template.
+ template<typename Key,
+ typename Data,
+ typename Cmp_Fn,
+ template<typename Node_CItr,
+ typename Node_Itr,
+ typename Cmp_Fn_,
+ typename _Alloc>
+ class Node_Update,
+ typename Tag,
+ typename _Alloc>
+ struct tree_traits;
+
+ /// Trie traits class, primary template.
+ template<typename Key,
+ typename Data,
+ typename _ATraits,
+ template<typename Node_CItr,
+ typename Node_Itr,
+ typename _ATraits_,
+ typename _Alloc>
+ class Node_Update,
+ typename Tag,
+ typename _Alloc>
+ struct trie_traits;
} // namespace detail
} // namespace __gnu_pbds
-#endif // #ifndef PB_DS_PAT_TRIE_NODE_BASE_HPP
+#include <ext/pb_ds/detail/rb_tree_map_/traits.hpp>
+#include <ext/pb_ds/detail/splay_tree_/traits.hpp>
+#include <ext/pb_ds/detail/ov_tree_map_/traits.hpp>
+#include <ext/pb_ds/detail/pat_trie_/traits.hpp>
+
+#undef PB_DS_DEBUG_VERIFY
+#endif // #ifndef PB_DS_NODE_AND_IT_TRAITS_HPP
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
index 149a206a4e7..f1c2540e7d5 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
@@ -35,7 +35,7 @@
// warranty.
/**
- * @file cc_ht_map_.hpp
+ * @file cc_hash_table_map_/cc_ht_map_.hpp
* Contains an implementation class for cc_ht_map_.
*/
@@ -49,99 +49,89 @@
#include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp>
#ifdef _GLIBCXX_DEBUG
#include <ext/pb_ds/detail/debug_map_base.hpp>
-#endif
+#endif
#ifdef PB_DS_HT_MAP_TRACE_
#include <iostream>
-#endif
+#endif
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_CC_HASH_NAME cc_ht_map
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_CC_HASH_NAME cc_ht_set
+#endif
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Mapped, typename Hash_Fn, \
- typename Eq_Fn, typename Allocator, bool Store_Hash, \
+ typename Eq_Fn, typename _Alloc, bool Store_Hash, \
typename Comb_Hash_Fn, typename Resize_Policy>
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CLASS_NAME cc_ht_map_data_
-#endif
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_CLASS_NAME cc_ht_map_no_data_
-#endif
-
#define PB_DS_CLASS_C_DEC \
- PB_DS_CLASS_NAME<Key, Mapped, Hash_Fn, Eq_Fn, Allocator, \
+ PB_DS_CC_HASH_NAME<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, \
Store_Hash, Comb_Hash_Fn, Resize_Policy>
#define PB_DS_HASH_EQ_FN_C_DEC \
- hash_eq_fn<Key, Eq_Fn, Allocator, Store_Hash>
+ hash_eq_fn<Key, Eq_Fn, _Alloc, Store_Hash>
#define PB_DS_RANGED_HASH_FN_C_DEC \
- ranged_hash_fn<Key, Hash_Fn, Allocator, Comb_Hash_Fn, Store_Hash>
+ ranged_hash_fn<Key, Hash_Fn, _Alloc, Comb_Hash_Fn, Store_Hash>
-#define PB_DS_TYPES_TRAITS_C_DEC \
- types_traits<Key, Mapped, Allocator, Store_Hash>
+#define PB_DS_CC_HASH_TRAITS_BASE \
+ types_traits<Key, Mapped, _Alloc, Store_Hash>
#ifdef _GLIBCXX_DEBUG
#define PB_DS_DEBUG_MAP_BASE_C_DEC \
- debug_map_base<Key, Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference>
-#endif
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#endif
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped_Data()
+ debug_map_base<Key, Eq_Fn, \
+ typename _Alloc::template rebind<Key>::other::const_reference>
#endif
- // <011i$i0|\|-<|-|4i|\|i|\|g |-|4$|-| 74813.
+ /// Collision chaining hash.
template<typename Key,
typename Mapped,
typename Hash_Fn,
typename Eq_Fn,
- typename Allocator,
+ typename _Alloc,
bool Store_Hash,
typename Comb_Hash_Fn,
typename Resize_Policy >
- class PB_DS_CLASS_NAME:
+ class PB_DS_CC_HASH_NAME:
#ifdef _GLIBCXX_DEBUG
protected PB_DS_DEBUG_MAP_BASE_C_DEC,
-#endif
+#endif
public PB_DS_HASH_EQ_FN_C_DEC,
public Resize_Policy,
public PB_DS_RANGED_HASH_FN_C_DEC,
- public PB_DS_TYPES_TRAITS_C_DEC
+ public PB_DS_CC_HASH_TRAITS_BASE
{
private:
- typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
- typedef typename traits_base::comp_hash comp_hash;
- typedef typename traits_base::value_type value_type_;
- typedef typename traits_base::pointer pointer_;
+ typedef PB_DS_CC_HASH_TRAITS_BASE traits_base;
+ typedef typename traits_base::comp_hash comp_hash;
+ typedef typename traits_base::value_type value_type_;
+ typedef typename traits_base::pointer pointer_;
typedef typename traits_base::const_pointer const_pointer_;
- typedef typename traits_base::reference reference_;
+ typedef typename traits_base::reference reference_;
typedef typename traits_base::const_reference const_reference_;
- struct entry : public traits_base::stored_value_type
+ struct entry : public traits_base::stored_data_type
{
- typename Allocator::template rebind<entry>::other::pointer m_p_next;
+ typename _Alloc::template rebind<entry>::other::pointer m_p_next;
};
- typedef cond_dealtor<entry, Allocator> cond_dealtor_t;
+ typedef cond_dealtor<entry, _Alloc> cond_dealtor_t;
- typedef typename Allocator::template rebind<entry>::other entry_allocator;
+ typedef typename _Alloc::template rebind<entry>::other entry_allocator;
typedef typename entry_allocator::pointer entry_pointer;
typedef typename entry_allocator::const_pointer const_entry_pointer;
typedef typename entry_allocator::reference entry_reference;
typedef typename entry_allocator::const_reference const_entry_reference;
- typedef typename Allocator::template rebind<entry_pointer>::other entry_pointer_allocator;
+ typedef typename _Alloc::template rebind<entry_pointer>::other entry_pointer_allocator;
typedef typename entry_pointer_allocator::pointer entry_pointer_array;
typedef PB_DS_RANGED_HASH_FN_C_DEC ranged_hash_fn_base;
@@ -149,12 +139,12 @@ namespace __gnu_pbds
typedef Resize_Policy resize_base;
#ifdef _GLIBCXX_DEBUG
- typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
-#endif
+ typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
+#endif
-#define PB_DS_GEN_POS std::pair<entry_pointer, typename Allocator::size_type>
+#define PB_DS_GEN_POS std::pair<entry_pointer, typename _Alloc::size_type>
-#include <ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>
@@ -162,13 +152,13 @@ namespace __gnu_pbds
#undef PB_DS_GEN_POS
public:
- typedef Allocator allocator_type;
- typedef typename Allocator::size_type size_type;
- typedef typename Allocator::difference_type difference_type;
- typedef Hash_Fn hash_fn;
- typedef Eq_Fn eq_fn;
- typedef Comb_Hash_Fn comb_hash_fn;
- typedef Resize_Policy resize_policy;
+ typedef _Alloc allocator_type;
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef Hash_Fn hash_fn;
+ typedef Eq_Fn eq_fn;
+ typedef Comb_Hash_Fn comb_hash_fn;
+ typedef Resize_Policy resize_policy;
enum
{
@@ -177,55 +167,55 @@ namespace __gnu_pbds
typedef typename traits_base::key_type key_type;
typedef typename traits_base::key_pointer key_pointer;
- typedef typename traits_base::const_key_pointer const_key_pointer;
+ typedef typename traits_base::key_const_pointer key_const_pointer;
typedef typename traits_base::key_reference key_reference;
- typedef typename traits_base::const_key_reference const_key_reference;
+ typedef typename traits_base::key_const_reference key_const_reference;
typedef typename traits_base::mapped_type mapped_type;
typedef typename traits_base::mapped_pointer mapped_pointer;
- typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
+ typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
typedef typename traits_base::mapped_reference mapped_reference;
- typedef typename traits_base::const_mapped_reference const_mapped_reference;
- typedef typename traits_base::value_type value_type;
- typedef typename traits_base::pointer pointer;
+ typedef typename traits_base::mapped_const_reference mapped_const_reference;
+ typedef typename traits_base::value_type value_type;
+ typedef typename traits_base::pointer pointer;
typedef typename traits_base::const_pointer const_pointer;
- typedef typename traits_base::reference reference;
+ typedef typename traits_base::reference reference;
typedef typename traits_base::const_reference const_reference;
#ifdef PB_DS_DATA_TRUE_INDICATOR
- typedef point_iterator_ point_iterator;
-#endif
+ typedef point_iterator_ point_iterator;
+#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
- typedef const_point_iterator_ point_iterator;
-#endif
+ typedef point_const_iterator_ point_iterator;
+#endif
- typedef const_point_iterator_ const_point_iterator;
+ typedef point_const_iterator_ point_const_iterator;
#ifdef PB_DS_DATA_TRUE_INDICATOR
- typedef iterator_ iterator;
-#endif
+ typedef iterator_ iterator;
+#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
- typedef const_iterator_ iterator;
-#endif
+ typedef const_iterator_ iterator;
+#endif
- typedef const_iterator_ const_iterator;
+ typedef const_iterator_ const_iterator;
- PB_DS_CLASS_NAME();
+ PB_DS_CC_HASH_NAME();
- PB_DS_CLASS_NAME(const Hash_Fn&);
+ PB_DS_CC_HASH_NAME(const Hash_Fn&);
- PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&);
+ PB_DS_CC_HASH_NAME(const Hash_Fn&, const Eq_Fn&);
- PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&);
+ PB_DS_CC_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&);
- PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&,
+ PB_DS_CC_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&,
const Resize_Policy&);
- PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+ PB_DS_CC_HASH_NAME(const PB_DS_CLASS_C_DEC&);
virtual
- ~PB_DS_CLASS_NAME();
+ ~PB_DS_CC_HASH_NAME();
void
swap(PB_DS_CLASS_C_DEC&);
@@ -246,28 +236,28 @@ namespace __gnu_pbds
inline bool
empty() const;
- Hash_Fn&
+ Hash_Fn&
get_hash_fn();
- const Hash_Fn&
+ const Hash_Fn&
get_hash_fn() const;
- Eq_Fn&
+ Eq_Fn&
get_eq_fn();
- const Eq_Fn&
+ const Eq_Fn&
get_eq_fn() const;
- Comb_Hash_Fn&
+ Comb_Hash_Fn&
get_comb_hash_fn();
- const Comb_Hash_Fn&
+ const Comb_Hash_Fn&
get_comb_hash_fn() const;
- Resize_Policy&
+ Resize_Policy&
get_resize_policy();
- const Resize_Policy&
+ const Resize_Policy&
get_resize_policy() const;
inline std::pair<point_iterator, bool>
@@ -275,30 +265,30 @@ namespace __gnu_pbds
{ return insert_imp(r_val, traits_base::m_store_extra_indicator); }
inline mapped_reference
- operator[](const_key_reference r_key)
+ operator[](key_const_reference r_key)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
return (subscript_imp(r_key, traits_base::m_store_extra_indicator));
-#else
+#else
insert(r_key);
- return traits_base::s_null_mapped;
-#endif
+ return traits_base::s_null_type;
+#endif
}
inline point_iterator
- find(const_key_reference);
+ find(key_const_reference);
- inline const_point_iterator
- find(const_key_reference) const;
+ inline point_const_iterator
+ find(key_const_reference) const;
inline point_iterator
find_end();
- inline const_point_iterator
+ inline point_const_iterator
find_end() const;
inline bool
- erase(const_key_reference);
+ erase(key_const_reference);
template<typename Pred>
inline size_type
@@ -321,13 +311,13 @@ namespace __gnu_pbds
#ifdef _GLIBCXX_DEBUG
void
- assert_valid(const char* file, int line) const;
-#endif
+ assert_valid(const char*, int) const;
+#endif
#ifdef PB_DS_HT_MAP_TRACE_
void
trace() const;
-#endif
+#endif
private:
void
@@ -340,19 +330,23 @@ namespace __gnu_pbds
do_resize_if_needed_no_throw();
void
- resize_imp(size_type new_size);
+ resize_imp(size_type);
void
- do_resize(size_type new_size);
+ do_resize(size_type);
void
resize_imp_no_exceptions(size_type, entry_pointer_array, size_type);
inline entry_pointer
- resize_imp_no_exceptions_reassign_pointer(entry_pointer, entry_pointer_array, false_type);
+ resize_imp_no_exceptions_reassign_pointer(entry_pointer,
+ entry_pointer_array,
+ false_type);
inline entry_pointer
- resize_imp_no_exceptions_reassign_pointer(entry_pointer, entry_pointer_array, true_type);
+ resize_imp_no_exceptions_reassign_pointer(entry_pointer,
+ entry_pointer_array,
+ true_type);
void
deallocate_links_in_list(entry_pointer);
@@ -368,14 +362,14 @@ namespace __gnu_pbds
#ifdef PB_DS_DATA_TRUE_INDICATOR
inline mapped_reference
- subscript_imp(const_key_reference r_key, false_type)
+ subscript_imp(key_const_reference r_key, false_type)
{
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
- const size_type pos = ranged_hash_fn_base::operator()(r_key);
+ const size_type pos = ranged_hash_fn_base::operator()(r_key);
entry_pointer p_e = m_entries[pos];
resize_base::notify_insert_search_start();
- while (p_e != 0
+ while (p_e != 0
&& !hash_eq_fn_base::operator()(p_e->m_value.first, r_key))
{
resize_base::notify_insert_search_collision();
@@ -394,14 +388,15 @@ namespace __gnu_pbds
}
inline mapped_reference
- subscript_imp(const_key_reference r_key, true_type)
+ subscript_imp(key_const_reference r_key, true_type)
{
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);
entry_pointer p_e = m_entries[pos_hash_pair.first];
resize_base::notify_insert_search_start();
- while (p_e != 0 &&
- !hash_eq_fn_base::operator()(p_e->m_value.first, p_e->m_hash, r_key, pos_hash_pair.second))
+ while (p_e != 0 &&
+ !hash_eq_fn_base::operator()(p_e->m_value.first, p_e->m_hash,
+ r_key, pos_hash_pair.second))
{
resize_base::notify_insert_search_collision();
p_e = p_e->m_p_next;
@@ -415,10 +410,10 @@ namespace __gnu_pbds
}
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
- return insert_new_imp(value_type(r_key, mapped_type()),
+ return insert_new_imp(value_type(r_key, mapped_type()),
pos_hash_pair)->second;
}
-#endif
+#endif
inline std::pair<point_iterator, bool>
insert_imp(const_reference, false_type);
@@ -433,7 +428,8 @@ namespace __gnu_pbds
pos = ranged_hash_fn_base::operator()(PB_DS_V2F(r_val));
// Following lines might throw an exception.
- entry_pointer p_e = get_entry(r_val, traits_base::m_no_throw_copies_indicator);
+ entry_pointer p_e = get_entry(r_val,
+ traits_base::m_no_throw_copies_indicator);
// At this point no exceptions can be thrown.
p_e->m_p_next = m_entries[pos];
@@ -452,7 +448,8 @@ namespace __gnu_pbds
if (do_resize_if_needed())
r_pos_hash_pair = ranged_hash_fn_base::operator()(PB_DS_V2F(r_val));
- entry_pointer p_e = get_entry(r_val, traits_base::m_no_throw_copies_indicator);
+ entry_pointer p_e = get_entry(r_val,
+ traits_base::m_no_throw_copies_indicator);
// At this point no exceptions can be thrown.
p_e->m_hash = r_pos_hash_pair.second;
@@ -465,11 +462,11 @@ namespace __gnu_pbds
}
inline pointer
- find_key_pointer(const_key_reference r_key, false_type)
+ find_key_pointer(key_const_reference r_key, false_type)
{
entry_pointer p_e = m_entries[ranged_hash_fn_base::operator()(r_key)];
resize_base::notify_find_search_start();
- while (p_e != 0 &&
+ while (p_e != 0 &&
!hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
{
resize_base::notify_find_search_collision();
@@ -483,17 +480,17 @@ namespace __gnu_pbds
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
else
PB_DS_CHECK_KEY_EXISTS(r_key)
-#endif
+#endif
return &p_e->m_value;
}
inline pointer
- find_key_pointer(const_key_reference r_key, true_type)
+ find_key_pointer(key_const_reference r_key, true_type)
{
comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);
entry_pointer p_e = m_entries[pos_hash_pair.first];
resize_base::notify_find_search_start();
- while (p_e != 0 &&
+ while (p_e != 0 &&
!hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
p_e->m_hash,
r_key, pos_hash_pair.second))
@@ -509,30 +506,30 @@ namespace __gnu_pbds
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
else
PB_DS_CHECK_KEY_EXISTS(r_key)
-#endif
+#endif
return &p_e->m_value;
}
inline bool
- erase_in_pos_imp(const_key_reference, size_type);
+ erase_in_pos_imp(key_const_reference, size_type);
inline bool
- erase_in_pos_imp(const_key_reference, const comp_hash&);
+ erase_in_pos_imp(key_const_reference, const comp_hash&);
inline void
erase_entry_pointer(entry_pointer&);
#ifdef PB_DS_DATA_TRUE_INDICATOR
void
- inc_it_state(pointer& r_p_value,
+ inc_it_state(pointer& r_p_value,
std::pair<entry_pointer, size_type>& r_pos) const
{
- inc_it_state((const_mapped_pointer& )r_p_value, r_pos);
+ inc_it_state((mapped_const_pointer& )r_p_value, r_pos);
}
-#endif
+#endif
void
- inc_it_state(const_pointer& r_p_value,
+ inc_it_state(const_pointer& r_p_value,
std::pair<entry_pointer, size_type>& r_pos) const
{
_GLIBCXX_DEBUG_ASSERT(r_p_value != 0);
@@ -554,7 +551,7 @@ namespace __gnu_pbds
}
void
- get_start_it_state(pointer& r_p_value,
+ get_start_it_state(pointer& r_p_value,
std::pair<entry_pointer, size_type>& r_pos) const
{
for (r_pos.second = 0; r_pos.second < m_num_e; ++r_pos.second)
@@ -570,26 +567,26 @@ namespace __gnu_pbds
#ifdef _GLIBCXX_DEBUG
void
assert_entry_pointer_array_valid(const entry_pointer_array,
- const char* file, int line) const;
+ const char*, int) const;
void
assert_entry_pointer_valid(const entry_pointer, true_type,
- const char* file, int line) const;
+ const char*, int) const;
void
assert_entry_pointer_valid(const entry_pointer, false_type,
- const char* file, int line) const;
-#endif
+ const char*, int) const;
+#endif
#ifdef PB_DS_HT_MAP_TRACE_
void
trace_list(const_entry_pointer) const;
-#endif
+#endif
private:
#ifdef PB_DS_DATA_TRUE_INDICATOR
friend class iterator_;
-#endif
+#endif
friend class const_iterator_;
@@ -598,7 +595,7 @@ namespace __gnu_pbds
static iterator s_end_it;
static const_iterator s_const_end_it;
static point_iterator s_find_end_it;
- static const_point_iterator s_const_find_end_it;
+ static point_const_iterator s_const_find_end_it;
size_type m_num_e;
size_type m_num_used_e;
@@ -606,8 +603,8 @@ namespace __gnu_pbds
enum
{
- store_hash_ok = !Store_Hash
- || !is_same<Hash_Fn, __gnu_pbds::null_hash_fn>::value
+ store_hash_ok = !Store_Hash
+ || !is_same<Hash_Fn, __gnu_pbds::null_type>::value
};
PB_DS_STATIC_ASSERT(sth, store_hash_ok);
@@ -629,12 +626,8 @@ namespace __gnu_pbds
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_HASH_EQ_FN_C_DEC
#undef PB_DS_RANGED_HASH_FN_C_DEC
-#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_CC_HASH_TRAITS_BASE
#undef PB_DS_DEBUG_MAP_BASE_C_DEC
-#undef PB_DS_CLASS_NAME
-#undef PB_DS_V2F
-#undef PB_DS_V2S
-
+#undef PB_DS_CC_HASH_NAME
} // namespace detail
} // namespace __gnu_pbds
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
index c61eff99b90..4f7116f573f 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file cmp_fn_imps.hpp
+ * @file cc_hash_table_map_/cmp_fn_imps.hpp
* Contains implementations of cc_ht_map_'s entire container comparison related
* functions.
*/
@@ -58,9 +58,9 @@ cmp_with_other(const Other_Map_Type& other) const
for (typename Other_Map_Type::const_iterator it = other.begin();
it != other.end(); ++it)
{
- const_key_reference r_key = const_key_reference(PB_DS_V2F(*it));
+ key_const_reference r_key = key_const_reference(PB_DS_V2F(*it));
- const_mapped_pointer p_mapped_value =
+ mapped_const_pointer p_mapped_value =
const_cast<PB_DS_CLASS_C_DEC& >(*this).
find_key_pointer(r_key, traits_base::m_store_extra_indicator);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
index fa3f31df003..5b2db9b0f64 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file cond_key_dtor_entry_dealtor.hpp
+ * @file cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
* Contains a conditional key destructor, used for exception handling.
*/
@@ -42,65 +42,43 @@ namespace __gnu_pbds
{
namespace detail
{
-
-#define PB_DS_CLASS_T_DEC template<typename HT_Map>
-#define PB_DS_CLASS_C_DEC PB_DS_CKDED_CLASS_NAME<HT_Map>
-
- /**
- * A conditional key destructor, used for exception handling.
- **/
+ /// Conditional dey destructor, cc_hash.
template<typename HT_Map>
- class PB_DS_CKDED_CLASS_NAME
+ class cond_dealtor
{
public:
- typedef typename HT_Map::entry entry;
- typedef typename HT_Map::entry_allocator entry_allocator;
- typedef typename HT_Map::key_type key_type;
+ typedef typename HT_Map::entry entry;
+ typedef typename HT_Map::entry_allocator entry_allocator;
+ typedef typename HT_Map::key_type key_type;
- inline
- PB_DS_CKDED_CLASS_NAME(entry_allocator* p_a, entry* p_e);
+ cond_dealtor(entry_allocator* p_a, entry* p_e)
+ : m_p_a(p_a), m_p_e(p_e), m_key_destruct(false),
+ m_no_action_destructor(false)
+ { }
inline
- ~PB_DS_CKDED_CLASS_NAME();
+ ~cond_dealtor();
- inline void
- set_key_destruct();
+ void
+ set_key_destruct()
+ { m_key_destruct = true; }
- inline void
- set_no_action_destructor();
+ void
+ set_no_action_destructor()
+ { m_no_action_destructor = true; }
protected:
- entry_allocator* const m_p_a;
- entry* const m_p_e;
+ entry_allocator* const m_p_a;
+ entry* const m_p_e;
- bool m_key_destruct;
- bool m_no_action_destructor;
+ bool m_key_destruct;
+ bool m_no_action_destructor;
};
- PB_DS_CLASS_T_DEC
- inline
- PB_DS_CLASS_C_DEC::
- PB_DS_CKDED_CLASS_NAME(entry_allocator* p_a, entry* p_e)
- : m_p_a(p_a), m_p_e(p_e), m_key_destruct(false),
- m_no_action_destructor(false)
- { }
-
- PB_DS_CLASS_T_DEC
- inline void
- PB_DS_CLASS_C_DEC::
- set_key_destruct()
- { m_key_destruct = true; }
-
- PB_DS_CLASS_T_DEC
- inline void
- PB_DS_CLASS_C_DEC::
- set_no_action_destructor()
- { m_no_action_destructor = true; }
-
- PB_DS_CLASS_T_DEC
+ template<typename HT_Map>
inline
- PB_DS_CLASS_C_DEC::
- ~PB_DS_CKDED_CLASS_NAME()
+ cond_dealtor<HT_Map>::
+ ~cond_dealtor()
{
if (m_no_action_destructor)
return;
@@ -108,10 +86,5 @@ namespace __gnu_pbds
m_p_e->m_value.first.~key_type();
m_p_a->deallocate(m_p_e, 1);
}
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
} // namespace detail
} // namespace __gnu_pbds
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
index 8278fd7e662..9d37d9f86c3 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
@@ -35,9 +35,9 @@
// warranty.
/**
- * @file constructor_destructor_fn_imps.hpp
+ * @file cc_hash_table_map_/constructor_destructor_fn_imps.hpp
* Contains implementations of cc_ht_map_'s constructors, destructor,
- * and related functions.
+ * and related functions.
*/
PB_DS_CLASS_T_DEC
@@ -60,7 +60,7 @@ copy_from_range(It first_it, It last_it)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME() :
+PB_DS_CC_HASH_NAME() :
ranged_hash_fn_base(resize_base::get_nearest_larger_size(1)),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_pointer_allocator.allocate(m_num_e))
@@ -71,7 +71,7 @@ PB_DS_CLASS_NAME() :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn) :
+PB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn) :
ranged_hash_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_pointer_allocator.allocate(m_num_e))
@@ -82,7 +82,7 @@ PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn) :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn) :
+PB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn) :
PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn),
ranged_hash_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
@@ -96,7 +96,8 @@ PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn) :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, const Comb_Hash_Fn& r_comb_hash_fn) :
+PB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
+ const Comb_Hash_Fn& r_comb_hash_fn) :
PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn),
ranged_hash_fn_base(resize_base::get_nearest_larger_size(1),
r_hash_fn, r_comb_hash_fn),
@@ -109,7 +110,9 @@ PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, const Comb_Hash
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, const Comb_Hash_Fn& r_comb_hash_fn, const Resize_Policy& r_resize_policy) :
+PB_DS_CC_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
+ const Comb_Hash_Fn& r_comb_hash_fn,
+ const Resize_Policy& r_resize_policy) :
PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn),
Resize_Policy(r_resize_policy),
ranged_hash_fn_base(resize_base::get_nearest_larger_size(1),
@@ -123,7 +126,7 @@ PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, const Comb_Hash
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+PB_DS_CC_HASH_NAME(const PB_DS_CLASS_C_DEC& other) :
PB_DS_HASH_EQ_FN_C_DEC(other),
resize_base(other), ranged_hash_fn_base(other),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
@@ -133,19 +136,19 @@ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
PB_DS_ASSERT_VALID((*this))
__try
{
- copy_from_range(other.begin(), other.end());
+ copy_from_range(other.begin(), other.end());
}
__catch(...)
{
- deallocate_all();
- __throw_exception_again;
+ deallocate_all();
+ __throw_exception_again;
}
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-~PB_DS_CLASS_NAME()
+~PB_DS_CC_HASH_NAME()
{ deallocate_all(); }
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
index 4f1cce64806..1f68349d929 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file constructor_destructor_no_store_hash_fn_imps.hpp
+ * @file cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s constructors, destructor,
* and related functions.
*/
@@ -42,7 +42,7 @@
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
-constructor_insert_new_imp(const_mapped_reference r_val, size_type pos,
+constructor_insert_new_imp(mapped_const_reference r_val, size_type pos,
false_type)
{
// Following lines might throw an exception.
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
index a2b6fa11149..f6a73af6d65 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
@@ -34,9 +34,9 @@
// warranty.
/**
- * @file constructor_destructor_store_hash_fn_imps.hpp
+ * @file cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s constructors, destructor,
- * and related functions.
+ * and related functions.
*/
PB_DS_CLASS_T_DEC
@@ -49,7 +49,7 @@ constructor_insert_new_imp(const_reference r_val, size_type pos, true_type)
// At this point no exceptions can be thrown.
p->m_p_next = m_entries[pos];
- p->m_hash = ranged_hash_fn_base::operator()((const_key_reference)(PB_DS_V2F(p->m_value))).second;
+ p->m_hash = ranged_hash_fn_base::operator()((key_const_reference)(PB_DS_V2F(p->m_value))).second;
m_entries[pos] = p;
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(r_key);)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
index d10ff7862cc..c5af1d3ea4a 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_fn_imps.hpp
+ * @file cc_hash_table_map_/debug_fn_imps.hpp
* Contains implementations of cc_ht_map_'s debug-mode functions.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
index 4a02bbfcc5d..1c19cac9590 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_no_store_hash_fn_imps.hpp
+ * @file cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s debug-mode functions.
*/
@@ -47,4 +47,4 @@ assert_entry_pointer_valid(const entry_pointer p, false_type,
const char* __file, int __line) const
{ debug_base::check_key_exists(PB_DS_V2F(p->m_value), __file, __line); }
-#endif
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp
index 07f2998bcec..76ad8c6bff5 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_store_hash_fn_imps.hpp
+ * @file cc_hash_table_map_/debug_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s debug-mode functions.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
index 07999119335..74404035f99 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file entry_list_fn_imps.hpp
+ * @file cc_hash_table_map_/entry_list_fn_imps.hpp
* Contains implementations of cc_ht_map_'s entry-list related functions.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
index c6febe421a1..c9c4b1c745d 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file erase_fn_imps.hpp
+ * @file cc_hash_table_map_/erase_fn_imps.hpp
* Contains implementations of cc_ht_map_'s erase related functions.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
index ffe32103cbe..1e2661efa55 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file erase_no_store_hash_fn_imps.hpp
+ * @file cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s erase related functions,
* when the hash value is not stored.
*/
@@ -42,7 +42,7 @@
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
-erase(const_key_reference r_key)
+erase(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
return erase_in_pos_imp(r_key, ranged_hash_fn_base::operator()(r_key));
@@ -51,7 +51,7 @@ erase(const_key_reference r_key)
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
-erase_in_pos_imp(const_key_reference r_key, size_type pos)
+erase_in_pos_imp(key_const_reference r_key, size_type pos)
{
PB_DS_ASSERT_VALID((*this))
entry_pointer p_e = m_entries[pos];
@@ -78,24 +78,23 @@ erase_in_pos_imp(const_key_reference r_key, size_type pos)
{
entry_pointer p_next_e = p_e->m_p_next;
if (p_next_e == 0)
- {
+ {
resize_base::notify_erase_search_end();
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
- PB_DS_ASSERT_VALID((*this))
- return false;
- }
+ PB_DS_ASSERT_VALID((*this))
+ return false;
+ }
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_next_e->m_value), r_key))
- {
+ {
resize_base::notify_erase_search_end();
PB_DS_CHECK_KEY_EXISTS(r_key)
- erase_entry_pointer(p_e->m_p_next);
+ erase_entry_pointer(p_e->m_p_next);
do_resize_if_needed_no_throw();
PB_DS_ASSERT_VALID((*this))
- return true;
- }
+ return true;
+ }
resize_base::notify_erase_search_collision();
p_e = p_next_e;
}
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp
index 09d34f2c0b1..a4cddeafb67 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file erase_store_hash_fn_imps.hpp
+ * @file cc_hash_table_map_/erase_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s erase related functions,
* when the hash value is stored.
*/
@@ -42,7 +42,7 @@
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
-erase_in_pos_imp(const_key_reference r_key, const comp_hash& r_pos_hash_pair)
+erase_in_pos_imp(key_const_reference r_key, const comp_hash& r_pos_hash_pair)
{
PB_DS_ASSERT_VALID((*this))
entry_pointer p_e = m_entries[r_pos_hash_pair.first];
@@ -70,26 +70,25 @@ erase_in_pos_imp(const_key_reference r_key, const comp_hash& r_pos_hash_pair)
{
entry_pointer p_next_e = p_e->m_p_next;
if (p_next_e == 0)
- {
+ {
resize_base::notify_erase_search_end();
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
- PB_DS_ASSERT_VALID((*this))
- return false;
- }
+ PB_DS_ASSERT_VALID((*this))
+ return false;
+ }
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_next_e->m_value),
p_next_e->m_hash, r_key,
r_pos_hash_pair.second))
- {
+ {
resize_base::notify_erase_search_end();
PB_DS_CHECK_KEY_EXISTS(r_key)
- erase_entry_pointer(p_e->m_p_next);
+ erase_entry_pointer(p_e->m_p_next);
do_resize_if_needed_no_throw();
PB_DS_ASSERT_VALID((*this))
- return true;
- }
+ return true;
+ }
resize_base::notify_erase_search_collision();
p_e = p_next_e;
}
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
index 32ca47d6e3f..e3f363f41ed 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
@@ -34,23 +34,23 @@
// warranty.
/**
- * @file find_fn_imps.hpp
+ * @file cc_hash_table_map_/find_fn_imps.hpp
* Contains implementations of cc_ht_map_'s find related functions.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key)
+find(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
return find_key_pointer(r_key, traits_base::m_store_extra_indicator);
}
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key) const
+find(key_const_reference r_key) const
{
PB_DS_ASSERT_VALID((*this))
return const_cast<PB_DS_CLASS_C_DEC& >(*this).find_key_pointer(r_key,
@@ -64,7 +64,7 @@ find_end()
{ return 0; }
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
find_end() const
{ return 0; }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp
index 1db51c990a6..d532c4f45be 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file find_store_hash_fn_imps.hpp
+ * @file cc_hash_table_map_/find_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s find related functions,
* when the hash value is stored.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
index 2b429960c00..99eea41c598 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file info_fn_imps.hpp
+ * @file cc_hash_table_map_/info_fn_imps.hpp
* Contains implementations of cc_ht_map_'s entire container info related
* functions.
*/
@@ -76,8 +76,8 @@ cmp_with_other(const Other_Map_Type& other) const
for (typename Other_Map_Type::const_iterator it = other.begin();
it != other.end(); ++it)
{
- const_key_reference r_key =(const_key_reference)PB_DS_V2F(*it);
- const_mapped_pointer p_mapped_value =
+ key_const_reference r_key =(key_const_reference)PB_DS_V2F(*it);
+ mapped_const_pointer p_mapped_value =
const_cast<PB_DS_CLASS_C_DEC& >(*this).
find_key_pointer(r_key, traits_base::m_store_extra_indicator);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
index 0679dbe6e74..dc7d44cc504 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_fn_imps.hpp
+ * @file cc_hash_table_map_/insert_fn_imps.hpp
* Contains implementations of cc_ht_map_'s insert related functions.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
index acbd8a78d07..ba898739589 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_no_store_hash_fn_imps.hpp
+ * @file cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s insert related functions,
* when the hash value is not stored.
*/
@@ -45,7 +45,7 @@ PB_DS_CLASS_C_DEC::
insert_imp(const_reference r_val, false_type)
{
PB_DS_ASSERT_VALID((*this))
- const_key_reference r_key = PB_DS_V2F(r_val);
+ key_const_reference r_key = PB_DS_V2F(r_val);
const size_type pos = ranged_hash_fn_base::operator()(r_key);
entry_pointer p_e = m_entries[pos];
resize_base::notify_insert_search_start();
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
index 1224880ecc9..f4553976cfb 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_store_hash_fn_imps.hpp
+ * @file cc_hash_table_map_/insert_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s insert related functions,
* when the hash value is stored.
*/
@@ -45,7 +45,7 @@ PB_DS_CLASS_C_DEC::
insert_imp(const_reference r_val, true_type)
{
PB_DS_ASSERT_VALID((*this))
- const_key_reference key = PB_DS_V2F(r_val);
+ key_const_reference key = PB_DS_V2F(r_val);
comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(key);
entry_pointer p_e = m_entries[pos_hash_pair.first];
resize_base::notify_insert_search_start();
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
index a7592b7f1f7..5be4a9caab0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file iterators_fn_imps.hpp
+ * @file cc_hash_table_map_/iterators_fn_imps.hpp
* Contains implementations of cc_ht_map_'s iterators related functions, e.g.,
* begin().
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
index 9a661b36197..5bf12c8f166 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file policy_access_fn_imps.hpp
+ * @file cc_hash_table_map_/policy_access_fn_imps.hpp
* Contains implementations of cc_ht_map_'s policy access
* functions.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
index 4e3f48dd12d..66145b81da1 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
@@ -35,7 +35,7 @@
// warranty.
/**
- * @file resize_fn_imps.hpp
+ * @file cc_hash_table_map_/resize_fn_imps.hpp
* Contains implementations of cc_ht_map_'s resize related functions.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
index 6577630f0f0..f43850818b6 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
@@ -34,9 +34,9 @@
// warranty.
/**
- * @file resize_no_store_hash_fn_imps.hpp
+ * @file cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s resize related functions, when the
- * hash value is not stored.
+ * hash value is not stored.
*/
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
index c1adb61b190..1901b803938 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
@@ -34,9 +34,9 @@
// warranty.
/**
- * @file resize_store_hash_fn_imps.hpp
+ * @file cc_hash_table_map_/resize_store_hash_fn_imps.hpp
* Contains implementations of cc_ht_map_'s resize related functions, when the
- * hash value is stored.
+ * hash value is stored.
*/
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
index 0d5ec85f2e5..ff11890e693 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
@@ -34,9 +34,9 @@
// warranty.
/**
- * @file size_fn_imps.hpp
+ * @file cc_hash_table_map_/size_fn_imps.hpp
* Contains implementations of cc_ht_map_'s entire container size related
- * functions.
+ * functions.
*/
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
index b9c1ee20e5e..3c07f95a496 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file standard_policies.hpp
+ * @file cc_hash_table_map_/standard_policies.hpp
* Contains standard policies for cc_ht_map types.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
index 497977d97cc..ede1d6a8fc9 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file trace_fn_imps.hpp
+ * @file cc_hash_table_map_/trace_fn_imps.hpp
* Contains implementations of cc_ht_map_'s trace-mode functions.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cond_dealtor.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cond_dealtor.hpp
index 1ee48a2ac66..eb87bea9e24 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cond_dealtor.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cond_dealtor.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file cond_dealtor.hpp
+ * @file detail/cond_dealtor.hpp
* Contains a conditional deallocator.
*/
@@ -43,83 +43,42 @@
namespace __gnu_pbds
{
-
namespace detail
{
-
-#define PB_DS_COND_DEALTOR_CLASS_T_DEC \
- template<typename Entry, class Allocator>
-
-#define PB_DS_COND_DEALTOR_CLASS_C_DEC \
- cond_dealtor< \
- Entry, \
- Allocator>
-
- template<typename Entry, class Allocator>
- class cond_dealtor
- {
- public:
- typedef
- typename Allocator::template rebind<Entry>::other
- entry_allocator;
-
- typedef typename entry_allocator::pointer entry_pointer;
-
- public:
- inline
- cond_dealtor(entry_pointer p_e);
-
- inline
- ~cond_dealtor();
-
- inline void
- set_no_action();
-
- private:
- entry_pointer m_p_e;
-
- bool m_no_action_destructor;
-
- static entry_allocator s_alloc;
- };
-
- PB_DS_COND_DEALTOR_CLASS_T_DEC
- typename PB_DS_COND_DEALTOR_CLASS_C_DEC::entry_allocator
- PB_DS_COND_DEALTOR_CLASS_C_DEC::s_alloc;
-
- PB_DS_COND_DEALTOR_CLASS_T_DEC
- inline
- PB_DS_COND_DEALTOR_CLASS_C_DEC::
- cond_dealtor(entry_pointer p_e) :
- m_p_e(p_e),
- m_no_action_destructor(false)
- { }
-
- PB_DS_COND_DEALTOR_CLASS_T_DEC
- inline void
- PB_DS_COND_DEALTOR_CLASS_C_DEC::
- set_no_action()
- {
- m_no_action_destructor = true;
- }
-
- PB_DS_COND_DEALTOR_CLASS_T_DEC
- inline
- PB_DS_COND_DEALTOR_CLASS_C_DEC::
- ~cond_dealtor()
- {
- if (m_no_action_destructor)
- return;
-
- s_alloc.deallocate(m_p_e, 1);
- }
-
-#undef PB_DS_COND_DEALTOR_CLASS_T_DEC
-#undef PB_DS_COND_DEALTOR_CLASS_C_DEC
-
+ /// Conditional deallocate constructor argument.
+ template<typename Entry, typename _Alloc>
+ class cond_dealtor
+ {
+ typedef typename _Alloc::template rebind<Entry> __rebind_e;
+
+ public:
+ typedef typename __rebind_e::other entry_allocator;
+ typedef typename entry_allocator::pointer entry_pointer;
+
+ cond_dealtor(entry_pointer p_e)
+ : m_p_e(p_e), m_no_action_destructor(false) { }
+
+ ~cond_dealtor()
+ {
+ if (m_no_action_destructor)
+ return;
+ s_alloc.deallocate(m_p_e, 1);
+ }
+
+ void
+ set_no_action()
+ { m_no_action_destructor = true; }
+
+ private:
+ entry_pointer m_p_e;
+ bool m_no_action_destructor;
+ static entry_allocator s_alloc;
+ };
+
+ template<typename Entry, class _Alloc>
+ typename cond_dealtor<Entry, _Alloc>::entry_allocator
+ cond_dealtor<Entry, _Alloc>::s_alloc;
} // namespace detail
-
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_COND_DEALTOR_HPP
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
index 20c99886879..a960b7d2317 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file constructors_destructor_fn_imps.hpp
+ * @file detail/constructors_destructor_fn_imps.hpp
* Contains constructors_destructor_fn_imps applicable to different containers.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/container_base_dispatch.hpp b/libstdc++-v3/include/ext/pb_ds/detail/container_base_dispatch.hpp
index 2964b2d30c6..37217d950b7 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/container_base_dispatch.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/container_base_dispatch.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -35,7 +35,7 @@
/**
* @file container_base_dispatch.hpp
- * Contains an associative container dispatching base.
+ * Contains associative container dispatching.
*/
#ifndef PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP
@@ -60,60 +60,38 @@
__FILE__, __LINE__);)
#define PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_V2F(X) (X).first
+#define PB_DS_V2S(X) (X).second
+#define PB_DS_EP2VP(X)& ((X)->m_value)
#include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
-#undef PB_DS_DATA_TRUE_INDICATOR
-
-#define PB_DS_DATA_FALSE_INDICATOR
-#include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
-#undef PB_DS_DATA_FALSE_INDICATOR
-
-#define PB_DS_DATA_TRUE_INDICATOR
+#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
#include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
-#undef PB_DS_DATA_TRUE_INDICATOR
-
-#define PB_DS_DATA_FALSE_INDICATOR
-#include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
-#undef PB_DS_DATA_FALSE_INDICATOR
-
-#define PB_DS_DATA_TRUE_INDICATOR
-#include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
-#undef PB_DS_DATA_TRUE_INDICATOR
-
-#define PB_DS_DATA_FALSE_INDICATOR
#include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
-#undef PB_DS_DATA_FALSE_INDICATOR
-
-#define PB_DS_DATA_TRUE_INDICATOR
-#include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
-#undef PB_DS_DATA_TRUE_INDICATOR
-
-#define PB_DS_DATA_FALSE_INDICATOR
#include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
-#undef PB_DS_DATA_FALSE_INDICATOR
-
-#define PB_DS_DATA_TRUE_INDICATOR
-#include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
-#undef PB_DS_DATA_TRUE_INDICATOR
-
-#define PB_DS_DATA_FALSE_INDICATOR
#include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
-#undef PB_DS_DATA_FALSE_INDICATOR
-
-#define PB_DS_DATA_TRUE_INDICATOR
-#include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
-#undef PB_DS_DATA_TRUE_INDICATOR
-
-#define PB_DS_DATA_FALSE_INDICATOR
#include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
-#undef PB_DS_DATA_FALSE_INDICATOR
-
-#define PB_DS_DATA_TRUE_INDICATOR
#include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>
#undef PB_DS_DATA_TRUE_INDICATOR
+#undef PB_DS_V2F
+#undef PB_DS_V2S
+#undef PB_DS_EP2VP
#define PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_V2F(X) (X)
+#define PB_DS_V2S(X) Mapped_Data()
+#define PB_DS_EP2VP(X)& ((X)->m_value.first)
+#include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
+#include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
+#include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
+#include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
+#include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
#include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>
#undef PB_DS_DATA_FALSE_INDICATOR
+#undef PB_DS_V2F
+#undef PB_DS_V2S
+#undef PB_DS_EP2VP
#undef PB_DS_CHECK_KEY_DOES_NOT_EXIST
#undef PB_DS_CHECK_KEY_EXISTS
@@ -124,28 +102,26 @@ namespace __gnu_pbds
{
namespace detail
{
- // Primary template.
- template<typename Key, typename Mapped, typename Data_Structure_Taq,
- typename Policy_Tl, typename Alloc>
- struct container_base_dispatch;
-
- template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
- struct container_base_dispatch<Key, Mapped, list_update_tag,
- Policy_Tl, Alloc>
+ /// Specialization for list-update map.
+ template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
+ struct container_base_dispatch<Key, Mapped, _Alloc, list_update_tag,
+ Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
typedef typename at0::type at0t;
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
-
+
public:
- typedef lu_map_data_<Key, Mapped, at0t, Alloc, at1t> type;
+ /// Dispatched type.
+ typedef lu_map<Key, Mapped, at0t, _Alloc, at1t> type;
};
- template<typename Key, typename Policy_Tl, typename Alloc>
- struct container_base_dispatch<Key, null_mapped_type, list_update_tag,
- Policy_Tl, Alloc>
+ /// Specialization for list-update set.
+ template<typename Key, typename _Alloc, typename Policy_Tl>
+ struct container_base_dispatch<Key, null_type, _Alloc, list_update_tag,
+ Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
@@ -154,34 +130,39 @@ namespace detail
typedef typename at1::type at1t;
public:
- typedef lu_map_no_data_<Key, null_mapped_type, at0t, Alloc, at1t> type;
+ /// Dispatched type.
+ typedef lu_set<Key, null_type, at0t, _Alloc, at1t> type;
};
- template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
- struct container_base_dispatch<Key, Mapped, pat_trie_tag, Policy_Tl, Alloc>
+ /// Specialization for PATRICIA trie map.
+ template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
+ struct container_base_dispatch<Key, Mapped, _Alloc, pat_trie_tag, Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
public:
- typedef pat_trie_data_<Key, Mapped, at1t, Alloc> type;
+ typedef pat_trie_map<Key, Mapped, at1t, _Alloc> type;
};
- template<typename Key, typename Policy_Tl, typename Alloc>
- struct container_base_dispatch<Key, null_mapped_type, pat_trie_tag,
- Policy_Tl, Alloc>
+ /// Specialization for PATRICIA trie set.
+ template<typename Key, typename _Alloc, typename Policy_Tl>
+ struct container_base_dispatch<Key, null_type, _Alloc, pat_trie_tag,
+ Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
typedef typename at1::type at1t;
public:
- typedef pat_trie_no_data_<Key, null_mapped_type, at1t, Alloc> type;
+ /// Dispatched type.
+ typedef pat_trie_set<Key, null_type, at1t, _Alloc> type;
};
- template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
- struct container_base_dispatch<Key, Mapped, rb_tree_tag, Policy_Tl, Alloc>
+ /// Specialization for R-B tree map.
+ template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
+ struct container_base_dispatch<Key, Mapped, _Alloc, rb_tree_tag, Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
@@ -190,12 +171,14 @@ namespace detail
typedef typename at1::type at1t;
public:
- typedef rb_tree_data_<Key, Mapped, at0t, at1t, Alloc> type;
+ /// Dispatched type.
+ typedef rb_tree_map<Key, Mapped, at0t, at1t, _Alloc> type;
};
- template<typename Key, typename Policy_Tl, typename Alloc>
- struct container_base_dispatch<Key, null_mapped_type, rb_tree_tag,
- Policy_Tl, Alloc>
+ /// Specialization for R-B tree set.
+ template<typename Key, typename _Alloc, typename Policy_Tl>
+ struct container_base_dispatch<Key, null_type, _Alloc, rb_tree_tag,
+ Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
@@ -204,12 +187,13 @@ namespace detail
typedef typename at1::type at1t;
public:
- typedef rb_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;
+ typedef rb_tree_set<Key, null_type, at0t, at1t, _Alloc> type;
};
- template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
- struct container_base_dispatch<Key, Mapped, splay_tree_tag,
- Policy_Tl, Alloc>
+ /// Specialization splay tree map.
+ template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
+ struct container_base_dispatch<Key, Mapped, _Alloc, splay_tree_tag,
+ Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
@@ -218,12 +202,14 @@ namespace detail
typedef typename at1::type at1t;
public:
- typedef splay_tree_data_<Key, Mapped, at0t, at1t, Alloc> type;
+ /// Dispatched type.
+ typedef splay_tree_map<Key, Mapped, at0t, at1t, _Alloc> type;
};
- template<typename Key, typename Policy_Tl, typename Alloc>
- struct container_base_dispatch<Key, null_mapped_type, splay_tree_tag,
- Policy_Tl, Alloc>
+ /// Specialization splay tree set.
+ template<typename Key, typename _Alloc, typename Policy_Tl>
+ struct container_base_dispatch<Key, null_type, _Alloc, splay_tree_tag,
+ Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
@@ -232,11 +218,13 @@ namespace detail
typedef typename at1::type at1t;
public:
- typedef splay_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;
+ /// Dispatched type.
+ typedef splay_tree_set<Key, null_type, at0t, at1t, _Alloc> type;
};
- template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
- struct container_base_dispatch<Key, Mapped, ov_tree_tag, Policy_Tl, Alloc>
+ /// Specialization ordered-vector tree map.
+ template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
+ struct container_base_dispatch<Key, Mapped, _Alloc, ov_tree_tag, Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
@@ -245,12 +233,14 @@ namespace detail
typedef typename at1::type at1t;
public:
- typedef ov_tree_data_<Key, Mapped, at0t, at1t, Alloc> type;
+ /// Dispatched type.
+ typedef ov_tree_map<Key, Mapped, at0t, at1t, _Alloc> type;
};
- template<typename Key, typename Policy_Tl, typename Alloc>
- struct container_base_dispatch<Key, null_mapped_type, ov_tree_tag,
- Policy_Tl, Alloc>
+ /// Specialization ordered-vector tree set.
+ template<typename Key, typename _Alloc, typename Policy_Tl>
+ struct container_base_dispatch<Key, null_type, _Alloc, ov_tree_tag,
+ Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
@@ -259,11 +249,13 @@ namespace detail
typedef typename at1::type at1t;
public:
- typedef ov_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;
+ /// Dispatched type.
+ typedef ov_tree_set<Key, null_type, at0t, at1t, _Alloc> type;
};
- template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
- struct container_base_dispatch<Key, Mapped, cc_hash_tag, Policy_Tl, Alloc>
+ /// Specialization colision-chaining hash map.
+ template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
+ struct container_base_dispatch<Key, Mapped, _Alloc, cc_hash_tag, Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
@@ -278,13 +270,15 @@ namespace detail
typedef typename at4::type at4t;
public:
- typedef cc_ht_map_data_<Key, Mapped, at0t, at1t, Alloc, at3t::value,
- at4t, at2t> type;
+ /// Dispatched type.
+ typedef cc_ht_map<Key, Mapped, at0t, at1t, _Alloc,
+ at3t::value, at4t, at2t> type;
};
- template<typename Key, typename Policy_Tl, typename Alloc>
- struct container_base_dispatch<Key, null_mapped_type, cc_hash_tag,
- Policy_Tl, Alloc>
+ /// Specialization colision-chaining hash set.
+ template<typename Key, typename _Alloc, typename Policy_Tl>
+ struct container_base_dispatch<Key, null_type, _Alloc, cc_hash_tag,
+ Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
@@ -299,12 +293,14 @@ namespace detail
typedef typename at4::type at4t;
public:
- typedef cc_ht_map_no_data_<Key, null_mapped_type, at0t, at1t, Alloc,
+ /// Dispatched type.
+ typedef cc_ht_set<Key, null_type, at0t, at1t, _Alloc,
at3t::value, at4t, at2t> type;
};
- template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
- struct container_base_dispatch<Key, Mapped, gp_hash_tag, Policy_Tl, Alloc>
+ /// Specialization general-probe hash map.
+ template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
+ struct container_base_dispatch<Key, Mapped, _Alloc, gp_hash_tag, Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
@@ -321,13 +317,15 @@ namespace detail
typedef typename at5::type at5t;
public:
- typedef gp_ht_map_data_<Key, Mapped, at0t, at1t, Alloc, at3t::value,
- at4t, at5t, at2t> type;
+ /// Dispatched type.
+ typedef gp_ht_map<Key, Mapped, at0t, at1t, _Alloc,
+ at3t::value, at4t, at5t, at2t> type;
};
- template<typename Key, typename Policy_Tl, typename Alloc>
- struct container_base_dispatch<Key, null_mapped_type, gp_hash_tag,
- Policy_Tl, Alloc>
+ /// Specialization general-probe hash set.
+ template<typename Key, typename _Alloc, typename Policy_Tl>
+ struct container_base_dispatch<Key, null_type, _Alloc, gp_hash_tag,
+ Policy_Tl>
{
private:
typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
@@ -344,10 +342,11 @@ namespace detail
typedef typename at5::type at5t;
public:
- typedef gp_ht_map_no_data_<Key, null_mapped_type, at0t, at1t, Alloc,
- at3t::value, at4t, at5t, at2t> type;
+ /// Dispatched type.
+ typedef gp_ht_set<Key, null_type, at0t, at1t, _Alloc,
+ at3t::value, at4t, at5t, at2t> type;
};
} // namespace detail
} // namespace __gnu_pbds
-#endif
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/debug_map_base.hpp b/libstdc++-v3/include/ext/pb_ds/detail/debug_map_base.hpp
index a9a0b42d263..c1709ba452d 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/debug_map_base.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/debug_map_base.hpp
@@ -35,7 +35,7 @@
// warranty.
/**
- * @file debug_map_base.hpp
+ * @file detail/debug_map_base.hpp
* Contains a debug-mode base for all maps.
*/
@@ -63,73 +63,69 @@ namespace __gnu_pbds
{ return (__out << '(' << p.first << ',' << p.second << ')'); }
#define PB_DS_CLASS_T_DEC \
- template<typename Key, class Eq_Fn, typename Const_Key_Reference>
+ template<typename Key, typename Eq_Fn, typename Const_Key_Reference>
#define PB_DS_CLASS_C_DEC \
debug_map_base<Key, Eq_Fn, Const_Key_Reference>
- template<typename Key, class Eq_Fn, typename Const_Key_Reference>
+ /// Debug base class.
+ template<typename Key, typename Eq_Fn, typename Const_Key_Reference>
class debug_map_base
{
private:
- typedef typename std::allocator<Key> key_allocator;
- typedef typename key_allocator::size_type size_type;
- typedef Const_Key_Reference const_key_reference;
- typedef std::_GLIBCXX_STD_C::list<Key> key_set;
- typedef typename key_set::iterator key_set_iterator;
- typedef typename key_set::const_iterator const_key_set_iterator;
- typedef __gnu_cxx::throw_allocator_random<Key> key_db_allocator;
- typedef typename key_db_allocator::never_adjustor never_adjustor;
+ typedef Const_Key_Reference key_const_reference;
+ typedef std::_GLIBCXX_STD_C::list<Key> key_repository;
+ typedef typename key_repository::size_type size_type;
+ typedef typename key_repository::iterator iterator;
+ typedef typename key_repository::const_iterator const_iterator;
protected:
debug_map_base();
- debug_map_base(const PB_DS_CLASS_C_DEC& other);
+ debug_map_base(const PB_DS_CLASS_C_DEC&);
~debug_map_base();
inline void
- insert_new(const_key_reference r_key);
+ insert_new(key_const_reference);
inline void
- erase_existing(const_key_reference r_key);
+ erase_existing(key_const_reference);
void
clear();
inline void
- check_key_exists(const_key_reference r_key,
- const char* file, int line) const;
+ check_key_exists(key_const_reference, const char*, int) const;
inline void
- check_key_does_not_exist(const_key_reference r_key,
- const char* file, int line) const;
+ check_key_does_not_exist(key_const_reference, const char*, int) const;
inline void
- check_size(size_type size, const char* file, int line) const;
+ check_size(size_type, const char*, int) const;
void
- swap(PB_DS_CLASS_C_DEC& other);
+ swap(PB_DS_CLASS_C_DEC&);
template<typename Cmp_Fn>
void
- split(const_key_reference, Cmp_Fn, PB_DS_CLASS_C_DEC&);
+ split(key_const_reference, Cmp_Fn, PB_DS_CLASS_C_DEC&);
void
- join(PB_DS_CLASS_C_DEC& other, bool with_cleanup = true);
+ join(PB_DS_CLASS_C_DEC&, bool with_cleanup = true);
private:
void
- assert_valid(const char* file, int line) const;
+ assert_valid(const char*, int) const;
- const_key_set_iterator
- find(const_key_reference r_key) const;
+ const_iterator
+ find(key_const_reference) const;
- key_set_iterator
- find(const_key_reference r_key);
+ iterator
+ find(key_const_reference);
- key_set m_key_set;
- Eq_Fn m_eq;
+ key_repository m_keys;
+ Eq_Fn m_eq;
};
PB_DS_CLASS_T_DEC
@@ -139,7 +135,8 @@ namespace __gnu_pbds
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
- debug_map_base(const PB_DS_CLASS_C_DEC& other) : m_key_set(other.m_key_set)
+ debug_map_base(const PB_DS_CLASS_C_DEC& other)
+ : m_keys(other.m_keys), m_eq(other.m_eq)
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
@@ -150,20 +147,19 @@ namespace __gnu_pbds
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
- insert_new(const_key_reference r_key)
+ insert_new(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
- if (find(r_key) != m_key_set.end())
+ if (find(r_key) != m_keys.end())
{
std::cerr << "insert_new key already present " << r_key << std::endl;
- std::abort;
+ std::abort();
}
- never_adjustor never;
__try
{
- m_key_set.push_back(r_key);
+ m_keys.push_back(r_key);
}
__catch(...)
{
@@ -177,16 +173,16 @@ namespace __gnu_pbds
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
- erase_existing(const_key_reference r_key)
+ erase_existing(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
- key_set_iterator it = find(r_key);
- if (it == m_key_set.end())
+ iterator it = find(r_key);
+ if (it == m_keys.end())
{
std::cerr << "erase_existing" << r_key << std::endl;
std::abort();
}
- m_key_set.erase(it);
+ m_keys.erase(it);
PB_DS_ASSERT_VALID((*this))
}
@@ -196,18 +192,18 @@ namespace __gnu_pbds
clear()
{
PB_DS_ASSERT_VALID((*this))
- m_key_set.clear();
+ m_keys.clear();
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
- check_key_exists(const_key_reference r_key,
+ check_key_exists(key_const_reference r_key,
const char* __file, int __line) const
{
assert_valid(__file, __line);
- if (find(r_key) == m_key_set.end())
+ if (find(r_key) == m_keys.end())
{
std::cerr << __file << ':' << __line << ": check_key_exists "
<< r_key << std::endl;
@@ -218,11 +214,11 @@ namespace __gnu_pbds
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
- check_key_does_not_exist(const_key_reference r_key,
+ check_key_does_not_exist(key_const_reference r_key,
const char* __file, int __line) const
{
assert_valid(__file, __line);
- if (find(r_key) != m_key_set.end())
+ if (find(r_key) != m_keys.end())
{
using std::cerr;
using std::endl;
@@ -238,11 +234,11 @@ namespace __gnu_pbds
check_size(size_type size, const char* __file, int __line) const
{
assert_valid(__file, __line);
- const size_type key_set_size = m_key_set.size();
- if (size != key_set_size)
+ const size_type keys_size = m_keys.size();
+ if (size != keys_size)
{
- std::cerr << __file << ':' << __line << ": check_size " << size
- << " != " << key_set_size << std::endl;
+ std::cerr << __file << ':' << __line << ": check_size "
+ << size << " != " << keys_size << std::endl;
std::abort();
}
}
@@ -253,31 +249,32 @@ namespace __gnu_pbds
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
- m_key_set.swap(other.m_key_set);
+ m_keys.swap(other.m_keys);
+ std::swap(m_eq, other.m_eq);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::const_key_set_iterator
+ typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
- find(const_key_reference r_key) const
+ find(key_const_reference r_key) const
{
PB_DS_ASSERT_VALID((*this))
- typedef const_key_set_iterator iterator_type;
- for (iterator_type it = m_key_set.begin(); it != m_key_set.end(); ++it)
+ typedef const_iterator iterator_type;
+ for (iterator_type it = m_keys.begin(); it != m_keys.end(); ++it)
if (m_eq(*it, r_key))
return it;
- return m_key_set.end();
+ return m_keys.end();
}
PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::key_set_iterator
+ typename PB_DS_CLASS_C_DEC::iterator
PB_DS_CLASS_C_DEC::
- find(const_key_reference r_key)
+ find(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
- key_set_iterator it = m_key_set.begin();
- while (it != m_key_set.end())
+ iterator it = m_keys.begin();
+ while (it != m_keys.end())
{
if (m_eq(*it, r_key))
return it;
@@ -291,12 +288,12 @@ namespace __gnu_pbds
PB_DS_CLASS_C_DEC::
assert_valid(const char* __file, int __line) const
{
- const_key_set_iterator prime_it = m_key_set.begin();
- while (prime_it != m_key_set.end())
+ const_iterator prime_it = m_keys.begin();
+ while (prime_it != m_keys.end())
{
- const_key_set_iterator sec_it = prime_it;
+ const_iterator sec_it = prime_it;
++sec_it;
- while (sec_it != m_key_set.end())
+ while (sec_it != m_keys.end())
{
PB_DS_DEBUG_VERIFY(!m_eq(*sec_it, *prime_it));
PB_DS_DEBUG_VERIFY(!m_eq(*prime_it, *sec_it));
@@ -310,15 +307,15 @@ namespace __gnu_pbds
template<typename Cmp_Fn>
void
PB_DS_CLASS_C_DEC::
- split(const_key_reference r_key, Cmp_Fn cmp_fn, PB_DS_CLASS_C_DEC& other)
+ split(key_const_reference r_key, Cmp_Fn cmp_fn, PB_DS_CLASS_C_DEC& other)
{
other.clear();
- key_set_iterator it = m_key_set.begin();
- while (it != m_key_set.end())
- if (cmp_fn(r_key, * it))
+ iterator it = m_keys.begin();
+ while (it != m_keys.end())
+ if (cmp_fn(r_key, *it))
{
other.insert_new(*it);
- it = m_key_set.erase(it);
+ it = m_keys.erase(it);
}
else
++it;
@@ -329,16 +326,16 @@ namespace __gnu_pbds
PB_DS_CLASS_C_DEC::
join(PB_DS_CLASS_C_DEC& other, bool with_cleanup)
{
- key_set_iterator it = other.m_key_set.begin();
- while (it != other.m_key_set.end())
+ iterator it = other.m_keys.begin();
+ while (it != other.m_keys.end())
{
insert_new(*it);
if (with_cleanup)
- it = other.m_key_set.erase(it);
+ it = other.m_keys.erase(it);
else
++it;
}
- _GLIBCXX_DEBUG_ASSERT(!with_cleanup || other.m_key_set.empty());
+ _GLIBCXX_DEBUG_ASSERT(!with_cleanup || other.m_keys.empty());
}
#undef PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp b/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
index ec95bca6402..389bdcdb637 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -51,6 +51,7 @@ namespace __gnu_pbds
{
namespace detail
{
+ /// Equivalence function.
template<typename Key, class Cmp_Fn>
struct eq_by_less : private Cmp_Fn
{
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp b/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
index b21c252e2c0..6255d55eb0e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -36,7 +36,7 @@
/**
* @file hash_eq_fn.hpp
* Contains 2 eqivalence functions, one employing a hash value,
- * and one ignoring it.
+ * and one ignoring it.
*/
#ifndef PB_DS_HASH_EQ_FN_HPP
@@ -49,130 +49,60 @@ namespace __gnu_pbds
{
namespace detail
{
- template<typename Key, class Eq_Fn, class Allocator, bool Store_Hash>
- struct hash_eq_fn;
+ template<typename Key, typename Eq_Fn, typename _Alloc, bool Store_Hash>
+ struct hash_eq_fn;
-#define PB_DS_CLASS_T_DEC \
- template<typename Key, class Eq_Fn, class Allocator>
-
-#define PB_DS_CLASS_C_DEC \
- hash_eq_fn<Key, Eq_Fn, Allocator, false>
-
- /**
- * Specialization 1- The client requests that hash values not be stored.
- **/
- template<typename Key, class Eq_Fn, class Allocator>
- struct hash_eq_fn<Key, Eq_Fn, Allocator, false> : public Eq_Fn
+ /// Specialization 1 - The client requests that hash values not be stored.
+ template<typename Key, typename Eq_Fn, typename _Alloc>
+ struct hash_eq_fn<Key, Eq_Fn, _Alloc, false> : public Eq_Fn
{
- typedef Eq_Fn eq_fn_base;
-
- typedef typename Allocator::template rebind<Key>::other key_allocator;
-
- typedef typename key_allocator::const_reference const_key_reference;
+ typedef Eq_Fn eq_fn_base;
+ typedef typename _Alloc::template rebind<Key>::other key_allocator;
+ typedef typename key_allocator::const_reference key_const_reference;
- hash_eq_fn();
+ hash_eq_fn() { }
- hash_eq_fn(const Eq_Fn& r_eq_fn);
+ hash_eq_fn(const Eq_Fn& r_eq_fn) : Eq_Fn(r_eq_fn) { }
- inline bool
- operator()(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const;
+ bool
+ operator()(key_const_reference r_lhs_key,
+ key_const_reference r_rhs_key) const
+ { return eq_fn_base::operator()(r_lhs_key, r_rhs_key); }
- inline void
- swap(const PB_DS_CLASS_C_DEC& other);
+ void
+ swap(const hash_eq_fn& other)
+ { std::swap((Eq_Fn&)(*this), (Eq_Fn&)other); }
};
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- hash_eq_fn()
- { }
-
- PB_DS_CLASS_T_DEC
- inline void
- PB_DS_CLASS_C_DEC::
- swap(const PB_DS_CLASS_C_DEC& other)
- { std::swap((Eq_Fn& )(*this), (Eq_Fn& )other); }
-
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- hash_eq_fn(const Eq_Fn& r_eq_fn) :
- Eq_Fn(r_eq_fn)
- { }
-
- PB_DS_CLASS_T_DEC
- inline bool
- PB_DS_CLASS_C_DEC::
- operator()(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const
- { return (eq_fn_base::operator()(r_lhs_key, r_rhs_key)); }
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
-#define PB_DS_CLASS_T_DEC \
- template<typename Key, class Eq_Fn, class Allocator>
-
-#define PB_DS_CLASS_C_DEC \
- hash_eq_fn<Key, Eq_Fn, Allocator, true>
-
- /**
- * Specialization 2- The client requests that hash values be stored.
- **/
- template<typename Key, class Eq_Fn, class Allocator>
- struct hash_eq_fn<Key, Eq_Fn, Allocator, true> :
- public Eq_Fn
- {
- typedef typename Allocator::size_type size_type;
-
- typedef Eq_Fn eq_fn_base;
- typedef typename Allocator::template rebind<Key>::other key_allocator;
+ /// Specialization 2 - The client requests that hash values be stored.
+ template<typename Key, class Eq_Fn, class _Alloc>
+ struct hash_eq_fn<Key, Eq_Fn, _Alloc, true> : public Eq_Fn
+ {
+ typedef typename _Alloc::size_type size_type;
+ typedef Eq_Fn eq_fn_base;
+ typedef typename _Alloc::template rebind<Key>::other key_allocator;
+ typedef typename key_allocator::const_reference key_const_reference;
- typedef typename key_allocator::const_reference const_key_reference;
+ hash_eq_fn() { }
- hash_eq_fn();
+ hash_eq_fn(const Eq_Fn& r_eq_fn) : Eq_Fn(r_eq_fn) { }
- hash_eq_fn(const Eq_Fn& r_eq_fn);
+ bool
+ operator()(key_const_reference r_lhs_key, size_type lhs_hash,
+ key_const_reference r_rhs_key, size_type rhs_hash) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(!eq_fn_base::operator()(r_lhs_key, r_rhs_key)
+ || lhs_hash == rhs_hash);
- inline bool
- operator()(const_key_reference r_lhs_key, size_type lhs_hash,
- const_key_reference r_rhs_key, size_type rhs_hash) const;
+ return (lhs_hash == rhs_hash &&
+ eq_fn_base::operator()(r_lhs_key, r_rhs_key));
+ }
- inline void
- swap(const PB_DS_CLASS_C_DEC& other);
+ void
+ swap(const hash_eq_fn& other)
+ { std::swap((Eq_Fn&)(*this), (Eq_Fn&)(other)); }
};
-
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- hash_eq_fn()
- { }
-
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- hash_eq_fn(const Eq_Fn& r_eq_fn) :
- Eq_Fn(r_eq_fn)
- { }
-
- PB_DS_CLASS_T_DEC
- inline bool
- PB_DS_CLASS_C_DEC::
- operator()(const_key_reference r_lhs_key, size_type lhs_hash,
- const_key_reference r_rhs_key, size_type rhs_hash) const
- {
- _GLIBCXX_DEBUG_ASSERT(!eq_fn_base::operator()(r_lhs_key, r_rhs_key)
- || lhs_hash == rhs_hash);
-
- return (lhs_hash == rhs_hash &&
- eq_fn_base::operator()(r_lhs_key, r_rhs_key));
- }
-
- PB_DS_CLASS_T_DEC
- inline void
- PB_DS_CLASS_C_DEC::
- swap(const PB_DS_CLASS_C_DEC& other)
- { std::swap((Eq_Fn& )(*this), (Eq_Fn& )(other)); }
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
} // namespace detail
} // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
index 90f17094a0f..8a51541b528 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
@@ -35,9 +35,9 @@
// warranty.
/**
- * @file constructor_destructor_fn_imps.hpp
+ * @file gp_hash_table_map_/constructor_destructor_fn_imps.hpp
* Contains implementations of gp_ht_map_'s constructors, destructor,
- * and related functions.
+ * and related functions.
*/
PB_DS_CLASS_T_DEC
@@ -56,7 +56,7 @@ copy_from_range(It first_it, It last_it)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME()
+PB_DS_GP_HASH_NAME()
: ranged_probe_fn_base(resize_base::get_nearest_larger_size(1)),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_allocator.allocate(m_num_e))
@@ -67,7 +67,7 @@ PB_DS_CLASS_NAME()
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn)
+PB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn)
: ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_allocator.allocate(m_num_e))
@@ -78,7 +78,7 @@ PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn)
+PB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn)
: hash_eq_fn_base(r_eq_fn),
ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
@@ -90,7 +90,7 @@ PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
+PB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
const Comb_Probe_Fn& r_comb_hash_fn)
: hash_eq_fn_base(r_eq_fn),
ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
@@ -104,7 +104,7 @@ PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
+PB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& prober)
: hash_eq_fn_base(r_eq_fn),
ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
@@ -118,7 +118,7 @@ PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
+PB_DS_GP_HASH_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& prober,
const Resize_Policy& r_resize_policy)
: hash_eq_fn_base(r_eq_fn), resize_base(r_resize_policy),
@@ -133,7 +133,7 @@ PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+PB_DS_GP_HASH_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG
debug_base(other),
#endif
@@ -166,7 +166,7 @@ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-~PB_DS_CLASS_NAME()
+~PB_DS_GP_HASH_NAME()
{ deallocate_all(); }
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
index ec8069839b0..d077cbf3cea 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file constructor_destructor_no_store_hash_fn_imps.hpp
+ * @file gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s constructors, destructor,
* and related functions.
*/
@@ -42,7 +42,7 @@
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
-constructor_insert_new_imp(const_mapped_reference r_val, size_type pos,
+constructor_insert_new_imp(mapped_const_reference r_val, size_type pos,
false_type)
{
_GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status)k;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
index 5f304875908..ff83c20b8f5 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file constructor_destructor_store_hash_fn_imps.hpp
+ * @file gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s constructors, destructor,
* and related functions.
*/
@@ -42,7 +42,7 @@
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
-constructor_insert_new_imp(const_mapped_reference r_val, size_type pos,
+constructor_insert_new_imp(mapped_const_reference r_val, size_type pos,
true_type)
{
_GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
index eca853a2092..cad9a733be9 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_fn_imps.hpp
+ * @file gp_hash_table_map_/debug_fn_imps.hpp
* Contains implementations of gp_ht_map_'s debug-mode functions.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
index ba8f54e5dea..ff9bdae14a0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_no_store_hash_fn_imps.hpp
+ * @file gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s debug-mode functions.
*/
@@ -57,7 +57,7 @@ assert_entry_array_valid(const entry_array a_entries, false_type,
break;
case valid_entry_status:
{
- const_key_reference r_key = PB_DS_V2F(p_e->m_value);
+ key_const_reference r_key = PB_DS_V2F(p_e->m_value);
debug_base::check_key_exists(r_key, __file, __line);
++iterated_num_used_e;
break;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp
index 2c2833eacbf..488b6b9236c 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_store_hash_fn_imps.hpp
+ * @file gp_hash_table_map_/debug_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s debug-mode functions.
*/
@@ -58,7 +58,7 @@ assert_entry_array_valid(const entry_array a_entries, true_type,
break;
case valid_entry_status:
{
- const_key_reference r_key = PB_DS_V2F(p_e->m_value);
+ key_const_reference r_key = PB_DS_V2F(p_e->m_value);
debug_base::check_key_exists(r_key, __file, __line);
const comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
index e57d5cc7f2d..0e6227bc7cf 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file erase_fn_imps.hpp
+ * @file gp_hash_table_map_/erase_fn_imps.hpp
* Contains implementations of gp_ht_map_'s erase related functions.
*/
@@ -93,7 +93,7 @@ erase_if(Pred pred)
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
-erase(const_key_reference r_key)
+erase(key_const_reference r_key)
{ return erase_imp(r_key, traits_base::m_store_extra_indicator); }
#include <ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp>
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
index 67e64e91ab6..d95b9a72b46 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file erase_no_store_hash_fn_imps.hpp
+ * @file gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s erase related functions,
* when the hash value is not stored.
*/
@@ -42,7 +42,7 @@
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
-erase_imp(const_key_reference r_key, false_type)
+erase_imp(key_const_reference r_key, false_type)
{
PB_DS_ASSERT_VALID((*this))
size_type hash = ranged_probe_fn_base::operator()(r_key);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp
index 02dc63ea5bb..9ccad4f94b7 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file erase_store_hash_fn_imps.hpp
+ * @file gp_hash_table_map_/erase_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s erase related functions,
* when the hash value is stored.
*/
@@ -42,7 +42,7 @@
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
-erase_imp(const_key_reference r_key, true_type)
+erase_imp(key_const_reference r_key, true_type)
{
const comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);
size_type i;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
index d8b32fe1719..e6e9c5f0da9 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
@@ -34,23 +34,23 @@
// warranty.
/**
- * @file find_fn_imps.hpp
+ * @file gp_hash_table_map_/find_fn_imps.hpp
* Contains implementations of gp_ht_map_'s find related functions.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key)
+find(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
return find_key_pointer(r_key, traits_base::m_store_extra_indicator);
}
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key) const
+find(key_const_reference r_key) const
{
PB_DS_ASSERT_VALID((*this))
return const_cast<PB_DS_CLASS_C_DEC&>(*this).find_key_pointer(r_key, traits_base::m_store_extra_indicator);
@@ -63,7 +63,7 @@ find_end()
{ return 0; }
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
find_end() const
{ return 0; }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
index 298604c80e2..2af9781b5e3 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file find_no_store_hash_fn_imps.hpp
+ * @file gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s find related functions,
* when the hash value is not stored.
*/
@@ -42,5 +42,5 @@
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::pointer
PB_DS_CLASS_C_DEC::
-find_key_pointer(const_key_reference r_key, false_type)
+find_key_pointer(key_const_reference r_key, false_type)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
index a44b8326e28..80c7788c70f 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file find_store_hash_fn_imps.hpp
+ * @file gp_hash_table_map_/find_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s insert related functions,
* when the hash value is stored.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
index a9179d5363d..4ce94aefecd 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
@@ -35,8 +35,8 @@
// warranty.
/**
- * @file gp_ht_map_.hpp
- * Contains an implementation class for gp_ht_map_.
+ * @file gp_hash_table_map_/gp_ht_map_.hpp
+ * Contains an implementation class for general probing hash.
*/
#include <ext/pb_ds/tag_and_trait.hpp>
@@ -47,7 +47,7 @@
#include <utility>
#ifdef PB_DS_HT_MAP_TRACE_
#include <iostream>
-#endif
+#endif
#ifdef _GLIBCXX_DEBUG
#include <ext/pb_ds/detail/debug_map_base.hpp>
#endif
@@ -57,73 +57,66 @@ namespace __gnu_pbds
{
namespace detail
{
-#define PB_DS_CLASS_T_DEC \
- template<typename Key, typename Mapped, typename Hash_Fn, typename Eq_Fn, \
- typename Allocator, bool Store_Hash, typename Comb_Probe_Fn, \
- typename Probe_Fn, typename Resize_Policy>
-
#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CLASS_NAME gp_ht_map_data_
+#define PB_DS_GP_HASH_NAME gp_ht_map
#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_CLASS_NAME gp_ht_map_no_data_
-#endif
+#define PB_DS_GP_HASH_NAME gp_ht_set
+#endif
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Mapped, typename Hash_Fn, typename Eq_Fn, \
+ typename _Alloc, bool Store_Hash, typename Comb_Probe_Fn, \
+ typename Probe_Fn, typename Resize_Policy>
#define PB_DS_CLASS_C_DEC \
- PB_DS_CLASS_NAME<Key, Mapped, Hash_Fn, Eq_Fn, Allocator, \
- Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy>
+ PB_DS_GP_HASH_NAME<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, \
+ Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy>
#define PB_DS_HASH_EQ_FN_C_DEC \
- hash_eq_fn<Key, Eq_Fn, Allocator, Store_Hash>
+ hash_eq_fn<Key, Eq_Fn, _Alloc, Store_Hash>
#define PB_DS_RANGED_PROBE_FN_C_DEC \
- ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, Store_Hash>
+ ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, Store_Hash>
-#define PB_DS_TYPES_TRAITS_C_DEC \
- types_traits<Key, Mapped, Allocator, Store_Hash>
+#define PB_DS_GP_HASH_TRAITS_BASE \
+ types_traits<Key, Mapped, _Alloc, Store_Hash>
#ifdef _GLIBCXX_DEBUG
#define PB_DS_DEBUG_MAP_BASE_C_DEC \
- debug_map_base<Key, Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference>
-#endif
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#endif
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped()
+ debug_map_base<Key, Eq_Fn, \
+ typename _Alloc::template rebind<Key>::other::const_reference>
#endif
+
+ /// General probing hash.
template<typename Key,
typename Mapped,
typename Hash_Fn,
typename Eq_Fn,
- typename Allocator,
+ typename _Alloc,
bool Store_Hash,
typename Comb_Probe_Fn,
typename Probe_Fn,
typename Resize_Policy>
- class PB_DS_CLASS_NAME :
+ class PB_DS_GP_HASH_NAME :
#ifdef _GLIBCXX_DEBUG
protected PB_DS_DEBUG_MAP_BASE_C_DEC,
-#endif
+#endif
public PB_DS_HASH_EQ_FN_C_DEC,
public Resize_Policy,
public PB_DS_RANGED_PROBE_FN_C_DEC,
- public PB_DS_TYPES_TRAITS_C_DEC
+ public PB_DS_GP_HASH_TRAITS_BASE
{
private:
- typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
- typedef typename traits_base::value_type value_type_;
- typedef typename traits_base::pointer pointer_;
+ typedef PB_DS_GP_HASH_TRAITS_BASE traits_base;
+ typedef typename traits_base::value_type value_type_;
+ typedef typename traits_base::pointer pointer_;
typedef typename traits_base::const_pointer const_pointer_;
- typedef typename traits_base::reference reference_;
+ typedef typename traits_base::reference reference_;
typedef typename traits_base::const_reference const_reference_;
- typedef typename traits_base::comp_hash comp_hash;
+ typedef typename traits_base::comp_hash comp_hash;
enum entry_status
{
@@ -132,30 +125,30 @@ namespace __gnu_pbds
erased_entry_status
} __attribute__ ((packed));
- struct entry : public traits_base::stored_value_type
+ struct entry : public traits_base::stored_data_type
{
entry_status m_stat;
};
- typedef typename Allocator::template rebind<entry>::other entry_allocator;
+ typedef typename _Alloc::template rebind<entry>::other entry_allocator;
typedef typename entry_allocator::pointer entry_pointer;
typedef typename entry_allocator::const_pointer const_entry_pointer;
typedef typename entry_allocator::reference entry_reference;
typedef typename entry_allocator::const_reference const_entry_reference;
typedef typename entry_allocator::pointer entry_array;
- typedef PB_DS_RANGED_PROBE_FN_C_DEC ranged_probe_fn_base;
+ typedef PB_DS_RANGED_PROBE_FN_C_DEC ranged_probe_fn_base;
#ifdef _GLIBCXX_DEBUG
- typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
-#endif
+ typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
+#endif
- typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base;
- typedef Resize_Policy resize_base;
+ typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base;
+ typedef Resize_Policy resize_base;
-#define PB_DS_GEN_POS typename Allocator::size_type
+#define PB_DS_GEN_POS typename _Alloc::size_type
-#include <ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>
@@ -163,30 +156,30 @@ namespace __gnu_pbds
#undef PB_DS_GEN_POS
public:
- typedef Allocator allocator_type;
- typedef typename Allocator::size_type size_type;
- typedef typename Allocator::difference_type difference_type;
- typedef Hash_Fn hash_fn;
- typedef Eq_Fn eq_fn;
- typedef Probe_Fn probe_fn;
- typedef Comb_Probe_Fn comb_probe_fn;
- typedef Resize_Policy resize_policy;
+ typedef _Alloc allocator_type;
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef Hash_Fn hash_fn;
+ typedef Eq_Fn eq_fn;
+ typedef Probe_Fn probe_fn;
+ typedef Comb_Probe_Fn comb_probe_fn;
+ typedef Resize_Policy resize_policy;
enum
{
store_hash = Store_Hash
};
- typedef typename traits_base::key_type key_type;
+ typedef typename traits_base::key_type key_type;
typedef typename traits_base::key_pointer key_pointer;
- typedef typename traits_base::const_key_pointer const_key_pointer;
+ typedef typename traits_base::key_const_pointer key_const_pointer;
typedef typename traits_base::key_reference key_reference;
- typedef typename traits_base::const_key_reference const_key_reference;
+ typedef typename traits_base::key_const_reference key_const_reference;
typedef typename traits_base::mapped_type mapped_type;
typedef typename traits_base::mapped_pointer mapped_pointer;
- typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
+ typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
typedef typename traits_base::mapped_reference mapped_reference;
- typedef typename traits_base::const_mapped_reference const_mapped_reference;
+ typedef typename traits_base::mapped_const_reference mapped_const_reference;
typedef typename traits_base::value_type value_type;
typedef typename traits_base::pointer pointer;
typedef typename traits_base::const_pointer const_pointer;
@@ -194,50 +187,50 @@ namespace __gnu_pbds
typedef typename traits_base::const_reference const_reference;
#ifdef PB_DS_DATA_TRUE_INDICATOR
- typedef point_iterator_ point_iterator;
-#endif
+ typedef point_iterator_ point_iterator;
+#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
- typedef const_point_iterator_ point_iterator;
-#endif
+ typedef point_const_iterator_ point_iterator;
+#endif
- typedef const_point_iterator_ const_point_iterator;
+ typedef point_const_iterator_ point_const_iterator;
#ifdef PB_DS_DATA_TRUE_INDICATOR
- typedef iterator_ iterator;
-#endif
+ typedef iterator_ iterator;
+#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
- typedef const_iterator_ iterator;
-#endif
+ typedef const_iterator_ iterator;
+#endif
- typedef const_iterator_ const_iterator;
+ typedef const_iterator_ const_iterator;
- PB_DS_CLASS_NAME();
+ PB_DS_GP_HASH_NAME();
- PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+ PB_DS_GP_HASH_NAME(const PB_DS_CLASS_C_DEC&);
- PB_DS_CLASS_NAME(const Hash_Fn&);
+ PB_DS_GP_HASH_NAME(const Hash_Fn&);
- PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&);
+ PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&);
- PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&);
+ PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&);
- PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,
+ PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,
const Probe_Fn&);
- PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,
+ PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,
const Probe_Fn&, const Resize_Policy&);
template<typename It>
void
- copy_from_range(It first_it, It last_it);
+ copy_from_range(It, It);
virtual
- ~PB_DS_CLASS_NAME();
+ ~PB_DS_GP_HASH_NAME();
void
- swap(PB_DS_CLASS_C_DEC& other);
+ swap(PB_DS_CLASS_C_DEC&);
inline size_type
size() const;
@@ -248,72 +241,72 @@ namespace __gnu_pbds
inline bool
empty() const;
- Hash_Fn&
+ Hash_Fn&
get_hash_fn();
- const Hash_Fn&
+ const Hash_Fn&
get_hash_fn() const;
- Eq_Fn&
+ Eq_Fn&
get_eq_fn();
- const Eq_Fn&
+ const Eq_Fn&
get_eq_fn() const;
- Probe_Fn&
+ Probe_Fn&
get_probe_fn();
- const Probe_Fn&
+ const Probe_Fn&
get_probe_fn() const;
- Comb_Probe_Fn&
+ Comb_Probe_Fn&
get_comb_probe_fn();
- const Comb_Probe_Fn&
+ const Comb_Probe_Fn&
get_comb_probe_fn() const;
- Resize_Policy&
+ Resize_Policy&
get_resize_policy();
- const Resize_Policy&
+ const Resize_Policy&
get_resize_policy() const;
inline std::pair<point_iterator, bool>
insert(const_reference r_val)
{
- _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid(__FILE__, __LINE__);)
- return insert_imp(r_val, traits_base::m_store_extra_indicator);
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid(__FILE__, __LINE__);)
+ return insert_imp(r_val, traits_base::m_store_extra_indicator);
}
inline mapped_reference
- operator[](const_key_reference r_key)
+ operator[](key_const_reference r_key)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
return subscript_imp(r_key, traits_base::m_store_extra_indicator);
-#else
+#else
insert(r_key);
- return traits_base::s_null_mapped;
+ return traits_base::s_null_type;
#endif
}
inline point_iterator
- find(const_key_reference r_key);
+ find(key_const_reference);
- inline const_point_iterator
- find(const_key_reference r_key) const;
+ inline point_const_iterator
+ find(key_const_reference) const;
inline point_iterator
find_end();
- inline const_point_iterator
+ inline point_const_iterator
find_end() const;
inline bool
- erase(const_key_reference r_key);
+ erase(key_const_reference);
template<typename Pred>
inline size_type
- erase_if(Pred prd);
+ erase_if(Pred);
void
clear();
@@ -332,18 +325,18 @@ namespace __gnu_pbds
#ifdef _GLIBCXX_DEBUG
void
- assert_valid(const char* file, int line) const;
-#endif
+ assert_valid(const char*, int) const;
+#endif
#ifdef PB_DS_HT_MAP_TRACE_
void
trace() const;
-#endif
+#endif
private:
#ifdef PB_DS_DATA_TRUE_INDICATOR
friend class iterator_;
-#endif
+#endif
friend class const_iterator_;
@@ -378,10 +371,10 @@ namespace __gnu_pbds
resize_imp_reassign(entry_pointer, entry_array, true_type);
inline size_type
- find_ins_pos(const_key_reference, false_type);
+ find_ins_pos(key_const_reference, false_type);
inline comp_hash
- find_ins_pos(const_key_reference, true_type);
+ find_ins_pos(key_const_reference, true_type);
inline std::pair<point_iterator, bool>
insert_imp(const_reference, false_type);
@@ -399,14 +392,12 @@ namespace __gnu_pbds
traits_base::m_store_extra_indicator);
_GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);
-
entry* const p_e = m_entries + pos;
new (&p_e->m_value) value_type(r_val);
p_e->m_stat = valid_entry_status;
resize_base::notify_inserted(++m_num_used_e);
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));)
-
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
return &p_e->m_value;
}
@@ -432,18 +423,17 @@ namespace __gnu_pbds
resize_base::notify_inserted(++m_num_used_e);
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));)
-
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
return &p_e->m_value;
}
#ifdef PB_DS_DATA_TRUE_INDICATOR
inline mapped_reference
- subscript_imp(const_key_reference key, false_type)
+ subscript_imp(key_const_reference key, false_type)
{
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
- const size_type pos = find_ins_pos(key,
+ const size_type pos = find_ins_pos(key,
traits_base::m_store_extra_indicator);
entry_pointer p_e = &m_entries[pos];
@@ -455,12 +445,12 @@ namespace __gnu_pbds
}
inline mapped_reference
- subscript_imp(const_key_reference key, true_type)
+ subscript_imp(key_const_reference key, true_type)
{
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
- comp_hash pos_hash_pair =
- find_ins_pos(key, traits_base::m_store_extra_indicator);
+ comp_hash pos_hash_pair = find_ins_pos(key,
+ traits_base::m_store_extra_indicator);
if (m_entries[pos_hash_pair.first].m_stat != valid_entry_status)
return insert_new_imp(value_type(key, mapped_type()),
@@ -472,16 +462,16 @@ namespace __gnu_pbds
#endif
inline pointer
- find_key_pointer(const_key_reference key, false_type)
+ find_key_pointer(key_const_reference key, false_type)
{
const size_type hash = ranged_probe_fn_base::operator()(key);
- size_type i;
resize_base::notify_find_search_start();
// Loop until entry is found or until all possible entries accessed.
- for (i = 0; i < m_num_e; ++i)
+ for (size_type i = 0; i < m_num_e; ++i)
{
- const size_type pos = ranged_probe_fn_base::operator()(key, hash, i);
+ const size_type pos = ranged_probe_fn_base::operator()(key,
+ hash, i);
entry* const p_e = m_entries + pos;
switch (p_e->m_stat)
@@ -516,14 +506,13 @@ namespace __gnu_pbds
}
inline pointer
- find_key_pointer(const_key_reference key, true_type)
+ find_key_pointer(key_const_reference key, true_type)
{
comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(key);
- size_type i;
resize_base::notify_find_search_start();
// Loop until entry is found or until all possible entries accessed.
- for (i = 0; i < m_num_e; ++i)
+ for (size_type i = 0; i < m_num_e; ++i)
{
const size_type pos =
ranged_probe_fn_base::operator()(key, pos_hash_pair.second, i);
@@ -564,19 +553,19 @@ namespace __gnu_pbds
}
inline bool
- erase_imp(const_key_reference, true_type);
+ erase_imp(key_const_reference, true_type);
inline bool
- erase_imp(const_key_reference, false_type);
+ erase_imp(key_const_reference, false_type);
inline void
- erase_entry(entry_pointer p_e);
+ erase_entry(entry_pointer);
#ifdef PB_DS_DATA_TRUE_INDICATOR
void
inc_it_state(pointer& r_p_value, size_type& r_pos) const
- { inc_it_state((const_mapped_pointer& )r_p_value, r_pos); }
-#endif
+ { inc_it_state((mapped_const_pointer& )r_p_value, r_pos); }
+#endif
void
inc_it_state(const_pointer& r_p_value, size_type& r_pos) const
@@ -627,12 +616,12 @@ namespace __gnu_pbds
#ifdef _GLIBCXX_DEBUG
void
assert_entry_array_valid(const entry_array, false_type,
- const char* file, int line) const;
+ const char*, int) const;
void
assert_entry_array_valid(const entry_array, true_type,
- const char* file, int line) const;
-#endif
+ const char*, int) const;
+#endif
static entry_allocator s_entry_allocator;
static iterator s_end_it;
@@ -644,8 +633,8 @@ namespace __gnu_pbds
enum
{
- store_hash_ok = !Store_Hash
- || !is_same<Hash_Fn, __gnu_pbds::null_hash_fn>::value
+ store_hash_ok = !Store_Hash
+ || !is_same<Hash_Fn, __gnu_pbds::null_type>::value
};
PB_DS_STATIC_ASSERT(sth, store_hash_ok);
@@ -666,12 +655,8 @@ namespace __gnu_pbds
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_HASH_EQ_FN_C_DEC
#undef PB_DS_RANGED_PROBE_FN_C_DEC
-#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_GP_HASH_TRAITS_BASE
#undef PB_DS_DEBUG_MAP_BASE_C_DEC
-#undef PB_DS_CLASS_NAME
-#undef PB_DS_V2F
-#undef PB_DS_V2S
-
+#undef PB_DS_GP_HASH_NAME
} // namespace detail
} // namespace __gnu_pbds
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
index 423a9288e5e..8fa762b7718 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
@@ -34,9 +34,9 @@
// warranty.
/**
- * @file info_fn_imps.hpp
+ * @file gp_hash_table_map_/info_fn_imps.hpp
* Contains implementations of gp_ht_map_'s entire container info related
- * functions.
+ * functions.
*/
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
index 101ce8c6be7..03731778bec 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_fn_imps.hpp
+ * @file gp_hash_table_map_/insert_fn_imps.hpp
* Contains implementations of gp_ht_map_'s insert related functions.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
index 95c9054f3b7..03b2c9b8ee3 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_no_store_hash_fn_imps.hpp
+ * @file gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s insert related functions,
* when the hash value is not stored.
*/
@@ -42,7 +42,7 @@
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
-find_ins_pos(const_key_reference r_key, false_type)
+find_ins_pos(key_const_reference r_key, false_type)
{
size_type hash = ranged_probe_fn_base::operator()(r_key);
size_type i;
@@ -95,7 +95,7 @@ inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
PB_DS_CLASS_C_DEC::
insert_imp(const_reference r_val, false_type)
{
- const_key_reference r_key = PB_DS_V2F(r_val);
+ key_const_reference r_key = PB_DS_V2F(r_val);
const size_type pos = find_ins_pos(r_key,
traits_base::m_store_extra_indicator);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
index a27d9d202c9..856306a7ab1 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_store_hash_fn_imps.hpp
+ * @file gp_hash_table_map_/insert_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s find related functions,
* when the hash value is stored.
*/
@@ -42,7 +42,7 @@
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::comp_hash
PB_DS_CLASS_C_DEC::
-find_ins_pos(const_key_reference r_key, true_type)
+find_ins_pos(key_const_reference r_key, true_type)
{
PB_DS_ASSERT_VALID((*this))
comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);
@@ -100,7 +100,7 @@ inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
PB_DS_CLASS_C_DEC::
insert_imp(const_reference r_val, true_type)
{
- const_key_reference r_key = PB_DS_V2F(r_val);
+ key_const_reference r_key = PB_DS_V2F(r_val);
comp_hash pos_hash_pair = find_ins_pos(r_key,
traits_base::m_store_extra_indicator);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
index ff1f80f28fd..695b03eedc0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
@@ -34,9 +34,9 @@
// warranty.
/**
- * @file iterator_fn_imps.hpp
+ * @file gp_hash_table_map_/iterator_fn_imps.hpp
* Contains implementations of gp_ht_map_'s iterators related functions, e.g.,
- * begin().
+ * begin().
*/
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
index b1a3f7a7e67..22afeb7690f 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
@@ -34,9 +34,9 @@
// warranty.
/**
- * @file policy_access_fn_imps.hpp
+ * @file gp_hash_table_map_/policy_access_fn_imps.hpp
* Contains implementations of gp_ht_map_'s policy agpess
- * functions.
+ * functions.
*/
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
index 70381f10602..76b6174efef 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
@@ -35,7 +35,7 @@
// warranty.
/**
- * @file resize_fn_imps.hpp
+ * @file gp_hash_table_map_/resize_fn_imps.hpp
* Contains implementations of gp_ht_map_'s resize related functions.
*/
@@ -80,7 +80,7 @@ PB_DS_CLASS_C_DEC::
resize_imp(size_type new_size)
{
#ifdef PB_DS_REGRESSION
- typename Allocator::group_adjustor adjust(m_num_e);
+ typename _Alloc::group_adjustor adjust(m_num_e);
#endif
if (new_size == m_num_e)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
index 1d2839e0ac7..8819238b6da 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
@@ -34,9 +34,9 @@
// warranty.
/**
- * @file resize_no_store_hash_fn_imps.hpp
+ * @file gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s resize related functions, when the
- * hash value is not stored.
+ * hash value is not stored.
*/
PB_DS_CLASS_T_DEC
@@ -45,7 +45,7 @@ PB_DS_CLASS_C_DEC::
resize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized,
false_type)
{
- const_key_reference r_key = PB_DS_V2F(p_e->m_value);
+ key_const_reference r_key = PB_DS_V2F(p_e->m_value);
size_type hash = ranged_probe_fn_base::operator()(r_key);
size_type i;
for (i = 0; i < m_num_e; ++i)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
index 765e9624b8f..c291747ed14 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
@@ -34,9 +34,9 @@
// warranty.
/**
- * @file resize_store_hash_fn_imps.hpp
+ * @file gp_hash_table_map_/resize_store_hash_fn_imps.hpp
* Contains implementations of gp_ht_map_'s resize related functions, when the
- * hash value is stored.
+ * hash value is stored.
*/
PB_DS_CLASS_T_DEC
@@ -45,7 +45,7 @@ PB_DS_CLASS_C_DEC::
resize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized,
true_type)
{
- const_key_reference r_key = PB_DS_V2F(p_e->m_value);
+ key_const_reference r_key = PB_DS_V2F(p_e->m_value);
size_type hash = ranged_probe_fn_base::operator()(r_key, p_e->m_hash);
size_type i;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
index dac063927f6..74aeba4d63d 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file standard_policies.hpp
+ * @file gp_hash_table_map_/standard_policies.hpp
* Contains standard policies for gp_ht_map types.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
index c3fe13c0082..0e6a7da087e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file trace_fn_imps.hpp
+ * @file gp_hash_table_map_/trace_fn_imps.hpp
* Contains implementations of gp_ht_map_'s trace-mode functions.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
index 970cfc1e553..19855ac1e8b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
@@ -47,7 +47,7 @@ namespace __gnu_pbds
{
namespace detail
{
- template<typename Allocator>
+ template<typename _Alloc>
class probe_fn_base
{
protected:
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
index 24899272f8f..8567851f798 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -42,7 +42,6 @@
#ifndef PB_DS_RANGED_HASH_FN_HPP
#define PB_DS_RANGED_HASH_FN_HPP
-#include <ext/pb_ds/detail/basic_types.hpp>
#include <utility>
#include <debug/debug.h>
@@ -50,33 +49,33 @@ namespace __gnu_pbds
{
namespace detail
{
- template<typename Key, typename Hash_Fn, typename Allocator,
+ template<typename Key, typename Hash_Fn, typename _Alloc,
typename Comb_Hash_Fn, bool Store_Hash>
class ranged_hash_fn;
#define PB_DS_CLASS_T_DEC \
- template<typename Key, typename Hash_Fn, typename Allocator, \
+ template<typename Key, typename Hash_Fn, typename _Alloc, \
typename Comb_Hash_Fn>
#define PB_DS_CLASS_C_DEC \
- ranged_hash_fn<Key, Hash_Fn, Allocator, Comb_Hash_Fn, false>
+ ranged_hash_fn<Key, Hash_Fn, _Alloc, Comb_Hash_Fn, false>
/**
* Specialization 1
* The client supplies a hash function and a ranged hash function,
* and requests that hash values not be stored.
**/
- template<typename Key, typename Hash_Fn, typename Allocator,
+ template<typename Key, typename Hash_Fn, typename _Alloc,
typename Comb_Hash_Fn>
- class ranged_hash_fn< Key, Hash_Fn, Allocator, Comb_Hash_Fn, false>
+ class ranged_hash_fn< Key, Hash_Fn, _Alloc, Comb_Hash_Fn, false>
: public Hash_Fn, public Comb_Hash_Fn
{
protected:
- typedef typename Allocator::size_type size_type;
+ typedef typename _Alloc::size_type size_type;
typedef Hash_Fn hash_fn_base;
typedef Comb_Hash_Fn comb_hash_fn_base;
- typedef typename Allocator::template rebind< Key>::other key_allocator;
- typedef typename key_allocator::const_reference const_key_reference;
+ typedef typename _Alloc::template rebind< Key>::other key_allocator;
+ typedef typename key_allocator::const_reference key_const_reference;
ranged_hash_fn(size_type);
@@ -91,7 +90,7 @@ namespace __gnu_pbds
notify_resized(size_type);
inline size_type
- operator()(const_key_reference) const;
+ operator()(key_const_reference) const;
};
PB_DS_CLASS_T_DEC
@@ -130,36 +129,36 @@ namespace __gnu_pbds
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
- operator()(const_key_reference r_key) const
+ operator()(key_const_reference r_key) const
{ return (comb_hash_fn_base::operator()(hash_fn_base::operator()(r_key)));}
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
#define PB_DS_CLASS_T_DEC \
- template<typename Key, typename Hash_Fn, typename Allocator, \
+ template<typename Key, typename Hash_Fn, typename _Alloc, \
typename Comb_Hash_Fn>
#define PB_DS_CLASS_C_DEC \
- ranged_hash_fn<Key,Hash_Fn, Allocator, Comb_Hash_Fn, true>
+ ranged_hash_fn<Key,Hash_Fn, _Alloc, Comb_Hash_Fn, true>
/**
* Specialization 2
* The client supplies a hash function and a ranged hash function,
* and requests that hash values be stored.
**/
- template<typename Key, typename Hash_Fn, typename Allocator,
+ template<typename Key, typename Hash_Fn, typename _Alloc,
typename Comb_Hash_Fn>
- class ranged_hash_fn<Key, Hash_Fn, Allocator, Comb_Hash_Fn, true>
+ class ranged_hash_fn<Key, Hash_Fn, _Alloc, Comb_Hash_Fn, true>
: public Hash_Fn, public Comb_Hash_Fn
{
protected:
- typedef typename Allocator::size_type size_type;
+ typedef typename _Alloc::size_type size_type;
typedef std::pair<size_type, size_type> comp_hash;
typedef Hash_Fn hash_fn_base;
typedef Comb_Hash_Fn comb_hash_fn_base;
- typedef typename Allocator::template rebind<Key>::other key_allocator;
- typedef typename key_allocator::const_reference const_key_reference;
+ typedef typename _Alloc::template rebind<Key>::other key_allocator;
+ typedef typename key_allocator::const_reference key_const_reference;
ranged_hash_fn(size_type);
@@ -174,10 +173,10 @@ namespace __gnu_pbds
notify_resized(size_type);
inline comp_hash
- operator()(const_key_reference) const;
+ operator()(key_const_reference) const;
inline comp_hash
- operator()(const_key_reference, size_type) const;
+ operator()(key_const_reference, size_type) const;
};
PB_DS_CLASS_T_DEC
@@ -216,7 +215,7 @@ namespace __gnu_pbds
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::comp_hash
PB_DS_CLASS_C_DEC::
- operator()(const_key_reference r_key) const
+ operator()(key_const_reference r_key) const
{
const size_type hash = hash_fn_base::operator()(r_key);
return std::make_pair(comb_hash_fn_base::operator()(hash), hash);
@@ -227,9 +226,9 @@ namespace __gnu_pbds
PB_DS_CLASS_C_DEC::
operator()
#ifdef _GLIBCXX_DEBUG
- (const_key_reference r_key, size_type hash) const
+ (key_const_reference r_key, size_type hash) const
#else
- (const_key_reference /*r_key*/, size_type hash) const
+ (key_const_reference /*r_key*/, size_type hash) const
#endif
{
_GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));
@@ -240,30 +239,30 @@ namespace __gnu_pbds
#undef PB_DS_CLASS_C_DEC
#define PB_DS_CLASS_T_DEC \
- template<typename Key, typename Allocator, typename Comb_Hash_Fn>
+ template<typename Key, typename _Alloc, typename Comb_Hash_Fn>
#define PB_DS_CLASS_C_DEC \
- ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, false>
+ ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, false>
/**
* Specialization 3
* The client does not supply a hash function (by specifying
- * null_hash_fn as the Hash_Fn parameter), and requests that hash
+ * null_type as the Hash_Fn parameter), and requests that hash
* values not be stored.
**/
- template<typename Key, typename Allocator, typename Comb_Hash_Fn>
- class ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, false>
- : public null_hash_fn, public Comb_Hash_Fn
+ template<typename Key, typename _Alloc, typename Comb_Hash_Fn>
+ class ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, false>
+ : public Comb_Hash_Fn
{
protected:
- typedef typename Allocator::size_type size_type;
+ typedef typename _Alloc::size_type size_type;
typedef Comb_Hash_Fn comb_hash_fn_base;
ranged_hash_fn(size_type);
ranged_hash_fn(size_type, const Comb_Hash_Fn&);
- ranged_hash_fn(size_type, const null_hash_fn&, const Comb_Hash_Fn&);
+ ranged_hash_fn(size_type, const null_type&, const Comb_Hash_Fn&);
void
swap(PB_DS_CLASS_C_DEC&);
@@ -282,7 +281,7 @@ namespace __gnu_pbds
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
- ranged_hash_fn(size_type size, const null_hash_fn& r_null_hash_fn,
+ ranged_hash_fn(size_type size, const null_type& r_null_type,
const Comb_Hash_Fn& r_comb_hash_fn)
: Comb_Hash_Fn(r_comb_hash_fn)
{ }
@@ -297,30 +296,30 @@ namespace __gnu_pbds
#undef PB_DS_CLASS_C_DEC
#define PB_DS_CLASS_T_DEC \
- template<typename Key, typename Allocator, typename Comb_Hash_Fn>
+ template<typename Key, typename _Alloc, typename Comb_Hash_Fn>
#define PB_DS_CLASS_C_DEC \
- ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, true>
+ ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, true>
/**
* Specialization 4
* The client does not supply a hash function (by specifying
- * null_hash_fn as the Hash_Fn parameter), and requests that hash
+ * null_type as the Hash_Fn parameter), and requests that hash
* values be stored.
**/
- template<typename Key, typename Allocator, typename Comb_Hash_Fn>
- class ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, true>
- : public null_hash_fn, public Comb_Hash_Fn
+ template<typename Key, typename _Alloc, typename Comb_Hash_Fn>
+ class ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, true>
+ : public Comb_Hash_Fn
{
protected:
- typedef typename Allocator::size_type size_type;
+ typedef typename _Alloc::size_type size_type;
typedef Comb_Hash_Fn comb_hash_fn_base;
ranged_hash_fn(size_type);
ranged_hash_fn(size_type, const Comb_Hash_Fn&);
- ranged_hash_fn(size_type, const null_hash_fn&, const Comb_Hash_Fn&);
+ ranged_hash_fn(size_type, const null_type&, const Comb_Hash_Fn&);
void
swap(PB_DS_CLASS_C_DEC&);
@@ -339,7 +338,7 @@ namespace __gnu_pbds
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
- ranged_hash_fn(size_type size, const null_hash_fn& r_null_hash_fn,
+ ranged_hash_fn(size_type size, const null_type& r_null_type,
const Comb_Hash_Fn& r_comb_hash_fn)
: Comb_Hash_Fn(r_comb_hash_fn)
{ }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
index ddfba9de1f2..b13de65555a 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
@@ -42,7 +42,6 @@
#ifndef PB_DS_RANGED_PROBE_FN_HPP
#define PB_DS_RANGED_PROBE_FN_HPP
-#include <ext/pb_ds/detail/basic_types.hpp>
#include <utility>
#include <debug/debug.h>
@@ -50,35 +49,35 @@ namespace __gnu_pbds
{
namespace detail
{
- template<typename Key, typename Hash_Fn, typename Allocator,
+ template<typename Key, typename Hash_Fn, typename _Alloc,
typename Comb_Probe_Fn, typename Probe_Fn, bool Store_Hash>
class ranged_probe_fn;
#define PB_DS_CLASS_T_DEC \
- template<typename Key, typename Hash_Fn, typename Allocator, \
+ template<typename Key, typename Hash_Fn, typename _Alloc, \
typename Comb_Probe_Fn, typename Probe_Fn>
#define PB_DS_CLASS_C_DEC \
- ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, false>
+ ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, false>
/**
* Specialization 1
* The client supplies a probe function and a ranged probe
* function, and requests that hash values not be stored.
**/
- template<typename Key, typename Hash_Fn, typename Allocator,
+ template<typename Key, typename Hash_Fn, typename _Alloc,
typename Comb_Probe_Fn, typename Probe_Fn>
- class ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn,
+ class ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn,
Probe_Fn, false>
: public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn
{
protected:
- typedef typename Allocator::size_type size_type;
+ typedef typename _Alloc::size_type size_type;
typedef Comb_Probe_Fn comb_probe_fn_base;
typedef Hash_Fn hash_fn_base;
typedef Probe_Fn probe_fn_base;
- typedef typename Allocator::template rebind<Key>::other key_allocator;
- typedef typename key_allocator::const_reference const_key_reference;
+ typedef typename _Alloc::template rebind<Key>::other key_allocator;
+ typedef typename key_allocator::const_reference key_const_reference;
ranged_probe_fn(size_type);
@@ -96,10 +95,10 @@ namespace __gnu_pbds
notify_resized(size_type);
inline size_type
- operator()(const_key_reference) const;
+ operator()(key_const_reference) const;
inline size_type
- operator()(const_key_reference, size_type, size_type) const;
+ operator()(key_const_reference, size_type, size_type) const;
};
PB_DS_CLASS_T_DEC
@@ -146,13 +145,13 @@ namespace __gnu_pbds
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
- operator()(const_key_reference r_key) const
+ operator()(key_const_reference r_key) const
{ return comb_probe_fn_base::operator()(hash_fn_base::operator()(r_key)); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
- operator()(const_key_reference, size_type hash, size_type i) const
+ operator()(key_const_reference, size_type hash, size_type i) const
{
return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));
}
@@ -161,30 +160,30 @@ namespace __gnu_pbds
#undef PB_DS_CLASS_C_DEC
#define PB_DS_CLASS_T_DEC \
- template<typename Key, typename Hash_Fn, typename Allocator, \
+ template<typename Key, typename Hash_Fn, typename _Alloc, \
typename Comb_Probe_Fn, typename Probe_Fn>
#define PB_DS_CLASS_C_DEC \
- ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, true>
+ ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, true>
/**
* Specialization 2- The client supplies a probe function and a ranged
* probe function, and requests that hash values not be stored.
**/
- template<typename Key, typename Hash_Fn, typename Allocator,
+ template<typename Key, typename Hash_Fn, typename _Alloc,
typename Comb_Probe_Fn, typename Probe_Fn>
- class ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn,
+ class ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn,
Probe_Fn, true>
: public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn
{
protected:
- typedef typename Allocator::size_type size_type;
+ typedef typename _Alloc::size_type size_type;
typedef std::pair<size_type, size_type> comp_hash;
typedef Comb_Probe_Fn comb_probe_fn_base;
typedef Hash_Fn hash_fn_base;
typedef Probe_Fn probe_fn_base;
- typedef typename Allocator::template rebind<Key>::other key_allocator;
- typedef typename key_allocator::const_reference const_key_reference;
+ typedef typename _Alloc::template rebind<Key>::other key_allocator;
+ typedef typename key_allocator::const_reference key_const_reference;
ranged_probe_fn(size_type);
@@ -203,13 +202,13 @@ namespace __gnu_pbds
notify_resized(size_type);
inline comp_hash
- operator()(const_key_reference) const;
+ operator()(key_const_reference) const;
inline size_type
- operator()(const_key_reference, size_type, size_type) const;
+ operator()(key_const_reference, size_type, size_type) const;
inline size_type
- operator()(const_key_reference, size_type) const;
+ operator()(key_const_reference, size_type) const;
};
PB_DS_CLASS_T_DEC
@@ -256,7 +255,7 @@ namespace __gnu_pbds
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::comp_hash
PB_DS_CLASS_C_DEC::
- operator()(const_key_reference r_key) const
+ operator()(key_const_reference r_key) const
{
const size_type hash = hash_fn_base::operator()(r_key);
return std::make_pair(comb_probe_fn_base::operator()(hash), hash);
@@ -265,7 +264,7 @@ namespace __gnu_pbds
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
- operator()(const_key_reference, size_type hash, size_type i) const
+ operator()(key_const_reference, size_type hash, size_type i) const
{
return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));
}
@@ -275,9 +274,9 @@ namespace __gnu_pbds
PB_DS_CLASS_C_DEC::
operator()
#ifdef _GLIBCXX_DEBUG
- (const_key_reference r_key, size_type hash) const
+ (key_const_reference r_key, size_type hash) const
#else
- (const_key_reference /*r_key*/, size_type hash) const
+ (key_const_reference /*r_key*/, size_type hash) const
#endif
{
_GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));
@@ -292,16 +291,16 @@ namespace __gnu_pbds
* The client does not supply a hash function or probe function,
* and requests that hash values not be stored.
**/
- template<typename Key, typename Allocator, typename Comb_Probe_Fn>
- class ranged_probe_fn<Key, null_hash_fn, Allocator, Comb_Probe_Fn,
- null_probe_fn, false>
- : public Comb_Probe_Fn, public null_hash_fn, public null_probe_fn
+ template<typename Key, typename _Alloc, typename Comb_Probe_Fn>
+ class ranged_probe_fn<Key, null_type, _Alloc, Comb_Probe_Fn,
+ null_type, false>
+ : public Comb_Probe_Fn
{
protected:
- typedef typename Allocator::size_type size_type;
+ typedef typename _Alloc::size_type size_type;
typedef Comb_Probe_Fn comb_probe_fn_base;
- typedef typename Allocator::template rebind<Key>::other key_allocator;
- typedef typename key_allocator::const_reference const_key_reference;
+ typedef typename _Alloc::template rebind<Key>::other key_allocator;
+ typedef typename key_allocator::const_reference key_const_reference;
ranged_probe_fn(size_type size)
{ Comb_Probe_Fn::notify_resized(size); }
@@ -310,9 +309,9 @@ namespace __gnu_pbds
: Comb_Probe_Fn(r_comb_probe_fn)
{ }
- ranged_probe_fn(size_type, const null_hash_fn&,
+ ranged_probe_fn(size_type, const null_type&,
const Comb_Probe_Fn& r_comb_probe_fn,
- const null_probe_fn&)
+ const null_type&)
: Comb_Probe_Fn(r_comb_probe_fn)
{ }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
index 7dcd82588c1..3ca9001e025 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
@@ -41,33 +41,28 @@
#ifndef PB_DS_SAMPLE_PROBE_FN_HPP
#define PB_DS_SAMPLE_PROBE_FN_HPP
-// A sample probe policy.
-class sample_probe_fn
+namespace __gnu_pbds
{
-
-public:
-
- // Size type.
- typedef std::size_t size_type;
-
-public:
-
- // Default constructor.
- sample_probe_fn();
-
- // Copy constructor.
- sample_probe_fn(const sample_probe_fn& other);
-
- // Swaps content.
- inline void
- swap(sample_probe_fn& other);
-
-protected:
-
- // Returns the i-th offset from the hash value of some key r_key.
- inline size_type
- operator()(const_key_reference r_key, size_type i) const;
-
-};
-
+ /// A sample probe policy.
+ class sample_probe_fn
+ {
+ public:
+ typedef std::size_t size_type;
+
+ // Default constructor.
+ sample_probe_fn();
+
+ // Copy constructor.
+ sample_probe_fn(const sample_probe_fn&);
+
+ // Swaps content.
+ inline void
+ swap(sample_probe_fn&);
+
+ protected:
+ // Returns the i-th offset from the hash value of some key r_key.
+ inline size_type
+ operator()(key_const_reference r_key, size_type i) const;
+ };
+}
#endif // #ifndef PB_DS_SAMPLE_PROBE_FN_HPP
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
index 988f111ea20..3092376832c 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
@@ -41,37 +41,34 @@
#ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP
#define PB_DS_SAMPLE_RANGE_HASHING_HPP
-// A sample range-hashing functor.
-class sample_range_hashing
+namespace __gnu_pbds
{
-
-public:
-
- // Size type.
- typedef std::size_t size_type;
-
-public:
-
- // Default constructor.
- sample_range_hashing();
-
- // Copy constructor.
- sample_range_hashing(const sample_range_hashing& other);
-
- // Swaps content.
- inline void
- swap(sample_range_hashing& other);
-
-protected:
-
- // Notifies the policy object that the container's __size has changed to size.
- void
- notify_resized(size_type size);
-
- // Transforms the __hash value hash into a ranged-hash value.
- inline size_type
- operator()(size_type hash) const;
-
-};
-
+ /// A sample range-hashing functor.
+ class sample_range_hashing
+ {
+ public:
+ // Size type.
+ typedef std::size_t size_type;
+
+ // Default constructor.
+ sample_range_hashing();
+
+ // Copy constructor.
+ sample_range_hashing(const sample_range_hashing& other);
+
+ // Swaps content.
+ inline void
+ swap(sample_range_hashing& other);
+
+ protected:
+ // Notifies the policy object that the container's __size has
+ // changed to size.
+ void
+ notify_resized(size_type);
+
+ // Transforms the __hash value hash into a ranged-hash value.
+ inline size_type
+ operator()(size_type ) const;
+ };
+}
#endif // #ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
index 8fa04d140e5..cc9aaab9134 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
@@ -41,37 +41,35 @@
#ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP
#define PB_DS_SAMPLE_RANGED_HASH_FN_HPP
-// A sample ranged-hash functor.
-class sample_ranged_hash_fn
+namespace __gnu_pbds
{
+ /// A sample ranged-hash functor.
+ class sample_ranged_hash_fn
+ {
+ public:
+ typedef std::size_t size_type;
-public:
+ // Default constructor.
+ sample_ranged_hash_fn();
- // Size type.
- typedef std::size_t size_type;
+ // Copy constructor.
+ sample_ranged_hash_fn(const sample_ranged_hash_fn&);
-public:
+ // Swaps content.
+ inline void
+ swap(sample_ranged_hash_fn&);
- // Default constructor.
- sample_ranged_hash_fn();
+ protected:
- // Copy constructor.
- sample_ranged_hash_fn(const sample_ranged_hash_fn& other);
+ // Notifies the policy object that the container's __size has
+ // changed to size.
+ void
+ notify_resized(size_type);
- // Swaps content.
- inline void
- swap(sample_ranged_hash_fn& other);
-
-protected:
-
- // Notifies the policy object that the container's __size has changed to size.
- void
- notify_resized(size_type size);
-
- // Transforms r_key into a position within the table.
- inline size_type
- operator()(const_key_reference r_key) const;
-
-};
+ // Transforms key_const_reference into a position within the table.
+ inline size_type
+ operator()(key_const_reference) const;
+ };
+}
#endif // #ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
index 2bcfdf51a54..b362f3d354f 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
@@ -41,37 +41,37 @@
#ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP
#define PB_DS_SAMPLE_RANGED_PROBE_FN_HPP
-// A sample ranged-probe functor.
-class sample_ranged_probe_fn
+namespace __gnu_pbds
{
+ /// A sample ranged-probe functor.
+ class sample_ranged_probe_fn
+ {
+ public:
+ typedef std::size_t size_type;
-public:
+ // Default constructor.
+ sample_ranged_probe_fn();
- // Size type.
- typedef std::size_t size_type;
+ // Copy constructor.
+ sample_ranged_probe_fn(const sample_ranged_probe_fn&);
-public:
+ // Swaps content.
+ inline void
+ swap(sample_ranged_probe_fn&);
- // Default constructor.
- sample_ranged_probe_fn();
+ protected:
- // Copy constructor.
- sample_ranged_probe_fn(const sample_ranged_probe_fn& other);
+ // Notifies the policy object that the container's __size has
+ // changed to size.
+ void
+ notify_resized(size_type);
- // Swaps content.
- inline void
- swap(sample_ranged_probe_fn& other);
-
-protected:
-
- // Notifies the policy object that the container's __size has changed to size.
- void
- notify_resized(size_type size);
-
- // Transforms the const key reference r_key into the i-th position within the table. This method is called for each collision within the probe sequence.
- inline size_type
- operator()(const_key_reference r_key, std::size_t hash, size_type i) const;
-
-};
+ // Transforms the const key reference r_key into the i-th position
+ // within the table. This method is called for each collision within
+ // the probe sequence.
+ inline size_type
+ operator()(key_const_reference, std::size_t, size_type) const;
+ };
+}
#endif // #ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
index 2448f3c7988..e51abe17e06 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
@@ -34,65 +34,61 @@
// warranty.
/**
- * @file const_iterator.hpp
+ * @file left_child_next_sibling_heap_/const_iterator.hpp
* Contains an iterator class returned by the table's const find and insert
- * methods.
+ * methods.
*/
#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP
#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP
-#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
+#define PB_DS_CLASS_C_DEC \
+ left_child_next_sibling_heap_const_iterator_<Node, _Alloc>
-#define PB_DS_CLASS_C_DEC \
- left_child_next_sibling_heap_const_iterator_<Node, Allocator>
+#define PB_DS_BASIC_HEAP_CIT_BASE \
+ left_child_next_sibling_heap_node_point_const_iterator_<Node, _Alloc>
-#define PB_DS_BASE_C_DEC \
- left_child_next_sibling_heap_node_const_point_iterator_<Node, Allocator>
-
- // Const point-type iterator.
- template<typename Node, class Allocator>
- class left_child_next_sibling_heap_const_iterator_ : public PB_DS_BASE_C_DEC
+ /// Const point-type iterator.
+ template<typename Node, typename _Alloc>
+ class left_child_next_sibling_heap_const_iterator_
+ : public PB_DS_BASIC_HEAP_CIT_BASE
{
-
private:
- typedef typename PB_DS_BASE_C_DEC::node_pointer node_pointer;
-
- typedef PB_DS_BASE_C_DEC base_type;
+ typedef PB_DS_BASIC_HEAP_CIT_BASE base_type;
+ typedef typename base_type::node_pointer node_pointer;
public:
-
// Category.
- typedef std::forward_iterator_tag iterator_category;
+ typedef std::forward_iterator_tag iterator_category;
// Difference type.
- typedef typename Allocator::difference_type difference_type;
+ typedef typename _Alloc::difference_type difference_type;
// Iterator's value type.
- typedef typename base_type::value_type value_type;
+ typedef typename base_type::value_type value_type;
// Iterator's pointer type.
- typedef typename base_type::pointer pointer;
+ typedef typename base_type::pointer pointer;
// Iterator's const pointer type.
- typedef typename base_type::const_pointer const_pointer;
+ typedef typename base_type::const_pointer const_pointer;
// Iterator's reference type.
- typedef typename base_type::reference reference;
+ typedef typename base_type::reference reference;
// Iterator's const reference type.
- typedef typename base_type::const_reference const_reference;
-
- public:
+ typedef typename base_type::const_reference const_reference;
inline
- left_child_next_sibling_heap_const_iterator_(node_pointer p_nd) : base_type(p_nd)
+ left_child_next_sibling_heap_const_iterator_(node_pointer p_nd)
+ : base_type(p_nd)
{ }
// Default constructor.
@@ -115,7 +111,7 @@ namespace __gnu_pbds
operator!=(const PB_DS_CLASS_C_DEC& other) const
{ return (base_type::m_p_nd != other.m_p_nd); }
- inline PB_DS_CLASS_C_DEC&
+ inline PB_DS_CLASS_C_DEC&
operator++()
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd != 0);
@@ -147,16 +143,17 @@ namespace __gnu_pbds
{
node_pointer p_next = base_type::m_p_nd;
base_type::m_p_nd = base_type::m_p_nd->m_p_prev_or_parent;
- if (base_type::m_p_nd == 0 || base_type::m_p_nd->m_p_l_child == p_next)
+ if (base_type::m_p_nd == 0
+ || base_type::m_p_nd->m_p_l_child == p_next)
return;
}
}
};
#undef PB_DS_CLASS_C_DEC
-#undef PB_DS_BASE_C_DEC
+#undef PB_DS_BASIC_HEAP_CIT_BASE
} // namespace detail
} // namespace __gnu_pbds
-#endif
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
index 5bec709fb50..5cec97b3273 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
@@ -35,7 +35,7 @@
// warranty.
/**
- * @file constructors_destructor_fn_imps.hpp
+ * @file left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
@@ -49,7 +49,7 @@ PB_DS_CLASS_C_DEC::s_no_throw_copies_ind;
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-left_child_next_sibling_heap_() :
+left_child_next_sibling_heap() :
m_p_root(0),
m_size(0)
{
@@ -58,7 +58,7 @@ left_child_next_sibling_heap_() :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-left_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn) :
+left_child_next_sibling_heap(const Cmp_Fn& r_cmp_fn) :
Cmp_Fn(r_cmp_fn),
m_p_root(0),
m_size(0)
@@ -68,7 +68,7 @@ left_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn) :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-left_child_next_sibling_heap_(const PB_DS_CLASS_C_DEC& other)
+left_child_next_sibling_heap(const PB_DS_CLASS_C_DEC& other)
: Cmp_Fn(other), m_p_root(0), m_size(0)
{
m_size = other.m_size;
@@ -102,7 +102,7 @@ value_swap(PB_DS_CLASS_C_DEC& other)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-~left_child_next_sibling_heap_()
+~left_child_next_sibling_heap()
{
clear();
}
@@ -110,7 +110,7 @@ PB_DS_CLASS_C_DEC::
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
-recursive_copy_node(const_node_pointer p_nd)
+recursive_copy_node(node_const_pointer p_nd)
{
if (p_nd == 0)
return (0);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
index 77c23c1eb36..500fac11207 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_fn_imps.hpp
+ * @file left_child_next_sibling_heap_/debug_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
@@ -56,7 +56,7 @@ assert_valid(const char* __file, int __line) const
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-assert_node_consistent(const_node_pointer p_nd, bool single_link,
+assert_node_consistent(node_const_pointer p_nd, bool single_link,
const char* __file, int __line) const
{
if (p_nd == 0)
@@ -73,10 +73,10 @@ assert_node_consistent(const_node_pointer p_nd, bool single_link,
if (p_nd->m_p_l_child == 0)
return;
- const_node_pointer p_child = p_nd->m_p_l_child;
+ node_const_pointer p_child = p_nd->m_p_l_child;
while (p_child != 0)
{
- const_node_pointer p_next_child = p_child->m_p_next_sibling;
+ node_const_pointer p_next_child = p_child->m_p_next_sibling;
PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(p_nd->m_value, p_child->m_value));
p_child = p_next_child;
}
@@ -102,13 +102,13 @@ assert_size(const char* __file, int __line) const
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
-size_under_node(const_node_pointer p_nd)
+size_under_node(node_const_pointer p_nd)
{ return 1 + size_from_node(p_nd->m_p_l_child); }
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
-size_from_node(const_node_pointer p_nd)
+size_from_node(node_const_pointer p_nd)
{
size_type ret = 0;
while (p_nd != 0)
@@ -122,10 +122,10 @@ size_from_node(const_node_pointer p_nd)
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
-degree(const_node_pointer p_nd)
+degree(node_const_pointer p_nd)
{
size_type ret = 0;
- const_node_pointer p_child = p_nd->m_p_l_child;
+ node_const_pointer p_child = p_nd->m_p_l_child;
while (p_child != 0)
{
++ret;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
index 056cc38fc94..c7d5602318b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file erase_fn_imps.hpp
+ * @file left_child_next_sibling_heap_/erase_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
@@ -92,7 +92,7 @@ to_linked_list()
p_cur = p_cur->m_p_next_sibling;
#ifdef _GLIBCXX_DEBUG
- const_node_pointer p_counter = m_p_root;
+ node_const_pointer p_counter = m_p_root;
size_type count = 0;
while (p_counter != 0)
{
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
index 75e6561c393..3535a0351aa 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file info_fn_imps.hpp
+ * @file left_child_next_sibling_heap_/info_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
index 9ffc912719c..e5031c8d9d0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_fn_imps.hpp
+ * @file left_child_next_sibling_heap_/insert_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
index ec09cf641bd..40b0a17c78b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file iterators_fn_imps.hpp
+ * @file left_child_next_sibling_heap_/iterators_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
index d3115463810..b6f3b51710b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file left_child_next_sibling_heap_.hpp
+ * @file left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
* Contains an implementation class for a basic heap.
*/
@@ -49,159 +49,102 @@
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp>
-#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp>
#ifdef PB_DS_LC_NS_HEAP_TRACE_
#include <iostream>
-#endif
+#endif
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
-
-#ifdef _GLIBCXX_DEBUG
-#define PB_DS_CLASS_T_DEC \
- template< \
- typename Value_Type, \
- class Cmp_Fn, \
- typename Node_Metadata, \
- class Allocator, \
- bool Single_Link_Roots>
-#else
-#define PB_DS_CLASS_T_DEC \
- template< \
- typename Value_Type, \
- class Cmp_Fn, \
- typename Node_Metadata, \
- class Allocator>
-#endif
-
-#ifdef _GLIBCXX_DEBUG
-#define PB_DS_CLASS_C_DEC \
- left_child_next_sibling_heap_< \
- Value_Type, \
- Cmp_Fn, \
- Node_Metadata, \
- Allocator, \
- Single_Link_Roots>
-#else
-#define PB_DS_CLASS_C_DEC \
- left_child_next_sibling_heap_< \
- Value_Type, \
- Cmp_Fn, \
- Node_Metadata, \
- Allocator>
-#endif
-
- /**
- * class description = "Base class for some types of h3ap$">
- **/
#ifdef _GLIBCXX_DEBUG
+#define PB_DS_CLASS_T_DEC \
+ template<typename Value_Type, typename Cmp_Fn, typename Node_Metadata, \
+ typename _Alloc, bool Single_Link_Roots>
+
+#define PB_DS_CLASS_C_DEC \
+ left_child_next_sibling_heap<Value_Type, Cmp_Fn, Node_Metadata, \
+ _Alloc, Single_Link_Roots>
+#else
+#define PB_DS_CLASS_T_DEC \
+ template<typename Value_Type, typename Cmp_Fn, typename Node_Metadata, \
+ typename _Alloc>
+
+#define PB_DS_CLASS_C_DEC \
+ left_child_next_sibling_heap<Value_Type, Cmp_Fn, Node_Metadata, _Alloc>
+#endif
+
+ /// Base class for a basic heap.
template<typename Value_Type,
- class Cmp_Fn,
+ typename Cmp_Fn,
typename Node_Metadata,
- class Allocator,
- bool Single_Link_Roots>
-#else
- template<typename Value_Type,
- class Cmp_Fn,
- typename Node_Metadata,
- class Allocator>
-#endif
- class left_child_next_sibling_heap_ : public Cmp_Fn
+ typename _Alloc
+#ifdef _GLIBCXX_DEBUG
+ ,bool Single_Link_Roots>
+#else
+ >
+#endif
+ class left_child_next_sibling_heap : public Cmp_Fn
{
-
protected:
typedef
- typename Allocator::template rebind<
- left_child_next_sibling_heap_node_<
- Value_Type,
- Node_Metadata,
- Allocator> >::other
+ typename _Alloc::template rebind<
+ left_child_next_sibling_heap_node_<Value_Type, Node_Metadata,
+ _Alloc> >::other
node_allocator;
- typedef typename node_allocator::value_type node;
-
- typedef typename node_allocator::pointer node_pointer;
-
- typedef typename node_allocator::const_pointer const_node_pointer;
-
+ typedef typename node_allocator::value_type node;
+ typedef typename node_allocator::pointer node_pointer;
+ typedef typename node_allocator::const_pointer node_const_pointer;
typedef Node_Metadata node_metadata;
-
- typedef std::pair< node_pointer, node_pointer> node_pointer_pair;
+ typedef std::pair< node_pointer, node_pointer> node_pointer_pair;
private:
- typedef cond_dealtor< node, Allocator> cond_dealtor_t;
+ typedef cond_dealtor< node, _Alloc> cond_dealtor_t;
enum
{
simple_value = is_simple<Value_Type>::value
};
- typedef integral_constant<int, simple_value> no_throw_copies_t;
+ typedef integral_constant<int, simple_value> no_throw_copies_t;
+ typedef typename _Alloc::template rebind<Value_Type> __rebind_v;
public:
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef Value_Type value_type;
- typedef typename Allocator::size_type size_type;
-
- typedef typename Allocator::difference_type difference_type;
+ typedef typename __rebind_v::other::pointer pointer;
+ typedef typename __rebind_v::other::const_pointer const_pointer;
+ typedef typename __rebind_v::other::reference reference;
+ typedef typename __rebind_v::other::const_reference const_reference;
- typedef Value_Type value_type;
+ typedef left_child_next_sibling_heap_node_point_const_iterator_<node, _Alloc>
+ point_const_iterator;
- typedef
- typename Allocator::template rebind<
- value_type>::other::pointer
- pointer;
-
- typedef
- typename Allocator::template rebind<
- value_type>::other::const_pointer
- const_pointer;
+ typedef point_const_iterator point_iterator;
- typedef
- typename Allocator::template rebind<
- value_type>::other::reference
- reference;
-
- typedef
- typename Allocator::template rebind<
- value_type>::other::const_reference
- const_reference;
-
- typedef
- left_child_next_sibling_heap_node_const_point_iterator_<
- node,
- Allocator>
- const_point_iterator;
-
- typedef const_point_iterator point_iterator;
-
- typedef
- left_child_next_sibling_heap_const_iterator_<
- node,
- Allocator>
+ typedef left_child_next_sibling_heap_const_iterator_<node, _Alloc>
const_iterator;
- typedef const_iterator iterator;
-
- typedef Cmp_Fn cmp_fn;
-
- typedef Allocator allocator_type;
+ typedef const_iterator iterator;
+ typedef Cmp_Fn cmp_fn;
+ typedef _Alloc allocator_type;
public:
- left_child_next_sibling_heap_();
-
- left_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn);
-
- left_child_next_sibling_heap_(const PB_DS_CLASS_C_DEC& other);
+ left_child_next_sibling_heap();
+ left_child_next_sibling_heap(const Cmp_Fn&);
+ left_child_next_sibling_heap(const left_child_next_sibling_heap&);
void
- swap(PB_DS_CLASS_C_DEC& other);
+ swap(PB_DS_CLASS_C_DEC&);
- ~left_child_next_sibling_heap_();
+ ~left_child_next_sibling_heap();
inline bool
empty() const;
@@ -212,10 +155,10 @@ namespace __gnu_pbds
inline size_type
max_size() const;
- Cmp_Fn&
+ Cmp_Fn&
get_cmp_fn();
- const Cmp_Fn&
+ const Cmp_Fn&
get_cmp_fn() const;
inline iterator
@@ -236,100 +179,97 @@ namespace __gnu_pbds
#ifdef PB_DS_LC_NS_HEAP_TRACE_
void
trace() const;
-#endif
+#endif
protected:
inline node_pointer
- get_new_node_for_insert(const_reference r_val);
+ get_new_node_for_insert(const_reference);
inline static void
- make_child_of(node_pointer p_nd, node_pointer p_new_parent);
+ make_child_of(node_pointer, node_pointer);
void
- value_swap(PB_DS_CLASS_C_DEC& other);
+ value_swap(left_child_next_sibling_heap&);
inline static node_pointer
- parent(node_pointer p_nd);
+ parent(node_pointer);
inline void
- swap_with_parent(node_pointer p_nd, node_pointer p_parent);
+ swap_with_parent(node_pointer, node_pointer);
void
- bubble_to_top(node_pointer p_nd);
+ bubble_to_top(node_pointer);
inline void
- actual_erase_node(node_pointer p_nd);
+ actual_erase_node(node_pointer);
void
- clear_imp(node_pointer p_nd);
+ clear_imp(node_pointer);
void
to_linked_list();
template<typename Pred>
node_pointer
- prune(Pred pred);
+ prune(Pred);
#ifdef _GLIBCXX_DEBUG
void
- assert_valid(const char* file, int line) const;
+ assert_valid(const char*, int) const;
void
- assert_node_consistent(const_node_pointer p_nd, bool single_link,
- const char* file, int line) const;
+ assert_node_consistent(node_const_pointer, bool, const char*, int) const;
static size_type
- size_under_node(const_node_pointer p_nd);
+ size_under_node(node_const_pointer);
static size_type
- degree(const_node_pointer p_nd);
-#endif
+ degree(node_const_pointer);
+#endif
#ifdef PB_DS_LC_NS_HEAP_TRACE_
static void
- trace_node(const_node_pointer, size_type level);
-#endif
-
- protected:
- node_pointer m_p_root;
-
- size_type m_size;
+ trace_node(node_const_pointer, size_type);
+#endif
private:
#ifdef _GLIBCXX_DEBUG
void
- assert_iterators(const char* file, int line) const;
+ assert_iterators(const char*, int) const;
void
- assert_size(const char* file, int line) const;
+ assert_size(const char*, int) const;
static size_type
- size_from_node(const_node_pointer p_nd);
-#endif
+ size_from_node(node_const_pointer);
+#endif
node_pointer
- recursive_copy_node(const_node_pointer p_nd);
+ recursive_copy_node(node_const_pointer);
inline node_pointer
- get_new_node_for_insert(const_reference r_val, false_type);
+ get_new_node_for_insert(const_reference, false_type);
inline node_pointer
- get_new_node_for_insert(const_reference r_val, true_type);
+ get_new_node_for_insert(const_reference, true_type);
#ifdef PB_DS_LC_NS_HEAP_TRACE_
template<typename Metadata_>
static void
- trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>);
+ trace_node_metadata(node_const_pointer, type_to_type<Metadata_>);
static void
- trace_node_metadata(const_node_pointer, type_to_type<null_left_child_next_sibling_heap_node_metadata>);
-#endif
+ trace_node_metadata(node_const_pointer,
+ type_to_type<null_type>);
+#endif
+ protected:
+ node_pointer m_p_root;
+ size_type m_size;
private:
- static node_allocator s_node_allocator;
-
- static no_throw_copies_t s_no_throw_copies_ind;
+ static node_allocator s_node_allocator;
+ static no_throw_copies_t s_no_throw_copies_ind;
};
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp>
@@ -347,4 +287,4 @@ namespace __gnu_pbds
} // namespace detail
} // namespace __gnu_pbds
-#endif
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
index 1cdfe288391..d74b86c42d9 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
@@ -34,87 +34,54 @@
// warranty.
/**
- * @file node.hpp
+ * @file left_child_next_sibling_heap_/node.hpp
* Contains an implementation struct for this type of heap's node.
*/
#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP
#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP
-#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>
-
namespace __gnu_pbds
{
namespace detail
{
-
- template<typename Value_Type, typename Metadata_Type, class Allocator>
+ /// Node.
+ template<typename _Value, typename _Metadata, typename _Alloc>
struct left_child_next_sibling_heap_node_
{
private:
- typedef
- left_child_next_sibling_heap_node_<
- Value_Type,
- Metadata_Type,
- Allocator>
- this_type;
-
- public:
- typedef typename Allocator::size_type size_type;
-
- typedef
- typename Allocator::template rebind<
- this_type>::other::pointer
- node_pointer;
-
- typedef Value_Type value_type;
-
- typedef Metadata_Type metadata_type;
+ typedef left_child_next_sibling_heap_node_<_Value, _Metadata, _Alloc> this_type;
public:
- value_type m_value;
+ typedef _Value value_type;
+ typedef typename _Alloc::size_type size_type;
+ typedef _Metadata metadata_type;
- metadata_type m_metadata;
+ typedef typename _Alloc::template rebind<this_type>::other::pointer node_pointer;
- node_pointer m_p_l_child;
-
- node_pointer m_p_next_sibling;
-
- node_pointer m_p_prev_or_parent;
+ value_type m_value;
+ metadata_type m_metadata;
+ node_pointer m_p_l_child;
+ node_pointer m_p_next_sibling;
+ node_pointer m_p_prev_or_parent;
};
- template<typename Value_Type, class Allocator>
- struct left_child_next_sibling_heap_node_<
- Value_Type,
- null_left_child_next_sibling_heap_node_metadata,
- Allocator>
+ template<typename _Value, typename _Alloc>
+ struct left_child_next_sibling_heap_node_<_Value, null_type, _Alloc>
{
private:
- typedef
- left_child_next_sibling_heap_node_<
- Value_Type,
- null_left_child_next_sibling_heap_node_metadata,
- Allocator>
- this_type;
+ typedef left_child_next_sibling_heap_node_<_Value, null_type, _Alloc> this_type;
public:
- typedef typename Allocator::size_type size_type;
-
- typedef
- typename Allocator::template rebind<
- this_type>::other::pointer
- node_pointer;
-
- typedef Value_Type value_type;
-
- public:
- value_type m_value;
-
- node_pointer m_p_l_child;
+ typedef _Value value_type;
+ typedef typename _Alloc::size_type size_type;
- node_pointer m_p_next_sibling;
+ typedef typename _Alloc::template rebind<this_type>::other::pointer node_pointer;
- node_pointer m_p_prev_or_parent;
+ value_type m_value;
+ node_pointer m_p_l_child;
+ node_pointer m_p_next_sibling;
+ node_pointer m_p_prev_or_parent;
};
} // namespace detail
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp
index 712a76fb7c0..5b29254f6aa 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp
@@ -34,9 +34,9 @@
// warranty.
/**
- * @file const_point_iterator.hpp
+ * @file left_child_next_sibling_heap_/point_const_iterator.hpp
* Contains an iterator class returned by the table's const find and insert
- * methods.
+ * methods.
*/
#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP
@@ -51,18 +51,18 @@ namespace __gnu_pbds
{
#define PB_DS_CLASS_T_DEC \
- template<typename Node, class Allocator>
+ template<typename Node, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
- left_child_next_sibling_heap_node_const_point_iterator_<Node, Allocator>
+ left_child_next_sibling_heap_node_point_const_iterator_<Node, _Alloc>
- // Const point-type iterator.
- template<typename Node, class Allocator>
- class left_child_next_sibling_heap_node_const_point_iterator_
+ /// Const point-type iterator.
+ template<typename Node, typename _Alloc>
+ class left_child_next_sibling_heap_node_point_const_iterator_
{
protected:
- typedef typename Allocator::template rebind<Node>::other::pointer node_pointer;
+ typedef typename _Alloc::template rebind<Node>::other::pointer node_pointer;
public:
@@ -77,42 +77,42 @@ namespace __gnu_pbds
// Iterator's pointer type.
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
value_type>::other::pointer
pointer;
// Iterator's const pointer type.
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
value_type>::other::const_pointer
const_pointer;
// Iterator's reference type.
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
value_type>::other::reference
reference;
// Iterator's const reference type.
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
value_type>::other::const_reference
const_reference;
public:
inline
- left_child_next_sibling_heap_node_const_point_iterator_(node_pointer p_nd) : m_p_nd(p_nd)
+ left_child_next_sibling_heap_node_point_const_iterator_(node_pointer p_nd) : m_p_nd(p_nd)
{ }
// Default constructor.
inline
- left_child_next_sibling_heap_node_const_point_iterator_() : m_p_nd(0)
+ left_child_next_sibling_heap_node_point_const_iterator_() : m_p_nd(0)
{ }
// Copy constructor.
inline
- left_child_next_sibling_heap_node_const_point_iterator_(const PB_DS_CLASS_C_DEC& other) : m_p_nd(other.m_p_nd)
+ left_child_next_sibling_heap_node_point_const_iterator_(const PB_DS_CLASS_C_DEC& other) : m_p_nd(other.m_p_nd)
{ }
// Access.
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
index 350b4d08af3..b2d0d8527d7 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file policy_access_fn_imps.hpp
+ * @file left_child_next_sibling_heap_/policy_access_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
index d42100212e4..28ee13e9122 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file trace_fn_imps.hpp
+ * @file left_child_next_sibling_heap_/trace_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
@@ -46,16 +46,14 @@ PB_DS_CLASS_C_DEC::
trace() const
{
std::cerr << std::endl;
-
trace_node(m_p_root, 0);
-
std::cerr << std::endl;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-trace_node(const_node_pointer p_nd, size_type level)
+trace_node(node_const_pointer p_nd, size_type level)
{
while (p_nd != 0)
{
@@ -68,11 +66,8 @@ trace_node(const_node_pointer p_nd, size_type level)
" left = " << p_nd->m_p_l_child << " ";
trace_node_metadata(p_nd, type_to_type<node_metadata>());
-
std::cerr << p_nd->m_value << std::endl;
-
trace_node(p_nd->m_p_l_child, level + 1);
-
p_nd = p_nd->m_p_next_sibling;
}
}
@@ -81,7 +76,7 @@ PB_DS_CLASS_T_DEC
template<typename Metadata_>
void
PB_DS_CLASS_C_DEC::
-trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>)
+trace_node_metadata(node_const_pointer p_nd, type_to_type<Metadata_>)
{
std::cerr << "(" << p_nd->m_metadata << ") ";
}
@@ -89,7 +84,7 @@ trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>)
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-trace_node_metadata(const_node_pointer, type_to_type<null_left_child_next_sibling_heap_node_metadata>)
+trace_node_metadata(node_const_pointer, type_to_type<null_type>)
{ }
#endif // #ifdef PB_DS_LC_NS_HEAP_TRACE_
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
index 17ddaaf3e69..8ec39a6acef 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
@@ -35,8 +35,7 @@
// warranty.
/**
- * @file constructor_destructor_fn_imps.hpp
- * Contains implementations of PB_DS_CLASS_NAME.
+ * @file list_update_map_/constructor_destructor_fn_imps.hpp
*/
PB_DS_CLASS_T_DEC
@@ -47,7 +46,7 @@ PB_DS_CLASS_T_DEC
Eq_Fn PB_DS_CLASS_C_DEC::s_eq_fn;
PB_DS_CLASS_T_DEC
-null_lu_metadata PB_DS_CLASS_C_DEC::s_null_lu_metadata;
+null_type PB_DS_CLASS_C_DEC::s_null_type;
PB_DS_CLASS_T_DEC
Update_Policy PB_DS_CLASS_C_DEC::s_update_policy;
@@ -68,13 +67,13 @@ copy_from_range(It first_it, It last_it)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME() : m_p_l(0)
+PB_DS_LU_NAME() : m_p_l(0)
{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
template<typename It>
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(It first_it, It last_it) : m_p_l(0)
+PB_DS_LU_NAME(It first_it, It last_it) : m_p_l(0)
{
copy_from_range(first_it, last_it);
PB_DS_ASSERT_VALID((*this));
@@ -82,19 +81,19 @@ PB_DS_CLASS_NAME(It first_it, It last_it) : m_p_l(0)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+PB_DS_LU_NAME(const PB_DS_CLASS_C_DEC& other) :
m_p_l(0)
{
__try
{
for (const_iterator it = other.begin(); it != other.end(); ++it)
- {
- entry_pointer p_l = allocate_new_entry(*it,
- PB_DS_TYPES_TRAITS_C_DEC::m_no_throw_copies_indicator);
+ {
+ entry_pointer p_l = allocate_new_entry(*it,
+ traits_base::m_no_throw_copies_indicator);
p_l->m_p_next = m_p_l;
m_p_l = p_l;
- }
+ }
}
__catch(...)
{
@@ -134,6 +133,5 @@ deallocate_all()
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-~PB_DS_CLASS_NAME()
+~PB_DS_LU_NAME()
{ deallocate_all(); }
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
index 98391802945..510c9050015 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_fn_imps.hpp
+ * @file list_update_map_/debug_fn_imps.hpp
* Contains implementations of cc_ht_map_'s debug-mode functions.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
index 021ef50d870..f1e440a72a0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file entry_metadata_base.hpp
+ * @file list_update_map_/entry_metadata_base.hpp
* Contains an implementation for a list update map.
*/
@@ -52,7 +52,7 @@ namespace __gnu_pbds
};
template<>
- struct lu_map_entry_metadata_base<null_lu_metadata>
+ struct lu_map_entry_metadata_base<null_type>
{ };
} // namespace detail
} // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
index dd60ea6cdce..bbd7b8355ea 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
@@ -34,14 +34,14 @@
// warranty.
/**
- * @file erase_fn_imps.hpp
+ * @file list_update_map_/erase_fn_imps.hpp
* Contains implementations of lu_map_.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
-erase(const_key_reference r_key)
+erase(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
if (m_p_l == 0)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
index 9164b92255e..0d5f98aaf7e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
@@ -34,14 +34,14 @@
// warranty.
/**
- * @file find_fn_imps.hpp
+ * @file list_update_map_/find_fn_imps.hpp
* Contains implementations of lu_map_.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::entry_pointer
PB_DS_CLASS_C_DEC::
-find_imp(const_key_reference r_key) const
+find_imp(key_const_reference r_key) const
{
if (m_p_l == 0)
return 0;
@@ -85,6 +85,6 @@ apply_update(entry_pointer p_l, type_to_type<Metadata>)
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
-apply_update(entry_pointer, type_to_type<null_lu_metadata>)
-{ return s_update_policy(s_null_lu_metadata); }
+apply_update(entry_pointer, type_to_type<null_type>)
+{ return s_update_policy(s_null_type); }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
index 31f743cf18b..294d73a0187 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file info_fn_imps.hpp
+ * @file list_update_map_/info_fn_imps.hpp
* Contains implementations of lu_map_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
index 2677683f8df..9c250df49a1 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_fn_imps.hpp
+ * @file list_update_map_/insert_fn_imps.hpp
* Contains implementations of lu_map_.
*/
@@ -101,6 +101,6 @@ init_entry_metadata(entry_pointer p_l, type_to_type<Metadata>)
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
-init_entry_metadata(entry_pointer, type_to_type<null_lu_metadata>)
+init_entry_metadata(entry_pointer, type_to_type<null_type>)
{ }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
index ac3163858f1..2a1aa6c9dd0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file iterators_fn_imps.hpp
+ * @file list_update_map_/iterators_fn_imps.hpp
* Contains implementations of lu_map_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
index 329f2fa780a..9e48f17f7cd 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file lu_map_.hpp
+ * @file list_update_map_/lu_map_.hpp
* Contains a list update map.
*/
@@ -47,82 +47,70 @@
#include <ext/pb_ds/exception.hpp>
#ifdef _GLIBCXX_DEBUG
#include <ext/pb_ds/detail/debug_map_base.hpp>
-#endif
+#endif
#ifdef PB_DS_LU_MAP_TRACE_
#include <iostream>
-#endif
+#endif
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
-#define PB_DS_CLASS_T_DEC \
- template<typename Key, typename Mapped, class Eq_Fn, \
- class Allocator, class Update_Policy>
-
#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CLASS_NAME lu_map_data_
-#endif
+#define PB_DS_LU_NAME lu_map
+#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_CLASS_NAME lu_map_no_data_
-#endif
+#define PB_DS_LU_NAME lu_set
+#endif
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Mapped, typename Eq_Fn, \
+ typename _Alloc, typename Update_Policy>
#define PB_DS_CLASS_C_DEC \
- PB_DS_CLASS_NAME<Key, Mapped, Eq_Fn, Allocator, Update_Policy>
+ PB_DS_LU_NAME<Key, Mapped, Eq_Fn, _Alloc, Update_Policy>
-#define PB_DS_TYPES_TRAITS_C_DEC \
- types_traits<Key, Mapped, Allocator, false>
+#define PB_DS_LU_TRAITS_BASE \
+ types_traits<Key, Mapped, _Alloc, false>
#ifdef _GLIBCXX_DEBUG
#define PB_DS_DEBUG_MAP_BASE_C_DEC \
debug_map_base<Key, Eq_Fn, \
- typename Allocator::template rebind<Key>::other::const_reference>
-#endif
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#define PB_DS_EP2VP(X)& ((X)->m_value)
-#endif
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped_Data()
-#define PB_DS_EP2VP(X)& ((X)->m_value.first)
-#endif
+ typename _Alloc::template rebind<Key>::other::const_reference>
+#endif
- /* Skip to the lu, my darling. */
- // list-based (with updates) associative container.
+ /// list-based (with updates) associative container.
+ /// Skip to the lu, my darling.
template<typename Key,
typename Mapped,
- class Eq_Fn,
- class Allocator,
- class Update_Policy>
- class PB_DS_CLASS_NAME :
+ typename Eq_Fn,
+ typename _Alloc,
+ typename Update_Policy>
+ class PB_DS_LU_NAME :
#ifdef _GLIBCXX_DEBUG
protected PB_DS_DEBUG_MAP_BASE_C_DEC,
-#endif
- public PB_DS_TYPES_TRAITS_C_DEC
+#endif
+ public PB_DS_LU_TRAITS_BASE
{
private:
- typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
+ typedef PB_DS_LU_TRAITS_BASE traits_base;
- struct entry
+ struct entry
: public lu_map_entry_metadata_base<typename Update_Policy::metadata_type>
{
typename traits_base::value_type m_value;
- typename Allocator::template rebind<entry>::other::pointer m_p_next;
+ typename _Alloc::template rebind<entry>::other::pointer m_p_next;
};
- typedef typename Allocator::template rebind<entry>::other entry_allocator;
+ typedef typename _Alloc::template rebind<entry>::other entry_allocator;
typedef typename entry_allocator::pointer entry_pointer;
typedef typename entry_allocator::const_pointer const_entry_pointer;
typedef typename entry_allocator::reference entry_reference;
typedef typename entry_allocator::const_reference const_entry_reference;
- typedef typename Allocator::template rebind<entry_pointer>::other entry_pointer_allocator;
+ typedef typename _Alloc::template rebind<entry_pointer>::other entry_pointer_allocator;
typedef typename entry_pointer_allocator::pointer entry_pointer_array;
typedef typename traits_base::value_type value_type_;
@@ -133,7 +121,7 @@ namespace __gnu_pbds
#define PB_DS_GEN_POS entry_pointer
-#include <ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>
#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>
@@ -143,27 +131,27 @@ namespace __gnu_pbds
#ifdef _GLIBCXX_DEBUG
typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
-#endif
+#endif
- typedef cond_dealtor<entry, Allocator> cond_dealtor_t;
+ typedef cond_dealtor<entry, _Alloc> cond_dealtor_t;
public:
- typedef Allocator allocator_type;
- typedef typename Allocator::size_type size_type;
- typedef typename Allocator::difference_type difference_type;
+ typedef _Alloc allocator_type;
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
typedef Eq_Fn eq_fn;
typedef Update_Policy update_policy;
typedef typename Update_Policy::metadata_type update_metadata;
typedef typename traits_base::key_type key_type;
typedef typename traits_base::key_pointer key_pointer;
- typedef typename traits_base::const_key_pointer const_key_pointer;
+ typedef typename traits_base::key_const_pointer key_const_pointer;
typedef typename traits_base::key_reference key_reference;
- typedef typename traits_base::const_key_reference const_key_reference;
+ typedef typename traits_base::key_const_reference key_const_reference;
typedef typename traits_base::mapped_type mapped_type;
typedef typename traits_base::mapped_pointer mapped_pointer;
- typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
+ typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
typedef typename traits_base::mapped_reference mapped_reference;
- typedef typename traits_base::const_mapped_reference const_mapped_reference;
+ typedef typename traits_base::mapped_const_reference mapped_const_reference;
typedef typename traits_base::value_type value_type;
typedef typename traits_base::pointer pointer;
typedef typename traits_base::const_pointer const_pointer;
@@ -171,35 +159,35 @@ namespace __gnu_pbds
typedef typename traits_base::const_reference const_reference;
#ifdef PB_DS_DATA_TRUE_INDICATOR
- typedef point_iterator_ point_iterator;
-#endif
+ typedef point_iterator_ point_iterator;
+#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
- typedef const_point_iterator_ point_iterator;
-#endif
+ typedef point_const_iterator_ point_iterator;
+#endif
- typedef const_point_iterator_ const_point_iterator;
+ typedef point_const_iterator_ point_const_iterator;
#ifdef PB_DS_DATA_TRUE_INDICATOR
- typedef iterator_ iterator;
-#endif
+ typedef iterator_ iterator;
+#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
- typedef const_iterator_ iterator;
-#endif
+ typedef const_iterator_ iterator;
+#endif
- typedef const_iterator_ const_iterator;
+ typedef const_iterator_ const_iterator;
public:
- PB_DS_CLASS_NAME();
+ PB_DS_LU_NAME();
- PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+ PB_DS_LU_NAME(const PB_DS_CLASS_C_DEC&);
virtual
- ~PB_DS_CLASS_NAME();
+ ~PB_DS_LU_NAME();
template<typename It>
- PB_DS_CLASS_NAME(It first_it, It last_it);
+ PB_DS_LU_NAME(It, It);
void
swap(PB_DS_CLASS_C_DEC&);
@@ -214,38 +202,38 @@ namespace __gnu_pbds
empty() const;
inline mapped_reference
- operator[](const_key_reference r_key)
+ operator[](key_const_reference r_key)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
return insert(std::make_pair(r_key, mapped_type())).first->second;
-#else
+#else
insert(r_key);
- return traits_base::s_null_mapped;
-#endif
+ return traits_base::s_null_type;
+#endif
}
inline std::pair<point_iterator, bool>
insert(const_reference);
inline point_iterator
- find(const_key_reference r_key)
+ find(key_const_reference r_key)
{
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
entry_pointer p_e = find_imp(r_key);
return point_iterator(p_e == 0 ? 0: &p_e->m_value);
}
- inline const_point_iterator
- find(const_key_reference r_key) const
+ inline point_const_iterator
+ find(key_const_reference r_key) const
{
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
entry_pointer p_e = find_imp(r_key);
- return const_point_iterator(p_e == 0 ? 0: &p_e->m_value);
+ return point_const_iterator(p_e == 0 ? 0: &p_e->m_value);
}
inline bool
- erase(const_key_reference);
+ erase(key_const_reference);
template<typename Pred>
inline size_type
@@ -269,7 +257,7 @@ namespace __gnu_pbds
#ifdef _GLIBCXX_DEBUG
void
assert_valid(const char* file, int line) const;
-#endif
+#endif
#ifdef PB_DS_LU_MAP_TRACE_
void
@@ -285,7 +273,7 @@ namespace __gnu_pbds
private:
#ifdef PB_DS_DATA_TRUE_INDICATOR
friend class iterator_;
-#endif
+#endif
friend class const_iterator_;
@@ -300,7 +288,7 @@ namespace __gnu_pbds
init_entry_metadata(entry_pointer, type_to_type<Metadata>);
inline static void
- init_entry_metadata(entry_pointer, type_to_type<null_lu_metadata>);
+ init_entry_metadata(entry_pointer, type_to_type<null_type>);
void
deallocate_all();
@@ -323,18 +311,18 @@ namespace __gnu_pbds
apply_update(entry_pointer, type_to_type<Metadata>);
inline static bool
- apply_update(entry_pointer, type_to_type<null_lu_metadata>);
+ apply_update(entry_pointer, type_to_type<null_type>);
inline entry_pointer
- find_imp(const_key_reference) const;
+ find_imp(key_const_reference) const;
- static entry_allocator s_entry_allocator;
- static Eq_Fn s_eq_fn;
- static Update_Policy s_update_policy;
- static type_to_type<update_metadata> s_metadata_type_indicator;
- static null_lu_metadata s_null_lu_metadata;
+ static entry_allocator s_entry_allocator;
+ static Eq_Fn s_eq_fn;
+ static Update_Policy s_update_policy;
+ static type_to_type<update_metadata> s_metadata_type_indicator;
+ static null_type s_null_type;
- mutable entry_pointer m_p_l;
+ mutable entry_pointer m_p_l;
};
#include <ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp>
@@ -348,12 +336,8 @@ namespace __gnu_pbds
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
-#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_LU_TRAITS_BASE
#undef PB_DS_DEBUG_MAP_BASE_C_DEC
-#undef PB_DS_CLASS_NAME
-#undef PB_DS_V2F
-#undef PB_DS_EP2VP
-#undef PB_DS_V2S
-
+#undef PB_DS_LU_NAME
} // namespace detail
} // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
index 009610998a5..1ee219ae553 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file trace_fn_imps.hpp
+ * @file list_update_map_/trace_fn_imps.hpp
* Contains implementations of lu_map_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
deleted file mode 100644
index f74a9fb5485..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
+++ /dev/null
@@ -1,51 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file counter_lu_policy_imp.hpp
- * Contains a lu counter policy implementation.
- */
-
-PB_DS_CLASS_T_DEC
-detail::counter_lu_metadata<typename Allocator::size_type>
-PB_DS_CLASS_C_DEC::
-operator()() const
-{ return (base_type::operator()(max_count)); }
-
-PB_DS_CLASS_T_DEC
-bool
-PB_DS_CLASS_C_DEC::
-operator()(metadata_reference r_data) const
-{ return (base_type::operator()(r_data, max_count)); }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp
index 8e476cb91b9..74ab81388bb 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp
@@ -1,6 +1,7 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011
+// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,7 +35,7 @@
// warranty.
/**
- * @file counter_lu_metadata.hpp
+ * @file lu_counter_metadata.hpp
* Contains implementation of a lu counter policy's metadata.
*/
@@ -43,44 +44,45 @@ namespace __gnu_pbds
namespace detail
{
template<typename Size_Type>
- class counter_lu_policy_base;
+ class lu_counter_policy_base;
- // A list-update metadata type that moves elements to the front of
- // the list based on the counter algorithm.
+ /// A list-update metadata type that moves elements to the front of
+ /// the list based on the counter algorithm.
template<typename Size_Type = std::size_t>
- class counter_lu_metadata
- {
- public:
- typedef Size_Type size_type;
+ class lu_counter_metadata
+ {
+ public:
+ typedef Size_Type size_type;
- private:
- counter_lu_metadata(size_type init_count) : m_count(init_count)
- { }
+ private:
+ lu_counter_metadata(size_type init_count) : m_count(init_count)
+ { }
- friend class counter_lu_policy_base<size_type>;
+ friend class lu_counter_policy_base<size_type>;
- mutable size_type m_count;
+ mutable size_type m_count;
};
+ /// Base class for list-update counter policy.
template<typename Size_Type>
- class counter_lu_policy_base
- {
- protected:
- typedef Size_Type size_type;
+ class lu_counter_policy_base
+ {
+ protected:
+ typedef Size_Type size_type;
- counter_lu_metadata<size_type>
- operator()(size_type max_size) const
- { return counter_lu_metadata<Size_Type>(std::rand() % max_size); }
+ lu_counter_metadata<size_type>
+ operator()(size_type max_size) const
+ { return lu_counter_metadata<Size_Type>(std::rand() % max_size); }
- template<typename Metadata_Reference>
- bool
- operator()(Metadata_Reference r_data, size_type m_max_count) const
- {
- if (++r_data.m_count != m_max_count)
- return false;
- r_data.m_count = 0;
- return true;
- }
- };
+ template<typename Metadata_Reference>
+ bool
+ operator()(Metadata_Reference r_data, size_type m_max_count) const
+ {
+ if (++r_data.m_count != m_max_count)
+ return false;
+ r_data.m_count = 0;
+ return true;
+ }
+ };
} // namespace detail
} // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
deleted file mode 100644
index 34426c53821..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file mtf_lu_policy_imp.hpp
- * Contains a move-to-front policy implementation.
- */
-
-PB_DS_CLASS_T_DEC
-null_lu_metadata PB_DS_CLASS_C_DEC::s_metadata;
-
-PB_DS_CLASS_T_DEC
-typename PB_DS_CLASS_C_DEC::metadata_type
-PB_DS_CLASS_C_DEC::
-operator()() const
-{ return s_metadata; }
-
-PB_DS_CLASS_T_DEC
-inline bool
-PB_DS_CLASS_C_DEC::
-operator()(metadata_reference /*r_data*/) const
-{ return true; }
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
index c5da1e9d004..13ee6e1c7b0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
@@ -41,34 +41,36 @@
#ifndef PB_DS_SAMPLE_UPDATE_POLICY_HPP
#define PB_DS_SAMPLE_UPDATE_POLICY_HPP
-// A sample list-update policy.
-struct sample_update_policy
+namespace __gnu_pbds
{
- // Default constructor.
- sample_update_policy();
+ /// A sample list-update policy.
+ struct sample_update_policy
+ {
+ // Default constructor.
+ sample_update_policy();
- // Copy constructor.
- sample_update_policy(const sample_update_policy&);
+ // Copy constructor.
+ sample_update_policy(const sample_update_policy&);
- // Swaps content.
- inline void
- swap(sample_update_policy& other);
+ // Swaps content.
+ inline void
+ swap(sample_update_policy& other);
-protected:
- // Metadata on which this functor operates.
- typedef some_metadata_type metadata_type;
+ protected:
+ // Metadata on which this functor operates.
+ typedef some_metadata_type metadata_type;
- // Creates a metadata object.
- metadata_type
- operator()() const;
+ // Creates a metadata object.
+ metadata_type
+ operator()() const;
- // Decides whether a metadata object should be moved to the front of
- // the list. A list-update based containers object will call this
- // method to decide whether to move a node to the front of the
- // list. The method shoule return true if the node should be moved
- // to the front of the list.
- bool
- operator()(metadata_reference) const;
-};
-
-#endif
+ // Decides whether a metadata object should be moved to the front of
+ // the list. A list-update based containers object will call this
+ // method to decide whether to move a node to the front of the
+ // list. The method shoule return true if the node should be moved
+ // to the front of the list.
+ bool
+ operator()(metadata_reference) const;
+ };
+}
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
deleted file mode 100644
index e2c4b9ae9c4..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
+++ /dev/null
@@ -1,74 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file cond_dtor.hpp
- * Contains a conditional destructor
- */
-
-template<typename Size_Type>
-class cond_dtor
-{
-public:
- cond_dtor(value_vector a_vec, iterator& r_last_it, Size_Type total_size)
- : m_a_vec(a_vec), m_r_last_it(r_last_it), m_max_size(total_size),
- m_no_action(false)
- { }
-
- ~cond_dtor()
- {
- if (m_no_action)
- return;
- iterator it = m_a_vec;
- while (it != m_r_last_it)
- {
- it->~value_type();
- ++it;
- }
-
- if (m_max_size > 0)
- value_allocator().deallocate(m_a_vec, m_max_size);
- }
-
- inline void
- set_no_action()
- { m_no_action = true; }
-
-protected:
- value_vector m_a_vec;
- iterator& m_r_last_it;
- const Size_Type m_max_size;
- bool m_no_action;
-};
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
index 1c3b9dd6e47..494ded24bd6 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file constructors_destructor_fn_imps.hpp
+ * @file ov_tree_map_/constructors_destructor_fn_imps.hpp
* Contains an implementation class for ov_tree_.
*/
@@ -48,7 +48,7 @@ PB_DS_CLASS_C_DEC::s_metadata_alloc;
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_OV_TREE_CLASS_NAME() :
+PB_DS_OV_TREE_NAME() :
m_a_values(0),
m_a_metadata(0),
m_end_it(0),
@@ -57,8 +57,8 @@ PB_DS_OV_TREE_CLASS_NAME() :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
- cmp_fn_base(r_cmp_fn),
+PB_DS_OV_TREE_NAME(const Cmp_Fn& r_cmp_fn) :
+ cmp_fn(r_cmp_fn),
m_a_values(0),
m_a_metadata(0),
m_end_it(0),
@@ -67,9 +67,9 @@ PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
- cmp_fn_base(r_cmp_fn),
- node_update(r_node_update),
+PB_DS_OV_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_nodeu) :
+ cmp_fn(r_cmp_fn),
+ node_update(r_nodeu),
m_a_values(0),
m_a_metadata(0),
m_end_it(0),
@@ -78,11 +78,11 @@ PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_updat
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_OV_TREE_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+PB_DS_OV_TREE_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef PB_DS_TREE_TRACE
- PB_DS_TREE_TRACE_BASE_C_DEC(other),
-#endif
- cmp_fn_base(other),
+ trace_base(other),
+#endif
+ cmp_fn(other),
node_update(other),
m_a_values(0),
m_a_metadata(0),
@@ -100,23 +100,14 @@ PB_DS_CLASS_C_DEC::
copy_from_range(It first_it, It last_it)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
- typedef
- std::map<
- key_type,
- mapped_type,
- Cmp_Fn,
- typename Allocator::template rebind<
- value_type>::other>
+ typedef std::map<key_type, mapped_type, Cmp_Fn,
+ typename _Alloc::template rebind<value_type>::other>
map_type;
-#else
- typedef
- std::set<
- key_type,
- Cmp_Fn,
- typename Allocator::template rebind<
- Key>::other>
+#else
+ typedef std::set<key_type, Cmp_Fn,
+ typename _Alloc::template rebind<Key>::other>
map_type;
-#endif
+#endif
map_type m(first_it, last_it);
copy_from_ordered_range(m.begin(), m.end());
@@ -141,24 +132,21 @@ copy_from_ordered_range(It first_it, It last_it)
cond_dtor<size_type> cd(a_values, target_it, len);
while (source_it != source_end_it)
{
- new (const_cast<void* >(static_cast<const void* >(target_it)))
- value_type(*source_it++);
-
+ void* __v = const_cast<void*>(static_cast<const void*>(target_it));
+ new (__v) value_type(*source_it++);
++target_it;
}
- reallocate_metadata((node_update* )this, len);
+ reallocate_metadata((node_update*)this, len);
cd.set_no_action();
m_a_values = a_values;
m_size = len;
m_end_it = m_a_values + m_size;
- update(PB_DS_node_begin_imp(), (node_update* )this);
+ update(PB_DS_node_begin_imp(), (node_update*)this);
#ifdef _GLIBCXX_DEBUG
for (const_iterator dbg_it = m_a_values; dbg_it != m_end_it; ++dbg_it)
- {
- debug_base::insert_new(PB_DS_V2F(*dbg_it));
- }
+ debug_base::insert_new(PB_DS_V2F(*dbg_it));
#endif
}
@@ -166,12 +154,12 @@ PB_DS_CLASS_T_DEC
template<typename It>
void
PB_DS_CLASS_C_DEC::
-copy_from_ordered_range(It first_it, It last_it, It other_first_it,
+copy_from_ordered_range(It first_it, It last_it, It other_first_it,
It other_last_it)
{
clear();
- const size_type len = std::distance(first_it, last_it)
- + std::distance(other_first_it, other_last_it);
+ const size_type len = std::distance(first_it, last_it)
+ + std::distance(other_first_it, other_last_it);
value_vector a_values = s_value_alloc.allocate(len);
@@ -206,9 +194,7 @@ copy_from_ordered_range(It first_it, It last_it, It other_first_it,
#ifdef _GLIBCXX_DEBUG
for (const_iterator dbg_it = m_a_values; dbg_it != m_end_it; ++dbg_it)
- {
- debug_base::insert_new(PB_DS_V2F(*dbg_it));
- }
+ debug_base::insert_new(PB_DS_V2F(*dbg_it));
#endif
}
@@ -220,7 +206,10 @@ swap(PB_DS_CLASS_C_DEC& other)
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
value_swap(other);
- std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other);
+ std::swap(static_cast<cmp_fn&>(*this),
+ static_cast<cmp_fn&>(other));
+ std::swap(static_cast<traits_base&>(*this),
+ static_cast<traits_base&>(other));
PB_DS_ASSERT_VALID(other)
PB_DS_ASSERT_VALID((*this))
}
@@ -230,18 +219,18 @@ void
PB_DS_CLASS_C_DEC::
value_swap(PB_DS_CLASS_C_DEC& other)
{
+ _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
std::swap(m_a_values, other.m_a_values);
std::swap(m_a_metadata, other.m_a_metadata);
std::swap(m_size, other.m_size);
std::swap(m_end_it, other.m_end_it);
- _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-~PB_DS_OV_TREE_CLASS_NAME()
+~PB_DS_OV_TREE_NAME()
{
- //PB_DS_ASSERT_VALID((*this))
+ PB_DS_ASSERT_VALID((*this))
cond_dtor<size_type> cd(m_a_values, m_end_it, m_size);
reallocate_metadata((node_update*)this, 0);
}
@@ -249,7 +238,7 @@ PB_DS_CLASS_C_DEC::
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
-update(node_iterator /*it*/, null_node_update_pointer)
+update(node_iterator, null_node_update_pointer)
{ }
PB_DS_CLASS_T_DEC
@@ -258,10 +247,11 @@ void
PB_DS_CLASS_C_DEC::
update(node_iterator nd_it, Node_Update* p_update)
{
- const_node_iterator end_it = PB_DS_node_end_imp();
- if (nd_it == end_it)
- return;
- update(nd_it.get_l_child(), p_update);
- update(nd_it.get_r_child(), p_update);
- node_update::operator()(nd_it, end_it);
+ node_const_iterator end_it = PB_DS_node_end_imp();
+ if (nd_it != end_it)
+ {
+ update(nd_it.get_l_child(), p_update);
+ update(nd_it.get_r_child(), p_update);
+ node_update::operator()(nd_it, end_it);
+ }
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
index 1ba96d8edbb..8c27a46500f 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_fn_imps.hpp
+ * @file ov_tree_map_/debug_fn_imps.hpp
* Contains an implementation class for ov_tree_.
*/
@@ -76,5 +76,4 @@ assert_iterators(const char* __file, int __line) const
PB_DS_DEBUG_VERIFY(iterated_num == m_size);
}
-#endif
-
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
index a9bfab64e12..31eb7c74920 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file erase_fn_imps.hpp
+ * @file ov_tree_map_/erase_fn_imps.hpp
* Contains an implementation class for ov_tree_.
*/
@@ -70,11 +70,12 @@ erase_if(Pred pred)
PB_DS_ASSERT_VALID((*this))
#ifdef PB_DS_REGRESSION
- typename Allocator::group_adjustor adjust(m_size);
-#endif
+ typename _Alloc::group_adjustor adjust(m_size);
+#endif
size_type new_size = 0;
size_type num_val_ersd = 0;
+
for (iterator source_it = begin(); source_it != m_end_it; ++source_it)
if (!pred(*source_it))
++new_size;
@@ -94,16 +95,16 @@ erase_if(Pred pred)
for (iterator source_it = begin(); source_it != m_end_it; ++source_it)
{
if (!pred(*source_it))
- {
- new (const_cast<void*>(static_cast<const void* >(target_it)))
+ {
+ new (const_cast<void*>(static_cast<const void*>(target_it)))
value_type(*source_it);
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(*source_it)));
++target_it;
- }
+ }
}
- reallocate_metadata((node_update* )this, new_size);
+ reallocate_metadata((node_update*)this, new_size);
cd.set_no_action();
{
@@ -113,7 +114,7 @@ erase_if(Pred pred)
m_a_values = a_new_values;
m_size = new_size;
m_end_it = target_it;
- update(node_begin(), (node_update* )this);
+ update(node_begin(), (node_update*)this);
PB_DS_ASSERT_VALID((*this))
return num_val_ersd;
}
@@ -131,8 +132,8 @@ erase_imp(It it)
PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(*it))
#ifdef PB_DS_REGRESSION
- typename Allocator::group_adjustor adjust(m_size);
-#endif
+ typename _Alloc::group_adjustor adjust(m_size);
+#endif
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
value_vector a_values = s_value_alloc.allocate(m_size - 1);
@@ -149,12 +150,12 @@ erase_imp(It it)
{
if (source_it != it)
{
- _GLIBCXX_DEBUG_ONLY(++cnt;)
+ _GLIBCXX_DEBUG_ONLY(++cnt;)
_GLIBCXX_DEBUG_ASSERT(cnt != m_size);
- new (const_cast<void* >(static_cast<const void* >(target_it)))
+ new (const_cast<void*>(static_cast<const void*>(target_it)))
value_type(*source_it);
- ++target_it;
+ ++target_it;
}
else
ret_it = target_it;
@@ -162,9 +163,9 @@ erase_imp(It it)
}
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
- reallocate_metadata((node_update* )this, m_size - 1);
+ reallocate_metadata((node_update*)this, m_size - 1);
cd.set_no_action();
- _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::erase_existing(PB_DS_V2F(*it));)
+ _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(*it));)
{
cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size);
}
@@ -172,7 +173,7 @@ erase_imp(It it)
m_a_values = a_values;
--m_size;
m_end_it = m_a_values + m_size;
- update(node_begin(), (node_update* )this);
+ update(node_begin(), (node_update*)this);
PB_DS_ASSERT_VALID((*this))
return It(ret_it);
}
@@ -180,7 +181,7 @@ erase_imp(It it)
PB_DS_CLASS_T_DEC
bool
PB_DS_CLASS_C_DEC::
-erase(const_key_reference r_key)
+erase(key_const_reference r_key)
{
point_iterator it = find(r_key);
if (it == end())
@@ -188,4 +189,3 @@ erase(const_key_reference r_key)
erase(it);
return true;
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
index 7eeb85b7c19..6beee7118c7 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file info_fn_imps.hpp
+ * @file ov_tree_map_/info_fn_imps.hpp
* Contains an implementation class for ov_tree_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
index 51d1b4d34bb..e96628bdd88 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_fn_imps.hpp
+ * @file ov_tree_map_/insert_fn_imps.hpp
* Contains an implementation class for ov_tree_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
index 40f110084c1..af866866ce0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
@@ -34,18 +34,18 @@
// warranty.
/**
- * @file iterators_fn_imps.hpp
+ * @file ov_tree_map_/iterators_fn_imps.hpp
* Contains an implementation class for ov_tree_.
*/
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
node_begin() const
{ return PB_DS_node_begin_imp(); }
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
node_end() const
{ return PB_DS_node_end_imp(); }
@@ -63,11 +63,11 @@ node_end()
{ return PB_DS_node_end_imp(); }
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
PB_DS_node_begin_imp() const
{
- return const_node_iterator(const_cast<pointer>(mid_pointer(begin(), end())),
+ return node_const_iterator(const_cast<pointer>(mid_pointer(begin(), end())),
const_cast<pointer>(begin()),
const_cast<pointer>(end()),(m_a_metadata == 0)?
0 :
@@ -75,11 +75,11 @@ PB_DS_node_begin_imp() const
}
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
PB_DS_node_end_imp() const
{
- return const_node_iterator(end(), end(), end(),
+ return node_const_iterator(end(), end(), end(),
(m_a_metadata == 0) ? 0 : m_a_metadata + m_size);
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
index 3517896a6f5..79c95043853 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file node_iterators.hpp
+ * @file ov_tree_map_/node_iterators.hpp
* Contains an implementation class for ov_tree_.
*/
@@ -49,28 +49,27 @@ namespace __gnu_pbds
{
namespace detail
{
-
#define PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC \
- ov_tree_node_const_it_<Value_Type, Metadata_Type, Allocator>
+ ov_tree_node_const_it_<Value_Type, Metadata_Type, _Alloc>
- // Const node reference.
- template<typename Value_Type, typename Metadata_Type, class Allocator>
+ /// Const node reference.
+ template<typename Value_Type, typename Metadata_Type, typename _Alloc>
class ov_tree_node_const_it_
{
protected:
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
Value_Type>::other::pointer
pointer;
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
Value_Type>::other::const_pointer
const_pointer;
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
Metadata_Type>::other::const_pointer
const_metadata_pointer;
@@ -93,18 +92,18 @@ namespace __gnu_pbds
typedef trivial_iterator_difference_type difference_type;
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
Value_Type>::other::const_pointer
value_type;
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
typename remove_const<
Value_Type>::type>::other::const_pointer
reference;
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
typename remove_const<
Value_Type>::type>::other::const_pointer
const_reference;
@@ -112,9 +111,9 @@ namespace __gnu_pbds
typedef Metadata_Type metadata_type;
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
metadata_type>::other::const_reference
- const_metadata_reference;
+ metadata_const_reference;
public:
inline
@@ -125,12 +124,12 @@ namespace __gnu_pbds
operator*() const
{ return m_p_value; }
- inline const_metadata_reference
+ inline metadata_const_reference
get_metadata() const
{
enum
{
- has_metadata = !is_same<Metadata_Type, null_node_metadata>::value
+ has_metadata = !is_same<Metadata_Type, null_type>::value
};
PB_DS_STATIC_ASSERT(should_have_metadata, has_metadata);
@@ -196,10 +195,10 @@ namespace __gnu_pbds
};
#define PB_DS_OV_TREE_NODE_ITERATOR_C_DEC \
- ov_tree_node_it_<Value_Type, Metadata_Type, Allocator>
+ ov_tree_node_it_<Value_Type, Metadata_Type, _Alloc>
- // Node reference.
- template<typename Value_Type, typename Metadata_Type, class Allocator>
+ /// Node reference.
+ template<typename Value_Type, typename Metadata_Type, typename _Alloc>
class ov_tree_node_it_ : public PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC
{
@@ -223,18 +222,18 @@ namespace __gnu_pbds
typedef trivial_iterator_difference_type difference_type;
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
Value_Type>::other::pointer
value_type;
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
typename remove_const<
Value_Type>::type>::other::pointer
reference;
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
typename remove_const<
Value_Type>::type>::other::pointer
const_reference;
@@ -270,7 +269,9 @@ namespace __gnu_pbds
get_r_child() const
{
if (base_type::m_p_value == base_type::m_p_end_value)
- return (this_type(base_type::m_p_end_value, base_type::m_p_end_value, base_type::m_p_end_value));
+ return this_type(base_type::m_p_end_value,
+ base_type::m_p_end_value,
+ base_type::m_p_end_value);
const_metadata_pointer p_end_metadata =
base_type::m_p_metadata + (base_type::m_p_end_value - base_type::m_p_value);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp
index 06436591ef5..20a435047dd 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp
@@ -34,19 +34,21 @@
// warranty.
/**
- * @file ov_tree_map_.hpp
+ * @file ov_tree_map_/ov_tree_map_.hpp
* Contains an implementation class for ov_tree_.
*/
#include <map>
#include <set>
+#include <ext/pb_ds/exception.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
#include <ext/pb_ds/detail/types_traits.hpp>
-#include <ext/pb_ds/detail/debug_map_base.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
-#include <ext/pb_ds/exception.hpp>
#include <ext/pb_ds/detail/tree_trace_base.hpp>
+#ifdef _GLIBCXX_DEBUG
+#include <ext/pb_ds/detail/debug_map_base.hpp>
+#endif
#include <utility>
#include <functional>
#include <algorithm>
@@ -58,159 +60,171 @@ namespace __gnu_pbds
{
namespace detail
{
-#define PB_DS_CLASS_T_DEC \
- template<typename Key, typename Mapped, class Cmp_Fn, \
- class Node_And_It_Traits, class Allocator>
-
#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_OV_TREE_CLASS_NAME ov_tree_data_
-#endif
+#define PB_DS_OV_TREE_NAME ov_tree_map
+#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_node_const_iterator_map
+#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_OV_TREE_CLASS_NAME ov_tree_no_data_
-#endif
+#define PB_DS_OV_TREE_NAME ov_tree_set
+#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_node_const_iterator_set
+#endif
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_const_node_iterator_data_
-#else
-#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_const_node_iterator_no_data_
-#endif
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Mapped, typename Cmp_Fn, \
+ typename Node_And_It_Traits, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
- PB_DS_OV_TREE_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>
+ PB_DS_OV_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
-#define PB_DS_TYPES_TRAITS_C_DEC \
- types_traits<Key, Mapped, Allocator, false>
+#define PB_DS_OV_TREE_TRAITS_BASE \
+ types_traits<Key, Mapped, _Alloc, false>
#ifdef _GLIBCXX_DEBUG
#define PB_DS_DEBUG_MAP_BASE_C_DEC \
debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \
- typename Allocator::template rebind<Key>::other::const_reference>
-#endif
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#define PB_DS_EP2VP(X)& ((X)->m_value)
-#endif
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped_Data()
-#define PB_DS_EP2VP(X)& ((X)->m_value.first)
-#endif
+ typename _Alloc::template rebind<Key>::other::const_reference>
+#endif
#ifdef PB_DS_TREE_TRACE
#define PB_DS_TREE_TRACE_BASE_C_DEC \
- tree_trace_base<typename Node_And_It_Traits::const_node_iterator, \
+ tree_trace_base<typename Node_And_It_Traits::node_const_iterator, \
typename Node_And_It_Traits::node_iterator, \
- Cmp_Fn, false, Allocator>
+ Cmp_Fn, false, _Alloc>
#endif
#ifndef PB_DS_CHECK_KEY_EXISTS
# error Missing definition
#endif
- // Ordered-vector tree associative-container.
- template<typename Key, typename Mapped, class Cmp_Fn,
- class Node_And_It_Traits, class Allocator>
- class PB_DS_OV_TREE_CLASS_NAME :
+ /// Ordered-vector tree associative-container.
+ template<typename Key, typename Mapped, typename Cmp_Fn,
+ typename Node_And_It_Traits, typename _Alloc>
+ class PB_DS_OV_TREE_NAME :
#ifdef _GLIBCXX_DEBUG
protected PB_DS_DEBUG_MAP_BASE_C_DEC,
-#endif
+#endif
#ifdef PB_DS_TREE_TRACE
public PB_DS_TREE_TRACE_BASE_C_DEC,
-#endif
+#endif
public Cmp_Fn,
public Node_And_It_Traits::node_update,
- public PB_DS_TYPES_TRAITS_C_DEC
+ public PB_DS_OV_TREE_TRAITS_BASE
{
private:
- typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
+ typedef PB_DS_OV_TREE_TRAITS_BASE traits_base;
+ typedef Node_And_It_Traits traits_type;
typedef typename remove_const<typename traits_base::value_type>::type non_const_value_type;
- typedef typename Allocator::template rebind<non_const_value_type>::other value_allocator;
- typedef typename value_allocator::pointer value_vector;
-
-
- typedef Cmp_Fn cmp_fn_base;
+ typedef typename _Alloc::template rebind<non_const_value_type>::other value_allocator;
+ typedef typename value_allocator::pointer value_vector;
#ifdef _GLIBCXX_DEBUG
- typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
-#endif
+ typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
+#endif
+
+#ifdef PB_DS_TREE_TRACE
+ typedef PB_DS_TREE_TRACE_BASE_C_DEC trace_base;
+#endif
- typedef typename traits_base::pointer mapped_pointer_;
- typedef typename traits_base::const_pointer const_mapped_pointer_;
+ typedef typename traits_base::pointer mapped_pointer_;
+ typedef typename traits_base::const_pointer mapped_const_pointer_;
- typedef typename Node_And_It_Traits::metadata_type metadata_type;
+ typedef typename traits_type::metadata_type metadata_type;
- typedef typename Allocator::template rebind<metadata_type>::other metadata_allocator;
- typedef typename metadata_allocator::pointer metadata_pointer;
- typedef typename metadata_allocator::const_reference const_metadata_reference;
- typedef typename metadata_allocator::reference metadata_reference;
+ typedef typename _Alloc::template rebind<metadata_type>::other metadata_allocator;
+ typedef typename metadata_allocator::pointer metadata_pointer;
+ typedef typename metadata_allocator::const_reference metadata_const_reference;
+ typedef typename metadata_allocator::reference metadata_reference;
- typedef
- typename Node_And_It_Traits::null_node_update_pointer
+ typedef typename traits_type::null_node_update_pointer
null_node_update_pointer;
public:
-
- typedef Allocator allocator_type;
- typedef typename Allocator::size_type size_type;
- typedef typename Allocator::difference_type difference_type;
-
- typedef Cmp_Fn cmp_fn;
-
- typedef typename Node_And_It_Traits::node_update node_update;
-
- typedef typename traits_base::key_type key_type;
- typedef typename traits_base::key_pointer key_pointer;
- typedef typename traits_base::const_key_pointer const_key_pointer;
- typedef typename traits_base::key_reference key_reference;
- typedef typename traits_base::const_key_reference const_key_reference;
- typedef typename traits_base::mapped_type mapped_type;
- typedef typename traits_base::mapped_pointer mapped_pointer;
- typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
- typedef typename traits_base::mapped_reference mapped_reference;
- typedef typename traits_base::const_mapped_reference const_mapped_reference;
- typedef typename traits_base::value_type value_type;
- typedef typename traits_base::pointer pointer;
- typedef typename traits_base::const_pointer const_pointer;
- typedef typename traits_base::reference reference;
- typedef typename traits_base::const_reference const_reference;
-
- typedef const_pointer const_point_iterator;
-
+ typedef ov_tree_tag container_category;
+ typedef _Alloc allocator_type;
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef Cmp_Fn cmp_fn;
+
+ typedef typename traits_base::key_type key_type;
+ typedef typename traits_base::key_pointer key_pointer;
+ typedef typename traits_base::key_const_pointer key_const_pointer;
+ typedef typename traits_base::key_reference key_reference;
+ typedef typename traits_base::key_const_reference key_const_reference;
+ typedef typename traits_base::mapped_type mapped_type;
+ typedef typename traits_base::mapped_pointer mapped_pointer;
+ typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
+ typedef typename traits_base::mapped_reference mapped_reference;
+ typedef typename traits_base::mapped_const_reference mapped_const_reference;
+ typedef typename traits_base::value_type value_type;
+ typedef typename traits_base::pointer pointer;
+ typedef typename traits_base::const_pointer const_pointer;
+ typedef typename traits_base::reference reference;
+ typedef typename traits_base::const_reference const_reference;
+
+ typedef const_pointer point_const_iterator;
#ifdef PB_DS_DATA_TRUE_INDICATOR
- typedef pointer point_iterator;
-#else
- typedef const_point_iterator point_iterator;
-#endif
-
- typedef const_point_iterator const_iterator;
-
- typedef point_iterator iterator;
-
-#include <ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp>
+ typedef pointer point_iterator;
+#else
+ typedef point_const_iterator point_iterator;
+#endif
- typedef
- typename Node_And_It_Traits::const_node_iterator
- const_node_iterator;
+ typedef point_iterator iterator;
+ typedef point_const_iterator const_iterator;
+
+ /// Conditional destructor.
+ template<typename Size_Type>
+ class cond_dtor
+ {
+ public:
+ cond_dtor(value_vector a_vec, iterator& r_last_it,
+ Size_Type total_size)
+ : m_a_vec(a_vec), m_r_last_it(r_last_it), m_max_size(total_size),
+ m_no_action(false)
+ { }
+
+ ~cond_dtor()
+ {
+ if (m_no_action)
+ return;
+ iterator it = m_a_vec;
+ while (it != m_r_last_it)
+ {
+ it->~value_type();
+ ++it;
+ }
+
+ if (m_max_size > 0)
+ value_allocator().deallocate(m_a_vec, m_max_size);
+ }
- typedef typename Node_And_It_Traits::node_iterator node_iterator;
+ inline void
+ set_no_action()
+ { m_no_action = true; }
+
+ protected:
+ value_vector m_a_vec;
+ iterator& m_r_last_it;
+ const Size_Type m_max_size;
+ bool m_no_action;
+ };
+
+ typedef typename traits_type::node_update node_update;
+ typedef typename traits_type::node_iterator node_iterator;
+ typedef typename traits_type::node_const_iterator node_const_iterator;
- public:
- PB_DS_OV_TREE_CLASS_NAME();
+ PB_DS_OV_TREE_NAME();
- PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn&);
+ PB_DS_OV_TREE_NAME(const Cmp_Fn&);
- PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn&, const node_update&);
+ PB_DS_OV_TREE_NAME(const Cmp_Fn&, const node_update&);
- PB_DS_OV_TREE_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+ PB_DS_OV_TREE_NAME(const PB_DS_CLASS_C_DEC&);
- ~PB_DS_OV_TREE_CLASS_NAME();
+ ~PB_DS_OV_TREE_NAME();
void
swap(PB_DS_CLASS_C_DEC&);
@@ -228,14 +242,14 @@ namespace __gnu_pbds
inline size_type
size() const;
- Cmp_Fn&
+ Cmp_Fn&
get_cmp_fn();
- const Cmp_Fn&
+ const Cmp_Fn&
get_cmp_fn() const;
inline mapped_reference
- operator[](const_key_reference r_key)
+ operator[](key_const_reference r_key)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
PB_DS_ASSERT_VALID((*this))
@@ -246,19 +260,18 @@ namespace __gnu_pbds
PB_DS_ASSERT_VALID((*this))
return it->second;
}
-
- return (insert_new_val(it, std::make_pair(r_key, mapped_type()))->second);
-#else
+ return insert_new_val(it, std::make_pair(r_key, mapped_type()))->second;
+#else
insert(r_key);
- return traits_base::s_null_mapped;
-#endif
+ return traits_base::s_null_type;
+#endif
}
inline std::pair<point_iterator, bool>
insert(const_reference r_value)
{
PB_DS_ASSERT_VALID((*this))
- const_key_reference r_key = PB_DS_V2F(r_value);
+ key_const_reference r_key = PB_DS_V2F(r_value);
point_iterator it = lower_bound(r_key);
if (it != end()&& !Cmp_Fn::operator()(r_key, PB_DS_V2F(*it)))
@@ -272,14 +285,14 @@ namespace __gnu_pbds
}
inline point_iterator
- lower_bound(const_key_reference r_key)
+ lower_bound(key_const_reference r_key)
{
pointer it = m_a_values;
pointer e_it = m_a_values + m_size;
while (it != e_it)
{
pointer mid_it = it + ((e_it - it) >> 1);
- if (cmp_fn_base::operator()(PB_DS_V2F(*mid_it), r_key))
+ if (cmp_fn::operator()(PB_DS_V2F(*mid_it), r_key))
it = ++mid_it;
else
e_it = mid_it;
@@ -287,15 +300,15 @@ namespace __gnu_pbds
return it;
}
- inline const_point_iterator
- lower_bound(const_key_reference r_key) const
+ inline point_const_iterator
+ lower_bound(key_const_reference r_key) const
{ return const_cast<PB_DS_CLASS_C_DEC& >(*this).lower_bound(r_key); }
inline point_iterator
- upper_bound(const_key_reference r_key)
+ upper_bound(key_const_reference r_key)
{
iterator pot_it = lower_bound(r_key);
- if (pot_it != end()&& !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it)))
+ if (pot_it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it)))
{
PB_DS_CHECK_KEY_EXISTS(r_key)
return ++pot_it;
@@ -305,12 +318,12 @@ namespace __gnu_pbds
return pot_it;
}
- inline const_point_iterator
- upper_bound(const_key_reference r_key) const
+ inline point_const_iterator
+ upper_bound(key_const_reference r_key) const
{ return const_cast<PB_DS_CLASS_C_DEC&>(*this).upper_bound(r_key); }
inline point_iterator
- find(const_key_reference r_key)
+ find(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
iterator pot_it = lower_bound(r_key);
@@ -324,12 +337,12 @@ namespace __gnu_pbds
return end();
}
- inline const_point_iterator
- find(const_key_reference r_key) const
- { return (const_cast<PB_DS_CLASS_C_DEC& >(*this).find(r_key)); }
+ inline point_const_iterator
+ find(key_const_reference r_key) const
+ { return (const_cast<PB_DS_CLASS_C_DEC&>(*this).find(r_key)); }
bool
- erase(const_key_reference);
+ erase(key_const_reference);
template<typename Pred>
inline size_type
@@ -346,7 +359,7 @@ namespace __gnu_pbds
join(PB_DS_CLASS_C_DEC&);
void
- split(const_key_reference, PB_DS_CLASS_C_DEC&);
+ split(key_const_reference, PB_DS_CLASS_C_DEC&);
inline iterator
begin()
@@ -364,10 +377,10 @@ namespace __gnu_pbds
end() const
{ return m_end_it; }
- inline const_node_iterator
+ inline node_const_iterator
node_begin() const;
- inline const_node_iterator
+ inline node_const_iterator
node_end() const;
inline node_iterator
@@ -379,7 +392,7 @@ namespace __gnu_pbds
private:
inline void
- update(node_iterator /*it*/, null_node_update_pointer);
+ update(node_iterator, null_node_update_pointer);
template<typename Node_Update>
void
@@ -415,8 +428,8 @@ namespace __gnu_pbds
insert_new_val(iterator it, const_reference r_value)
{
#ifdef PB_DS_REGRESSION
- typename Allocator::group_adjustor adjust(m_size);
-#endif
+ typename _Alloc::group_adjustor adjust(m_size);
+#endif
PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_value))
@@ -430,23 +443,23 @@ namespace __gnu_pbds
cond_dtor<size_type> cd(a_values, target_it, m_size + 1);
while (source_it != it)
{
- new (const_cast<void* >(static_cast<const void* >(target_it)))
+ new (const_cast<void*>(static_cast<const void*>(target_it)))
value_type(*source_it++);
++target_it;
}
- new (const_cast<void* >(static_cast<const void* >(ret_it = target_it)))
+ new (const_cast<void*>(static_cast<const void*>(ret_it = target_it)))
value_type(r_value);
++target_it;
while (source_it != source_end_it)
{
- new (const_cast<void* >(static_cast<const void* >(target_it)))
+ new (const_cast<void*>(static_cast<const void*>(target_it)))
value_type(*source_it++);
++target_it;
}
- reallocate_metadata((node_update* )this, m_size + 1);
+ reallocate_metadata((node_update*)this, m_size + 1);
cd.set_no_action();
if (m_size != 0)
{
@@ -464,20 +477,20 @@ namespace __gnu_pbds
#ifdef _GLIBCXX_DEBUG
void
- assert_valid(const char* file, int line) const;
+ assert_valid(const char*, int) const;
void
- assert_iterators(const char* file, int line) const;
-#endif
+ assert_iterators(const char*, int) const;
+#endif
template<typename It>
It
- erase_imp(It it);
+ erase_imp(It);
- inline const_node_iterator
+ inline node_const_iterator
PB_DS_node_begin_imp() const;
- inline const_node_iterator
+ inline node_const_iterator
PB_DS_node_end_imp() const;
inline node_iterator
@@ -487,13 +500,13 @@ namespace __gnu_pbds
PB_DS_node_end_imp();
private:
- static value_allocator s_value_alloc;
+ static value_allocator s_value_alloc;
static metadata_allocator s_metadata_alloc;
- value_vector m_a_values;
- metadata_pointer m_a_metadata;
- iterator m_end_it;
- size_type m_size;
+ value_vector m_a_values;
+ metadata_pointer m_a_metadata;
+ iterator m_end_it;
+ size_type m_size;
};
#include <ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp>
@@ -507,17 +520,12 @@ namespace __gnu_pbds
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_OV_TREE_CLASS_NAME
-#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_OV_TREE_NAME
+#undef PB_DS_OV_TREE_TRAITS_BASE
#undef PB_DS_DEBUG_MAP_BASE_C_DEC
#ifdef PB_DS_TREE_TRACE
#undef PB_DS_TREE_TRACE_BASE_C_DEC
-#endif
-
-#undef PB_DS_V2F
-#undef PB_DS_EP2VP
-#undef PB_DS_V2S
+#endif
#undef PB_DS_CONST_NODE_ITERATOR_NAME
-
} // namespace detail
} // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
index c06d6f851f3..eafe0b039b2 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
@@ -34,8 +34,8 @@
// warranty.
/**
- * @file policy_access_fn_imps.hpp
- * Contains an implementation class for bin_search_tree_.
+ * @file ov_tree_map_/policy_access_fn_imps.hpp
+ * Contains an implementation class for ov_tree.
*/
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
index 567a52e0218..a12c2320cc2 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
@@ -34,14 +34,14 @@
// warranty.
/**
- * @file split_join_fn_imps.hpp
+ * @file ov_tree_map_/split_join_fn_imps.hpp
* Contains an implementation class for ov_tree_.
*/
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
+split(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
@@ -73,17 +73,15 @@ split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
return;
}
- _GLIBCXX_DEBUG_ONLY(debug_base::join(other);)
iterator it = upper_bound(r_key);
PB_DS_CLASS_C_DEC new_other(other, other);
new_other.copy_from_ordered_range(it, end());
- PB_DS_CLASS_C_DEC new_this(*this, * this);
+ PB_DS_CLASS_C_DEC new_this(*this, *this);
new_this.copy_from_ordered_range(begin(), it);
// No exceptions from this point.
- _GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(Cmp_Fn& )(*this), other);)
- other.update(other.node_begin(), (node_update* )(&other));
- update(node_begin(), (node_update* )this);
+ other.update(other.node_begin(), (node_update*)(&other));
+ update(node_begin(), (node_update*)this);
other.value_swap(new_other);
value_swap(new_this);
PB_DS_ASSERT_VALID((*this))
@@ -120,14 +118,13 @@ join(PB_DS_CLASS_C_DEC& other)
PB_DS_CLASS_C_DEC new_this(*this, *this);
if (greater)
- new_this.copy_from_ordered_range(begin(), end(),
+ new_this.copy_from_ordered_range(begin(), end(),
other.begin(), other.end());
else
new_this.copy_from_ordered_range(other.begin(), other.end(),
begin(), end());
// No exceptions from this point.
- _GLIBCXX_DEBUG_ONLY(debug_base::join(other, false);)
value_swap(new_this);
other.clear();
PB_DS_ASSERT_VALID((*this))
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
index 63cb0f7fb4c..359e599627b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file traits.hpp
+ * @file ov_tree_map_/traits.hpp
* Contains an implementation class for ov_tree_.
*/
@@ -47,135 +47,135 @@ namespace __gnu_pbds
{
namespace detail
{
-
+ /// Tree traits.
template<typename Key,
typename Mapped,
class Cmp_Fn,
- template<typename Const_Node_Iterator,
- class Node_Iterator,
+ template<typename Node_CItr,
+ class Node_Itr,
class Cmp_Fn_,
- class Allocator_>
+ typename _Alloc_>
class Node_Update,
- class Allocator>
+ typename _Alloc>
struct tree_traits<
Key,
Mapped,
Cmp_Fn,
Node_Update,
ov_tree_tag,
- Allocator>
+ _Alloc>
{
private:
typedef
typename types_traits<
Key,
Mapped,
- Allocator,
+ _Alloc,
false>::value_type
value_type;
public:
typedef
- typename tree_node_metadata_selector<
+ typename tree_node_metadata_dispatch<
Key,
Mapped,
Cmp_Fn,
Node_Update,
- Allocator>::type
+ _Alloc>::type
metadata_type;
typedef
ov_tree_node_const_it_<
value_type,
metadata_type,
- Allocator>
- const_node_iterator;
+ _Alloc>
+ node_const_iterator;
typedef
ov_tree_node_it_<
value_type,
metadata_type,
- Allocator>
+ _Alloc>
node_iterator;
typedef
Node_Update<
- const_node_iterator,
+ node_const_iterator,
node_iterator,
Cmp_Fn,
- Allocator>
+ _Alloc>
node_update;
typedef
- __gnu_pbds::null_tree_node_update<
- const_node_iterator,
+ __gnu_pbds::null_node_update<
+ node_const_iterator,
node_iterator,
Cmp_Fn,
- Allocator>*
+ _Alloc>*
null_node_update_pointer;
};
+ /// Specialization.
template<typename Key,
class Cmp_Fn,
- template<typename Const_Node_Iterator,
- class Node_Iterator,
+ template<typename Node_CItr,
+ class Node_Itr,
class Cmp_Fn_,
- class Allocator_>
+ typename _Alloc_>
class Node_Update,
- class Allocator>
+ typename _Alloc>
struct tree_traits<
Key,
- null_mapped_type,
+ null_type,
Cmp_Fn,
Node_Update,
ov_tree_tag,
- Allocator>
+ _Alloc>
{
private:
typedef
typename types_traits<
Key,
- null_mapped_type,
- Allocator,
+ null_type,
+ _Alloc,
false>::value_type
value_type;
public:
typedef
- typename tree_node_metadata_selector<
+ typename tree_node_metadata_dispatch<
Key,
- null_mapped_type,
+ null_type,
Cmp_Fn,
Node_Update,
- Allocator>::type
+ _Alloc>::type
metadata_type;
typedef
ov_tree_node_const_it_<
value_type,
metadata_type,
- Allocator>
- const_node_iterator;
+ _Alloc>
+ node_const_iterator;
- typedef const_node_iterator node_iterator;
+ typedef node_const_iterator node_iterator;
typedef
Node_Update<
- const_node_iterator,
- const_node_iterator,
+ node_const_iterator,
+ node_const_iterator,
Cmp_Fn,
- Allocator>
+ _Alloc>
node_update;
typedef
- __gnu_pbds::null_tree_node_update<
- const_node_iterator,
+ __gnu_pbds::null_node_update<
+ node_const_iterator,
node_iterator,
Cmp_Fn,
- Allocator>*
+ _Alloc>*
null_node_update_pointer;
};
-
} // namespace detail
} // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
index 6a70ea47601..0b836c549cd 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file constructors_destructor_fn_imps.hpp
+ * @file pairing_heap_/constructors_destructor_fn_imps.hpp
* Contains an implementation class for a pairing heap.
*/
@@ -46,32 +46,25 @@ copy_from_range(It first_it, It last_it)
{
while (first_it != last_it)
push(*(first_it++));
-
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-pairing_heap_()
-{
- PB_DS_ASSERT_VALID((*this))
-}
+pairing_heap()
+{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-pairing_heap_(const Cmp_Fn& r_cmp_fn) :
- PB_DS_BASE_C_DEC(r_cmp_fn)
-{
- PB_DS_ASSERT_VALID((*this))
-}
+pairing_heap(const Cmp_Fn& r_cmp_fn)
+: base_type(r_cmp_fn)
+{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-pairing_heap_(const PB_DS_CLASS_C_DEC& other) :
- PB_DS_BASE_C_DEC(other)
-{
- PB_DS_ASSERT_VALID((*this))
-}
+pairing_heap(const PB_DS_CLASS_C_DEC& other)
+: base_type(other)
+{ PB_DS_ASSERT_VALID((*this)) }
PB_DS_CLASS_T_DEC
void
@@ -79,13 +72,11 @@ PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
-
- PB_DS_BASE_C_DEC::swap(other);
-
+ base_type::swap(other);
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-~pairing_heap_()
+~pairing_heap()
{ }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
index 7212db2c539..802c95e9b50 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_fn_imps.hpp
+ * @file pairing_heap_/debug_fn_imps.hpp
* Contains an implementation class for a pairing heap.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
index be3a41c7827..d6303c3294e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file erase_fn_imps.hpp
+ * @file pairing_heap_/erase_fn_imps.hpp
* Contains an implementation class for a pairing heap.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
index c02373b2f3a..49b2ca6342d 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file find_fn_imps.hpp
+ * @file pairing_heap_/find_fn_imps.hpp
* Contains an implementation class for a pairing heap.
*/
@@ -45,6 +45,5 @@ top() const
{
PB_DS_ASSERT_VALID((*this))
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
-
return base_type::m_p_root->m_value;
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
index 07e6b00cb83..ced5eeb0819 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_fn_imps.hpp
+ * @file pairing_heap_/insert_fn_imps.hpp
* Contains an implementation class for a pairing heap.
*/
@@ -44,13 +44,9 @@ PB_DS_CLASS_C_DEC::
push(const_reference r_val)
{
PB_DS_ASSERT_VALID((*this))
-
node_pointer p_new_nd = base_type::get_new_node_for_insert(r_val);
-
push_imp(p_new_nd);
-
PB_DS_ASSERT_VALID((*this))
-
return point_iterator(p_new_nd);
}
@@ -60,20 +56,16 @@ PB_DS_CLASS_C_DEC::
push_imp(node_pointer p_nd)
{
p_nd->m_p_l_child = 0;
-
if (base_type::m_p_root == 0)
{
p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = 0;
-
base_type::m_p_root = p_nd;
}
else if (Cmp_Fn::operator()(base_type::m_p_root->m_value, p_nd->m_value))
{
p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = 0;
-
base_type::make_child_of(base_type::m_p_root, p_nd);
PB_DS_ASSERT_NODE_CONSISTENT(p_nd, false)
-
base_type::m_p_root = p_nd;
}
else
@@ -89,13 +81,8 @@ PB_DS_CLASS_C_DEC::
modify(point_iterator it, const_reference r_new_val)
{
PB_DS_ASSERT_VALID((*this))
-
remove_node(it.m_p_nd);
-
it.m_p_nd->m_value = r_new_val;
-
push_imp(it.m_p_nd);
-
PB_DS_ASSERT_VALID((*this))
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
index 3bdb82fb649..85e098ad4c8 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file pairing_heap_.hpp
+ * @file pairing_heap_/pairing_heap_.hpp
* Contains an implementation class for a pairing heap.
*/
@@ -48,106 +48,69 @@
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>
-#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
-
#define PB_DS_CLASS_T_DEC \
- template<typename Value_Type, class Cmp_Fn, class Allocator>
+ template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
- pairing_heap_<Value_Type, Cmp_Fn, Allocator>
+ pairing_heap<Value_Type, Cmp_Fn, _Alloc>
#ifdef _GLIBCXX_DEBUG
-#define PB_DS_BASE_C_DEC \
- left_child_next_sibling_heap_<Value_Type, \
- Cmp_Fn, \
- null_left_child_next_sibling_heap_node_metadata, \
- Allocator, \
- false>
-#else
-#define PB_DS_BASE_C_DEC \
- left_child_next_sibling_heap_<Value_Type, \
- Cmp_Fn, \
- null_left_child_next_sibling_heap_node_metadata, \
- Allocator>
-#endif
-
- /**
- * class description = "P4ri|\|g h3ap$">
- **/
- template<typename Value_Type, class Cmp_Fn, class Allocator>
- class pairing_heap_ : public PB_DS_BASE_C_DEC
- {
+#define PB_DS_P_HEAP_BASE \
+ left_child_next_sibling_heap<Value_Type, Cmp_Fn, null_type, _Alloc, false>
+#else
+#define PB_DS_P_HEAP_BASE \
+ left_child_next_sibling_heap<Value_Type, Cmp_Fn, null_type, _Alloc>
+#endif
+ /// Pairing heap.
+ template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
+ class pairing_heap : public PB_DS_P_HEAP_BASE
+ {
private:
- typedef PB_DS_BASE_C_DEC base_type;
+ typedef PB_DS_P_HEAP_BASE base_type;
+ typedef typename base_type::node_pointer node_pointer;
- typedef typename base_type::node_pointer node_pointer;
+ typedef typename _Alloc::template rebind<Value_Type>::other __rebind_a;
public:
+ typedef Value_Type value_type;
+ typedef Cmp_Fn cmp_fn;
+ typedef _Alloc allocator_type;
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
- typedef typename Allocator::size_type size_type;
-
- typedef typename Allocator::difference_type difference_type;
-
- typedef Value_Type value_type;
-
- typedef
- typename Allocator::template rebind<
- value_type>::other::pointer
- pointer;
-
- typedef
- typename Allocator::template rebind<
- value_type>::other::const_pointer
- const_pointer;
-
- typedef
- typename Allocator::template rebind<
- value_type>::other::reference
- reference;
-
- typedef
- typename Allocator::template rebind<
- value_type>::other::const_reference
- const_reference;
-
- typedef
- typename PB_DS_BASE_C_DEC::const_point_iterator
- const_point_iterator;
-
- typedef typename PB_DS_BASE_C_DEC::point_iterator point_iterator;
-
- typedef typename PB_DS_BASE_C_DEC::const_iterator const_iterator;
-
- typedef typename PB_DS_BASE_C_DEC::iterator iterator;
-
- typedef Cmp_Fn cmp_fn;
-
- typedef Allocator allocator_type;
+ typedef typename __rebind_a::pointer pointer;
+ typedef typename __rebind_a::const_pointer const_pointer;
+ typedef typename __rebind_a::reference reference;
+ typedef typename __rebind_a::const_reference const_reference;
+ typedef typename base_type::point_const_iterator point_const_iterator;
+ typedef typename base_type::point_iterator point_iterator;
+ typedef typename base_type::const_iterator const_iterator;
+ typedef typename base_type::iterator iterator;
- pairing_heap_();
+ pairing_heap();
- pairing_heap_(const Cmp_Fn& r_cmp_fn);
+ pairing_heap(const Cmp_Fn&);
- pairing_heap_(const PB_DS_CLASS_C_DEC& other);
+ pairing_heap(const pairing_heap&);
void
- swap(PB_DS_CLASS_C_DEC& other);
+ swap(pairing_heap&);
- ~pairing_heap_();
+ ~pairing_heap();
inline point_iterator
- push(const_reference r_val);
+ push(const_reference);
void
- modify(point_iterator it, const_reference r_new_val);
+ modify(point_iterator, const_reference);
inline const_reference
top() const;
@@ -156,51 +119,51 @@ namespace __gnu_pbds
pop();
void
- erase(point_iterator it);
+ erase(point_iterator);
template<typename Pred>
size_type
- erase_if(Pred pred);
+ erase_if(Pred);
template<typename Pred>
void
- split(Pred pred, PB_DS_CLASS_C_DEC& other);
+ split(Pred, pairing_heap&);
void
- join(PB_DS_CLASS_C_DEC& other);
+ join(pairing_heap&);
protected:
template<typename It>
void
- copy_from_range(It first_it, It last_it);
+ copy_from_range(It, It);
#ifdef _GLIBCXX_DEBUG
void
- assert_valid(const char* file, int line) const;
+ assert_valid(const char*, int) const;
#endif
private:
inline void
- push_imp(node_pointer p_nd);
+ push_imp(node_pointer);
node_pointer
- join_node_children(node_pointer p_nd);
+ join_node_children(node_pointer);
node_pointer
- forward_join(node_pointer p_nd, node_pointer p_next);
+ forward_join(node_pointer, node_pointer);
node_pointer
- back_join(node_pointer p_nd, node_pointer p_next);
+ back_join(node_pointer, node_pointer);
void
- remove_node(node_pointer p_nd);
+ remove_node(node_pointer);
};
-#define PB_DS_ASSERT_NODE_CONSISTENT(_Node, _Bool) \
- _GLIBCXX_DEBUG_ONLY(assert_node_consistent(_Node, _Bool, \
- __FILE__, __LINE__);)
+#define PB_DS_ASSERT_NODE_CONSISTENT(_Node, _Bool) \
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(_Node, _Bool, \
+ __FILE__, __LINE__);)
#include <ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp>
#include <ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp>
@@ -212,7 +175,7 @@ namespace __gnu_pbds
#undef PB_DS_ASSERT_NODE_CONSISTENT
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_BASE_C_DEC
+#undef PB_DS_P_HEAP_BASE
} // namespace detail
} // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
index e5469b9b99b..a74ed63b845 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file split_join_fn_imps.hpp
+ * @file pairing_heap_/split_join_fn_imps.hpp
* Contains an implementation class for a pairing heap.
*/
@@ -53,44 +53,32 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
-
return;
}
base_type::to_linked_list();
-
node_pointer p_out = base_type::prune(pred);
-
while (p_out != 0)
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);
--base_type::m_size;
-
++other.m_size;
-
node_pointer p_next = p_out->m_p_next_sibling;
-
p_out->m_p_l_child = p_out->m_p_next_sibling = p_out->m_p_prev_or_parent = 0;
other.push_imp(p_out);
-
p_out = p_next;
}
PB_DS_ASSERT_VALID(other)
-
node_pointer p_cur = base_type::m_p_root;
-
base_type::m_p_root = 0;
-
while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
-
p_cur->m_p_l_child = p_cur->m_p_next_sibling = p_cur->m_p_prev_or_parent = 0;
push_imp(p_cur);
-
p_cur = p_next;
}
@@ -110,7 +98,6 @@ join(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
-
return;
}
@@ -120,7 +107,6 @@ join(PB_DS_CLASS_C_DEC& other)
{
base_type::make_child_of(base_type::m_p_root, other.m_p_root);
PB_DS_ASSERT_NODE_CONSISTENT(other.m_p_root, false)
-
base_type::m_p_root = other.m_p_root;
}
else
@@ -130,11 +116,8 @@ join(PB_DS_CLASS_C_DEC& other)
}
base_type::m_size += other.m_size;
-
other.m_p_root = 0;
other.m_size = 0;
-
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
deleted file mode 100644
index b7cdf236311..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
+++ /dev/null
@@ -1,93 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file child_iterator.hpp
- * Contains a iterator for a patricia tree.
- */
-
-struct iterator : public const_iterator
-{
-public:
- typedef std::forward_iterator_tag iterator_category;
- typedef typename Allocator::difference_type difference_type;
- typedef node_pointer value_type;
- typedef node_pointer_pointer pointer;
- typedef node_pointer_reference reference;
-
- inline
- iterator(node_pointer_pointer p_p_cur = 0,
- node_pointer_pointer p_p_end = 0)
- : const_iterator(p_p_cur, p_p_end)
- { }
-
- inline bool
- operator==(const iterator& other) const
- { return const_iterator::m_p_p_cur == other.m_p_p_cur; }
-
- inline bool
- operator!=(const iterator& other) const
- { return const_iterator::m_p_p_cur != other.m_p_p_cur; }
-
- inline iterator&
- operator++()
- {
- const_iterator::operator++();
- return *this;
- }
-
- inline iterator
- operator++(int)
- {
- iterator ret_it(*this);
- operator++();
- return ret_it;
- }
-
- node_pointer_pointer
- operator->()
- {
- _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)
- return const_iterator::m_p_p_cur;
- }
-
- node_pointer
- operator*()
- {
- _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)
- return *const_iterator::m_p_p_cur;
- }
-};
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
deleted file mode 100644
index 184b986522f..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
+++ /dev/null
@@ -1,79 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file cond_dtor_entry_dealtor.hpp
- * Contains a binary tree container conditional deallocator
- */
-
-class cond_dealtor
-{
-public:
- inline
- cond_dealtor(leaf_pointer p_nd) : m_p_nd(p_nd),
- m_no_action_dtor(false),
- m_call_destructor(false)
- { }
-
- inline void
- set_no_action_dtor()
- {
- m_no_action_dtor = true;
- }
-
- inline void
- set_call_destructor()
- {
- m_call_destructor = true;
- }
-
- inline
- ~cond_dealtor()
- {
- if (m_no_action_dtor)
- return;
-
- if (m_call_destructor)
- m_p_nd->~leaf();
-
- s_leaf_allocator.deallocate(m_p_nd, 1);
- }
-
-protected:
- leaf_pointer m_p_nd;
- bool m_no_action_dtor;
- bool m_call_destructor;
-};
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
deleted file mode 100644
index 730148e1429..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
+++ /dev/null
@@ -1,111 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file const_child_iterator.hpp
- * Contains a const_iterator for a patricia tree.
- */
-
-struct const_iterator
-{
-public:
- typedef std::forward_iterator_tag iterator_category;
-
- typedef typename Allocator::difference_type difference_type;
-
- typedef node_pointer value_type;
-
- typedef node_pointer_pointer pointer;
-
- typedef node_pointer_reference reference;
-
-public:
- inline
- const_iterator(node_pointer_pointer p_p_cur = 0,
- node_pointer_pointer p_p_end = 0)
- : m_p_p_cur(p_p_cur), m_p_p_end(p_p_end)
- { }
-
- inline bool
- operator==(const const_iterator& other) const
- { return m_p_p_cur == other.m_p_p_cur; }
-
- inline bool
- operator!=(const const_iterator& other) const
- { return m_p_p_cur != other.m_p_p_cur; }
-
- inline const_iterator&
- operator++()
- {
- do
- ++m_p_p_cur;
- while (m_p_p_cur != m_p_p_end&& * m_p_p_cur == 0);
- return *this;
- }
-
- inline const_iterator
- operator++(int)
- {
- const_iterator ret_it(*this);
- operator++();
- return ret_it;
- }
-
- const node_pointer_pointer
- operator->() const
- {
- _GLIBCXX_DEBUG_ONLY(assert_referencible();)
- return (m_p_p_cur);
- }
-
- const_node_pointer
- operator*() const
- {
- _GLIBCXX_DEBUG_ONLY(assert_referencible();)
- return (*m_p_p_cur);
- }
-
-protected:
-#ifdef _GLIBCXX_DEBUG
- void
- assert_referencible() const
- { _GLIBCXX_DEBUG_ASSERT(m_p_p_cur != m_p_p_end&& * m_p_p_cur != 0); }
-#endif
-
-public:
- node_pointer_pointer m_p_p_cur;
- node_pointer_pointer m_p_p_end;
-};
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
index 6201b1d8525..8370a2ec885 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
@@ -1,4 +1,4 @@
-// -*- C++ -*-
+ // -*- C++ -*-
// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
// Free Software Foundation, Inc.
@@ -35,8 +35,8 @@
// warranty.
/**
- * @file constructors_destructor_fn_imps.hpp
- * Contains an implementation class for bin_search_tree_.
+ * @file pat_trie_/constructors_destructor_fn_imps.hpp
+ * Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
@@ -44,8 +44,8 @@ typename PB_DS_CLASS_C_DEC::head_allocator
PB_DS_CLASS_C_DEC::s_head_allocator;
PB_DS_CLASS_T_DEC
-typename PB_DS_CLASS_C_DEC::internal_node_allocator
-PB_DS_CLASS_C_DEC::s_internal_node_allocator;
+typename PB_DS_CLASS_C_DEC::inode_allocator
+PB_DS_CLASS_C_DEC::s_inode_allocator;
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::leaf_allocator
@@ -53,7 +53,7 @@ PB_DS_CLASS_C_DEC::s_leaf_allocator;
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME() :
+PB_DS_PAT_TRIE_NAME() :
m_p_head(s_head_allocator.allocate(1)),
m_size(0)
{
@@ -63,8 +63,8 @@ PB_DS_CLASS_NAME() :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const e_access_traits& r_e_access_traits) :
- synth_e_access_traits(r_e_access_traits),
+PB_DS_PAT_TRIE_NAME(const access_traits& r_access_traits) :
+ synth_access_traits(r_access_traits),
m_p_head(s_head_allocator.allocate(1)),
m_size(0)
{
@@ -74,11 +74,11 @@ PB_DS_CLASS_NAME(const e_access_traits& r_e_access_traits) :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+PB_DS_PAT_TRIE_NAME(const PB_DS_CLASS_C_DEC& other) :
#ifdef _GLIBCXX_DEBUG
debug_base(other),
#endif
- synth_e_access_traits(other),
+ synth_access_traits(other),
node_update(other),
m_p_head(s_head_allocator.allocate(1)),
m_size(0)
@@ -115,7 +115,7 @@ swap(PB_DS_CLASS_C_DEC& other)
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
value_swap(other);
- std::swap((e_access_traits& )(*this), (e_access_traits& )other);
+ std::swap((access_traits& )(*this), (access_traits& )other);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
}
@@ -132,7 +132,7 @@ value_swap(PB_DS_CLASS_C_DEC& other)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-~PB_DS_CLASS_NAME()
+~PB_DS_PAT_TRIE_NAME()
{
clear();
s_head_allocator.deallocate(m_p_head, 1);
@@ -163,36 +163,33 @@ copy_from_range(It first_it, It last_it)
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
-recursive_copy_node(const_node_pointer p_other_nd)
+recursive_copy_node(node_const_pointer p_ncp)
{
- _GLIBCXX_DEBUG_ASSERT(p_other_nd != 0);
- if (p_other_nd->m_type == pat_trie_leaf_node_type)
+ _GLIBCXX_DEBUG_ASSERT(p_ncp != 0);
+ if (p_ncp->m_type == leaf_node)
{
- const_leaf_pointer p_other_leaf = static_cast<const_leaf_pointer>(p_other_nd);
-
+ leaf_const_pointer p_other_lf = static_cast<leaf_const_pointer>(p_ncp);
leaf_pointer p_new_lf = s_leaf_allocator.allocate(1);
cond_dealtor cond(p_new_lf);
- new (p_new_lf) leaf(p_other_leaf->value());
- apply_update(p_new_lf, (node_update* )this);
+ new (p_new_lf) leaf(p_other_lf->value());
+ apply_update(p_new_lf, (node_update*)this);
cond.set_no_action_dtor();
return (p_new_lf);
}
- _GLIBCXX_DEBUG_ASSERT(p_other_nd->m_type == pat_trie_internal_node_type);
- node_pointer a_p_children[internal_node::arr_size];
+ _GLIBCXX_DEBUG_ASSERT(p_ncp->m_type == i_node);
+ node_pointer a_p_children[inode::arr_size];
size_type child_i = 0;
- const_internal_node_pointer p_other_internal_nd =
- static_cast<const_internal_node_pointer>(p_other_nd);
+ inode_const_pointer p_icp = static_cast<inode_const_pointer>(p_ncp);
- typename internal_node::const_iterator child_it =
- p_other_internal_nd->begin();
+ typename inode::const_iterator child_it = p_icp->begin();
- internal_node_pointer p_ret;
+ inode_pointer p_ret;
__try
{
- while (child_it != p_other_internal_nd->end())
+ while (child_it != p_icp->end())
a_p_children[child_i++] = recursive_copy_node(*(child_it++));
- p_ret = s_internal_node_allocator.allocate(1);
+ p_ret = s_inode_allocator.allocate(1);
}
__catch(...)
{
@@ -201,8 +198,7 @@ recursive_copy_node(const_node_pointer p_other_nd)
__throw_exception_again;
}
- new (p_ret) internal_node(p_other_internal_nd->get_e_ind(),
- pref_begin(a_p_children[0]));
+ new (p_ret) inode(p_icp->get_e_ind(), pref_begin(a_p_children[0]));
--child_i;
_GLIBCXX_DEBUG_ASSERT(child_i >= 1);
@@ -210,6 +206,6 @@ recursive_copy_node(const_node_pointer p_other_nd)
p_ret->add_child(a_p_children[child_i], pref_begin(a_p_children[child_i]),
pref_end(a_p_children[child_i]), this);
while (child_i-- > 0);
- apply_update(p_ret, (node_update* )this);
+ apply_update(p_ret, (node_update*)this);
return p_ret;
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
index 1beceb568ef..0aa4b28c10e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_fn_imps.hpp
+ * @file pat_trie_/debug_fn_imps.hpp
* Contains an implementation class for pat_trie_.
*/
@@ -57,8 +57,8 @@ assert_valid(const char* __file, int __line) const
return;
}
- PB_DS_DEBUG_VERIFY(m_p_head->m_p_min->m_type == pat_trie_leaf_node_type);
- PB_DS_DEBUG_VERIFY(m_p_head->m_p_max->m_type == pat_trie_leaf_node_type);
+ PB_DS_DEBUG_VERIFY(m_p_head->m_p_min->m_type == leaf_node);
+ PB_DS_DEBUG_VERIFY(m_p_head->m_p_max->m_type == leaf_node);
PB_DS_DEBUG_VERIFY(!empty());
}
@@ -87,8 +87,8 @@ assert_reverse_iterators(const char* __file, int __line) const
for (const_reverse_iterator it = rbegin(); it != rend(); ++it)
{
++calc_size;
- const_node_pointer p_nd =
- const_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(PB_DS_V2F(*it));
+ node_const_pointer p_nd =
+ const_cast<PB_DS_CLASS_C_DEC*>(this)->find_imp(PB_DS_V2F(*it));
PB_DS_DEBUG_VERIFY(p_nd == it.m_p_nd);
}
PB_DS_DEBUG_VERIFY(calc_size == m_size);
@@ -97,22 +97,19 @@ assert_reverse_iterators(const char* __file, int __line) const
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
-recursive_count_leafs(const_node_pointer p_nd,
- const char* __file, int __line)
+recursive_count_leafs(node_const_pointer p_nd, const char* __file, int __line)
{
if (p_nd == 0)
return (0);
- if (p_nd->m_type == pat_trie_leaf_node_type)
+ if (p_nd->m_type == leaf_node)
return (1);
- PB_DS_DEBUG_VERIFY(p_nd->m_type == pat_trie_internal_node_type);
+ PB_DS_DEBUG_VERIFY(p_nd->m_type == i_node);
size_type ret = 0;
- for (typename internal_node::const_iterator it =
- static_cast<const_internal_node_pointer>(p_nd)->begin();
- it != static_cast<const_internal_node_pointer>(p_nd)->end();
+ for (typename inode::const_iterator it = static_cast<inode_const_pointer>(p_nd)->begin();
+ it != static_cast<inode_const_pointer>(p_nd)->end();
++it)
ret += recursive_count_leafs(*it, __file, __line);
return ret;
}
-#endif
-
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
index cbf1b417098..c0ccd108e42 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
@@ -34,24 +34,24 @@
// warranty.
/**
- * @file erase_fn_imps.hpp
- * Contains an implementation class for bin_search_tree_.
+ * @file pat_trie_/erase_fn_imps.hpp
+ * Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
-erase(const_key_reference r_key)
+erase(key_const_reference r_key)
{
node_pointer p_nd = find_imp(r_key);
- if (p_nd == 0 || p_nd->m_type == pat_trie_internal_node_type)
+ if (p_nd == 0 || p_nd->m_type == i_node)
{
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return false;
}
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_leaf_node_type);
- if (!synth_e_access_traits::equal_keys(PB_DS_V2F(reinterpret_cast<leaf_pointer>(p_nd)->value()), r_key))
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == leaf_node);
+ if (!synth_access_traits::equal_keys(PB_DS_V2F(reinterpret_cast<leaf_pointer>(p_nd)->value()), r_key))
{
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return false;
@@ -66,48 +66,47 @@ erase(const_key_reference r_key)
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-erase_fixup(internal_node_pointer p_nd)
+erase_fixup(inode_pointer p_nd)
{
_GLIBCXX_DEBUG_ASSERT(std::distance(p_nd->begin(), p_nd->end()) >= 1);
if (std::distance(p_nd->begin(), p_nd->end()) == 1)
{
node_pointer p_parent = p_nd->m_p_parent;
if (p_parent == m_p_head)
- m_p_head->m_p_parent =* p_nd->begin();
+ m_p_head->m_p_parent = *p_nd->begin();
else
- {
- _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == pat_trie_internal_node_type);
- node_pointer p_new_child =* p_nd->begin();
- static_cast<internal_node_pointer>(p_parent)->replace_child(
- p_new_child,
- pref_begin(p_new_child),
- pref_end(p_new_child),
- this);
- }
+ {
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == i_node);
+ node_pointer p_new_child = *p_nd->begin();
+
+ typedef inode_pointer inode_ptr;
+ inode_ptr p_internal = static_cast<inode_ptr>(p_parent);
+ p_internal->replace_child(p_new_child, pref_begin(p_new_child),
+ pref_end(p_new_child), this);
+ }
(*p_nd->begin())->m_p_parent = p_nd->m_p_parent;
- p_nd->~internal_node();
- s_internal_node_allocator.deallocate(p_nd, 1);
+ p_nd->~inode();
+ s_inode_allocator.deallocate(p_nd, 1);
if (p_parent == m_p_head)
return;
- _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == pat_trie_internal_node_type);
- p_nd = static_cast<internal_node_pointer>(p_parent);
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == i_node);
+ p_nd = static_cast<inode_pointer>(p_parent);
}
while (true)
{
_GLIBCXX_DEBUG_ASSERT(std::distance(p_nd->begin(), p_nd->end()) > 1);
p_nd->update_prefixes(this);
- apply_update(p_nd, (node_update* )this);
+ apply_update(p_nd, (node_update*)this);
PB_DS_ASSERT_NODE_VALID(p_nd)
- if (p_nd->m_p_parent->m_type == pat_trie_head_node_type)
- return;
+ if (p_nd->m_p_parent->m_type == head_node)
+ return;
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_parent->m_type ==
- pat_trie_internal_node_type);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_parent->m_type == i_node);
- p_nd = static_cast<internal_node_pointer>(p_nd->m_p_parent);
+ p_nd = static_cast<inode_pointer>(p_nd->m_p_parent);
}
}
@@ -118,7 +117,7 @@ actual_erase_leaf(leaf_pointer p_l)
{
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
--m_size;
- _GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_l->value())));
+ _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_l->value())));
p_l->~leaf();
s_leaf_allocator.deallocate(p_l, 1);
}
@@ -128,15 +127,14 @@ void
PB_DS_CLASS_C_DEC::
clear()
{
- PB_DS_ASSERT_VALID((*this))
- if (empty())
- return;
-
- clear_imp(m_p_head->m_p_parent);
- m_size = 0;
- initialize();
- _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
- PB_DS_ASSERT_VALID((*this))
+ if (!empty())
+ {
+ clear_imp(m_p_head->m_p_parent);
+ m_size = 0;
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
+ PB_DS_ASSERT_VALID((*this))
+ }
}
PB_DS_CLASS_T_DEC
@@ -144,22 +142,22 @@ void
PB_DS_CLASS_C_DEC::
clear_imp(node_pointer p_nd)
{
- if (p_nd->m_type == pat_trie_internal_node_type)
+ if (p_nd->m_type == i_node)
{
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
- for (typename internal_node::iterator it =
- static_cast<internal_node_pointer>(p_nd)->begin();
- it != static_cast<internal_node_pointer>(p_nd)->end();
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
+ for (typename inode::iterator it =
+ static_cast<inode_pointer>(p_nd)->begin();
+ it != static_cast<inode_pointer>(p_nd)->end();
++it)
- {
+ {
node_pointer p_child =* it;
clear_imp(p_child);
- }
- s_internal_node_allocator.deallocate(static_cast<internal_node_pointer>(p_nd), 1);
+ }
+ s_inode_allocator.deallocate(static_cast<inode_pointer>(p_nd), 1);
return;
}
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_leaf_node_type);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == leaf_node);
static_cast<leaf_pointer>(p_nd)->~leaf();
s_leaf_allocator.deallocate(static_cast<leaf_pointer>(p_nd), 1);
}
@@ -176,7 +174,7 @@ erase(const_iterator it)
const_iterator ret_it = it;
++ret_it;
- _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);
+ _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);
erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
PB_DS_ASSERT_VALID((*this))
return ret_it;
@@ -194,7 +192,7 @@ erase(iterator it)
return it;
iterator ret_it = it;
++ret_it;
- _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);
+ _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);
erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
PB_DS_ASSERT_VALID((*this))
return ret_it;
@@ -213,7 +211,7 @@ erase(const_reverse_iterator it)
const_reverse_iterator ret_it = it;
++ret_it;
- _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);
+ _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);
erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
PB_DS_ASSERT_VALID((*this))
return ret_it;
@@ -232,7 +230,7 @@ erase(reverse_iterator it)
reverse_iterator ret_it = it;
++ret_it;
- _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);
+ _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);
erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
PB_DS_ASSERT_VALID((*this))
return ret_it;
@@ -254,8 +252,8 @@ erase_if(Pred pred)
PB_DS_ASSERT_VALID((*this))
if (pred(*it))
{
- ++num_ersd;
- it = erase(it);
+ ++num_ersd;
+ it = erase(it);
}
else
++it;
@@ -271,7 +269,7 @@ PB_DS_CLASS_C_DEC::
erase_leaf(leaf_pointer p_l)
{
update_min_max_for_erased_leaf(p_l);
- if (p_l->m_p_parent->m_type == pat_trie_head_node_type)
+ if (p_l->m_p_parent->m_type == head_node)
{
_GLIBCXX_DEBUG_ASSERT(size() == 1);
clear();
@@ -279,11 +277,9 @@ erase_leaf(leaf_pointer p_l)
}
_GLIBCXX_DEBUG_ASSERT(size() > 1);
- _GLIBCXX_DEBUG_ASSERT(p_l->m_p_parent->m_type ==
- pat_trie_internal_node_type);
+ _GLIBCXX_DEBUG_ASSERT(p_l->m_p_parent->m_type == i_node);
- internal_node_pointer p_parent =
- static_cast<internal_node_pointer>(p_l->m_p_parent);
+ inode_pointer p_parent = static_cast<inode_pointer>(p_l->m_p_parent);
p_parent->remove_child(p_l);
erase_fixup(p_parent);
@@ -302,7 +298,7 @@ update_min_max_for_erased_leaf(leaf_pointer p_l)
return;
}
- if (p_l == static_cast<const_leaf_pointer>(m_p_head->m_p_min))
+ if (p_l == static_cast<leaf_const_pointer>(m_p_head->m_p_min))
{
iterator it(p_l);
++it;
@@ -310,7 +306,7 @@ update_min_max_for_erased_leaf(leaf_pointer p_l)
return;
}
- if (p_l == static_cast<const_leaf_pointer>(m_p_head->m_p_max))
+ if (p_l == static_cast<leaf_const_pointer>(m_p_head->m_p_max))
{
iterator it(p_l);
--it;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
index e2e20f186d7..bbef9d7a043 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
@@ -34,25 +34,25 @@
// warranty.
/**
- * @file find_fn_imps.hpp
- * Contains an implementation class for bin_search_tree_.
+ * @file pat_trie_/find_fn_imps.hpp
+ * Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key)
+find(key_const_reference r_key)
{
PB_DS_ASSERT_VALID((*this))
node_pointer p_nd = find_imp(r_key);
- if (p_nd == 0 || p_nd->m_type != pat_trie_leaf_node_type)
+ if (p_nd == 0 || p_nd->m_type != leaf_node)
{
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return end();
}
- if (synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_nd)->value()), r_key))
+ if (synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_nd)->value()), r_key))
{
PB_DS_CHECK_KEY_EXISTS(r_key)
return iterator(p_nd);
@@ -63,21 +63,21 @@ find(const_key_reference r_key)
}
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key) const
+find(key_const_reference r_key) const
{
PB_DS_ASSERT_VALID((*this))
- const_node_pointer p_nd = const_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(r_key);
+ node_const_pointer p_nd = const_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(r_key);
- if (p_nd == 0 || p_nd->m_type != pat_trie_leaf_node_type)
+ if (p_nd == 0 || p_nd->m_type != leaf_node)
{
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return end();
}
- if (synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value()), r_key))
+ if (synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value()), r_key))
{
PB_DS_CHECK_KEY_EXISTS(r_key)
return const_iterator(const_cast<node_pointer>(p_nd));
@@ -90,23 +90,23 @@ find(const_key_reference r_key) const
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
-find_imp(const_key_reference r_key)
+find_imp(key_const_reference r_key)
{
if (empty())
- return (0);
+ return 0;
- typename synth_e_access_traits::const_iterator b_it =
- synth_e_access_traits::begin(r_key);
- typename synth_e_access_traits::const_iterator e_it =
- synth_e_access_traits::end(r_key);
+ typename synth_access_traits::const_iterator b_it =
+ synth_access_traits::begin(r_key);
+ typename synth_access_traits::const_iterator e_it =
+ synth_access_traits::end(r_key);
node_pointer p_nd = m_p_head->m_p_parent;
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
- while (p_nd->m_type != pat_trie_leaf_node_type)
+ while (p_nd->m_type != leaf_node)
{
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
- node_pointer p_next_nd = static_cast<internal_node_pointer>(p_nd)->get_child_node(b_it, e_it, this);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
+ node_pointer p_next_nd = static_cast<inode_pointer>(p_nd)->get_child_node(b_it, e_it, this);
if (p_next_nd == 0)
return p_nd;
@@ -118,7 +118,7 @@ find_imp(const_key_reference r_key)
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
-lower_bound_imp(const_key_reference r_key)
+lower_bound_imp(key_const_reference r_key)
{
if (empty())
return (m_p_head);
@@ -126,30 +126,30 @@ lower_bound_imp(const_key_reference r_key)
node_pointer p_nd = m_p_head->m_p_parent;
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
- typename PB_DS_CLASS_C_DEC::const_e_iterator b_it =
- synth_e_access_traits::begin(r_key);
+ typename PB_DS_CLASS_C_DEC::a_const_iterator b_it =
+ synth_access_traits::begin(r_key);
- typename PB_DS_CLASS_C_DEC::const_e_iterator e_it =
- synth_e_access_traits::end(r_key);
+ typename PB_DS_CLASS_C_DEC::a_const_iterator e_it =
+ synth_access_traits::end(r_key);
size_type checked_ind = 0;
while (true)
{
- if (p_nd->m_type == pat_trie_leaf_node_type)
+ if (p_nd->m_type == leaf_node)
{
- if (!synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value()), r_key))
+ if (!synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value()), r_key))
return p_nd;
iterator it(p_nd);
++it;
return it.m_p_nd;
}
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
const size_type new_checked_ind =
- static_cast<internal_node_pointer>(p_nd)->get_e_ind();
+ static_cast<inode_pointer>(p_nd)->get_e_ind();
p_nd =
- static_cast<internal_node_pointer>(p_nd)->get_lower_bound_child_node( b_it, e_it, checked_ind, this);
+ static_cast<inode_pointer>(p_nd)->get_lower_bound_child_node( b_it, e_it, checked_ind, this);
checked_ind = new_checked_ind;
}
}
@@ -157,84 +157,84 @@ lower_bound_imp(const_key_reference r_key)
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
-lower_bound(const_key_reference r_key)
+lower_bound(key_const_reference r_key)
{ return point_iterator(lower_bound_imp(r_key)); }
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
-lower_bound(const_key_reference r_key) const
+lower_bound(key_const_reference r_key) const
{
- return const_point_iterator(const_cast<PB_DS_CLASS_C_DEC* >(this)->lower_bound_imp(r_key));
+ return point_const_iterator(const_cast<PB_DS_CLASS_C_DEC* >(this)->lower_bound_imp(r_key));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
-upper_bound(const_key_reference r_key)
+upper_bound(key_const_reference r_key)
{
point_iterator l_bound_it = lower_bound(r_key);
_GLIBCXX_DEBUG_ASSERT(l_bound_it == end() ||
- !synth_e_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
+ !synth_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
r_key));
if (l_bound_it == end() ||
- synth_e_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
+ synth_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
return l_bound_it;
return ++l_bound_it;
}
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
-upper_bound(const_key_reference r_key) const
+upper_bound(key_const_reference r_key) const
{
- const_point_iterator l_bound_it = lower_bound(r_key);
+ point_const_iterator l_bound_it = lower_bound(r_key);
_GLIBCXX_DEBUG_ASSERT(l_bound_it == end() ||
- !synth_e_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
+ !synth_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
r_key));
if (l_bound_it == end() ||
- synth_e_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
+ synth_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
return l_bound_it;
return ++l_bound_it;
}
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_e_iterator
+inline typename PB_DS_CLASS_C_DEC::a_const_iterator
PB_DS_CLASS_C_DEC::
-pref_begin(const_node_pointer p_nd)
+pref_begin(node_const_pointer p_nd)
{
- if (p_nd->m_type == pat_trie_leaf_node_type)
- return (synth_e_access_traits::begin(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value())));
+ if (p_nd->m_type == leaf_node)
+ return (synth_access_traits::begin(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value())));
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
- return static_cast<const_internal_node_pointer>(p_nd)->pref_b_it();
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
+ return static_cast<inode_const_pointer>(p_nd)->pref_b_it();
}
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_e_iterator
+inline typename PB_DS_CLASS_C_DEC::a_const_iterator
PB_DS_CLASS_C_DEC::
-pref_end(const_node_pointer p_nd)
+pref_end(node_const_pointer p_nd)
{
- if (p_nd->m_type == pat_trie_leaf_node_type)
- return (synth_e_access_traits::end(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value())));
+ if (p_nd->m_type == leaf_node)
+ return (synth_access_traits::end(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value())));
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
- return static_cast<const_internal_node_pointer>(p_nd)->pref_e_it();
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
+ return static_cast<inode_const_pointer>(p_nd)->pref_e_it();
}
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_leaf_pointer
+inline typename PB_DS_CLASS_C_DEC::leaf_const_pointer
PB_DS_CLASS_C_DEC::
-leftmost_descendant(const_node_pointer p_nd)
+leftmost_descendant(node_const_pointer p_nd)
{
- if (p_nd->m_type == pat_trie_leaf_node_type)
- return static_cast<const_leaf_pointer>(p_nd);
- return static_cast<const_internal_node_pointer>(p_nd)->leftmost_descendant();
+ if (p_nd->m_type == leaf_node)
+ return static_cast<leaf_const_pointer>(p_nd);
+ return static_cast<inode_const_pointer>(p_nd)->leftmost_descendant();
}
PB_DS_CLASS_T_DEC
@@ -242,19 +242,19 @@ inline typename PB_DS_CLASS_C_DEC::leaf_pointer
PB_DS_CLASS_C_DEC::
leftmost_descendant(node_pointer p_nd)
{
- if (p_nd->m_type == pat_trie_leaf_node_type)
+ if (p_nd->m_type == leaf_node)
return static_cast<leaf_pointer>(p_nd);
- return static_cast<internal_node_pointer>(p_nd)->leftmost_descendant();
+ return static_cast<inode_pointer>(p_nd)->leftmost_descendant();
}
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_leaf_pointer
+inline typename PB_DS_CLASS_C_DEC::leaf_const_pointer
PB_DS_CLASS_C_DEC::
-rightmost_descendant(const_node_pointer p_nd)
+rightmost_descendant(node_const_pointer p_nd)
{
- if (p_nd->m_type == pat_trie_leaf_node_type)
- return static_cast<const_leaf_pointer>(p_nd);
- return static_cast<const_internal_node_pointer>(p_nd)->rightmost_descendant();
+ if (p_nd->m_type == leaf_node)
+ return static_cast<leaf_const_pointer>(p_nd);
+ return static_cast<inode_const_pointer>(p_nd)->rightmost_descendant();
}
PB_DS_CLASS_T_DEC
@@ -262,8 +262,8 @@ inline typename PB_DS_CLASS_C_DEC::leaf_pointer
PB_DS_CLASS_C_DEC::
rightmost_descendant(node_pointer p_nd)
{
- if (p_nd->m_type == pat_trie_leaf_node_type)
+ if (p_nd->m_type == leaf_node)
return static_cast<leaf_pointer>(p_nd);
- return static_cast<internal_node_pointer>(p_nd)->rightmost_descendant();
+ return static_cast<inode_pointer>(p_nd)->rightmost_descendant();
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/head.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/head.hpp
deleted file mode 100644
index bca847db784..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/head.hpp
+++ /dev/null
@@ -1,129 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file head.hpp
- * Contains a leaf for a patricia tree.
- */
-
-#ifndef PB_DS_PAT_TRIE_IHEAD_HPP
-#define PB_DS_PAT_TRIE_IHEAD_HPP
-
-#include <ext/pb_ds/detail/pat_trie_/node_base.hpp>
-#include <debug/debug.h>
-
-namespace __gnu_pbds
-{
- namespace detail
- {
-#define PB_DS_CLASS_T_DEC \
- template<typename Type_Traits, typename E_Access_Traits, \
- typename Metadata, typename Allocator>
-
-#define PB_DS_CLASS_C_DEC \
- pat_trie_head<Type_Traits, E_Access_Traits, Metadata, Allocator>
-
-#define PB_DS_BASE_C_DEC \
- pat_trie_node_base<Type_Traits, E_Access_Traits, Metadata, Allocator>
-
- template<typename Type_Traits,
- typename E_Access_Traits,
- typename Metadata,
- typename Allocator>
- struct pat_trie_head : public PB_DS_BASE_C_DEC
- {
- private:
- typedef E_Access_Traits e_access_traits;
-
- typedef
- typename Allocator::template rebind<
- e_access_traits>::other::const_pointer
- const_e_access_traits_pointer;
-
- typedef
- typename Allocator::template rebind<
- PB_DS_BASE_C_DEC>::other::pointer
- node_pointer;
-
-#ifdef _GLIBCXX_DEBUG
- typedef
- typename PB_DS_BASE_C_DEC::subtree_debug_info
- subtree_debug_info;
-#endif
-
- public:
- pat_trie_head();
-
-#ifdef _GLIBCXX_DEBUG
- virtual subtree_debug_info
- assert_valid_imp(const_e_access_traits_pointer p_traits,
- const char* file, int line) const;
-#endif
-
- public:
- node_pointer m_p_min;
-
- node_pointer m_p_max;
- };
-
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- pat_trie_head() : PB_DS_BASE_C_DEC(pat_trie_head_node_type)
- { }
-
-#ifdef _GLIBCXX_DEBUG
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::subtree_debug_info
- PB_DS_CLASS_C_DEC::
- assert_valid_imp(const_e_access_traits_pointer /*p_traits*/,
- const char* __file, int __line) const
- {
- _GLIBCXX_DEBUG_VERIFY_AT(false,
- _M_message("Assertion from %1;:%2;")
- ._M_string(__FILE__)._M_integer(__LINE__),
- __file, __line);
- return subtree_debug_info();
- }
-#endif
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-#undef PB_DS_BASE_C_DEC
-
- } // namespace detail
-} // namespace __gnu_pbds
-
-#endif
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
index 81d7096a94d..8246b518252 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
@@ -34,8 +34,8 @@
// warranty.
/**
- * @file info_fn_imps.hpp
- * Contains an implementation class for bin_search_tree_.
+ * @file pat_trie_/info_fn_imps.hpp
+ * Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
@@ -54,5 +54,5 @@ PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
max_size() const
-{ return s_internal_node_allocator.max_size(); }
+{ return s_inode_allocator.max_size(); }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
index 9afce8b0945..1b11280fd32 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
@@ -34,8 +34,8 @@
// warranty.
/**
- * @file insert_join_fn_imps.hpp
- * Contains an implementation class for bin_search_tree_.
+ * @file pat_trie_/insert_join_fn_imps.hpp
+ * Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
@@ -45,7 +45,7 @@ join(PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
- split_join_branch_bag bag;
+ branch_bag bag;
if (!join_prep(other, bag))
{
PB_DS_ASSERT_VALID((*this))
@@ -53,7 +53,7 @@ join(PB_DS_CLASS_C_DEC& other)
return;
}
- m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent,
+ m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent,
other.m_p_head->m_p_parent, 0, bag);
m_p_head->m_p_parent->m_p_parent = m_p_head;
@@ -68,7 +68,7 @@ join(PB_DS_CLASS_C_DEC& other)
PB_DS_CLASS_T_DEC
bool
PB_DS_CLASS_C_DEC::
-join_prep(PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)
+join_prep(PB_DS_CLASS_C_DEC& other, branch_bag& r_bag)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
@@ -82,12 +82,12 @@ join_prep(PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)
}
const bool greater =
- synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_max)->value()),
- PB_DS_V2F(static_cast<const_leaf_pointer>(other.m_p_head->m_p_min)->value()));
+ synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_max)->value()),
+ PB_DS_V2F(static_cast<leaf_const_pointer>(other.m_p_head->m_p_min)->value()));
const bool lesser =
- synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(other.m_p_head->m_p_max)->value()),
- PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_min)->value()));
+ synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(other.m_p_head->m_p_max)->value()),
+ PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_min)->value()));
if (!greater && !lesser)
__throw_join_error();
@@ -100,91 +100,92 @@ join_prep(PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-rec_join_prep(const_node_pointer p_l, const_node_pointer p_r, split_join_branch_bag& r_bag)
+rec_join_prep(node_const_pointer p_l, node_const_pointer p_r,
+ branch_bag& r_bag)
{
- if (p_l->m_type == pat_trie_leaf_node_type)
+ if (p_l->m_type == leaf_node)
{
- if (p_r->m_type == pat_trie_leaf_node_type)
- {
- rec_join_prep(static_cast<const_leaf_pointer>(p_l),
- static_cast<const_leaf_pointer>(p_r), r_bag);
+ if (p_r->m_type == leaf_node)
+ {
+ rec_join_prep(static_cast<leaf_const_pointer>(p_l),
+ static_cast<leaf_const_pointer>(p_r), r_bag);
return;
- }
+ }
- _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);
- rec_join_prep(static_cast<const_leaf_pointer>(p_l),
- static_cast<const_internal_node_pointer>(p_r), r_bag);
+ _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);
+ rec_join_prep(static_cast<leaf_const_pointer>(p_l),
+ static_cast<inode_const_pointer>(p_r), r_bag);
return;
}
- _GLIBCXX_DEBUG_ASSERT(p_l->m_type == pat_trie_internal_node_type);
- if (p_r->m_type == pat_trie_leaf_node_type)
+ _GLIBCXX_DEBUG_ASSERT(p_l->m_type == i_node);
+ if (p_r->m_type == leaf_node)
{
- rec_join_prep(static_cast<const_internal_node_pointer>(p_l),
- static_cast<const_leaf_pointer>(p_r), r_bag);
+ rec_join_prep(static_cast<inode_const_pointer>(p_l),
+ static_cast<leaf_const_pointer>(p_r), r_bag);
return;
}
- _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);
+ _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);
- rec_join_prep(static_cast<const_internal_node_pointer>(p_l),
- static_cast<const_internal_node_pointer>(p_r), r_bag);
+ rec_join_prep(static_cast<inode_const_pointer>(p_l),
+ static_cast<inode_const_pointer>(p_r), r_bag);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-rec_join_prep(const_leaf_pointer /*p_l*/, const_leaf_pointer /*p_r*/,
- split_join_branch_bag& r_bag)
+rec_join_prep(leaf_const_pointer /*p_l*/, leaf_const_pointer /*p_r*/,
+ branch_bag& r_bag)
{ r_bag.add_branch(); }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-rec_join_prep(const_leaf_pointer /*p_l*/, const_internal_node_pointer /*p_r*/,
- split_join_branch_bag& r_bag)
+rec_join_prep(leaf_const_pointer /*p_l*/, inode_const_pointer /*p_r*/,
+ branch_bag& r_bag)
{ r_bag.add_branch(); }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-rec_join_prep(const_internal_node_pointer /*p_l*/, const_leaf_pointer /*p_r*/,
- split_join_branch_bag& r_bag)
+rec_join_prep(inode_const_pointer /*p_l*/, leaf_const_pointer /*p_r*/,
+ branch_bag& r_bag)
{ r_bag.add_branch(); }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-rec_join_prep(const_internal_node_pointer p_l, const_internal_node_pointer p_r,
- split_join_branch_bag& r_bag)
+rec_join_prep(inode_const_pointer p_l, inode_const_pointer p_r,
+ branch_bag& r_bag)
{
- if (p_l->get_e_ind() == p_r->get_e_ind() &&
- synth_e_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),
+ if (p_l->get_e_ind() == p_r->get_e_ind() &&
+ synth_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),
p_r->pref_b_it(), p_r->pref_e_it()))
{
- for (typename internal_node::const_iterator it = p_r->begin();
+ for (typename inode::const_iterator it = p_r->begin();
it != p_r->end(); ++ it)
- {
- const_node_pointer p_l_join_child = p_l->get_join_child(*it, this);
+ {
+ node_const_pointer p_l_join_child = p_l->get_join_child(*it, this);
if (p_l_join_child != 0)
rec_join_prep(p_l_join_child, * it, r_bag);
- }
+ }
return;
}
- if (p_r->get_e_ind() < p_l->get_e_ind() &&
+ if (p_r->get_e_ind() < p_l->get_e_ind() &&
p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))
{
- const_node_pointer p_r_join_child = p_r->get_join_child(p_l, this);
+ node_const_pointer p_r_join_child = p_r->get_join_child(p_l, this);
if (p_r_join_child != 0)
rec_join_prep(p_r_join_child, p_l, r_bag);
return;
}
- if (p_r->get_e_ind() < p_l->get_e_ind() &&
+ if (p_r->get_e_ind() < p_l->get_e_ind() &&
p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))
{
- const_node_pointer p_r_join_child = p_r->get_join_child(p_l, this);
+ node_const_pointer p_r_join_child = p_r->get_join_child(p_l, this);
if (p_r_join_child != 0)
rec_join_prep(p_r_join_child, p_l, r_bag);
return;
@@ -195,56 +196,57 @@ rec_join_prep(const_internal_node_pointer p_l, const_internal_node_pointer p_r,
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
-rec_join(node_pointer p_l, node_pointer p_r, size_type checked_ind, split_join_branch_bag& r_bag)
+rec_join(node_pointer p_l, node_pointer p_r, size_type checked_ind,
+ branch_bag& r_bag)
{
_GLIBCXX_DEBUG_ASSERT(p_r != 0);
if (p_l == 0)
{
- apply_update(p_r, (node_update* )this);
+ apply_update(p_r, (node_update*)this);
return (p_r);
}
- if (p_l->m_type == pat_trie_leaf_node_type)
+ if (p_l->m_type == leaf_node)
{
- if (p_r->m_type == pat_trie_leaf_node_type)
- {
+ if (p_r->m_type == leaf_node)
+ {
node_pointer p_ret = rec_join(static_cast<leaf_pointer>(p_l),
static_cast<leaf_pointer>(p_r), r_bag);
- apply_update(p_ret, (node_update* )this);
+ apply_update(p_ret, (node_update*)this);
return p_ret;
- }
+ }
- _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);
+ _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);
node_pointer p_ret = rec_join(static_cast<leaf_pointer>(p_l),
- static_cast<internal_node_pointer>(p_r),
+ static_cast<inode_pointer>(p_r),
checked_ind, r_bag);
- apply_update(p_ret, (node_update* )this);
+ apply_update(p_ret, (node_update*)this);
return p_ret;
}
- _GLIBCXX_DEBUG_ASSERT(p_l->m_type == pat_trie_internal_node_type);
- if (p_r->m_type == pat_trie_leaf_node_type)
+ _GLIBCXX_DEBUG_ASSERT(p_l->m_type == i_node);
+ if (p_r->m_type == leaf_node)
{
- node_pointer p_ret = rec_join(static_cast<internal_node_pointer>(p_l),
+ node_pointer p_ret = rec_join(static_cast<inode_pointer>(p_l),
static_cast<leaf_pointer>(p_r),
checked_ind, r_bag);
- apply_update(p_ret, (node_update* )this);
+ apply_update(p_ret, (node_update*)this);
return p_ret;
}
- _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);
- node_pointer p_ret = rec_join(static_cast<internal_node_pointer>(p_l),
- static_cast<internal_node_pointer>(p_r),
+ _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);
+ node_pointer p_ret = rec_join(static_cast<inode_pointer>(p_l),
+ static_cast<inode_pointer>(p_r),
r_bag);
- apply_update(p_ret, (node_update* )this);
+ apply_update(p_ret, (node_update*)this);
return p_ret;
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
-rec_join(leaf_pointer p_l, leaf_pointer p_r, split_join_branch_bag& r_bag)
+rec_join(leaf_pointer p_l, leaf_pointer p_r, branch_bag& r_bag)
{
_GLIBCXX_DEBUG_ASSERT(p_r != 0);
if (p_l == 0)
@@ -257,13 +259,13 @@ rec_join(leaf_pointer p_l, leaf_pointer p_r, split_join_branch_bag& r_bag)
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
-rec_join(leaf_pointer p_l, internal_node_pointer p_r, size_type checked_ind,
- split_join_branch_bag& r_bag)
+rec_join(leaf_pointer p_l, inode_pointer p_r, size_type checked_ind,
+ branch_bag& r_bag)
{
#ifdef _GLIBCXX_DEBUG
const size_type lhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_l);
const size_type rhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_r);
-#endif
+#endif
_GLIBCXX_DEBUG_ASSERT(p_r != 0);
node_pointer p_ret = rec_join(p_r, p_l, checked_ind, r_bag);
@@ -274,7 +276,7 @@ rec_join(leaf_pointer p_l, internal_node_pointer p_r, size_type checked_ind,
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
-rec_join(internal_node_pointer p_l, leaf_pointer p_r, size_type checked_ind, split_join_branch_bag& r_bag)
+rec_join(inode_pointer p_l, leaf_pointer p_r, size_type checked_ind, branch_bag& r_bag)
{
_GLIBCXX_DEBUG_ASSERT(p_l != 0);
_GLIBCXX_DEBUG_ASSERT(p_r != 0);
@@ -282,14 +284,14 @@ rec_join(internal_node_pointer p_l, leaf_pointer p_r, size_type checked_ind, spl
#ifdef _GLIBCXX_DEBUG
const size_type lhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_l);
const size_type rhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_r);
-#endif
+#endif
if (!p_l->should_be_mine(pref_begin(p_r), pref_end(p_r), checked_ind, this))
{
node_pointer p_ret = insert_branch(p_l, p_r, r_bag);
PB_DS_ASSERT_NODE_VALID(p_ret)
_GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_ret) ==
- lhs_leafs + rhs_leafs);
+ lhs_leafs + rhs_leafs);
return p_ret;
}
@@ -312,7 +314,8 @@ rec_join(internal_node_pointer p_l, leaf_pointer p_r, size_type checked_ind, spl
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
-rec_join(internal_node_pointer p_l, internal_node_pointer p_r, split_join_branch_bag& r_bag)
+rec_join(inode_pointer p_l, inode_pointer p_r,
+ branch_bag& r_bag)
{
_GLIBCXX_DEBUG_ASSERT(p_l != 0);
_GLIBCXX_DEBUG_ASSERT(p_r != 0);
@@ -320,29 +323,29 @@ rec_join(internal_node_pointer p_l, internal_node_pointer p_r, split_join_branch
#ifdef _GLIBCXX_DEBUG
const size_type lhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_l);
const size_type rhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_r);
-#endif
+#endif
- if (p_l->get_e_ind() == p_r->get_e_ind() &&
- synth_e_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),
+ if (p_l->get_e_ind() == p_r->get_e_ind() &&
+ synth_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),
p_r->pref_b_it(), p_r->pref_e_it()))
{
- for (typename internal_node::iterator it = p_r->begin();
+ for (typename inode::iterator it = p_r->begin();
it != p_r->end(); ++ it)
- {
+ {
node_pointer p_new_child = rec_join(p_l->get_join_child(*it, this),
* it, 0, r_bag);
p_l->replace_child(p_new_child, pref_begin(p_new_child),
pref_end(p_new_child), this);
- }
+ }
- p_r->~internal_node();
- s_internal_node_allocator.deallocate(p_r, 1);
+ p_r->~inode();
+ s_inode_allocator.deallocate(p_r, 1);
PB_DS_ASSERT_NODE_VALID(p_l)
_GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_l) == lhs_leafs + rhs_leafs);
return p_l;
}
- if (p_l->get_e_ind() < p_r->get_e_ind() &&
+ if (p_l->get_e_ind() < p_r->get_e_ind() &&
p_l->should_be_mine(p_r->pref_b_it(), p_r->pref_e_it(), 0, this))
{
node_pointer p_new_child = rec_join(p_l->get_join_child(p_r, this),
@@ -353,13 +356,13 @@ rec_join(internal_node_pointer p_l, internal_node_pointer p_r, split_join_branch
return p_l;
}
- if (p_r->get_e_ind() < p_l->get_e_ind() &&
+ if (p_r->get_e_ind() < p_l->get_e_ind() &&
p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))
{
node_pointer p_new_child = rec_join(p_r->get_join_child(p_l, this), p_l,
0, r_bag);
- p_r->replace_child(p_new_child, pref_begin(p_new_child),
+ p_r->replace_child(p_new_child, pref_begin(p_new_child),
pref_end(p_new_child), this);
PB_DS_ASSERT_NODE_VALID(p_r)
@@ -379,8 +382,8 @@ PB_DS_CLASS_C_DEC::
insert(const_reference r_val)
{
node_pointer p_lf = find_imp(PB_DS_V2F(r_val));
- if (p_lf != 0 && p_lf->m_type == pat_trie_leaf_node_type &&
- synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_lf)->value()), PB_DS_V2F(r_val)))
+ if (p_lf != 0 && p_lf->m_type == leaf_node &&
+ synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_lf)->value()), PB_DS_V2F(r_val)))
{
PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(r_val))
PB_DS_ASSERT_VALID((*this))
@@ -393,16 +396,16 @@ insert(const_reference r_val)
cond_dealtor cond(p_new_lf);
new (p_new_lf) leaf(r_val);
- apply_update(p_new_lf, (node_update* )this);
+ apply_update(p_new_lf, (node_update*)this);
cond.set_call_destructor();
- split_join_branch_bag bag;
+ branch_bag bag;
bag.add_branch();
m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent, p_new_lf, 0, bag);
m_p_head->m_p_parent->m_p_parent = m_p_head;
cond.set_no_action_dtor();
++m_size;
update_min_max_for_inserted_leaf(p_new_lf);
- _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
PB_DS_ASSERT_VALID((*this))
return std::make_pair(point_iterator(p_new_lf), true);
}
@@ -410,17 +413,17 @@ insert(const_reference r_val)
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
-keys_diff_ind(typename e_access_traits::const_iterator b_l,
- typename e_access_traits::const_iterator e_l,
- typename e_access_traits::const_iterator b_r,
- typename e_access_traits::const_iterator e_r)
+keys_diff_ind(typename access_traits::const_iterator b_l,
+ typename access_traits::const_iterator e_l,
+ typename access_traits::const_iterator b_r,
+ typename access_traits::const_iterator e_r)
{
size_type diff_pos = 0;
while (b_l != e_l)
{
if (b_r == e_r)
return (diff_pos);
- if (e_access_traits::e_pos(*b_l) != e_access_traits::e_pos(*b_r))
+ if (access_traits::e_pos(*b_l) != access_traits::e_pos(*b_r))
return (diff_pos);
++b_l;
++b_r;
@@ -431,20 +434,20 @@ keys_diff_ind(typename e_access_traits::const_iterator b_l,
}
PB_DS_CLASS_T_DEC
-typename PB_DS_CLASS_C_DEC::internal_node_pointer
+typename PB_DS_CLASS_C_DEC::inode_pointer
PB_DS_CLASS_C_DEC::
-insert_branch(node_pointer p_l, node_pointer p_r, split_join_branch_bag& r_bag)
+insert_branch(node_pointer p_l, node_pointer p_r, branch_bag& r_bag)
{
- typename synth_e_access_traits::const_iterator left_b_it = pref_begin(p_l);
- typename synth_e_access_traits::const_iterator left_e_it = pref_end(p_l);
- typename synth_e_access_traits::const_iterator right_b_it = pref_begin(p_r);
- typename synth_e_access_traits::const_iterator right_e_it = pref_end(p_r);
+ typename synth_access_traits::const_iterator left_b_it = pref_begin(p_l);
+ typename synth_access_traits::const_iterator left_e_it = pref_end(p_l);
+ typename synth_access_traits::const_iterator right_b_it = pref_begin(p_r);
+ typename synth_access_traits::const_iterator right_e_it = pref_end(p_r);
- const size_type diff_ind = keys_diff_ind(left_b_it, left_e_it,
+ const size_type diff_ind = keys_diff_ind(left_b_it, left_e_it,
right_b_it, right_e_it);
- internal_node_pointer p_new_nd = r_bag.get_branch();
- new (p_new_nd) internal_node(diff_ind, left_b_it);
+ inode_pointer p_new_nd = r_bag.get_branch();
+ new (p_new_nd) inode(diff_ind, left_b_it);
p_new_nd->add_child(p_l, left_b_it, left_e_it, this);
p_new_nd->add_child(p_r, right_b_it, right_e_it, this);
p_l->m_p_parent = p_new_nd;
@@ -459,11 +462,11 @@ PB_DS_CLASS_C_DEC::
update_min_max_for_inserted_leaf(leaf_pointer p_new_lf)
{
if (m_p_head->m_p_min == m_p_head ||
- synth_e_access_traits::cmp_keys(PB_DS_V2F(p_new_lf->value()),
- PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_min)->value())))
+ synth_access_traits::cmp_keys(PB_DS_V2F(p_new_lf->value()),
+ PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_min)->value())))
m_p_head->m_p_min = p_new_lf;
if (m_p_head->m_p_max == m_p_head ||
- synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_max)->value()), PB_DS_V2F(p_new_lf->value())))
+ synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_max)->value()), PB_DS_V2F(p_new_lf->value())))
m_p_head->m_p_max = p_new_lf;
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
deleted file mode 100644
index cb8b6740d79..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
+++ /dev/null
@@ -1,603 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011
-// Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file internal_node.hpp
- * Contains an internal PB_DS_BASE_C_DEC for a patricia tree.
- */
-
-#ifndef PB_DS_PAT_TRIE_INTERNAL_NODE_HPP
-#define PB_DS_PAT_TRIE_INTERNAL_NODE_HPP
-
-#include <debug/debug.h>
-
-namespace __gnu_pbds
-{
- namespace detail
- {
-#define PB_DS_CLASS_T_DEC \
- template<typename Type_Traits, typename E_Access_Traits, \
- typename Metadata, typename Allocator>
-
-#define PB_DS_CLASS_C_DEC \
- pat_trie_internal_node<Type_Traits, E_Access_Traits, Metadata, Allocator>
-
-#define PB_DS_BASE_C_DEC \
- pat_trie_node_base<Type_Traits, E_Access_Traits, Metadata, Allocator>
-
-#define PB_DS_LEAF_C_DEC \
- pat_trie_leaf<Type_Traits, E_Access_Traits, Metadata, Allocator>
-
- template<typename Type_Traits,
- typename E_Access_Traits,
- typename Metadata,
- typename Allocator>
- struct pat_trie_internal_node : public PB_DS_BASE_C_DEC
- {
- private:
- typedef PB_DS_BASE_C_DEC base_type;
- typedef Type_Traits type_traits;
- typedef typename type_traits::value_type value_type;
- typedef typename Allocator::size_type size_type;
-
- typedef E_Access_Traits e_access_traits;
- typedef typename e_access_traits::const_iterator const_e_iterator;
- typedef typename Allocator::template rebind<e_access_traits>::other access_rebind;
- typedef typename access_rebind::const_pointer const_e_access_traits_pointer;
-
- typedef typename Allocator::template rebind<base_type>::other base_rebind;
- typedef typename base_rebind::pointer node_pointer;
- typedef typename base_rebind::const_pointer const_node_pointer;
-
- typedef PB_DS_LEAF_C_DEC leaf;
- typedef typename Allocator::template rebind<leaf>::other leaf_rebind;
- typedef typename leaf_rebind::pointer leaf_pointer;
- typedef typename leaf_rebind::const_pointer const_leaf_pointer;
-
- typedef typename Allocator::template rebind<pat_trie_internal_node>::other internal_node_rebind;
- typedef typename internal_node_rebind::pointer internal_node_pointer;
- typedef typename internal_node_rebind::const_pointer const_internal_node_pointer;
-
-#ifdef _GLIBCXX_DEBUG
- typedef typename base_type::subtree_debug_info subtree_debug_info;
-
- virtual subtree_debug_info
- assert_valid_imp(const_e_access_traits_pointer,
- const char* file, int line) const;
-#endif
-
- inline size_type
- get_pref_pos(const_e_iterator, const_e_iterator,
- const_e_access_traits_pointer) const;
-
- public:
- typedef typename Allocator::template rebind<node_pointer>::other node_pointer_rebind;
- typedef typename node_pointer_rebind::pointer node_pointer_pointer;
- typedef typename node_pointer_rebind::reference node_pointer_reference;
-
- enum
- {
- arr_size = E_Access_Traits::max_size + 1
- };
- PB_DS_STATIC_ASSERT(min_arr_size, arr_size >= 2);
-
-#include <ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp>
-#include <ext/pb_ds/detail/pat_trie_/child_iterator.hpp>
-
- pat_trie_internal_node(size_type, const const_e_iterator);
-
- void
- update_prefixes(const_e_access_traits_pointer);
-
- const_iterator
- begin() const;
-
- iterator
- begin();
-
- const_iterator
- end() const;
-
- iterator
- end();
-
- inline node_pointer
- get_child_node(const_e_iterator, const_e_iterator,
- const_e_access_traits_pointer);
-
- inline const_node_pointer
- get_child_node(const_e_iterator, const_e_iterator,
- const_e_access_traits_pointer) const;
-
- inline iterator
- get_child_it(const_e_iterator, const_e_iterator,
- const_e_access_traits_pointer);
-
- inline node_pointer
- get_lower_bound_child_node(const_e_iterator, const_e_iterator,
- size_type, const_e_access_traits_pointer);
-
- inline node_pointer
- add_child(node_pointer, const_e_iterator, const_e_iterator,
- const_e_access_traits_pointer);
-
- inline const_node_pointer
- get_join_child(const_node_pointer, const_e_access_traits_pointer) const;
-
- inline node_pointer
- get_join_child(node_pointer, const_e_access_traits_pointer);
-
- void
- remove_child(node_pointer p_nd);
-
- iterator
- remove_child(iterator it);
-
- void
- replace_child(node_pointer, const_e_iterator, const_e_iterator,
- const_e_access_traits_pointer);
-
- inline const_e_iterator
- pref_b_it() const;
-
- inline const_e_iterator
- pref_e_it() const;
-
- inline size_type
- get_e_ind() const;
-
- bool
- should_be_mine(const_e_iterator, const_e_iterator, size_type,
- const_e_access_traits_pointer) const;
-
- leaf_pointer
- leftmost_descendant();
-
- const_leaf_pointer
- leftmost_descendant() const;
-
- leaf_pointer
- rightmost_descendant();
-
- const_leaf_pointer
- rightmost_descendant() const;
-
-#ifdef _GLIBCXX_DEBUG
- size_type
- e_ind() const;
-#endif
-
- private:
- pat_trie_internal_node(const pat_trie_internal_node&);
-
- size_type
- get_begin_pos() const;
-
- const size_type m_e_ind;
- const_e_iterator m_pref_b_it;
- const_e_iterator m_pref_e_it;
- node_pointer m_a_p_children[arr_size];
- static leaf_rebind s_leaf_alloc;
- static internal_node_rebind s_internal_node_alloc;
- };
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::leaf_rebind
- PB_DS_CLASS_C_DEC::s_leaf_alloc;
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::internal_node_rebind
- PB_DS_CLASS_C_DEC::s_internal_node_alloc;
-
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::size_type
- PB_DS_CLASS_C_DEC::
- get_pref_pos(const_e_iterator b_it, const_e_iterator e_it,
- const_e_access_traits_pointer p_traits) const
- {
- if (static_cast<std::size_t>(std::distance(b_it, e_it)) <= m_e_ind)
- return 0;
- std::advance(b_it, m_e_ind);
- return 1 + p_traits->e_pos(*b_it);
- }
-
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- pat_trie_internal_node(size_type len, const const_e_iterator it) :
- PB_DS_BASE_C_DEC(pat_trie_internal_node_type),
- m_e_ind(len), m_pref_b_it(it), m_pref_e_it(it)
- {
- std::advance(m_pref_e_it, m_e_ind);
- std::fill(m_a_p_children, m_a_p_children + arr_size,
- static_cast<node_pointer>(0));
- }
-
- PB_DS_CLASS_T_DEC
- void
- PB_DS_CLASS_C_DEC::
- update_prefixes(const_e_access_traits_pointer p_traits)
- {
- node_pointer p_first = *begin();
- if (p_first->m_type == pat_trie_leaf_node_type)
- {
- const_leaf_pointer p = static_cast<const_leaf_pointer>(p_first);
- m_pref_b_it = p_traits->begin(e_access_traits::extract_key(p->value()));
- }
- else
- {
- _GLIBCXX_DEBUG_ASSERT(p_first->m_type == pat_trie_internal_node_type);
- m_pref_b_it = static_cast<internal_node_pointer>(p_first)->pref_b_it();
- }
- m_pref_e_it = m_pref_b_it;
- std::advance(m_pref_e_it, m_e_ind);
- }
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::const_iterator
- PB_DS_CLASS_C_DEC::
- begin() const
- {
- typedef node_pointer_pointer pointer_type;
- pointer_type p = const_cast<pointer_type>(m_a_p_children);
- return const_iterator(p + get_begin_pos(), p + arr_size);
- }
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::iterator
- PB_DS_CLASS_C_DEC::
- begin()
- {
- return iterator(m_a_p_children + get_begin_pos(),
- m_a_p_children + arr_size);
- }
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::const_iterator
- PB_DS_CLASS_C_DEC::
- end() const
- {
- typedef node_pointer_pointer pointer_type;
- pointer_type p = const_cast<pointer_type>(m_a_p_children) + arr_size;
- return const_iterator(p, p);
- }
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::iterator
- PB_DS_CLASS_C_DEC::
- end()
- { return iterator(m_a_p_children + arr_size, m_a_p_children + arr_size); }
-
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::node_pointer
- PB_DS_CLASS_C_DEC::
- get_child_node(const_e_iterator b_it, const_e_iterator e_it,
- const_e_access_traits_pointer p_traits)
- {
- const size_type i = get_pref_pos(b_it, e_it, p_traits);
- _GLIBCXX_DEBUG_ASSERT(i < arr_size);
- return m_a_p_children[i];
- }
-
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::iterator
- PB_DS_CLASS_C_DEC::
- get_child_it(const_e_iterator b_it, const_e_iterator e_it,
- const_e_access_traits_pointer p_traits)
- {
- const size_type i = get_pref_pos(b_it, e_it, p_traits);
- _GLIBCXX_DEBUG_ASSERT(i < arr_size);
- _GLIBCXX_DEBUG_ASSERT(m_a_p_children[i] != 0);
- return iterator(m_a_p_children + i, m_a_p_children + i);
- }
-
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::const_node_pointer
- PB_DS_CLASS_C_DEC::
- get_child_node(const_e_iterator b_it, const_e_iterator e_it,
- const_e_access_traits_pointer p_traits) const
- { return const_cast<node_pointer>(get_child_node(b_it, e_it, p_traits)); }
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::node_pointer
- PB_DS_CLASS_C_DEC::
- get_lower_bound_child_node(const_e_iterator b_it, const_e_iterator e_it,
- size_type checked_ind,
- const_e_access_traits_pointer p_traits)
- {
- if (!should_be_mine(b_it, e_it, checked_ind, p_traits))
- {
- if (p_traits->cmp_prefixes(b_it, e_it, m_pref_b_it, m_pref_e_it, true))
- return leftmost_descendant();
- return rightmost_descendant();
- }
-
- size_type i = get_pref_pos(b_it, e_it, p_traits);
- _GLIBCXX_DEBUG_ASSERT(i < arr_size);
-
- if (m_a_p_children[i] != 0)
- return m_a_p_children[i];
-
- while (++i < arr_size)
- if (m_a_p_children[i] != 0)
- {
- if (m_a_p_children[i]->m_type == pat_trie_leaf_node_type)
- return m_a_p_children[i];
-
- _GLIBCXX_DEBUG_ASSERT(m_a_p_children[i]->m_type == pat_trie_internal_node_type);
-
- return static_cast<internal_node_pointer>(m_a_p_children[i])->leftmost_descendant();
- }
-
- return rightmost_descendant();
- }
-
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::node_pointer
- PB_DS_CLASS_C_DEC::
- add_child(node_pointer p_nd, const_e_iterator b_it, const_e_iterator e_it,
- const_e_access_traits_pointer p_traits)
- {
- const size_type i = get_pref_pos(b_it, e_it, p_traits);
- _GLIBCXX_DEBUG_ASSERT(i < arr_size);
- if (m_a_p_children[i] == 0)
- {
- m_a_p_children[i] = p_nd;
- p_nd->m_p_parent = this;
- return p_nd;
- }
- return m_a_p_children[i];
- }
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::const_node_pointer
- PB_DS_CLASS_C_DEC::
- get_join_child(const_node_pointer p_nd, const_e_access_traits_pointer p_traits) const
- {
- node_pointer p = const_cast<node_pointer>(p_nd);
- return const_cast<internal_node_pointer>(this)->get_join_child(p, p_traits);
- }
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::node_pointer
- PB_DS_CLASS_C_DEC::
- get_join_child(node_pointer p_nd, const_e_access_traits_pointer p_traits)
- {
- size_type i;
- const_e_iterator b_it;
- const_e_iterator e_it;
- if (p_nd->m_type == pat_trie_leaf_node_type)
- {
- typename Type_Traits::const_key_reference r_key =
- e_access_traits::extract_key(static_cast<const_leaf_pointer>(p_nd)->value());
-
- b_it = p_traits->begin(r_key);
- e_it = p_traits->end(r_key);
- }
- else
- {
- b_it = static_cast<internal_node_pointer>(p_nd)->pref_b_it();
- e_it = static_cast<internal_node_pointer>(p_nd)->pref_e_it();
- }
- i = get_pref_pos(b_it, e_it, p_traits);
- _GLIBCXX_DEBUG_ASSERT(i < arr_size);
- return m_a_p_children[i];
- }
-
- PB_DS_CLASS_T_DEC
- void
- PB_DS_CLASS_C_DEC::
- remove_child(node_pointer p_nd)
- {
- size_type i = 0;
- for (; i < arr_size; ++i)
- if (m_a_p_children[i] == p_nd)
- {
- m_a_p_children[i] = 0;
- return;
- }
- _GLIBCXX_DEBUG_ASSERT(i != arr_size);
- }
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::iterator
- PB_DS_CLASS_C_DEC::
- remove_child(iterator it)
- {
- iterator ret = it;
- ++ret;
- * it.m_p_p_cur = 0;
- return ret;
- }
-
- PB_DS_CLASS_T_DEC
- void
- PB_DS_CLASS_C_DEC::
- replace_child(node_pointer p_nd, const_e_iterator b_it,
- const_e_iterator e_it,
- const_e_access_traits_pointer p_traits)
- {
- const size_type i = get_pref_pos(b_it, e_it, p_traits);
- _GLIBCXX_DEBUG_ASSERT(i < arr_size);
- m_a_p_children[i] = p_nd;
- p_nd->m_p_parent = this;
- }
-
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::const_e_iterator
- PB_DS_CLASS_C_DEC::
- pref_b_it() const
- { return m_pref_b_it; }
-
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::const_e_iterator
- PB_DS_CLASS_C_DEC::
- pref_e_it() const
- { return m_pref_e_it; }
-
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::size_type
- PB_DS_CLASS_C_DEC::
- get_e_ind() const
- { return m_e_ind; }
-
- PB_DS_CLASS_T_DEC
- bool
- PB_DS_CLASS_C_DEC::
- should_be_mine(const_e_iterator b_it, const_e_iterator e_it,
- size_type checked_ind,
- const_e_access_traits_pointer p_traits) const
- {
- if (m_e_ind == 0)
- return true;
-
- const size_type num_es = std::distance(b_it, e_it);
- if (num_es < m_e_ind)
- return false;
-
- const_e_iterator key_b_it = b_it;
- std::advance(key_b_it, checked_ind);
- const_e_iterator key_e_it = b_it;
- std::advance(key_e_it, m_e_ind);
-
- const_e_iterator value_b_it = m_pref_b_it;
- std::advance(value_b_it, checked_ind);
- const_e_iterator value_e_it = m_pref_b_it;
- std::advance(value_e_it, m_e_ind);
-
- return p_traits->equal_prefixes(key_b_it, key_e_it, value_b_it,
- value_e_it);
- }
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::leaf_pointer
- PB_DS_CLASS_C_DEC::
- leftmost_descendant()
- {
- node_pointer p_pot =* begin();
- if (p_pot->m_type == pat_trie_leaf_node_type)
- return (static_cast<leaf_pointer>(p_pot));
- _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == pat_trie_internal_node_type);
- return static_cast<internal_node_pointer>(p_pot)->leftmost_descendant();
- }
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::const_leaf_pointer
- PB_DS_CLASS_C_DEC::
- leftmost_descendant() const
- {
- return const_cast<internal_node_pointer>(this)->leftmost_descendant();
- }
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::leaf_pointer
- PB_DS_CLASS_C_DEC::
- rightmost_descendant()
- {
- const size_type num_children = std::distance(begin(), end());
- _GLIBCXX_DEBUG_ASSERT(num_children >= 2);
-
- iterator it = begin();
- std::advance(it, num_children - 1);
- node_pointer p_pot =* it;
- if (p_pot->m_type == pat_trie_leaf_node_type)
- return static_cast<leaf_pointer>(p_pot);
- _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == pat_trie_internal_node_type);
- return static_cast<internal_node_pointer>(p_pot)->rightmost_descendant();
- }
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::const_leaf_pointer
- PB_DS_CLASS_C_DEC::
- rightmost_descendant() const
- {
- return const_cast<internal_node_pointer>(this)->rightmost_descendant();
- }
-
-#ifdef _GLIBCXX_DEBUG
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::size_type
- PB_DS_CLASS_C_DEC::
- e_ind() const
- { return m_e_ind; }
-#endif
-
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::size_type
- PB_DS_CLASS_C_DEC::
- get_begin_pos() const
- {
- size_type i;
- for (i = 0; i < arr_size && m_a_p_children[i] == 0; ++i)
- ;
- return i;
- }
-
-#ifdef _GLIBCXX_DEBUG
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::subtree_debug_info
- PB_DS_CLASS_C_DEC::
- assert_valid_imp(const_e_access_traits_pointer p_traits,
- const char* __file, int __line) const
- {
- PB_DS_DEBUG_VERIFY(base_type::m_type == pat_trie_internal_node_type);
- PB_DS_DEBUG_VERIFY(static_cast<size_type>(std::distance(pref_b_it(), pref_e_it())) == m_e_ind);
- PB_DS_DEBUG_VERIFY(std::distance(begin(), end()) >= 2);
-
- for (typename pat_trie_internal_node::const_iterator it = begin();
- it != end(); ++it)
- {
- const_node_pointer p_nd =* it;
- PB_DS_DEBUG_VERIFY(p_nd->m_p_parent == this);
- subtree_debug_info child_ret =
- p_nd->assert_valid_imp(p_traits, __file, __line);
-
- PB_DS_DEBUG_VERIFY(static_cast<size_type>(std::distance(child_ret.first, child_ret.second)) >= m_e_ind);
- PB_DS_DEBUG_VERIFY(should_be_mine(child_ret.first, child_ret.second, 0, p_traits));
- PB_DS_DEBUG_VERIFY(get_pref_pos(child_ret.first, child_ret.second, p_traits) == static_cast<size_type>(it.m_p_p_cur - m_a_p_children));
- }
- return std::make_pair(pref_b_it(), pref_e_it());
- }
-#endif
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-#undef PB_DS_BASE_C_DEC
-#undef PB_DS_LEAF_C_DEC
-
- } // namespace detail
-} // namespace __gnu_pbds
-
-#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
index 85199f81cb0..d53f1b274b3 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
@@ -34,8 +34,8 @@
// warranty.
/**
- * @file iterators_fn_imps.hpp
- * Contains an implementation class for bin_search_tree_.
+ * @file pat_trie_/iterators_fn_imps.hpp
+ * Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
@@ -95,10 +95,10 @@ rend() const
{ return const_reverse_iterator(m_p_head); }
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
node_begin() const
-{ return const_node_iterator(m_p_head->m_p_parent, this); }
+{ return node_const_iterator(m_p_head->m_p_parent, this); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_iterator
@@ -107,10 +107,10 @@ node_begin()
{ return node_iterator(m_p_head->m_p_parent, this); }
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+inline typename PB_DS_CLASS_C_DEC::node_const_iterator
PB_DS_CLASS_C_DEC::
node_end() const
-{ return const_node_iterator(0, this); }
+{ return node_const_iterator(0, this); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_iterator
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/leaf.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
deleted file mode 100644
index de8057a0219..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
+++ /dev/null
@@ -1,169 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file leaf.hpp
- * Contains a pat_trie_leaf for a patricia tree.
- */
-
-#ifndef PB_DS_PAT_TRIE_LEAF_HPP
-#define PB_DS_PAT_TRIE_LEAF_HPP
-
-#include <debug/debug.h>
-
-namespace __gnu_pbds
-{
- namespace detail
- {
-
-#define PB_DS_CLASS_T_DEC \
- template<class Type_Traits, \
- class E_Access_Traits, \
- class Metadata, \
- class Allocator>
-
-#define PB_DS_CLASS_C_DEC \
- pat_trie_leaf<Type_Traits, \
- E_Access_Traits, \
- Metadata, \
- Allocator>
-
-#define PB_DS_BASE_C_DEC \
- pat_trie_node_base<Type_Traits, \
- E_Access_Traits, \
- Metadata, \
- Allocator>
-
-#define PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC \
- pat_trie_subtree_debug_info<Type_Traits, \
- E_Access_Traits, \
- Allocator>
-
- template<typename Type_Traits,
- class E_Access_Traits,
- class Metadata,
- class Allocator>
- struct pat_trie_leaf : public PB_DS_BASE_C_DEC
- {
- private:
- typedef typename Type_Traits::value_type value_type;
-
- typedef typename Type_Traits::const_reference const_reference;
-
- typedef typename Type_Traits::reference reference;
-
- typedef
- typename Allocator::template rebind<
- E_Access_Traits>::other::const_pointer
- const_e_access_traits_pointer;
-
-#ifdef _GLIBCXX_DEBUG
- typedef
- typename PB_DS_BASE_C_DEC::subtree_debug_info
- subtree_debug_info;
-#endif
-
- typedef PB_DS_BASE_C_DEC base_type;
-
- public:
- pat_trie_leaf(const_reference r_val);
-
- inline reference
- value();
-
- inline const_reference
- value() const;
-
-#ifdef _GLIBCXX_DEBUG
- virtual subtree_debug_info
- assert_valid_imp(const_e_access_traits_pointer p_traits,
- const char* file, int line) const;
-
- virtual
- ~pat_trie_leaf();
-#endif
-
- private:
- pat_trie_leaf(const PB_DS_CLASS_C_DEC& other);
-
- value_type m_value;
- };
-
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- pat_trie_leaf(const_reference r_val) :
- PB_DS_BASE_C_DEC(pat_trie_leaf_node_type), m_value(r_val)
- { }
-
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::reference
- PB_DS_CLASS_C_DEC::
- value()
- { return m_value; }
-
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::const_reference
- PB_DS_CLASS_C_DEC::
- value() const
- { return m_value; }
-
-#ifdef _GLIBCXX_DEBUG
- PB_DS_CLASS_T_DEC
- typename PB_DS_CLASS_C_DEC::subtree_debug_info
- PB_DS_CLASS_C_DEC::
- assert_valid_imp(const_e_access_traits_pointer p_traits,
- const char* __file, int __line) const
- {
- PB_DS_DEBUG_VERIFY(base_type::m_type == pat_trie_leaf_node_type);
- subtree_debug_info ret;
- const_reference r_val = value();
- return std::make_pair(p_traits->begin(p_traits->extract_key(r_val)),
- p_traits->end(p_traits->extract_key(r_val)));
- }
-
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- ~pat_trie_leaf() { }
-#endif
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-#undef PB_DS_BASE_C_DEC
-#undef PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC
-
- } // namespace detail
-} // namespace __gnu_pbds
-
-#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
deleted file mode 100644
index 6e131e4074c..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
+++ /dev/null
@@ -1,131 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file node_base.hpp
- * Contains a pat_trie_node_base base for a patricia tree.
- */
-
-#ifndef PB_DS_PAT_TRIE_NODE_BASE_HPP
-#define PB_DS_PAT_TRIE_NODE_BASE_HPP
-
-#include <ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp>
-
-namespace __gnu_pbds
-{
- namespace detail
- {
-#define PB_DS_CLASS_T_DEC \
- template<typename Type_Traits, typename E_Access_Traits, \
- typename Metadata, typename Allocator>
-
-#define PB_DS_CLASS_C_DEC \
- pat_trie_node_base<Type_Traits, E_Access_Traits, Metadata, Allocator>
-
-#define PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC \
- pat_trie_subtree_debug_info<Type_Traits, E_Access_Traits, Allocator>
-
- enum pat_trie_node_type
- {
- pat_trie_internal_node_type,
- pat_trie_leaf_node_type,
- pat_trie_head_node_type
- };
-
- template<typename Type_Traits,
- typename E_Access_Traits,
- typename Metadata,
- typename Allocator>
- struct pat_trie_node_base : public pat_trie_node_metadata_base<
- Metadata,
- Allocator>
- {
- public:
- typedef
- typename Allocator::template rebind<
- pat_trie_node_base>::other::pointer
- node_pointer;
-
- typedef
- typename Allocator::template rebind<
- E_Access_Traits>::other::const_pointer
- const_e_access_traits_pointer;
-
-#ifdef _GLIBCXX_DEBUG
- typedef
- std::pair<
- typename E_Access_Traits::const_iterator,
- typename E_Access_Traits::const_iterator>
- subtree_debug_info;
-#endif
-
- pat_trie_node_base(pat_trie_node_type type);
-
-#ifdef _GLIBCXX_DEBUG
- void
- assert_valid(const_e_access_traits_pointer p_traits,
- const char* file, int line) const;
-
- virtual subtree_debug_info
- assert_valid_imp(const_e_access_traits_pointer p_traits,
- const char* file, int line) const = 0;
-#endif
-
- node_pointer m_p_parent;
- const pat_trie_node_type m_type;
- };
-
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- pat_trie_node_base(pat_trie_node_type type) : m_type(type)
- { }
-
-#ifdef _GLIBCXX_DEBUG
- PB_DS_CLASS_T_DEC
- void
- PB_DS_CLASS_C_DEC::
- assert_valid(const_e_access_traits_pointer p_traits,
- const char* __file, int __line) const
- { assert_valid_imp(p_traits, __file, __line); }
-#endif
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-#undef PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC
-
- } // namespace detail
-} // namespace __gnu_pbds
-
-#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
deleted file mode 100644
index c57462868bd..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
+++ /dev/null
@@ -1,338 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file node_iterators.hpp
- * Contains an implementation class for pat_trie_.
- */
-
-#ifndef PB_DS_PAT_TRIE_NODE_ITERATORS_HPP
-#define PB_DS_PAT_TRIE_NODE_ITERATORS_HPP
-
-#include <debug/debug.h>
-
-namespace __gnu_pbds
-{
- namespace detail
- {
-
-#define PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC \
- pat_trie_const_node_it_< \
- Node, \
- Leaf, \
- Head, \
- Internal_Node, \
- Const_Iterator, \
- Iterator, \
- E_Access_Traits, \
- Allocator>
-
-#define PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC \
- pat_trie_node_it_< \
- Node, \
- Leaf, \
- Head, \
- Internal_Node, \
- Const_Iterator, \
- Iterator, \
- E_Access_Traits, \
- Allocator>
-
- // Const node iterator.
- template<typename Node,
- class Leaf,
- class Head,
- class Internal_Node,
- class Const_Iterator,
- class Iterator,
- class E_Access_Traits,
- class Allocator>
- class pat_trie_const_node_it_
- {
- protected:
- typedef
- typename Allocator::template rebind<
- Node>::other::pointer
- node_pointer;
-
- typedef
- typename Allocator::template rebind<
- Leaf>::other::const_pointer
- const_leaf_pointer;
-
- typedef
- typename Allocator::template rebind<
- Leaf>::other::pointer
- leaf_pointer;
-
- typedef
- typename Allocator::template rebind<
- Internal_Node>::other::pointer
- internal_node_pointer;
-
- typedef
- typename Allocator::template rebind<
- Internal_Node>::other::const_pointer
- const_internal_node_pointer;
-
- typedef
- typename Allocator::template rebind<
- E_Access_Traits>::other::const_pointer
- const_e_access_traits_pointer;
-
- private:
- inline typename E_Access_Traits::const_iterator
- pref_begin() const
- {
- if (m_p_nd->m_type == pat_trie_leaf_node_type)
- return (m_p_traits->begin(
- m_p_traits->extract_key(
- static_cast<const_leaf_pointer>(m_p_nd)->value())));
-
- _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);
-
- return (static_cast<const_internal_node_pointer>(m_p_nd)->pref_b_it());
- }
-
- inline typename E_Access_Traits::const_iterator
- pref_end() const
- {
- if (m_p_nd->m_type == pat_trie_leaf_node_type)
- return (m_p_traits->end(
- m_p_traits->extract_key(
- static_cast<const_leaf_pointer>(m_p_nd)->value())));
-
- _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);
-
- return (static_cast<const_internal_node_pointer>(m_p_nd)->pref_e_it());
- }
-
- public:
-
- // Size type.
- typedef typename Allocator::size_type size_type;
-
- // Category.
- typedef trivial_iterator_tag iterator_category;
-
- // Difference type.
- typedef trivial_iterator_difference_type difference_type;
-
- // __Iterator's value type.
- typedef Const_Iterator value_type;
-
- // __Iterator's reference type.
- typedef value_type reference;
-
- // __Iterator's __const reference type.
- typedef value_type const_reference;
-
- // Element access traits.
- typedef E_Access_Traits e_access_traits;
-
- // A key's element __const iterator.
- typedef typename e_access_traits::const_iterator const_e_iterator;
-
- // Metadata type.
- typedef typename Node::metadata_type metadata_type;
-
- // Const metadata reference type.
- typedef
- typename Allocator::template rebind<
- metadata_type>::other::const_reference
- const_metadata_reference;
-
- // Default constructor.
- /*
- inline
- pat_trie_const_node_it_()
- */
- inline
- pat_trie_const_node_it_(node_pointer p_nd = 0,
- const_e_access_traits_pointer p_traits = 0)
- : m_p_nd(const_cast<node_pointer>(p_nd)), m_p_traits(p_traits)
- { }
-
- // Subtree valid prefix.
- inline std::pair<const_e_iterator, const_e_iterator>
- valid_prefix() const
- { return std::make_pair(pref_begin(), pref_end()); }
-
- // Const access; returns the __const iterator* associated with
- // the current leaf.
- inline const_reference
- operator*() const
- {
- _GLIBCXX_DEBUG_ASSERT(num_children() == 0);
- return Const_Iterator(m_p_nd);
- }
-
- // Metadata access.
- inline const_metadata_reference
- get_metadata() const
- { return m_p_nd->get_metadata(); }
-
- // Returns the number of children in the corresponding node.
- inline size_type
- num_children() const
- {
- if (m_p_nd->m_type == pat_trie_leaf_node_type)
- return 0;
- _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);
- return std::distance(static_cast<internal_node_pointer>(m_p_nd)->begin(), static_cast<internal_node_pointer>(m_p_nd)->end());
- }
-
- // Returns a __const node __iterator to the corresponding node's
- // i-th child.
- PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC
- get_child(size_type i) const
- {
- _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);
- typename Internal_Node::iterator it =
- static_cast<internal_node_pointer>(m_p_nd)->begin();
-
- std::advance(it, i);
- return PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC(*it, m_p_traits);
- }
-
- // Compares content to a different iterator object.
- inline bool
- operator==(const PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC& other) const
- { return (m_p_nd == other.m_p_nd); }
-
- // Compares content (negatively) to a different iterator object.
- inline bool
- operator!=(const PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC& other) const
- { return m_p_nd != other.m_p_nd; }
-
- private:
-
- friend class PB_DS_CLASS_C_DEC;
-
- public:
- node_pointer m_p_nd;
-
- const_e_access_traits_pointer m_p_traits;
- };
-
- // Node iterator.
- template<typename Node,
- class Leaf,
- class Head,
- class Internal_Node,
- class Const_Iterator,
- class Iterator,
- class E_Access_Traits,
- class Allocator>
- class pat_trie_node_it_ :
- public PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC
-
- {
- private:
- typedef
- typename Allocator::template rebind<
- Node>::other::pointer
- node_pointer;
-
- typedef Iterator iterator;
-
- typedef PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC base_type;
-
- typedef
- typename base_type::const_e_access_traits_pointer
- const_e_access_traits_pointer;
-
- typedef typename base_type::internal_node_pointer internal_node_pointer;
-
- public:
-
- // Size type.
- typedef
- typename PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC::size_type
- size_type;
-
- // __Iterator's value type.
- typedef Iterator value_type;
-
- // __Iterator's reference type.
- typedef value_type reference;
-
- // __Iterator's __const reference type.
- typedef value_type const_reference;
-
- // Default constructor.
- /*
- inline
- pat_trie_node_it_() ;
- */
-
- inline
- pat_trie_node_it_(node_pointer p_nd = 0, const_e_access_traits_pointer p_traits = 0) : base_type(p_nd, p_traits)
- { }
-
- // Access; returns the iterator* associated with the current leaf.
- inline reference
- operator*() const
- {
- _GLIBCXX_DEBUG_ASSERT(base_type::num_children() == 0);
- return Iterator(base_type::m_p_nd);
-
- }
-
- // Returns a node __iterator to the corresponding node's i-th child.
- PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC
- get_child(size_type i) const
- {
- _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == pat_trie_internal_node_type);
-
- typename Internal_Node::iterator it =
- static_cast<internal_node_pointer>(base_type::m_p_nd)->begin();
-
- std::advance(it, i);
- return PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC(*it, base_type::m_p_traits);
- }
-
- private:
- friend class PB_DS_CLASS_C_DEC;
- };
-
-#undef PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC
-#undef PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC
-
- } // namespace detail
-} // namespace __gnu_pbds
-
-#endif
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
index 5313c0b9712..46bb016e25e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
@@ -35,172 +35,249 @@
// warranty.
/**
- * @file pat_trie_.hpp
+ * @file pat_trie_/pat_trie_.hpp
* Contains an implementation class for a patricia tree.
*/
-/**
- * This implementation loosely borrows ideas from:
- * 1) Fast Mergeable Integer Maps, Okasaki, Gill 1998
- * 2) Ptset: Sets of integers implemented as Patricia trees,
- * Jean-Christophe Filliatr, 2000
- **/
-
-#include <ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp>
-#include <ext/pb_ds/detail/pat_trie_/node_base.hpp>
-#include <ext/pb_ds/exception.hpp>
-#include <ext/pb_ds/tag_and_trait.hpp>
-#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
-#include <ext/pb_ds/detail/types_traits.hpp>
-#include <ext/pb_ds/tree_policy.hpp>
-#include <ext/pb_ds/detail/cond_dealtor.hpp>
-#include <ext/pb_ds/detail/type_utils.hpp>
#include <iterator>
#include <utility>
#include <algorithm>
#include <functional>
#include <assert.h>
#include <list>
+#include <ext/pb_ds/exception.hpp>
+#include <ext/pb_ds/tag_and_trait.hpp>
+#include <ext/pb_ds/tree_policy.hpp>
+#include <ext/pb_ds/detail/cond_dealtor.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <ext/pb_ds/detail/types_traits.hpp>
+#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
+#include <ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp>
+#include <ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp>
#ifdef _GLIBCXX_DEBUG
#include <ext/pb_ds/detail/debug_map_base.hpp>
-#endif
+#endif
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
-#define PB_DS_CLASS_T_DEC \
- template<typename Key, typename Mapped, typename Node_And_It_Traits, \
- typename Allocator>
-
#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CLASS_NAME pat_trie_data_
-#endif
+#define PB_DS_PAT_TRIE_NAME pat_trie_map
+#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_CLASS_NAME pat_trie_no_data_
-#endif
+#define PB_DS_PAT_TRIE_NAME pat_trie_set
+#endif
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Mapped, typename Node_And_It_Traits, \
+ typename _Alloc>
#define PB_DS_CLASS_C_DEC \
- PB_DS_CLASS_NAME<Key, Mapped, Node_And_It_Traits, Allocator>
+ PB_DS_PAT_TRIE_NAME<Key, Mapped, Node_And_It_Traits, _Alloc>
-#define PB_DS_TYPES_TRAITS_C_DEC \
- types_traits<Key, Mapped, Allocator, false>
+#define PB_DS_PAT_TRIE_TRAITS_BASE \
+ types_traits<Key, Mapped, _Alloc, false>
#ifdef _GLIBCXX_DEBUG
#define PB_DS_DEBUG_MAP_BASE_C_DEC \
- debug_map_base<Key, eq_by_less<Key, \
- std::less<Key> >, typename Allocator::template rebind<Key>::other::const_reference>
-#endif
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#define PB_DS_EP2VP(X)& ((X)->m_value)
-#endif
+ debug_map_base<Key, eq_by_less<Key, std::less<Key> >, \
+ typename _Alloc::template rebind<Key>::other::const_reference>
+#endif
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped_Data()
-#define PB_DS_EP2VP(X)& ((X)->m_value.first)
-#endif
/**
- * class description = PATRICIA trie implementation.">
- **/
- template<typename Key,
- typename Mapped,
- typename Node_And_It_Traits,
- typename Allocator>
- class PB_DS_CLASS_NAME :
+ * @brief PATRICIA trie.
+ *
+ * This implementation loosely borrows ideas from:
+ * 1) Fast Mergeable Integer Maps, Okasaki, Gill 1998
+ * 2) Ptset: Sets of integers implemented as Patricia trees,
+ * Jean-Christophe Filliatr, 2000
+ */
+ template<typename Key, typename Mapped, typename Node_And_It_Traits,
+ typename _Alloc>
+ class PB_DS_PAT_TRIE_NAME :
#ifdef _GLIBCXX_DEBUG
public PB_DS_DEBUG_MAP_BASE_C_DEC,
-#endif
- public Node_And_It_Traits::synth_e_access_traits,
+#endif
+ public Node_And_It_Traits::synth_access_traits,
public Node_And_It_Traits::node_update,
- public PB_DS_TYPES_TRAITS_C_DEC
+ public PB_DS_PAT_TRIE_TRAITS_BASE,
+ public pat_trie_base
{
private:
- typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
+ typedef pat_trie_base base_type;
+ typedef PB_DS_PAT_TRIE_TRAITS_BASE traits_base;
+ typedef Node_And_It_Traits traits_type;
+
+ typedef typename traits_type::synth_access_traits synth_access_traits;
+ typedef typename synth_access_traits::const_iterator a_const_iterator;
+
+ typedef typename traits_type::node node;
+ typedef typename _Alloc::template rebind<node> __rebind_n;
+ typedef typename __rebind_n::other::const_pointer node_const_pointer;
+ typedef typename __rebind_n::other::pointer node_pointer;
+
+ typedef typename traits_type::head head;
+ typedef typename _Alloc::template rebind<head> __rebind_h;
+ typedef typename __rebind_h::other head_allocator;
+ typedef typename head_allocator::pointer head_pointer;
+
+ typedef typename traits_type::leaf leaf;
+ typedef typename _Alloc::template rebind<leaf> __rebind_l;
+ typedef typename __rebind_l::other leaf_allocator;
+ typedef typename leaf_allocator::pointer leaf_pointer;
+ typedef typename leaf_allocator::const_pointer leaf_const_pointer;
+
+ typedef typename traits_type::inode inode;
+ typedef typename inode::iterator inode_iterator;
+ typedef typename _Alloc::template rebind<inode> __rebind_in;
+ typedef typename __rebind_in::other __rebind_ina;
+ typedef typename __rebind_in::other inode_allocator;
+ typedef typename __rebind_ina::pointer inode_pointer;
+ typedef typename __rebind_ina::const_pointer inode_const_pointer;
+
+
+ /// Conditional deallocator.
+ class cond_dealtor
+ {
+ protected:
+ leaf_pointer m_p_nd;
+ bool m_no_action_dtor;
+ bool m_call_destructor;
+
+ public:
+ cond_dealtor(leaf_pointer p_nd)
+ : m_p_nd(p_nd), m_no_action_dtor(false), m_call_destructor(false)
+ { }
- typedef typename Node_And_It_Traits::synth_e_access_traits synth_e_access_traits;
- typedef typename Allocator::template rebind<synth_e_access_traits>::other::const_pointer const_e_access_traits_pointer;
- typedef typename synth_e_access_traits::const_iterator const_e_iterator;
+ void
+ set_no_action_dtor()
+ { m_no_action_dtor = true; }
- typedef typename Node_And_It_Traits::node node;
- typedef typename Allocator::template rebind<node>::other::const_pointer const_node_pointer;
+ void
+ set_call_destructor()
+ { m_call_destructor = true; }
- typedef typename Allocator::template rebind<node>::other::pointer node_pointer;
+ ~cond_dealtor()
+ {
+ if (m_no_action_dtor)
+ return;
- typedef typename Node_And_It_Traits::head head;
- typedef typename Allocator::template rebind<head>::other head_allocator;
- typedef typename head_allocator::pointer head_pointer;
+ if (m_call_destructor)
+ m_p_nd->~leaf();
- typedef typename Node_And_It_Traits::leaf leaf;
- typedef typename Allocator::template rebind<leaf>::other leaf_allocator;
- typedef typename leaf_allocator::const_pointer const_leaf_pointer;
- typedef typename leaf_allocator::pointer leaf_pointer;
+ s_leaf_allocator.deallocate(m_p_nd, 1);
+ }
+ };
- typedef typename Node_And_It_Traits::internal_node internal_node;
- typedef typename Allocator::template rebind<internal_node>::other internal_node_allocator;
- typedef typename internal_node_allocator::const_pointer const_internal_node_pointer;
- typedef typename internal_node_allocator::pointer internal_node_pointer;
-#include <ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp>
+ /// Branch bag, for split-join.
+ class branch_bag
+ {
+ private:
+ typedef inode_pointer __inp;
+ typedef typename _Alloc::template rebind<__inp>::other __rebind_inp;
#ifdef _GLIBCXX_DEBUG
- typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
-#endif
+ typedef std::_GLIBCXX_STD_C::list<__inp, __rebind_inp> bag_type;
+#else
+ typedef std::list<__inp, __rebind_inp> bag_type;
+#endif
+
+ bag_type m_bag;
+ public:
+ void
+ add_branch()
+ {
+ inode_pointer p_nd = s_inode_allocator.allocate(1);
+ __try
+ {
+ m_bag.push_back(p_nd);
+ }
+ __catch(...)
+ {
+ s_inode_allocator.deallocate(p_nd, 1);
+ __throw_exception_again;
+ }
+ }
+
+ inode_pointer
+ get_branch()
+ {
+ _GLIBCXX_DEBUG_ASSERT(!m_bag.empty());
+ inode_pointer p_nd = *m_bag.begin();
+ m_bag.pop_front();
+ return p_nd;
+ }
+
+ ~branch_bag()
+ {
+ while (!m_bag.empty())
+ {
+ inode_pointer p_nd = *m_bag.begin();
+ s_inode_allocator.deallocate(p_nd, 1);
+ m_bag.pop_front();
+ }
+ }
+
+ inline bool
+ empty() const
+ { return m_bag.empty(); }
+ };
-#include <ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp>
+#ifdef _GLIBCXX_DEBUG
+ typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
+#endif
- typedef typename Node_And_It_Traits::null_node_update_pointer null_node_update_pointer;
+ typedef typename traits_type::null_node_update_pointer null_node_update_pointer;
public:
- typedef pat_trie_tag container_category;
- typedef Allocator allocator_type;
- typedef typename Allocator::size_type size_type;
- typedef typename Allocator::difference_type difference_type;
-
- typedef typename traits_base::key_type key_type;
- typedef typename traits_base::key_pointer key_pointer;
- typedef typename traits_base::const_key_pointer const_key_pointer;
- typedef typename traits_base::key_reference key_reference;
- typedef typename traits_base::const_key_reference const_key_reference;
- typedef typename traits_base::mapped_type mapped_type;
- typedef typename traits_base::mapped_pointer mapped_pointer;
- typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
- typedef typename traits_base::mapped_reference mapped_reference;
- typedef typename traits_base::const_mapped_reference const_mapped_reference;
- typedef typename traits_base::value_type value_type;
- typedef typename traits_base::pointer pointer;
- typedef typename traits_base::const_pointer const_pointer;
- typedef typename traits_base::reference reference;
- typedef typename traits_base::const_reference const_reference;
-
- typedef typename Node_And_It_Traits::const_iterator const_point_iterator;
- typedef typename Node_And_It_Traits::iterator point_iterator;
- typedef const_point_iterator const_iterator;
- typedef point_iterator iterator;
-
- typedef typename Node_And_It_Traits::const_reverse_iterator const_reverse_iterator;
- typedef typename Node_And_It_Traits::reverse_iterator reverse_iterator;
- typedef typename Node_And_It_Traits::const_node_iterator const_node_iterator;
- typedef typename Node_And_It_Traits::node_iterator node_iterator;
- typedef typename Node_And_It_Traits::e_access_traits e_access_traits;
- typedef typename Node_And_It_Traits::node_update node_update;
-
- PB_DS_CLASS_NAME();
-
- PB_DS_CLASS_NAME(const e_access_traits&);
-
- PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+ typedef pat_trie_tag container_category;
+ typedef _Alloc allocator_type;
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
+
+ typedef typename traits_base::key_type key_type;
+ typedef typename traits_base::key_pointer key_pointer;
+ typedef typename traits_base::key_const_pointer key_const_pointer;
+ typedef typename traits_base::key_reference key_reference;
+ typedef typename traits_base::key_const_reference key_const_reference;
+ typedef typename traits_base::mapped_type mapped_type;
+ typedef typename traits_base::mapped_pointer mapped_pointer;
+ typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
+ typedef typename traits_base::mapped_reference mapped_reference;
+ typedef typename traits_base::mapped_const_reference mapped_const_reference;
+ typedef typename traits_base::value_type value_type;
+ typedef typename traits_base::pointer pointer;
+ typedef typename traits_base::const_pointer const_pointer;
+ typedef typename traits_base::reference reference;
+ typedef typename traits_base::const_reference const_reference;
+
+ typedef typename traits_type::access_traits access_traits;
+ typedef typename traits_type::const_iterator point_const_iterator;
+ typedef typename traits_type::iterator point_iterator;
+ typedef point_const_iterator const_iterator;
+ typedef point_iterator iterator;
+
+ typedef typename traits_type::reverse_iterator reverse_iterator;
+ typedef typename traits_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename traits_type::node_const_iterator node_const_iterator;
+ typedef typename traits_type::node_iterator node_iterator;
+ typedef typename traits_type::node_update node_update;
+
+ PB_DS_PAT_TRIE_NAME();
+
+ PB_DS_PAT_TRIE_NAME(const access_traits&);
+
+ PB_DS_PAT_TRIE_NAME(const PB_DS_CLASS_C_DEC&);
void
swap(PB_DS_CLASS_C_DEC&);
- ~PB_DS_CLASS_NAME();
+ ~PB_DS_PAT_TRIE_NAME();
inline bool
empty() const;
@@ -211,55 +288,55 @@ namespace __gnu_pbds
inline size_type
max_size() const;
- e_access_traits&
- get_e_access_traits();
+ access_traits&
+ get_access_traits();
- const e_access_traits&
- get_e_access_traits() const;
+ const access_traits&
+ get_access_traits() const;
- node_update&
+ node_update&
get_node_update();
- const node_update&
+ const node_update&
get_node_update() const;
inline std::pair<point_iterator, bool>
insert(const_reference);
inline mapped_reference
- operator[](const_key_reference r_key)
+ operator[](key_const_reference r_key)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
return insert(std::make_pair(r_key, mapped_type())).first->second;
-#else
+#else
insert(r_key);
- return traits_base::s_null_mapped;
-#endif
+ return traits_base::s_null_type;
+#endif
}
inline point_iterator
- find(const_key_reference);
+ find(key_const_reference);
- inline const_point_iterator
- find(const_key_reference) const;
+ inline point_const_iterator
+ find(key_const_reference) const;
inline point_iterator
- lower_bound(const_key_reference);
+ lower_bound(key_const_reference);
- inline const_point_iterator
- lower_bound(const_key_reference) const;
+ inline point_const_iterator
+ lower_bound(key_const_reference) const;
inline point_iterator
- upper_bound(const_key_reference);
+ upper_bound(key_const_reference);
- inline const_point_iterator
- upper_bound(const_key_reference) const;
+ inline point_const_iterator
+ upper_bound(key_const_reference) const;
void
clear();
inline bool
- erase(const_key_reference);
+ erase(key_const_reference);
inline const_iterator
erase(const_iterator);
@@ -267,7 +344,7 @@ namespace __gnu_pbds
#ifdef PB_DS_DATA_TRUE_INDICATOR
inline iterator
erase(iterator);
-#endif
+#endif
inline const_reverse_iterator
erase(const_reverse_iterator);
@@ -275,7 +352,7 @@ namespace __gnu_pbds
#ifdef PB_DS_DATA_TRUE_INDICATOR
inline reverse_iterator
erase(reverse_iterator);
-#endif
+#endif
template<typename Pred>
inline size_type
@@ -285,7 +362,7 @@ namespace __gnu_pbds
join(PB_DS_CLASS_C_DEC&);
void
- split(const_key_reference, PB_DS_CLASS_C_DEC&);
+ split(key_const_reference, PB_DS_CLASS_C_DEC&);
inline iterator
begin();
@@ -311,13 +388,13 @@ namespace __gnu_pbds
inline const_reverse_iterator
rend() const;
- inline const_node_iterator
+ inline node_const_iterator
node_begin() const;
inline node_iterator
node_begin();
- inline const_node_iterator
+ inline node_const_iterator
node_end() const;
inline node_iterator
@@ -326,10 +403,9 @@ namespace __gnu_pbds
#ifdef PB_DS_PAT_TRIE_TRACE_
void
trace() const;
-#endif
+#endif
protected:
-
template<typename It>
void
copy_from_range(It, It);
@@ -338,10 +414,9 @@ namespace __gnu_pbds
value_swap(PB_DS_CLASS_C_DEC&);
node_pointer
- recursive_copy_node(const_node_pointer);
+ recursive_copy_node(node_const_pointer);
private:
-
void
initialize();
@@ -353,54 +428,46 @@ namespace __gnu_pbds
apply_update(node_pointer, Node_Update_*);
bool
- join_prep(PB_DS_CLASS_C_DEC&, split_join_branch_bag&);
+ join_prep(PB_DS_CLASS_C_DEC&, branch_bag&);
void
- rec_join_prep(const_node_pointer, const_node_pointer,
- split_join_branch_bag&);
+ rec_join_prep(node_const_pointer, node_const_pointer, branch_bag&);
void
- rec_join_prep(const_leaf_pointer, const_leaf_pointer,
- split_join_branch_bag&);
+ rec_join_prep(leaf_const_pointer, leaf_const_pointer, branch_bag&);
void
- rec_join_prep(const_leaf_pointer, const_internal_node_pointer,
- split_join_branch_bag&);
+ rec_join_prep(leaf_const_pointer, inode_const_pointer, branch_bag&);
void
- rec_join_prep(const_internal_node_pointer, const_leaf_pointer,
- split_join_branch_bag&);
+ rec_join_prep(inode_const_pointer, leaf_const_pointer, branch_bag&);
void
- rec_join_prep(const_internal_node_pointer, const_internal_node_pointer,
- split_join_branch_bag&);
+ rec_join_prep(inode_const_pointer, inode_const_pointer, branch_bag&);
node_pointer
- rec_join(node_pointer, node_pointer, size_type, split_join_branch_bag&);
+ rec_join(node_pointer, node_pointer, size_type, branch_bag&);
node_pointer
- rec_join(leaf_pointer, leaf_pointer, split_join_branch_bag&);
+ rec_join(leaf_pointer, leaf_pointer, branch_bag&);
node_pointer
- rec_join(leaf_pointer, internal_node_pointer, size_type,
- split_join_branch_bag&);
+ rec_join(leaf_pointer, inode_pointer, size_type, branch_bag&);
node_pointer
- rec_join(internal_node_pointer, leaf_pointer, size_type,
- split_join_branch_bag&);
+ rec_join(inode_pointer, leaf_pointer, size_type, branch_bag&);
node_pointer
- rec_join(internal_node_pointer, internal_node_pointer,
- split_join_branch_bag&);
+ rec_join(inode_pointer, inode_pointer, branch_bag&);
size_type
- keys_diff_ind(typename e_access_traits::const_iterator,
- typename e_access_traits::const_iterator,
- typename e_access_traits::const_iterator,
- typename e_access_traits::const_iterator);
+ keys_diff_ind(typename access_traits::const_iterator,
+ typename access_traits::const_iterator,
+ typename access_traits::const_iterator,
+ typename access_traits::const_iterator);
- internal_node_pointer
- insert_branch(node_pointer, node_pointer, split_join_branch_bag&);
+ inode_pointer
+ insert_branch(node_pointer, node_pointer, branch_bag&);
void
update_min_max_for_inserted_leaf(leaf_pointer);
@@ -415,90 +482,87 @@ namespace __gnu_pbds
clear_imp(node_pointer);
void
- erase_fixup(internal_node_pointer);
+ erase_fixup(inode_pointer);
void
update_min_max_for_erased_leaf(leaf_pointer);
- static inline const_e_iterator
- pref_begin(const_node_pointer);
+ static inline a_const_iterator
+ pref_begin(node_const_pointer);
- static inline const_e_iterator
- pref_end(const_node_pointer);
+ static inline a_const_iterator
+ pref_end(node_const_pointer);
inline node_pointer
- find_imp(const_key_reference);
+ find_imp(key_const_reference);
inline node_pointer
- lower_bound_imp(const_key_reference);
+ lower_bound_imp(key_const_reference);
inline node_pointer
- upper_bound_imp(const_key_reference);
+ upper_bound_imp(key_const_reference);
- inline static const_leaf_pointer
- leftmost_descendant(const_node_pointer);
+ inline static leaf_const_pointer
+ leftmost_descendant(node_const_pointer);
inline static leaf_pointer
leftmost_descendant(node_pointer);
- inline static const_leaf_pointer
- rightmost_descendant(const_node_pointer);
+ inline static leaf_const_pointer
+ rightmost_descendant(node_const_pointer);
inline static leaf_pointer
rightmost_descendant(node_pointer);
#ifdef _GLIBCXX_DEBUG
void
- assert_valid(const char* file, int line) const;
+ assert_valid(const char*, int) const;
void
- assert_iterators(const char* file, int line) const;
+ assert_iterators(const char*, int) const;
void
- assert_reverse_iterators(const char* file, int line) const;
+ assert_reverse_iterators(const char*, int) const;
static size_type
- recursive_count_leafs(const_node_pointer,
- const char* file, int line);
-#endif
+ recursive_count_leafs(node_const_pointer, const char*, int);
+#endif
#ifdef PB_DS_PAT_TRIE_TRACE_
static void
- trace_node(const_node_pointer, size_type);
+ trace_node(node_const_pointer, size_type);
template<typename Metadata_>
static void
- trace_node_metadata(const_node_pointer, type_to_type<Metadata_>);
+ trace_node_metadata(node_const_pointer, type_to_type<Metadata_>);
static void
- trace_node_metadata(const_node_pointer, type_to_type<null_node_metadata>);
-#endif
+ trace_node_metadata(node_const_pointer, type_to_type<null_type>);
+#endif
leaf_pointer
- split_prep(const_key_reference, PB_DS_CLASS_C_DEC&,
- split_join_branch_bag&);
+ split_prep(key_const_reference, PB_DS_CLASS_C_DEC&, branch_bag&);
node_pointer
- rec_split(node_pointer, const_e_iterator, const_e_iterator,
- PB_DS_CLASS_C_DEC&, split_join_branch_bag&);
+ rec_split(node_pointer, a_const_iterator, a_const_iterator,
+ PB_DS_CLASS_C_DEC&, branch_bag&);
void
- split_insert_branch(size_type, const_e_iterator,
- typename internal_node::iterator,
- size_type, split_join_branch_bag&);
+ split_insert_branch(size_type, a_const_iterator, inode_iterator,
+ size_type, branch_bag&);
- static head_allocator s_head_allocator;
- static internal_node_allocator s_internal_node_allocator;
- static leaf_allocator s_leaf_allocator;
+ static head_allocator s_head_allocator;
+ static inode_allocator s_inode_allocator;
+ static leaf_allocator s_leaf_allocator;
- head_pointer m_p_head;
- size_type m_size;
+ head_pointer m_p_head;
+ size_type m_size;
};
-#define PB_DS_ASSERT_NODE_VALID(X) \
+#define PB_DS_ASSERT_NODE_VALID(X) \
_GLIBCXX_DEBUG_ONLY(X->assert_valid(this, __FILE__, __LINE__);)
-#define PB_DS_RECURSIVE_COUNT_LEAFS(X) \
+#define PB_DS_RECURSIVE_COUNT_LEAFS(X) \
recursive_count_leafs(X, __FILE__, __LINE__)
#include <ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp>
@@ -517,12 +581,8 @@ namespace __gnu_pbds
#undef PB_DS_ASSERT_NODE_VALID
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_NAME
-#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_PAT_TRIE_NAME
+#undef PB_DS_PAT_TRIE_TRAITS_BASE
#undef PB_DS_DEBUG_MAP_BASE_C_DEC
-#undef PB_DS_V2F
-#undef PB_DS_EP2VP
-#undef PB_DS_V2S
-
} // namespace detail
} // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp
new file mode 100644
index 00000000000..b3718b51ed2
--- /dev/null
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp
@@ -0,0 +1,1357 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file pat_trie_/pat_trie_base.hpp
+ * Contains the base class for a patricia tree.
+ */
+
+#ifndef PB_DS_PAT_TRIE_BASE
+#define PB_DS_PAT_TRIE_BASE
+
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ /// Base type for PATRICIA trees.
+ struct pat_trie_base
+ {
+ /// Three types of nodes.
+ enum node_type
+ {
+ i_node,
+ leaf_node,
+ head_node
+ };
+
+ /// Metadata base primary template.
+ template<typename Metadata, typename _Alloc>
+ struct _Metadata
+ {
+ typedef Metadata metadata_type;
+ typedef _Alloc allocator_type;
+ typedef typename _Alloc::template rebind<Metadata> __rebind_m;
+ typedef typename __rebind_m::other::const_reference const_reference;
+
+ const_reference
+ get_metadata() const
+ { return m_metadata; }
+
+ metadata_type m_metadata;
+ };
+
+ /// Specialization for null metadata.
+ template<typename _Alloc>
+ struct _Metadata<null_type, _Alloc>
+ {
+ typedef null_type metadata_type;
+ typedef _Alloc allocator_type;
+ };
+
+
+ /// Node base.
+ template<typename _ATraits, typename Metadata>
+ struct _Node_base
+ : public Metadata
+ {
+ private:
+ typedef typename Metadata::allocator_type _Alloc;
+
+ public:
+ typedef _Alloc allocator_type;
+ typedef _ATraits access_traits;
+ typedef typename _ATraits::type_traits type_traits;
+ typedef typename _Alloc::template rebind<_Node_base> __rebind_n;
+ typedef typename __rebind_n::other::pointer node_pointer;
+
+ node_pointer m_p_parent;
+ const node_type m_type;
+
+ _Node_base(node_type type) : m_type(type)
+ { }
+
+ typedef typename _Alloc::template rebind<_ATraits> __rebind_at;
+ typedef typename __rebind_at::other::const_pointer a_const_pointer;
+ typedef typename _ATraits::const_iterator a_const_iterator;
+
+#ifdef _GLIBCXX_DEBUG
+ typedef std::pair<a_const_iterator, a_const_iterator> node_debug_info;
+
+ void
+ assert_valid(a_const_pointer p_traits,
+ const char* __file, int __line) const
+ { assert_valid_imp(p_traits, __file, __line); }
+
+ virtual node_debug_info
+ assert_valid_imp(a_const_pointer, const char*, int) const = 0;
+#endif
+ };
+
+
+ /// Head node for PATRICIA tree.
+ template<typename _ATraits, typename Metadata>
+ struct _Head
+ : public _Node_base<_ATraits, Metadata>
+ {
+ typedef _Node_base<_ATraits, Metadata> base_type;
+ typedef typename base_type::type_traits type_traits;
+ typedef typename base_type::node_pointer node_pointer;
+
+ node_pointer m_p_min;
+ node_pointer m_p_max;
+
+ _Head() : base_type(head_node) { }
+
+#ifdef _GLIBCXX_DEBUG
+ typedef typename base_type::node_debug_info node_debug_info;
+ typedef typename base_type::a_const_pointer a_const_pointer;
+
+ virtual node_debug_info
+ assert_valid_imp(a_const_pointer, const char* __file, int __line) const
+ {
+ _GLIBCXX_DEBUG_VERIFY_AT(false,
+ _M_message("Assertion from %1;:%2;")
+ ._M_string(__FILE__)._M_integer(__LINE__),
+ __file, __line);
+ return node_debug_info();
+ }
+#endif
+ };
+
+
+ /// Leaf node for PATRICIA tree.
+ template<typename _ATraits, typename Metadata>
+ struct _Leaf
+ : public _Node_base<_ATraits, Metadata>
+ {
+ typedef _Node_base<_ATraits, Metadata> base_type;
+ typedef typename base_type::type_traits type_traits;
+ typedef typename type_traits::value_type value_type;
+ typedef typename type_traits::reference reference;
+ typedef typename type_traits::const_reference const_reference;
+
+ private:
+ value_type m_value;
+
+ _Leaf(const _Leaf&);
+
+ public:
+ _Leaf(const_reference other)
+ : base_type(leaf_node), m_value(other) { }
+
+ reference
+ value()
+ { return m_value; }
+
+ const_reference
+ value() const
+ { return m_value; }
+
+#ifdef _GLIBCXX_DEBUG
+ typedef typename base_type::node_debug_info node_debug_info;
+ typedef typename base_type::a_const_pointer a_const_pointer;
+
+ virtual node_debug_info
+ assert_valid_imp(a_const_pointer p_traits,
+ const char* __file, int __line) const
+ {
+ PB_DS_DEBUG_VERIFY(base_type::m_type == leaf_node);
+ node_debug_info ret;
+ const_reference r_val = value();
+ return std::make_pair(p_traits->begin(p_traits->extract_key(r_val)),
+ p_traits->end(p_traits->extract_key(r_val)));
+ }
+
+ virtual
+ ~_Leaf() { }
+#endif
+ };
+
+
+ /// Internal node type, PATRICIA tree.
+ template<typename _ATraits, typename Metadata>
+ struct _Inode
+ : public _Node_base<_ATraits, Metadata>
+ {
+ typedef _Node_base<_ATraits, Metadata> base_type;
+ typedef typename base_type::type_traits type_traits;
+ typedef typename base_type::access_traits access_traits;
+ typedef typename type_traits::value_type value_type;
+ typedef typename base_type::allocator_type _Alloc;
+ typedef _Alloc allocator_type;
+ typedef typename _Alloc::size_type size_type;
+
+ private:
+ typedef typename base_type::a_const_pointer a_const_pointer;
+ typedef typename base_type::a_const_iterator a_const_iterator;
+
+ typedef typename base_type::node_pointer node_pointer;
+ typedef typename _Alloc::template rebind<base_type> __rebind_n;
+ typedef typename __rebind_n::other::const_pointer node_const_pointer;
+
+ typedef _Leaf<_ATraits, Metadata> leaf;
+ typedef typename _Alloc::template rebind<leaf>::other __rebind_l;
+ typedef typename __rebind_l::pointer leaf_pointer;
+ typedef typename __rebind_l::const_pointer leaf_const_pointer;
+
+ typedef typename _Alloc::template rebind<_Inode>::other __rebind_in;
+ typedef typename __rebind_in::pointer inode_pointer;
+ typedef typename __rebind_in::const_pointer inode_const_pointer;
+
+ inline size_type
+ get_pref_pos(a_const_iterator, a_const_iterator, a_const_pointer) const;
+
+ public:
+ typedef typename _Alloc::template rebind<node_pointer>::other __rebind_np;
+ typedef typename __rebind_np::pointer node_pointer_pointer;
+ typedef typename __rebind_np::reference node_pointer_reference;
+
+ enum
+ {
+ arr_size = _ATraits::max_size + 1
+ };
+ PB_DS_STATIC_ASSERT(min_arr_size, arr_size >= 2);
+
+
+ /// Constant child iterator.
+ struct const_iterator
+ {
+ node_pointer_pointer m_p_p_cur;
+ node_pointer_pointer m_p_p_end;
+
+ typedef std::forward_iterator_tag iterator_category;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef node_pointer value_type;
+ typedef node_pointer_pointer pointer;
+ typedef node_pointer_reference reference;
+
+ const_iterator(node_pointer_pointer p_p_cur = 0,
+ node_pointer_pointer p_p_end = 0)
+ : m_p_p_cur(p_p_cur), m_p_p_end(p_p_end)
+ { }
+
+ bool
+ operator==(const const_iterator& other) const
+ { return m_p_p_cur == other.m_p_p_cur; }
+
+ bool
+ operator!=(const const_iterator& other) const
+ { return m_p_p_cur != other.m_p_p_cur; }
+
+ const_iterator&
+ operator++()
+ {
+ do
+ ++m_p_p_cur;
+ while (m_p_p_cur != m_p_p_end && *m_p_p_cur == 0);
+ return *this;
+ }
+
+ const_iterator
+ operator++(int)
+ {
+ const_iterator ret_it(*this);
+ operator++();
+ return ret_it;
+ }
+
+ const node_pointer_pointer
+ operator->() const
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_referencible();)
+ return m_p_p_cur;
+ }
+
+ node_const_pointer
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_referencible();)
+ return *m_p_p_cur;
+ }
+
+ protected:
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_referencible() const
+ { _GLIBCXX_DEBUG_ASSERT(m_p_p_cur != m_p_p_end && *m_p_p_cur != 0); }
+#endif
+ };
+
+
+ /// Child iterator.
+ struct iterator : public const_iterator
+ {
+ public:
+ typedef std::forward_iterator_tag iterator_category;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef node_pointer value_type;
+ typedef node_pointer_pointer pointer;
+ typedef node_pointer_reference reference;
+
+ inline
+ iterator(node_pointer_pointer p_p_cur = 0,
+ node_pointer_pointer p_p_end = 0)
+ : const_iterator(p_p_cur, p_p_end) { }
+
+ bool
+ operator==(const iterator& other) const
+ { return const_iterator::m_p_p_cur == other.m_p_p_cur; }
+
+ bool
+ operator!=(const iterator& other) const
+ { return const_iterator::m_p_p_cur != other.m_p_p_cur; }
+
+ iterator&
+ operator++()
+ {
+ const_iterator::operator++();
+ return *this;
+ }
+
+ iterator
+ operator++(int)
+ {
+ iterator ret_it(*this);
+ operator++();
+ return ret_it;
+ }
+
+ node_pointer_pointer
+ operator->()
+ {
+ _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)
+ return const_iterator::m_p_p_cur;
+ }
+
+ node_pointer
+ operator*()
+ {
+ _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)
+ return *const_iterator::m_p_p_cur;
+ }
+ };
+
+
+ _Inode(size_type, const a_const_iterator);
+
+ void
+ update_prefixes(a_const_pointer);
+
+ const_iterator
+ begin() const;
+
+ iterator
+ begin();
+
+ const_iterator
+ end() const;
+
+ iterator
+ end();
+
+ inline node_pointer
+ get_child_node(a_const_iterator, a_const_iterator, a_const_pointer);
+
+ inline node_const_pointer
+ get_child_node(a_const_iterator, a_const_iterator, a_const_pointer) const;
+
+ inline iterator
+ get_child_it(a_const_iterator, a_const_iterator, a_const_pointer);
+
+ inline node_pointer
+ get_lower_bound_child_node(a_const_iterator, a_const_iterator,
+ size_type, a_const_pointer);
+
+ inline node_pointer
+ add_child(node_pointer, a_const_iterator, a_const_iterator,
+ a_const_pointer);
+
+ inline node_const_pointer
+ get_join_child(node_const_pointer, a_const_pointer) const;
+
+ inline node_pointer
+ get_join_child(node_pointer, a_const_pointer);
+
+ void
+ remove_child(node_pointer);
+
+ void
+ remove_child(iterator);
+
+ void
+ replace_child(node_pointer, a_const_iterator, a_const_iterator,
+ a_const_pointer);
+
+ inline a_const_iterator
+ pref_b_it() const;
+
+ inline a_const_iterator
+ pref_e_it() const;
+
+ bool
+ should_be_mine(a_const_iterator, a_const_iterator, size_type,
+ a_const_pointer) const;
+
+ leaf_pointer
+ leftmost_descendant();
+
+ leaf_const_pointer
+ leftmost_descendant() const;
+
+ leaf_pointer
+ rightmost_descendant();
+
+ leaf_const_pointer
+ rightmost_descendant() const;
+
+#ifdef _GLIBCXX_DEBUG
+ typedef typename base_type::node_debug_info node_debug_info;
+
+ virtual node_debug_info
+ assert_valid_imp(a_const_pointer, const char*, int) const;
+#endif
+
+ size_type
+ get_e_ind() const
+ { return m_e_ind; }
+
+ private:
+ _Inode(const _Inode&);
+
+ size_type
+ get_begin_pos() const;
+
+ static __rebind_l s_leaf_alloc;
+ static __rebind_in s_inode_alloc;
+
+ const size_type m_e_ind;
+ a_const_iterator m_pref_b_it;
+ a_const_iterator m_pref_e_it;
+ node_pointer m_a_p_children[arr_size];
+ };
+
+#define PB_DS_CONST_IT_C_DEC \
+ _CIter<Node, Leaf, Head, Inode, Is_Forward_Iterator>
+
+#define PB_DS_CONST_ODIR_IT_C_DEC \
+ _CIter<Node, Leaf, Head, Inode, !Is_Forward_Iterator>
+
+#define PB_DS_IT_C_DEC \
+ _Iter<Node, Leaf, Head, Inode, Is_Forward_Iterator>
+
+#define PB_DS_ODIR_IT_C_DEC \
+ _Iter<Node, Leaf, Head, Inode, !Is_Forward_Iterator>
+
+
+ /// Const iterator.
+ template<typename Node, typename Leaf, typename Head, typename Inode,
+ bool Is_Forward_Iterator>
+ class _CIter
+ {
+ public:
+ // These types are all the same for the first four template arguments.
+ typedef typename Node::allocator_type allocator_type;
+ typedef typename Node::type_traits type_traits;
+
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef typename allocator_type::difference_type difference_type;
+ typedef typename type_traits::value_type value_type;
+ typedef typename type_traits::pointer pointer;
+ typedef typename type_traits::reference reference;
+ typedef typename type_traits::const_pointer const_pointer;
+ typedef typename type_traits::const_reference const_reference;
+
+ typedef allocator_type _Alloc;
+ typedef typename _Alloc::template rebind<Node> __rebind_n;
+ typedef typename __rebind_n::other::pointer node_pointer;
+ typedef typename _Alloc::template rebind<Leaf> __rebind_l;
+ typedef typename __rebind_l::other::pointer leaf_pointer;
+ typedef typename __rebind_l::other::const_pointer leaf_const_pointer;
+ typedef typename _Alloc::template rebind<Head> __rebind_h;
+ typedef typename __rebind_h::other::pointer head_pointer;
+
+ typedef typename _Alloc::template rebind<Inode> __rebind_in;
+ typedef typename __rebind_in::other::pointer inode_pointer;
+ typedef typename Inode::iterator inode_iterator;
+
+ node_pointer m_p_nd;
+
+ _CIter(node_pointer p_nd = 0) : m_p_nd(p_nd)
+ { }
+
+ _CIter(const PB_DS_CONST_ODIR_IT_C_DEC& other)
+ : m_p_nd(other.m_p_nd)
+ { }
+
+ _CIter&
+ operator=(const _CIter& other)
+ {
+ m_p_nd = other.m_p_nd;
+ return *this;
+ }
+
+ _CIter&
+ operator=(const PB_DS_CONST_ODIR_IT_C_DEC& other)
+ {
+ m_p_nd = other.m_p_nd;
+ return *this;
+ }
+
+ const_pointer
+ operator->() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == leaf_node);
+ return &static_cast<leaf_pointer>(m_p_nd)->value();
+ }
+
+ const_reference
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == leaf_node);
+ return static_cast<leaf_pointer>(m_p_nd)->value();
+ }
+
+ bool
+ operator==(const _CIter& other) const
+ { return m_p_nd == other.m_p_nd; }
+
+ bool
+ operator==(const PB_DS_CONST_ODIR_IT_C_DEC& other) const
+ { return m_p_nd == other.m_p_nd; }
+
+ bool
+ operator!=(const _CIter& other) const
+ { return m_p_nd != other.m_p_nd; }
+
+ bool
+ operator!=(const PB_DS_CONST_ODIR_IT_C_DEC& other) const
+ { return m_p_nd != other.m_p_nd; }
+
+ _CIter&
+ operator++()
+ {
+ inc(integral_constant<int, Is_Forward_Iterator>());
+ return *this;
+ }
+
+ _CIter
+ operator++(int)
+ {
+ _CIter ret_it(m_p_nd);
+ operator++();
+ return ret_it;
+ }
+
+ _CIter&
+ operator--()
+ {
+ dec(integral_constant<int, Is_Forward_Iterator>());
+ return *this;
+ }
+
+ _CIter
+ operator--(int)
+ {
+ _CIter ret_it(m_p_nd);
+ operator--();
+ return ret_it;
+ }
+
+ protected:
+ void
+ inc(false_type)
+ { dec(true_type()); }
+
+ void
+ inc(true_type)
+ {
+ if (m_p_nd->m_type == head_node)
+ {
+ m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_min;
+ return;
+ }
+
+ node_pointer p_y = m_p_nd->m_p_parent;
+ while (p_y->m_type != head_node && get_larger_sibling(m_p_nd) == 0)
+ {
+ m_p_nd = p_y;
+ p_y = p_y->m_p_parent;
+ }
+
+ if (p_y->m_type == head_node)
+ {
+ m_p_nd = p_y;
+ return;
+ }
+ m_p_nd = leftmost_descendant(get_larger_sibling(m_p_nd));
+ }
+
+ void
+ dec(false_type)
+ { inc(true_type()); }
+
+ void
+ dec(true_type)
+ {
+ if (m_p_nd->m_type == head_node)
+ {
+ m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_max;
+ return;
+ }
+
+ node_pointer p_y = m_p_nd->m_p_parent;
+ while (p_y->m_type != head_node && get_smaller_sibling(m_p_nd) == 0)
+ {
+ m_p_nd = p_y;
+ p_y = p_y->m_p_parent;
+ }
+
+ if (p_y->m_type == head_node)
+ {
+ m_p_nd = p_y;
+ return;
+ }
+ m_p_nd = rightmost_descendant(get_smaller_sibling(m_p_nd));
+ }
+
+ static node_pointer
+ get_larger_sibling(node_pointer p_nd)
+ {
+ inode_pointer p_parent = static_cast<inode_pointer>(p_nd->m_p_parent);
+
+ inode_iterator it = p_parent->begin();
+ while (*it != p_nd)
+ ++it;
+
+ inode_iterator next_it = it;
+ ++next_it;
+ return (next_it == p_parent->end())? 0 : *next_it;
+ }
+
+ static node_pointer
+ get_smaller_sibling(node_pointer p_nd)
+ {
+ inode_pointer p_parent = static_cast<inode_pointer>(p_nd->m_p_parent);
+
+ inode_iterator it = p_parent->begin();
+ if (*it == p_nd)
+ return 0;
+
+ inode_iterator prev_it;
+ do
+ {
+ prev_it = it;
+ ++it;
+ if (*it == p_nd)
+ return *prev_it;
+ }
+ while (true);
+
+ _GLIBCXX_DEBUG_ASSERT(false);
+ return 0;
+ }
+
+ static leaf_pointer
+ leftmost_descendant(node_pointer p_nd)
+ {
+ if (p_nd->m_type == leaf_node)
+ return static_cast<leaf_pointer>(p_nd);
+ return static_cast<inode_pointer>(p_nd)->leftmost_descendant();
+ }
+
+ static leaf_pointer
+ rightmost_descendant(node_pointer p_nd)
+ {
+ if (p_nd->m_type == leaf_node)
+ return static_cast<leaf_pointer>(p_nd);
+ return static_cast<inode_pointer>(p_nd)->rightmost_descendant();
+ }
+ };
+
+
+ /// Iterator.
+ template<typename Node, typename Leaf, typename Head, typename Inode,
+ bool Is_Forward_Iterator>
+ class _Iter
+ : public _CIter<Node, Leaf, Head, Inode, Is_Forward_Iterator>
+ {
+ public:
+ typedef _CIter<Node, Leaf, Head, Inode, Is_Forward_Iterator>
+ base_type;
+ typedef typename base_type::allocator_type allocator_type;
+ typedef typename base_type::type_traits type_traits;
+ typedef typename type_traits::value_type value_type;
+ typedef typename type_traits::pointer pointer;
+ typedef typename type_traits::reference reference;
+
+ typedef typename base_type::node_pointer node_pointer;
+ typedef typename base_type::leaf_pointer leaf_pointer;
+ typedef typename base_type::leaf_const_pointer leaf_const_pointer;
+ typedef typename base_type::head_pointer head_pointer;
+ typedef typename base_type::inode_pointer inode_pointer;
+
+ _Iter(node_pointer p_nd = 0)
+ : base_type(p_nd) { }
+
+ _Iter(const PB_DS_ODIR_IT_C_DEC& other)
+ : base_type(other.m_p_nd) { }
+
+ _Iter&
+ operator=(const _Iter& other)
+ {
+ base_type::m_p_nd = other.m_p_nd;
+ return *this;
+ }
+
+ _Iter&
+ operator=(const PB_DS_ODIR_IT_C_DEC& other)
+ {
+ base_type::m_p_nd = other.m_p_nd;
+ return *this;
+ }
+
+ pointer
+ operator->() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == leaf_node);
+ return &static_cast<leaf_pointer>(base_type::m_p_nd)->value();
+ }
+
+ reference
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == leaf_node);
+ return static_cast<leaf_pointer>(base_type::m_p_nd)->value();
+ }
+
+ _Iter&
+ operator++()
+ {
+ base_type::operator++();
+ return *this;
+ }
+
+ _Iter
+ operator++(int)
+ {
+ _Iter ret(base_type::m_p_nd);
+ operator++();
+ return ret;
+ }
+
+ _Iter&
+ operator--()
+ {
+ base_type::operator--();
+ return *this;
+ }
+
+ _Iter
+ operator--(int)
+ {
+ _Iter ret(base_type::m_p_nd);
+ operator--();
+ return ret;
+ }
+ };
+
+#undef PB_DS_CONST_ODIR_IT_C_DEC
+#undef PB_DS_ODIR_IT_C_DEC
+
+
+#define PB_DS_PAT_TRIE_NODE_CONST_ITERATOR_C_DEC \
+ _Node_citer<Node, Leaf, Head, Inode, _CIterator, Iterator, _ATraits, _Alloc>
+
+#define PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC \
+ _Node_iter<Node, Leaf, Head, Inode, _CIterator, Iterator, _ATraits, _Alloc>
+
+ /// Node const iterator.
+ template<typename Node,
+ typename Leaf,
+ typename Head,
+ typename Inode,
+ typename _CIterator,
+ typename Iterator,
+ typename _Alloc>
+ class _Node_citer
+ {
+ protected:
+ typedef typename _Alloc::template rebind<Node> __rebind_n;
+ typedef typename __rebind_n::other::pointer node_pointer;
+
+ typedef typename _Alloc::template rebind<Leaf> __rebind_l;
+ typedef typename __rebind_l::other::pointer leaf_pointer;
+ typedef typename __rebind_l::other::const_pointer leaf_const_pointer;
+
+ typedef typename _Alloc::template rebind<Inode> __rebind_in;
+ typedef typename __rebind_in::other::pointer inode_pointer;
+ typedef typename __rebind_in::other::const_pointer inode_const_pointer;
+
+ typedef typename Node::a_const_pointer a_const_pointer;
+ typedef typename Node::a_const_iterator a_const_iterator;
+
+ private:
+ a_const_iterator
+ pref_begin() const
+ {
+ if (m_p_nd->m_type == leaf_node)
+ {
+ leaf_const_pointer lcp = static_cast<leaf_const_pointer>(m_p_nd);
+ return m_p_traits->begin(m_p_traits->extract_key(lcp->value()));
+ }
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);
+ return static_cast<inode_const_pointer>(m_p_nd)->pref_b_it();
+ }
+
+ a_const_iterator
+ pref_end() const
+ {
+ if (m_p_nd->m_type == leaf_node)
+ {
+ leaf_const_pointer lcp = static_cast<leaf_const_pointer>(m_p_nd);
+ return m_p_traits->end(m_p_traits->extract_key(lcp->value()));
+ }
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);
+ return static_cast<inode_const_pointer>(m_p_nd)->pref_e_it();
+ }
+
+ public:
+ typedef trivial_iterator_tag iterator_category;
+ typedef trivial_iterator_difference_type difference_type;
+ typedef typename _Alloc::size_type size_type;
+
+ typedef _CIterator value_type;
+ typedef value_type reference;
+ typedef value_type const_reference;
+
+ // Metadata type.
+ typedef typename Node::metadata_type metadata_type;
+
+ // Const metadata reference type.
+ typedef typename _Alloc::template rebind<metadata_type> __rebind_m;
+ typedef typename __rebind_m::other __rebind_ma;
+ typedef typename __rebind_ma::const_reference metadata_const_reference;
+
+ inline
+ _Node_citer(node_pointer p_nd = 0, a_const_pointer p_traits = 0)
+ : m_p_nd(const_cast<node_pointer>(p_nd)), m_p_traits(p_traits)
+ { }
+
+ // Subtree valid prefix.
+ std::pair<a_const_iterator, a_const_iterator>
+ valid_prefix() const
+ { return std::make_pair(pref_begin(), pref_end()); }
+
+ // Const access; returns the __const iterator* associated with
+ // the current leaf.
+ const_reference
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(num_children() == 0);
+ return _CIterator(m_p_nd);
+ }
+
+ // Metadata access.
+ metadata_const_reference
+ get_metadata() const
+ { return m_p_nd->get_metadata(); }
+
+ // Returns the number of children in the corresponding node.
+ size_type
+ num_children() const
+ {
+ if (m_p_nd->m_type == leaf_node)
+ return 0;
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);
+ inode_pointer inp = static_cast<inode_pointer>(m_p_nd);
+ return std::distance(inp->begin(), inp->end());
+ }
+
+ // Returns a __const node __iterator to the corresponding node's
+ // i-th child.
+ _Node_citer
+ get_child(size_type i) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);
+ inode_pointer inp = static_cast<inode_pointer>(m_p_nd);
+ typename Inode::iterator it = inp->begin();
+ std::advance(it, i);
+ return _Node_citer(*it, m_p_traits);
+ }
+
+ // Compares content to a different iterator object.
+ bool
+ operator==(const _Node_citer& other) const
+ { return m_p_nd == other.m_p_nd; }
+
+ // Compares content (negatively) to a different iterator object.
+ bool
+ operator!=(const _Node_citer& other) const
+ { return m_p_nd != other.m_p_nd; }
+
+ node_pointer m_p_nd;
+ a_const_pointer m_p_traits;
+ };
+
+
+ /// Node iterator.
+ template<typename Node,
+ typename Leaf,
+ typename Head,
+ typename Inode,
+ typename _CIterator,
+ typename Iterator,
+ typename _Alloc>
+ class _Node_iter
+ : public _Node_citer<Node, Leaf, Head, Inode, _CIterator, Iterator, _Alloc>
+ {
+ private:
+ typedef _Node_citer<Node, Leaf, Head, Inode,
+ _CIterator, Iterator, _Alloc> base_type;
+ typedef typename _Alloc::template rebind<Node> __rebind_n;
+ typedef typename __rebind_n::other::pointer node_pointer;
+ typedef typename base_type::inode_pointer inode_pointer;
+ typedef typename base_type::a_const_pointer a_const_pointer;
+ typedef Iterator iterator;
+
+ public:
+ typedef typename base_type::size_type size_type;
+
+ typedef Iterator value_type;
+ typedef value_type reference;
+ typedef value_type const_reference;
+
+ _Node_iter(node_pointer p_nd = 0, a_const_pointer p_traits = 0)
+ : base_type(p_nd, p_traits)
+ { }
+
+ // Access; returns the iterator* associated with the current leaf.
+ reference
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::num_children() == 0);
+ return iterator(base_type::m_p_nd);
+ }
+
+ // Returns a node __iterator to the corresponding node's i-th child.
+ _Node_iter
+ get_child(size_type i) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == i_node);
+
+ typename Inode::iterator it =
+ static_cast<inode_pointer>(base_type::m_p_nd)->begin();
+
+ std::advance(it, i);
+ return _Node_iter(*it, base_type::m_p_traits);
+ }
+ };
+ };
+
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename _ATraits, typename Metadata>
+
+#define PB_DS_CLASS_C_DEC \
+ pat_trie_base::_Inode<_ATraits, Metadata>
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::__rebind_l
+ PB_DS_CLASS_C_DEC::s_leaf_alloc;
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::__rebind_in
+ PB_DS_CLASS_C_DEC::s_inode_alloc;
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ get_pref_pos(a_const_iterator b_it, a_const_iterator e_it,
+ a_const_pointer p_traits) const
+ {
+ if (static_cast<std::size_t>(std::distance(b_it, e_it)) <= m_e_ind)
+ return 0;
+ std::advance(b_it, m_e_ind);
+ return 1 + p_traits->e_pos(*b_it);
+ }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ _Inode(size_type len, const a_const_iterator it)
+ : base_type(i_node), m_e_ind(len), m_pref_b_it(it), m_pref_e_it(it)
+ {
+ std::advance(m_pref_e_it, m_e_ind);
+ std::fill(m_a_p_children, m_a_p_children + arr_size,
+ static_cast<node_pointer>(0));
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ update_prefixes(a_const_pointer p_traits)
+ {
+ node_pointer p_first = *begin();
+ if (p_first->m_type == leaf_node)
+ {
+ leaf_const_pointer p = static_cast<leaf_const_pointer>(p_first);
+ m_pref_b_it = p_traits->begin(access_traits::extract_key(p->value()));
+ }
+ else
+ {
+ inode_pointer p = static_cast<inode_pointer>(p_first);
+ _GLIBCXX_DEBUG_ASSERT(p_first->m_type == i_node);
+ m_pref_b_it = p->pref_b_it();
+ }
+ m_pref_e_it = m_pref_b_it;
+ std::advance(m_pref_e_it, m_e_ind);
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::const_iterator
+ PB_DS_CLASS_C_DEC::
+ begin() const
+ {
+ typedef node_pointer_pointer pointer_type;
+ pointer_type p = const_cast<pointer_type>(m_a_p_children);
+ return const_iterator(p + get_begin_pos(), p + arr_size);
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::iterator
+ PB_DS_CLASS_C_DEC::
+ begin()
+ {
+ return iterator(m_a_p_children + get_begin_pos(),
+ m_a_p_children + arr_size);
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::const_iterator
+ PB_DS_CLASS_C_DEC::
+ end() const
+ {
+ typedef node_pointer_pointer pointer_type;
+ pointer_type p = const_cast<pointer_type>(m_a_p_children) + arr_size;
+ return const_iterator(p, p);
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::iterator
+ PB_DS_CLASS_C_DEC::
+ end()
+ { return iterator(m_a_p_children + arr_size, m_a_p_children + arr_size); }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::node_pointer
+ PB_DS_CLASS_C_DEC::
+ get_child_node(a_const_iterator b_it, a_const_iterator e_it,
+ a_const_pointer p_traits)
+ {
+ const size_type i = get_pref_pos(b_it, e_it, p_traits);
+ _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+ return m_a_p_children[i];
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::iterator
+ PB_DS_CLASS_C_DEC::
+ get_child_it(a_const_iterator b_it, a_const_iterator e_it,
+ a_const_pointer p_traits)
+ {
+ const size_type i = get_pref_pos(b_it, e_it, p_traits);
+ _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+ _GLIBCXX_DEBUG_ASSERT(m_a_p_children[i] != 0);
+ return iterator(m_a_p_children + i, m_a_p_children + i);
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::node_const_pointer
+ PB_DS_CLASS_C_DEC::
+ get_child_node(a_const_iterator b_it, a_const_iterator e_it,
+ a_const_pointer p_traits) const
+ { return const_cast<node_pointer>(get_child_node(b_it, e_it, p_traits)); }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::node_pointer
+ PB_DS_CLASS_C_DEC::
+ get_lower_bound_child_node(a_const_iterator b_it, a_const_iterator e_it,
+ size_type checked_ind,
+ a_const_pointer p_traits)
+ {
+ if (!should_be_mine(b_it, e_it, checked_ind, p_traits))
+ {
+ if (p_traits->cmp_prefixes(b_it, e_it, m_pref_b_it,
+ m_pref_e_it, true))
+ return leftmost_descendant();
+ return rightmost_descendant();
+ }
+
+ size_type i = get_pref_pos(b_it, e_it, p_traits);
+ _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+
+ if (m_a_p_children[i] != 0)
+ return m_a_p_children[i];
+
+ while (++i < arr_size)
+ if (m_a_p_children[i] != 0)
+ {
+ const node_type& __nt = m_a_p_children[i]->m_type;
+ node_pointer ret = m_a_p_children[i];
+
+ if (__nt == leaf_node)
+ return ret;
+
+ _GLIBCXX_DEBUG_ASSERT(__nt == i_node);
+ inode_pointer inp = static_cast<inode_pointer>(ret);
+ return inp->leftmost_descendant();
+ }
+
+ return rightmost_descendant();
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::node_pointer
+ PB_DS_CLASS_C_DEC::
+ add_child(node_pointer p_nd, a_const_iterator b_it, a_const_iterator e_it,
+ a_const_pointer p_traits)
+ {
+ const size_type i = get_pref_pos(b_it, e_it, p_traits);
+ _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+ if (m_a_p_children[i] == 0)
+ {
+ m_a_p_children[i] = p_nd;
+ p_nd->m_p_parent = this;
+ return p_nd;
+ }
+ return m_a_p_children[i];
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::node_const_pointer
+ PB_DS_CLASS_C_DEC::
+ get_join_child(node_const_pointer p_nd,
+ a_const_pointer p_tr) const
+ {
+ node_pointer p = const_cast<node_pointer>(p_nd);
+ return const_cast<inode_pointer>(this)->get_join_child(p, p_tr);
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::node_pointer
+ PB_DS_CLASS_C_DEC::
+ get_join_child(node_pointer p_nd, a_const_pointer p_traits)
+ {
+ size_type i;
+ a_const_iterator b_it;
+ a_const_iterator e_it;
+ if (p_nd->m_type == leaf_node)
+ {
+ leaf_const_pointer p = static_cast<leaf_const_pointer>(p_nd);
+
+ typedef typename type_traits::key_const_reference kcr;
+ kcr r_key = access_traits::extract_key(p->value());
+ b_it = p_traits->begin(r_key);
+ e_it = p_traits->end(r_key);
+ }
+ else
+ {
+ b_it = static_cast<inode_pointer>(p_nd)->pref_b_it();
+ e_it = static_cast<inode_pointer>(p_nd)->pref_e_it();
+ }
+ i = get_pref_pos(b_it, e_it, p_traits);
+ _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+ return m_a_p_children[i];
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ remove_child(node_pointer p_nd)
+ {
+ size_type i = 0;
+ for (; i < arr_size; ++i)
+ if (m_a_p_children[i] == p_nd)
+ {
+ m_a_p_children[i] = 0;
+ return;
+ }
+ _GLIBCXX_DEBUG_ASSERT(i != arr_size);
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ remove_child(iterator it)
+ { *it.m_p_p_cur = 0; }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ replace_child(node_pointer p_nd, a_const_iterator b_it,
+ a_const_iterator e_it,
+ a_const_pointer p_traits)
+ {
+ const size_type i = get_pref_pos(b_it, e_it, p_traits);
+ _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+ m_a_p_children[i] = p_nd;
+ p_nd->m_p_parent = this;
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::a_const_iterator
+ PB_DS_CLASS_C_DEC::
+ pref_b_it() const
+ { return m_pref_b_it; }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::a_const_iterator
+ PB_DS_CLASS_C_DEC::
+ pref_e_it() const
+ { return m_pref_e_it; }
+
+ PB_DS_CLASS_T_DEC
+ bool
+ PB_DS_CLASS_C_DEC::
+ should_be_mine(a_const_iterator b_it, a_const_iterator e_it,
+ size_type checked_ind,
+ a_const_pointer p_traits) const
+ {
+ if (m_e_ind == 0)
+ return true;
+
+ const size_type num_es = std::distance(b_it, e_it);
+ if (num_es < m_e_ind)
+ return false;
+
+ a_const_iterator key_b_it = b_it;
+ std::advance(key_b_it, checked_ind);
+ a_const_iterator key_e_it = b_it;
+ std::advance(key_e_it, m_e_ind);
+
+ a_const_iterator value_b_it = m_pref_b_it;
+ std::advance(value_b_it, checked_ind);
+ a_const_iterator value_e_it = m_pref_b_it;
+ std::advance(value_e_it, m_e_ind);
+
+ return p_traits->equal_prefixes(key_b_it, key_e_it, value_b_it,
+ value_e_it);
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::leaf_pointer
+ PB_DS_CLASS_C_DEC::
+ leftmost_descendant()
+ {
+ node_pointer p_pot = *begin();
+ if (p_pot->m_type == leaf_node)
+ return (static_cast<leaf_pointer>(p_pot));
+ _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == i_node);
+ return static_cast<inode_pointer>(p_pot)->leftmost_descendant();
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::leaf_const_pointer
+ PB_DS_CLASS_C_DEC::
+ leftmost_descendant() const
+ { return const_cast<inode_pointer>(this)->leftmost_descendant(); }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::leaf_pointer
+ PB_DS_CLASS_C_DEC::
+ rightmost_descendant()
+ {
+ const size_type num_children = std::distance(begin(), end());
+ _GLIBCXX_DEBUG_ASSERT(num_children >= 2);
+
+ iterator it = begin();
+ std::advance(it, num_children - 1);
+ node_pointer p_pot =* it;
+ if (p_pot->m_type == leaf_node)
+ return static_cast<leaf_pointer>(p_pot);
+ _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == i_node);
+ return static_cast<inode_pointer>(p_pot)->rightmost_descendant();
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::leaf_const_pointer
+ PB_DS_CLASS_C_DEC::
+ rightmost_descendant() const
+ { return const_cast<inode_pointer>(this)->rightmost_descendant(); }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ get_begin_pos() const
+ {
+ size_type i = 0;
+ for (i; i < arr_size && m_a_p_children[i] == 0; ++i)
+ ;
+ return i;
+ }
+
+#ifdef _GLIBCXX_DEBUG
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::node_debug_info
+ PB_DS_CLASS_C_DEC::
+ assert_valid_imp(a_const_pointer p_traits,
+ const char* __file, int __line) const
+ {
+ PB_DS_DEBUG_VERIFY(base_type::m_type == i_node);
+ PB_DS_DEBUG_VERIFY(static_cast<size_type>(std::distance(pref_b_it(), pref_e_it())) == m_e_ind);
+ PB_DS_DEBUG_VERIFY(std::distance(begin(), end()) >= 2);
+
+ for (typename _Inode::const_iterator it = begin(); it != end(); ++it)
+ {
+ node_const_pointer p_nd = *it;
+ PB_DS_DEBUG_VERIFY(p_nd->m_p_parent == this);
+ node_debug_info child_ret = p_nd->assert_valid_imp(p_traits,
+ __file, __line);
+
+ PB_DS_DEBUG_VERIFY(static_cast<size_type>(std::distance(child_ret.first, child_ret.second)) >= m_e_ind);
+ PB_DS_DEBUG_VERIFY(should_be_mine(child_ret.first, child_ret.second, 0, p_traits));
+ PB_DS_DEBUG_VERIFY(get_pref_pos(child_ret.first, child_ret.second, p_traits) == static_cast<size_type>(it.m_p_p_cur - m_a_p_children));
+ }
+ return std::make_pair(pref_b_it(), pref_e_it());
+ }
+#endif
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
deleted file mode 100644
index a3e15062b3e..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
+++ /dev/null
@@ -1,484 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file point_iterators.hpp
- * Contains an implementation class for bin_search_tree_.
- */
-
-#ifndef PB_DS_PAT_TRIE_FIND_ITERATORS_HPP
-#define PB_DS_PAT_TRIE_FIND_ITERATORS_HPP
-
-#include <debug/debug.h>
-
-namespace __gnu_pbds
-{
- namespace detail
- {
-
-#define PB_DS_CONST_IT_C_DEC \
- pat_trie_const_it_< \
- Type_Traits, \
- Node, \
- Leaf, \
- Head, \
- Internal_Node, \
- Is_Forward_Iterator, \
- Allocator>
-
-#define PB_DS_CONST_ODIR_IT_C_DEC \
- pat_trie_const_it_< \
- Type_Traits, \
- Node, \
- Leaf, \
- Head, \
- Internal_Node, \
- !Is_Forward_Iterator, \
- Allocator>
-
-#define PB_DS_IT_C_DEC \
- pat_trie_it_< \
- Type_Traits, \
- Node, \
- Leaf, \
- Head, \
- Internal_Node, \
- Is_Forward_Iterator, \
- Allocator>
-
-#define PB_DS_ODIR_IT_C_DEC \
- pat_trie_it_< \
- Type_Traits, \
- Node, \
- Leaf, \
- Head, \
- Internal_Node, \
- !Is_Forward_Iterator, \
- Allocator>
-
-
- // Const iterator.
- template<typename Type_Traits,
- class Node,
- class Leaf,
- class Head,
- class Internal_Node,
- bool Is_Forward_Iterator,
- class Allocator>
- class pat_trie_const_it_
- {
-
- private:
- typedef
- typename Allocator::template rebind<
- Node>::other::pointer
- node_pointer;
-
- typedef
- typename Allocator::template rebind<
- Leaf>::other::const_pointer
- const_leaf_pointer;
-
- typedef
- typename Allocator::template rebind<
- Leaf>::other::pointer
- leaf_pointer;
-
- typedef
- typename Allocator::template rebind<
- Head>::other::pointer
- head_pointer;
-
- typedef
- typename Allocator::template rebind<
- Internal_Node>::other::pointer
- internal_node_pointer;
-
- public:
-
- typedef std::bidirectional_iterator_tag iterator_category;
-
- typedef typename Allocator::difference_type difference_type;
-
- typedef typename Type_Traits::value_type value_type;
-
- typedef typename Type_Traits::pointer pointer;
-
- typedef typename Type_Traits::const_pointer const_pointer;
-
- typedef typename Type_Traits::reference reference;
-
- typedef typename Type_Traits::const_reference const_reference;
-
- public:
-
- inline
- pat_trie_const_it_(node_pointer p_nd = 0) : m_p_nd(p_nd)
- { }
-
- inline
- pat_trie_const_it_(const PB_DS_CONST_ODIR_IT_C_DEC& other)
- : m_p_nd(other.m_p_nd)
- { }
-
- inline
- PB_DS_CONST_IT_C_DEC&
- operator=(const PB_DS_CONST_IT_C_DEC& other)
- {
- m_p_nd = other.m_p_nd;
- return *this;
- }
-
- inline
- PB_DS_CONST_IT_C_DEC&
- operator=(const PB_DS_CONST_ODIR_IT_C_DEC& other)
- {
- m_p_nd = other.m_p_nd;
- return *this;
- }
-
- inline const_pointer
- operator->() const
- {
- _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_leaf_node_type);
- return &static_cast<leaf_pointer>(m_p_nd)->value();
- }
-
- inline const_reference
- operator*() const
- {
- _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_leaf_node_type);
- return static_cast<leaf_pointer>(m_p_nd)->value();
- }
-
- inline bool
- operator==(const PB_DS_CONST_IT_C_DEC& other) const
- { return (m_p_nd == other.m_p_nd); }
-
- inline bool
- operator==(const PB_DS_CONST_ODIR_IT_C_DEC& other) const
- { return (m_p_nd == other.m_p_nd); }
-
- inline bool
- operator!=(const PB_DS_CONST_IT_C_DEC& other) const
- { return (m_p_nd != other.m_p_nd); }
-
- inline bool
- operator!=(const PB_DS_CONST_ODIR_IT_C_DEC& other) const
- { return (m_p_nd != other.m_p_nd); }
-
- inline PB_DS_CONST_IT_C_DEC&
- operator++()
- {
- inc(integral_constant<int,Is_Forward_Iterator>());
- return *this;
- }
-
- inline PB_DS_CONST_IT_C_DEC
- operator++(int)
- {
- PB_DS_CONST_IT_C_DEC ret_it(m_p_nd);
- operator++();
- return ret_it;
- }
-
- inline PB_DS_CONST_IT_C_DEC&
- operator--()
- {
- dec(integral_constant<int,Is_Forward_Iterator>());
- return *this;
- }
-
- inline PB_DS_CONST_IT_C_DEC
- operator--(int)
- {
- PB_DS_CONST_IT_C_DEC ret_it(m_p_nd);
- operator--();
- return ret_it;
- }
-
- protected:
- inline void
- inc(false_type)
- { dec(true_type()); }
-
- void
- inc(true_type)
- {
- if (m_p_nd->m_type == pat_trie_head_node_type)
- {
- m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_min;
- return;
- }
-
- node_pointer p_y = m_p_nd->m_p_parent;
- while (p_y->m_type != pat_trie_head_node_type &&
- get_larger_sibling(m_p_nd) == 0)
- {
- m_p_nd = p_y;
- p_y = p_y->m_p_parent;
- }
-
- if (p_y->m_type == pat_trie_head_node_type)
- {
- m_p_nd = p_y;
- return;
- }
- m_p_nd = leftmost_descendant(get_larger_sibling(m_p_nd));
- }
-
- inline void
- dec(false_type)
- { inc(true_type()); }
-
- void
- dec(true_type)
- {
- if (m_p_nd->m_type == pat_trie_head_node_type)
- {
- m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_max;
- return;
- }
-
- node_pointer p_y = m_p_nd->m_p_parent;
- while (p_y->m_type != pat_trie_head_node_type &&
- get_smaller_sibling(m_p_nd) == 0)
- {
- m_p_nd = p_y;
- p_y = p_y->m_p_parent;
- }
-
- if (p_y->m_type == pat_trie_head_node_type)
- {
- m_p_nd = p_y;
- return;
- }
- m_p_nd = rightmost_descendant(get_smaller_sibling(m_p_nd));
- }
-
- inline static node_pointer
- get_larger_sibling(node_pointer p_nd)
- {
- internal_node_pointer p_parent =
- static_cast<internal_node_pointer>(p_nd->m_p_parent);
-
- typename Internal_Node::iterator it = p_parent->begin();
- while (*it != p_nd)
- ++it;
-
- typename Internal_Node::iterator next_it = it;
- ++next_it;
- return ((next_it == p_parent->end())? 0 :* next_it);
- }
-
- inline static node_pointer
- get_smaller_sibling(node_pointer p_nd)
- {
- internal_node_pointer p_parent =
- static_cast<internal_node_pointer>(p_nd->m_p_parent);
-
- typename Internal_Node::iterator it = p_parent->begin();
-
- if (*it == p_nd)
- return (0);
- typename Internal_Node::iterator prev_it;
- do
- {
- prev_it = it;
- ++it;
- if (*it == p_nd)
- return (*prev_it);
- }
- while (true);
-
- _GLIBCXX_DEBUG_ASSERT(false);
- return (0);
- }
-
- inline static leaf_pointer
- leftmost_descendant(node_pointer p_nd)
- {
- if (p_nd->m_type == pat_trie_leaf_node_type)
- return static_cast<leaf_pointer>(p_nd);
- return static_cast<internal_node_pointer>(p_nd)->leftmost_descendant();
- }
-
- inline static leaf_pointer
- rightmost_descendant(node_pointer p_nd)
- {
- if (p_nd->m_type == pat_trie_leaf_node_type)
- return static_cast<leaf_pointer>(p_nd);
- return static_cast<internal_node_pointer>(p_nd)->rightmost_descendant();
- }
-
- public:
- node_pointer m_p_nd;
- };
-
- // Iterator.
- template<typename Type_Traits,
- class Node,
- class Leaf,
- class Head,
- class Internal_Node,
- bool Is_Forward_Iterator,
- class Allocator>
- class pat_trie_it_ :
- public PB_DS_CONST_IT_C_DEC
-
- {
- private:
- typedef
- typename Allocator::template rebind<
- Node>::other::pointer
- node_pointer;
-
- typedef
- typename Allocator::template rebind<
- Leaf>::other::const_pointer
- const_leaf_pointer;
-
- typedef
- typename Allocator::template rebind<
- Leaf>::other::pointer
- leaf_pointer;
-
- typedef
- typename Allocator::template rebind<
- Head>::other::pointer
- head_pointer;
-
- typedef
- typename Allocator::template rebind<
- Internal_Node>::other::pointer
- internal_node_pointer;
-
- public:
- typedef typename Type_Traits::value_type value_type;
-
- typedef typename Type_Traits::const_pointer const_pointer;
-
- typedef typename Type_Traits::pointer pointer;
-
- typedef typename Type_Traits::const_reference const_reference;
-
- typedef typename Type_Traits::reference reference;
-
- inline
- pat_trie_it_(node_pointer p_nd = 0) : PB_DS_CONST_IT_C_DEC((node_pointer)p_nd)
- { }
-
- inline
- pat_trie_it_(const PB_DS_ODIR_IT_C_DEC& other) : PB_DS_CONST_IT_C_DEC(other.m_p_nd)
- { }
-
- inline
- PB_DS_IT_C_DEC&
- operator=(const PB_DS_IT_C_DEC& other)
- {
- base_it_type::m_p_nd = other.m_p_nd;
- return *this;
- }
-
- inline
- PB_DS_IT_C_DEC&
- operator=(const PB_DS_ODIR_IT_C_DEC& other)
- {
- base_it_type::m_p_nd = other.m_p_nd;
- return *this;
- }
-
- inline pointer
- operator->() const
- {
- _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd->m_type == pat_trie_leaf_node_type);
-
- return &static_cast<leaf_pointer>(base_it_type::m_p_nd)->value();
- }
-
- inline reference
- operator*() const
- {
- _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd->m_type == pat_trie_leaf_node_type);
- return static_cast<leaf_pointer>(base_it_type::m_p_nd)->value();
- }
-
- inline PB_DS_IT_C_DEC&
- operator++()
- {
- PB_DS_CONST_IT_C_DEC::
- operator++();
- return *this;
- }
-
- inline PB_DS_IT_C_DEC
- operator++(int)
- {
- PB_DS_IT_C_DEC ret_it(base_it_type::m_p_nd);
- operator++();
- return ret_it;
- }
-
- inline PB_DS_IT_C_DEC&
- operator--()
- {
- PB_DS_CONST_IT_C_DEC::operator--();
- return *this;
- }
-
- inline PB_DS_IT_C_DEC
- operator--(int)
- {
- PB_DS_IT_C_DEC ret_it(base_it_type::m_p_nd);
- operator--();
- return ret_it;
- }
-
- protected:
- typedef PB_DS_CONST_IT_C_DEC base_it_type;
-
- friend class PB_DS_CLASS_C_DEC;
- };
-
-#undef PB_DS_CONST_IT_C_DEC
-#undef PB_DS_CONST_ODIR_IT_C_DEC
-#undef PB_DS_IT_C_DEC
-#undef PB_DS_ODIR_IT_C_DEC
-
- } // namespace detail
-} // namespace __gnu_pbds
-
-#endif
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
index 79bfe4283be..0afc2d40a60 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
@@ -34,20 +34,20 @@
// warranty.
/**
- * @file policy_access_fn_imps.hpp
- * Contains an implementation class for bin_search_tree_.
+ * @file pat_trie_/policy_access_fn_imps.hpp
+ * Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
-typename PB_DS_CLASS_C_DEC::e_access_traits&
+typename PB_DS_CLASS_C_DEC::access_traits&
PB_DS_CLASS_C_DEC::
-get_e_access_traits()
+get_access_traits()
{ return *this; }
PB_DS_CLASS_T_DEC
-const typename PB_DS_CLASS_C_DEC::e_access_traits&
+const typename PB_DS_CLASS_C_DEC::access_traits&
PB_DS_CLASS_C_DEC::
-get_e_access_traits() const
+get_access_traits() const
{ return *this; }
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
index 7b2ebd5596c..6a5582da255 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
@@ -34,8 +34,8 @@
// warranty.
/**
- * @file r_erase_fn_imps.hpp
- * Contains an implementation class for bin_search_tree_.
+ * @file pat_trie_/r_erase_fn_imps.hpp
+ * Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
@@ -45,7 +45,7 @@ actual_erase_node(node_pointer p_z)
{
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
--m_size;
- _GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_z->m_value)));
+ _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_z->m_value)));
p_z->~node();
s_node_allocator.deallocate(p_z, 1);
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
index c7fcdb72dfd..683b3a9087c 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file rotate_fn_imps.hpp
+ * @file pat_trie_/rotate_fn_imps.hpp
* Contains imps for rotating nodes.
*/
@@ -63,8 +63,8 @@ rotate_left(node_pointer p_x)
_GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);)
_GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);)
- apply_update(p_x, (Node_Update* )this);
- apply_update(p_x->m_p_parent, (Node_Update* )this);
+ apply_update(p_x, (Node_Update*)this);
+ apply_update(p_x->m_p_parent, (Node_Update*)this);
}
PB_DS_CLASS_T_DEC
@@ -92,8 +92,8 @@ rotate_right(node_pointer p_x)
_GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);)
_GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);)
- apply_update(p_x, (Node_Update* )this);
- apply_update(p_x->m_p_parent, (Node_Update* )this);
+ apply_update(p_x, (Node_Update*)this);
+ apply_update(p_x->m_p_parent, (Node_Update*)this);
}
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
index 06add93c1a9..c2aa9cde821 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
@@ -34,18 +34,18 @@
// warranty.
/**
- * @file split_fn_imps.hpp
- * Contains an implementation class for bin_search_tree_.
+ * @file pat_trie_/split_fn_imps.hpp
+ * Contains an implementation class for pat_trie.
*/
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
+split(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
- split_join_branch_bag bag;
+ branch_bag bag;
leaf_pointer p_split_lf = split_prep(r_key, other, bag);
if (p_split_lf == 0)
{
@@ -57,18 +57,16 @@ split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
_GLIBCXX_DEBUG_ASSERT(!bag.empty());
other.clear();
- m_p_head->m_p_parent = rec_split(m_p_head->m_p_parent,
- pref_begin(p_split_lf),
- pref_end(p_split_lf),
- other,
- bag);
+
+ m_p_head->m_p_parent = rec_split(m_p_head->m_p_parent, pref_begin(p_split_lf),
+ pref_end(p_split_lf), other, bag);
m_p_head->m_p_parent->m_p_parent = m_p_head;
- other.m_p_head->m_p_max = m_p_head->m_p_max;
+ head_pointer __ohead = other.m_p_head;
+ __ohead->m_p_max = m_p_head->m_p_max;
m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent);
- other.m_p_head->m_p_min =
- other.leftmost_descendant(other.m_p_head->m_p_parent);
+ __ohead->m_p_min = other.leftmost_descendant(__ohead->m_p_parent);
other.m_size = std::distance(other.PB_DS_CLASS_C_DEC::begin(),
other.PB_DS_CLASS_C_DEC::end());
@@ -80,7 +78,8 @@ split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::leaf_pointer
PB_DS_CLASS_C_DEC::
-split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)
+split_prep(key_const_reference r_key, PB_DS_CLASS_C_DEC& other,
+ branch_bag& r_bag)
{
_GLIBCXX_DEBUG_ASSERT(r_bag.empty());
if (m_size == 0)
@@ -88,126 +87,122 @@ split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other, split_join_branc
other.clear();
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
- return (0);
+ return 0;
}
- if (synth_e_access_traits::cmp_keys(r_key,
- PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_min)->value())))
+ if (synth_access_traits::cmp_keys(r_key,
+ PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_min)->value())))
{
other.clear();
value_swap(other);
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
- return (0);
+ return 0;
}
- if (!synth_e_access_traits::cmp_keys(r_key,
- PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_max)->value())))
+ if (!synth_access_traits::cmp_keys(r_key,
+ PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_max)->value())))
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
- return (0);
+ return 0;
}
iterator it = lower_bound(r_key);
- if (!synth_e_access_traits::equal_keys(PB_DS_V2F(*it), r_key))
+ if (!synth_access_traits::equal_keys(PB_DS_V2F(*it), r_key))
--it;
node_pointer p_nd = it.m_p_nd;
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_leaf_node_type);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == leaf_node);
leaf_pointer p_ret_l = static_cast<leaf_pointer>(p_nd);
- while (p_nd->m_type != pat_trie_head_node_type)
+ while (p_nd->m_type != head_node)
{
r_bag.add_branch();
p_nd = p_nd->m_p_parent;
}
- _GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(synth_e_access_traits& )(*this), other);)
+ _GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(synth_access_traits&)(*this), other);)
- return (p_ret_l);
+ return p_ret_l;
}
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
-rec_split(node_pointer p_nd, const_e_iterator b_it, const_e_iterator e_it, PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)
+rec_split(node_pointer p_nd, a_const_iterator b_it, a_const_iterator e_it,
+ PB_DS_CLASS_C_DEC& other, branch_bag& r_bag)
{
- if (p_nd->m_type == pat_trie_leaf_node_type)
+ if (p_nd->m_type == leaf_node)
{
_GLIBCXX_DEBUG_ASSERT(other.m_p_head->m_p_parent == 0);
- return (p_nd);
+ return p_nd;
}
- _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
- internal_node_pointer p_internal_nd = static_cast<internal_node_pointer>(p_nd);
-
- node_pointer p_child_ret = rec_split(p_internal_nd->get_child_node(b_it, e_it, this), b_it, e_it, other, r_bag);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
+ inode_pointer p_ind = static_cast<inode_pointer>(p_nd);
+ node_pointer pfirst = p_ind->get_child_node(b_it, e_it, this);
+ node_pointer p_child_ret = rec_split(pfirst, b_it, e_it, other, r_bag);
PB_DS_ASSERT_NODE_VALID(p_child_ret)
- p_internal_nd->replace_child(p_child_ret, b_it, e_it, this);
- apply_update(p_internal_nd, (node_update* )this);
-
- typename internal_node::iterator child_it =
- p_internal_nd->get_child_it(b_it, e_it, this);
-
- const size_type lhs_num_children =
- std::distance(p_internal_nd->begin(), child_it) + 1;
+ p_ind->replace_child(p_child_ret, b_it, e_it, this);
+ apply_update(p_ind, (node_update*)this);
+ inode_iterator child_it = p_ind->get_child_it(b_it, e_it, this);
+ const size_type lhs_dist = std::distance(p_ind->begin(), child_it);
+ const size_type lhs_num_children = lhs_dist + 1;
_GLIBCXX_DEBUG_ASSERT(lhs_num_children > 0);
- size_type rhs_num_children =
- std::distance(p_internal_nd->begin(), p_internal_nd->end()) -
- lhs_num_children;
-
+ const size_type rhs_dist = std::distance(p_ind->begin(), p_ind->end());
+ size_type rhs_num_children = rhs_dist - lhs_num_children;
if (rhs_num_children == 0)
{
- apply_update(p_internal_nd, (node_update* )this);
- return (p_internal_nd);
+ apply_update(p_ind, (node_update*)this);
+ return p_ind;
}
- ++child_it;
- other.split_insert_branch(p_internal_nd->get_e_ind(),
- b_it, child_it, rhs_num_children, r_bag);
+ other.split_insert_branch(p_ind->get_e_ind(), b_it, child_it,
+ rhs_num_children, r_bag);
- child_it = p_internal_nd->get_child_it(b_it, e_it, this);
- ++child_it;
+ child_it = p_ind->get_child_it(b_it, e_it, this);
while (rhs_num_children != 0)
{
- child_it = p_internal_nd->remove_child(child_it);
+ ++child_it;
+ p_ind->remove_child(child_it);
--rhs_num_children;
}
+ apply_update(p_ind, (node_update*)this);
- apply_update(p_internal_nd, (node_update* )this);
- _GLIBCXX_DEBUG_ASSERT(std::distance(p_internal_nd->begin(),
- p_internal_nd->end()) >= 1);
-
- if (std::distance(p_internal_nd->begin(), p_internal_nd->end()) > 1)
+ const size_type int_dist = std::distance(p_ind->begin(), p_ind->end());
+ _GLIBCXX_DEBUG_ASSERT(int_dist >= 1);
+ if (int_dist > 1)
{
- p_internal_nd->update_prefixes(this);
- PB_DS_ASSERT_NODE_VALID(p_internal_nd)
- apply_update(p_internal_nd, (node_update* )this);
- return (p_internal_nd);
+ p_ind->update_prefixes(this);
+ PB_DS_ASSERT_NODE_VALID(p_ind)
+ apply_update(p_ind, (node_update*)this);
+ return p_ind;
}
- node_pointer p_ret =* p_internal_nd->begin();
- p_internal_nd->~internal_node();
- s_internal_node_allocator.deallocate(p_internal_nd, 1);
- apply_update(p_ret, (node_update* )this);
- return (p_ret);
+ node_pointer p_ret = *p_ind->begin();
+ p_ind->~inode();
+ s_inode_allocator.deallocate(p_ind, 1);
+ apply_update(p_ret, (node_update*)this);
+ return p_ret;
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-split_insert_branch(size_type e_ind, const_e_iterator b_it, typename internal_node::iterator child_b_it, size_type num_children, split_join_branch_bag& r_bag)
+split_insert_branch(size_type e_ind, a_const_iterator b_it,
+ inode_iterator child_b_it,
+ size_type num_children, branch_bag& r_bag)
{
#ifdef _GLIBCXX_DEBUG
if (m_p_head->m_p_parent != 0)
PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)
-#endif
-
- const size_type total_num_children =((m_p_head->m_p_parent == 0)? 0 : 1) + num_children;
+#endif
+ const size_type start = m_p_head->m_p_parent == 0 ? 0 : 1;
+ const size_type total_num_children = start + num_children;
if (total_num_children == 0)
{
_GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == 0);
@@ -217,38 +212,39 @@ split_insert_branch(size_type e_ind, const_e_iterator b_it, typename internal_no
if (total_num_children == 1)
{
if (m_p_head->m_p_parent != 0)
- {
+ {
PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)
- return;
- }
+ return;
+ }
_GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == 0);
- m_p_head->m_p_parent =* child_b_it;
+ ++child_b_it;
+ m_p_head->m_p_parent = *child_b_it;
m_p_head->m_p_parent->m_p_parent = m_p_head;
- apply_update(m_p_head->m_p_parent, (node_update* )this);
+ apply_update(m_p_head->m_p_parent, (node_update*)this);
PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)
return;
}
_GLIBCXX_DEBUG_ASSERT(total_num_children > 1);
- internal_node_pointer p_new_root = r_bag.get_branch();
- new (p_new_root) internal_node(e_ind, b_it);
+ inode_pointer p_new_root = r_bag.get_branch();
+ new (p_new_root) inode(e_ind, b_it);
size_type num_inserted = 0;
while (num_inserted++ < num_children)
{
- PB_DS_ASSERT_NODE_VALID((*child_b_it))
- p_new_root->add_child(*child_b_it, pref_begin(*child_b_it),
- pref_end(*child_b_it), this);
++child_b_it;
+ PB_DS_ASSERT_NODE_VALID((*child_b_it))
+ p_new_root->add_child(*child_b_it, pref_begin(*child_b_it),
+ pref_end(*child_b_it), this);
}
if (m_p_head->m_p_parent != 0)
- p_new_root->add_child(m_p_head->m_p_parent,
+ p_new_root->add_child(m_p_head->m_p_parent,
pref_begin(m_p_head->m_p_parent),
pref_end(m_p_head->m_p_parent), this);
m_p_head->m_p_parent = p_new_root;
p_new_root->m_p_parent = m_p_head;
- apply_update(m_p_head->m_p_parent, (node_update* )this);
+ apply_update(m_p_head->m_p_parent, (node_update*)this);
PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
deleted file mode 100644
index 9cecae51770..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
+++ /dev/null
@@ -1,93 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file split_join_branch_bag.hpp
- * Contains an implementation class for pat_trie_.
- */
-
-class split_join_branch_bag
-{
-private:
- typedef
- std::list<
- internal_node_pointer,
- typename Allocator::template rebind<
- internal_node_pointer>::other>
- bag_t;
-
-public:
-
- void
- add_branch()
- {
- internal_node_pointer p_nd = s_internal_node_allocator.allocate(1);
- __try
- {
- m_bag.push_back(p_nd);
- }
- __catch(...)
- {
- s_internal_node_allocator.deallocate(p_nd, 1);
- __throw_exception_again;
- }
- }
-
- internal_node_pointer
- get_branch()
- {
- _GLIBCXX_DEBUG_ASSERT(!m_bag.empty());
- internal_node_pointer p_nd =* m_bag.begin();
- m_bag.pop_front();
- return p_nd;
- }
-
- ~split_join_branch_bag()
- {
- while (!m_bag.empty())
- {
- internal_node_pointer p_nd =* m_bag.begin();
- s_internal_node_allocator.deallocate(p_nd, 1);
- m_bag.pop_front();
- }
- }
-
- inline bool
- empty() const
- { return m_bag.empty(); }
-
-private:
- bag_t m_bag;
-};
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp
index abf5f118523..7cce3c530ff 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file synth_e_access_traits.hpp
+ * @file pat_trie_/synth_access_traits.hpp
* Contains an implementation class for a patricia tree.
*/
@@ -48,62 +48,56 @@ namespace __gnu_pbds
namespace detail
{
-#define PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC \
- template<typename Type_Traits, bool Set, class E_Access_Traits>
+#define PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC \
+ template<typename Type_Traits, bool Set, typename _ATraits>
-#define PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC \
- synth_e_access_traits< \
- Type_Traits, \
- Set, \
- E_Access_Traits>
+#define PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC \
+ synth_access_traits<Type_Traits, Set, _ATraits>
- template<typename Type_Traits, bool Set, class E_Access_Traits>
- struct synth_e_access_traits : public E_Access_Traits
+ /// Synthetic element access traits.
+ template<typename Type_Traits, bool Set, typename _ATraits>
+ struct synth_access_traits : public _ATraits
{
+ typedef _ATraits base_type;
+ typedef typename base_type::const_iterator const_iterator;
+ typedef Type_Traits type_traits;
+ typedef typename type_traits::const_reference const_reference;
+ typedef typename type_traits::key_const_reference key_const_reference;
- private:
- typedef E_Access_Traits base_type;
-
- typedef Type_Traits type_traits;
-
- typedef typename type_traits::const_key_reference const_key_reference;
-
- typedef typename type_traits::const_reference const_reference;
-
- public:
- synth_e_access_traits();
+ synth_access_traits();
- synth_e_access_traits(const E_Access_Traits& r_traits);
+ synth_access_traits(const base_type&);
inline bool
- equal_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after = true) const;
+ equal_prefixes(const_iterator, const_iterator, const_iterator,
+ const_iterator, bool compare_after = true) const;
bool
- equal_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const;
+ equal_keys(key_const_reference, key_const_reference) const;
bool
- cmp_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after = false) const;
+ cmp_prefixes(const_iterator, const_iterator, const_iterator,
+ const_iterator, bool compare_after = false) const;
bool
- cmp_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const;
+ cmp_keys(key_const_reference, key_const_reference) const;
- inline static const_key_reference
- extract_key(const_reference r_val);
+ inline static key_const_reference
+ extract_key(const_reference);
#ifdef _GLIBCXX_DEBUG
bool
- operator()(const_key_reference r_lhs, const_key_reference r_rhs);
+ operator()(key_const_reference, key_const_reference);
#endif
private:
- inline static const_key_reference
- extract_key(const_reference r_val, true_type);
+ inline static key_const_reference
+ extract_key(const_reference, true_type);
- inline static const_key_reference
- extract_key(const_reference r_val, false_type);
+ inline static key_const_reference
+ extract_key(const_reference, false_type);
- private:
- static integral_constant<int,Set> s_set_ind;
+ static integral_constant<int, Set> s_set_ind;
};
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
@@ -112,26 +106,27 @@ namespace __gnu_pbds
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
- synth_e_access_traits()
+ synth_access_traits()
{ }
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
- synth_e_access_traits(const E_Access_Traits& r_traits) :
- E_Access_Traits(r_traits)
+ synth_access_traits(const _ATraits& r_traits)
+ : _ATraits(r_traits)
{ }
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
inline bool
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
- equal_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after /*= false */) const
+ equal_prefixes(const_iterator b_l, const_iterator e_l, const_iterator b_r,
+ const_iterator e_r, bool compare_after /*= false */) const
{
while (b_l != e_l)
{
if (b_r == e_r)
- return (false);
+ return false;
if (base_type::e_pos(*b_l) != base_type::e_pos(*b_r))
- return (false);
+ return false;
++b_l;
++b_r;
}
@@ -141,84 +136,78 @@ namespace __gnu_pbds
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
bool
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
- equal_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const
+ equal_keys(key_const_reference r_lhs_key,
+ key_const_reference r_rhs_key) const
{
- return (equal_prefixes(base_type::begin(r_lhs_key),
- base_type::end(r_lhs_key),
- base_type::begin(r_rhs_key),
- base_type::end(r_rhs_key),
- true));
+ return equal_prefixes(base_type::begin(r_lhs_key),
+ base_type::end(r_lhs_key),
+ base_type::begin(r_rhs_key),
+ base_type::end(r_rhs_key),
+ true);
}
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
bool
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
- cmp_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after /* = false*/) const
+ cmp_prefixes(const_iterator b_l, const_iterator e_l, const_iterator b_r,
+ const_iterator e_r, bool compare_after /* = false*/) const
{
while (b_l != e_l)
{
if (b_r == e_r)
- return (false);
- const typename base_type::size_type l_pos =
- base_type::e_pos(*b_l);
- const typename base_type::size_type r_pos =
- base_type::e_pos(*b_r);
+ return false;
+
+ const typename base_type::size_type l_pos = base_type::e_pos(*b_l);
+ const typename base_type::size_type r_pos = base_type::e_pos(*b_r);
if (l_pos != r_pos)
- return (l_pos < r_pos);
+ return l_pos < r_pos;
++b_l;
++b_r;
}
if (!compare_after)
- return (false);
- return (b_r != e_r);
+ return false;
+ return b_r != e_r;
}
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
bool
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
- cmp_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const
+ cmp_keys(key_const_reference r_lhs_key,
+ key_const_reference r_rhs_key) const
{
- return (cmp_prefixes(base_type::begin(r_lhs_key),
- base_type::end(r_lhs_key),
- base_type::begin(r_rhs_key),
- base_type::end(r_rhs_key),
- true));
+ return cmp_prefixes(base_type::begin(r_lhs_key),
+ base_type::end(r_lhs_key),
+ base_type::begin(r_rhs_key),
+ base_type::end(r_rhs_key),
+ true);
}
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
- inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::const_key_reference
+ inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
extract_key(const_reference r_val)
- {
- return (extract_key(r_val, s_set_ind));
- }
+ { return extract_key(r_val, s_set_ind); }
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
- inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::const_key_reference
+ inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
extract_key(const_reference r_val, true_type)
- {
- return (r_val);
- }
+ { return r_val; }
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
- inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::const_key_reference
+ inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
extract_key(const_reference r_val, false_type)
- {
- return (r_val.first);
- }
+ { return r_val.first; }
#ifdef _GLIBCXX_DEBUG
PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
bool
PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
- operator()(const_key_reference r_lhs, const_key_reference r_rhs)
- {
- return (cmp_keys(r_lhs, r_rhs));
- }
-#endif
+ operator()(key_const_reference r_lhs, key_const_reference r_rhs)
+ { return cmp_keys(r_lhs, r_rhs); }
+#endif
#undef PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
#undef PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC
@@ -226,4 +215,4 @@ namespace __gnu_pbds
} // namespace detail
} // namespace __gnu_pbds
-#endif
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
index 39cf28a1b27..c8b54547fc8 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file trace_fn_imps.hpp
+ * @file pat_trie_/trace_fn_imps.hpp
* Contains an implementation class for pat_trie_.
*/
@@ -55,7 +55,7 @@ trace() const
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-trace_node(const_node_pointer p_nd, size_type level)
+trace_node(node_const_pointer p_nd, size_type level)
{
for (size_type i = 0; i < level; ++i)
std::cerr << ' ';
@@ -63,7 +63,7 @@ trace_node(const_node_pointer p_nd, size_type level)
std::cerr << ((p_nd->m_type == pat_trie_leaf_node_type) ? "l " : "i ");
trace_node_metadata(p_nd, type_to_type<typename node::metadata_type>());
- typename e_access_traits::const_iterator el_it = pref_begin(p_nd);
+ typename access_traits::const_iterator el_it = pref_begin(p_nd);
while (el_it != pref_end(p_nd))
{
std::cerr <<* el_it;
@@ -76,8 +76,7 @@ trace_node(const_node_pointer p_nd, size_type level)
return;
}
- const_internal_node_pointer p_internal =
- static_cast<const_internal_node_pointer>(p_nd);
+ inode_const_pointer p_internal = static_cast<inode_const_pointer>(p_nd);
std::cerr << " " <<
static_cast<unsigned long>(p_internal->get_e_ind()) << std::endl;
@@ -87,8 +86,7 @@ trace_node(const_node_pointer p_nd, size_type level)
for (size_type child_i = 0; child_i < num_children; ++child_i)
{
- typename internal_node::const_iterator child_it =
- p_internal->begin();
+ typename inode::const_iterator child_it = p_internal->begin();
std::advance(child_it, num_children - child_i - 1);
trace_node(*child_it, level + 1);
}
@@ -98,7 +96,7 @@ PB_DS_CLASS_T_DEC
template<typename Metadata_>
void
PB_DS_CLASS_C_DEC::
-trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>)
+trace_node_metadata(node_const_pointer p_nd, type_to_type<Metadata_>)
{
std::cerr << "(" << static_cast<unsigned long>(p_nd->get_metadata()) << ") ";
}
@@ -106,7 +104,7 @@ trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>)
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-trace_node_metadata(const_node_pointer, type_to_type<null_node_metadata>)
+trace_node_metadata(node_const_pointer, type_to_type<null_type>)
{ }
#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/traits.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/traits.hpp
index c8e7f587b55..2e64c52480f 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/traits.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/traits.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,317 +34,105 @@
// warranty.
/**
- * @file traits.hpp
+ * @file pat_trie_/traits.hpp
* Contains an implementation class for pat_trie_.
*/
#ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP
#define PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP
-#include <ext/pb_ds/detail/pat_trie_/node_base.hpp>
-#include <ext/pb_ds/detail/pat_trie_/head.hpp>
-#include <ext/pb_ds/detail/pat_trie_/leaf.hpp>
-#include <ext/pb_ds/detail/pat_trie_/internal_node.hpp>
-#include <ext/pb_ds/detail/pat_trie_/point_iterators.hpp>
-#include <ext/pb_ds/detail/pat_trie_/node_iterators.hpp>
-#include <ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp>
+#include <ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp>
+#include <ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp>
namespace __gnu_pbds
{
namespace detail
{
-
+ /// Specialization.
template<typename Key,
typename Mapped,
- class E_Access_Traits,
- template<typename Const_Node_Iterator,
- class Node_Iterator,
- class Cmp_Fn_,
- class Allocator_>
- class Node_Update,
- class Allocator>
- struct trie_traits<
- Key,
- Mapped,
- E_Access_Traits,
- Node_Update,
- pat_trie_tag,
- Allocator>
+ typename _ATraits,
+ template<typename Node_CItr,
+ typename Node_Itr,
+ typename Cmp_Fn_,
+ typename _Alloc_>
+ class Node_Update,
+ typename _Alloc>
+ struct trie_traits<Key, Mapped, _ATraits, Node_Update, pat_trie_tag, _Alloc>
{
private:
- typedef types_traits< Key, Mapped, Allocator, false> type_traits;
+ typedef pat_trie_base base_type;
+ typedef types_traits<Key, Mapped, _Alloc, false> type_traits;
public:
- typedef
- typename trie_node_metadata_selector<
- Key,
- Mapped,
- E_Access_Traits,
- Node_Update,
- Allocator>::type
- metadata_type;
-
- typedef E_Access_Traits e_access_traits;
-
- typedef
- __gnu_pbds::detail::synth_e_access_traits<
- type_traits,
- false,
- e_access_traits>
- synth_e_access_traits;
-
- typedef
- pat_trie_node_base<
- type_traits,
- synth_e_access_traits,
- metadata_type,
- Allocator>
- node;
+ typedef typename trie_node_metadata_dispatch<Key, Mapped, _ATraits, Node_Update, _Alloc>::type metadata_type;
+ typedef base_type::_Metadata<metadata_type, _Alloc> metadata;
+ typedef _ATraits access_traits;
- typedef
- pat_trie_leaf<
- type_traits,
- synth_e_access_traits,
- metadata_type,
- Allocator>
- leaf;
+ typedef __gnu_pbds::detail::synth_access_traits<type_traits, false, access_traits> synth_access_traits;
- typedef
- pat_trie_head<
- type_traits,
- synth_e_access_traits,
- metadata_type,
- Allocator>
- head;
+ typedef base_type::_Node_base<synth_access_traits, metadata> node;
+ typedef base_type::_Head<synth_access_traits, metadata> head;
+ typedef base_type::_Leaf<synth_access_traits, metadata> leaf;
+ typedef base_type::_Inode<synth_access_traits, metadata> inode;
- typedef
- pat_trie_internal_node<
- type_traits,
- synth_e_access_traits,
- metadata_type,
- Allocator>
- internal_node;
+ typedef base_type::_Iter<node, leaf, head, inode, true> iterator;
+ typedef base_type::_CIter<node, leaf, head, inode, true> const_iterator;
+ typedef base_type::_Iter<node, leaf, head, inode, false> reverse_iterator;
+ typedef base_type::_CIter<node, leaf, head, inode, false> const_reverse_iterator;
- typedef
- pat_trie_const_it_<
- type_traits,
- node,
- leaf,
- head,
- internal_node,
- true,
- Allocator>
- const_iterator;
- typedef
- pat_trie_it_<
- type_traits,
- node,
- leaf,
- head,
- internal_node,
- true,
- Allocator>
- iterator;
+ typedef base_type::_Node_citer<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_const_iterator;
- typedef
- pat_trie_const_it_<
- type_traits,
- node,
- leaf,
- head,
- internal_node,
- false,
- Allocator>
- const_reverse_iterator;
+ typedef base_type::_Node_iter<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_iterator;
- typedef
- pat_trie_it_<
- type_traits,
- node,
- leaf,
- head,
- internal_node,
- false,
- Allocator>
- reverse_iterator;
+ typedef Node_Update<node_const_iterator, node_iterator, _ATraits, _Alloc> node_update;
- typedef
- pat_trie_const_node_it_<
- node,
- leaf,
- head,
- internal_node,
- const_iterator,
- iterator,
- synth_e_access_traits,
- Allocator>
- const_node_iterator;
-
- typedef
- pat_trie_node_it_<
- node,
- leaf,
- head,
- internal_node,
- const_iterator,
- iterator,
- synth_e_access_traits,
- Allocator>
- node_iterator;
-
- typedef
- Node_Update<
- const_node_iterator,
- node_iterator,
- E_Access_Traits,
- Allocator>
- node_update;
-
- typedef
- __gnu_pbds::null_trie_node_update<
- const_node_iterator,
- node_iterator,
- E_Access_Traits,
- Allocator>*
- null_node_update_pointer;
+ typedef null_node_update<node_const_iterator, node_iterator, _ATraits, _Alloc>* null_node_update_pointer;
};
+ /// Specialization.
template<typename Key,
- class E_Access_Traits,
- template<typename Const_Node_Iterator,
- class Node_Iterator,
- class Cmp_Fn_,
- class Allocator_>
- class Node_Update,
- class Allocator>
- struct trie_traits<
- Key,
- null_mapped_type,
- E_Access_Traits,
- Node_Update,
- pat_trie_tag,
- Allocator>
+ typename _ATraits,
+ template<typename Node_CItr,
+ typename Node_Itr,
+ typename Cmp_Fn_,
+ typename _Alloc_>
+ class Node_Update,
+ typename _Alloc>
+ struct trie_traits<Key, null_type, _ATraits, Node_Update, pat_trie_tag, _Alloc>
{
private:
- typedef
- types_traits<
- Key,
- null_mapped_type,
- Allocator,
- false>
- type_traits;
+ typedef pat_trie_base base_type;
+ typedef types_traits<Key, null_type, _Alloc, false> type_traits;
public:
- typedef
- typename trie_node_metadata_selector<
- Key,
- null_mapped_type,
- E_Access_Traits,
- Node_Update,
- Allocator>::type
- metadata_type;
-
- typedef E_Access_Traits e_access_traits;
+ typedef typename trie_node_metadata_dispatch<Key, null_type, _ATraits, Node_Update, _Alloc>::type metadata_type;
+ typedef base_type::_Metadata<metadata_type, _Alloc> metadata;
+ typedef _ATraits access_traits;
+ typedef __gnu_pbds::detail::synth_access_traits<type_traits, true, access_traits> synth_access_traits;
- typedef
- __gnu_pbds::detail::synth_e_access_traits<
- type_traits,
- true,
- e_access_traits>
- synth_e_access_traits;
+ typedef base_type::_Node_base<synth_access_traits, metadata> node;
+ typedef base_type::_Head<synth_access_traits, metadata> head;
+ typedef base_type::_Leaf<synth_access_traits, metadata> leaf;
+ typedef base_type::_Inode<synth_access_traits, metadata> inode;
- typedef
- pat_trie_node_base<
- type_traits,
- synth_e_access_traits,
- metadata_type,
- Allocator>
- node;
+ typedef base_type::_CIter<node, leaf, head, inode, true> const_iterator;
+ typedef const_iterator iterator;
+ typedef base_type::_CIter<node, leaf, head, inode, false> const_reverse_iterator;
+ typedef const_reverse_iterator reverse_iterator;
- typedef
- pat_trie_leaf<
- type_traits,
- synth_e_access_traits,
- metadata_type,
- Allocator>
- leaf;
- typedef
- pat_trie_head<
- type_traits,
- synth_e_access_traits,
- metadata_type,
- Allocator>
- head;
+ typedef base_type::_Node_citer<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_const_iterator;
- typedef
- pat_trie_internal_node<
- type_traits,
- synth_e_access_traits,
- metadata_type,
- Allocator>
- internal_node;
+ typedef node_const_iterator node_iterator;
- typedef
- pat_trie_const_it_<
- type_traits,
- node,
- leaf,
- head,
- internal_node,
- true,
- Allocator>
- const_iterator;
+ typedef Node_Update<node_const_iterator, node_iterator, _ATraits, _Alloc> node_update;
- typedef const_iterator iterator;
-
- typedef
- pat_trie_const_it_<
- type_traits,
- node,
- leaf,
- head,
- internal_node,
- false,
- Allocator>
- const_reverse_iterator;
-
- typedef const_reverse_iterator reverse_iterator;
-
- typedef
- pat_trie_const_node_it_<
- node,
- leaf,
- head,
- internal_node,
- const_iterator,
- iterator,
- synth_e_access_traits,
- Allocator>
- const_node_iterator;
-
- typedef const_node_iterator node_iterator;
-
- typedef
- Node_Update<
- const_node_iterator,
- node_iterator,
- E_Access_Traits,
- Allocator>
- node_update;
-
- typedef
- __gnu_pbds::null_trie_node_update<
- const_node_iterator,
- const_node_iterator,
- E_Access_Traits,
- Allocator>*
- null_node_update_pointer;
+ typedef null_node_update<node_const_iterator, node_const_iterator, _ATraits, _Alloc>* null_node_update_pointer;
};
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
index 8c0304f695e..12ef07bd607 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
@@ -34,22 +34,22 @@
// warranty.
/**
- * @file update_fn_imps.hpp
+ * @file pat_trie_/update_fn_imps.hpp
* Contains an implementation class for pat_trie_.
*/
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
-apply_update(node_pointer /*p_nd*/, null_node_update_pointer)
+apply_update(node_pointer, null_node_update_pointer)
{ }
PB_DS_CLASS_T_DEC
template<typename Node_Update_>
inline void
PB_DS_CLASS_C_DEC::
-apply_update(node_pointer p_nd, Node_Update_* /*p_update*/)
+apply_update(node_pointer p_nd, Node_Update_*)
{
Node_Update_::operator()(node_iterator(p_nd, this),
- const_node_iterator(0, this));
+ node_const_iterator(0, this));
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp b/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
index c48ba7c6e1a..739d2b18bf6 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file priority_queue_base_dispatch.hpp
+ * @file detail/priority_queue_base_dispatch.hpp
* Contains an pqiative container dispatching base.
*/
@@ -61,43 +61,54 @@
namespace __gnu_pbds
{
- namespace detail
- {
-
- template<typename Value_Type, typename Cmp_Fn, typename Tag, typename Allocator>
- struct priority_queue_base_dispatch;
-
- template<typename Value_Type, typename Cmp_Fn, typename Allocator>
- struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, pairing_heap_tag, Allocator>
+ namespace detail
+ {
+ /// Specialization for pairing_heap.
+ template<typename _VTp, typename Cmp_Fn, typename _Alloc>
+ struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, pairing_heap_tag,
+ null_type>
{
- typedef pairing_heap_< Value_Type, Cmp_Fn, Allocator> type;
+ /// Dispatched type.
+ typedef pairing_heap<_VTp, Cmp_Fn, _Alloc> type;
};
- template<typename Value_Type, typename Cmp_Fn, typename Allocator>
- struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, binomial_heap_tag, Allocator>
+ /// Specialization for binomial_heap.
+ template<typename _VTp, typename Cmp_Fn, typename _Alloc>
+ struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, binomial_heap_tag,
+ null_type>
{
- typedef binomial_heap_< Value_Type, Cmp_Fn, Allocator> type;
+ /// Dispatched type.
+ typedef binomial_heap<_VTp, Cmp_Fn, _Alloc> type;
};
- template<typename Value_Type, typename Cmp_Fn, typename Allocator>
- struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, rc_binomial_heap_tag, Allocator>
+ /// Specialization for rc_binary_heap.
+ template<typename _VTp, typename Cmp_Fn, typename _Alloc>
+ struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, rc_binomial_heap_tag,
+ null_type>
{
- typedef rc_binomial_heap_< Value_Type, Cmp_Fn, Allocator> type;
+ /// Dispatched type.
+ typedef rc_binomial_heap<_VTp, Cmp_Fn, _Alloc> type;
};
- template<typename Value_Type, typename Cmp_Fn, typename Allocator>
- struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, binary_heap_tag, Allocator>
+ /// Specialization for binary_heap.
+ template<typename _VTp, typename Cmp_Fn, typename _Alloc>
+ struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, binary_heap_tag,
+ null_type>
{
- typedef binary_heap_< Value_Type, Cmp_Fn, Allocator> type;
+ /// Dispatched type.
+ typedef binary_heap<_VTp, Cmp_Fn, _Alloc> type;
};
- template<typename Value_Type, typename Cmp_Fn, typename Allocator>
- struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, thin_heap_tag, Allocator>
+ /// Specialization for thin_heap.
+ template<typename _VTp, typename Cmp_Fn, typename _Alloc>
+ struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, thin_heap_tag,
+ null_type>
{
- typedef thin_heap_< Value_Type, Cmp_Fn, Allocator> type;
+ /// Dispatched type.
+ typedef thin_heap<_VTp, Cmp_Fn, _Alloc> type;
};
-
- } // namespace detail
+ // @} group pbds
+ } // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
index 19adc8edaad..669c00c29b8 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file constructors_destructor_fn_imps.hpp
+ * @file rb_tree_map_/constructors_destructor_fn_imps.hpp
* Contains an implementation for rb_tree_.
*/
@@ -50,7 +50,7 @@ copy_from_range(It first_it, It last_it)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME()
+PB_DS_RB_TREE_NAME()
{
initialize();
PB_DS_ASSERT_VALID((*this))
@@ -58,7 +58,7 @@ PB_DS_CLASS_NAME()
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
+PB_DS_RB_TREE_NAME(const Cmp_Fn& r_cmp_fn) :
base_type(r_cmp_fn)
{
initialize();
@@ -67,7 +67,7 @@ PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
+PB_DS_RB_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
base_type(r_cmp_fn, r_node_update)
{
initialize();
@@ -76,7 +76,7 @@ PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+PB_DS_RB_TREE_NAME(const PB_DS_CLASS_C_DEC& other) :
base_type(other)
{
initialize();
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
index fe90b0a6a3f..40961edf81f 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_fn_imps.hpp
+ * @file rb_tree_map_/debug_fn_imps.hpp
* Contains an implementation for rb_tree_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
index 0ef925f079e..14e75328970 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
@@ -34,14 +34,14 @@
// warranty.
/**
- * @file erase_fn_imps.hpp
+ * @file rb_tree_map_/erase_fn_imps.hpp
* Contains an implementation for rb_tree_.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
-erase(const_key_reference r_key)
+erase(key_const_reference r_key)
{
point_iterator it = this->find(r_key);
if (it == base_type::end())
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
index 9378e156502..9203dd4d7a6 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
@@ -34,6 +34,6 @@
// warranty.
/**
- * @file find_fn_imps.hpp
+ * @file rb_tree_map_/find_fn_imps.hpp
* Contains an implementation for rb_tree_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
index 0bf69736e81..0903e211427 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file info_fn_imps.hpp
+ * @file rb_tree_map_/info_fn_imps.hpp
* Contains an implementation for rb_tree_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
index 55bd4ed1f0d..97dc8489ab1 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_fn_imps.hpp
+ * @file rb_tree_map_/insert_fn_imps.hpp
* Contains an implementation for rb_tree_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/node.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
index 3f24c762c07..b6f80b2b130 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,53 +34,54 @@
// warranty.
/**
- * @file node.hpp
+ * @file rb_tree_map_/node.hpp
* Contains an implementation for rb_tree_.
*/
#ifndef PB_DS_RB_TREE_NODE_HPP
#define PB_DS_RB_TREE_NODE_HPP
-#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>
namespace __gnu_pbds
{
namespace detail
{
- template<typename Value_Type, class Metadata, class Allocator>
+ /// Node for Red-Black trees.
+ template<typename Value_Type, class Metadata, typename _Alloc>
struct rb_tree_node_
{
public:
- typedef Value_Type value_type;
- typedef Metadata metadata_type;
+ typedef Value_Type value_type;
+ typedef Metadata metadata_type;
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
rb_tree_node_<
Value_Type,
Metadata,
- Allocator> >::other::pointer
+ _Alloc> >::other::pointer
node_pointer;
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
metadata_type>::other::reference
metadata_reference;
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
metadata_type>::other::const_reference
- const_metadata_reference;
+ metadata_const_reference;
- inline bool
+ bool
special() const
{ return m_red; }
- inline const_metadata_reference
+ metadata_const_reference
get_metadata() const
{ return m_metadata; }
- inline metadata_reference
+ metadata_reference
get_metadata()
{ return m_metadata; }
@@ -93,30 +94,30 @@ namespace __gnu_pbds
}
#endif
- node_pointer m_p_left;
- node_pointer m_p_right;
- node_pointer m_p_parent;
- value_type m_value;
- bool m_red;
- metadata_type m_metadata;
+ node_pointer m_p_left;
+ node_pointer m_p_right;
+ node_pointer m_p_parent;
+ value_type m_value;
+ bool m_red;
+ metadata_type m_metadata;
};
- template<typename Value_Type, class Allocator>
- struct rb_tree_node_<Value_Type, null_node_metadata, Allocator>
+ template<typename Value_Type, typename _Alloc>
+ struct rb_tree_node_<Value_Type, null_type, _Alloc>
{
public:
- typedef Value_Type value_type;
- typedef null_node_metadata metadata_type;
+ typedef Value_Type value_type;
+ typedef null_type metadata_type;
typedef
- typename Allocator::template rebind<
+ typename _Alloc::template rebind<
rb_tree_node_<
Value_Type,
- null_node_metadata,
- Allocator> >::other::pointer
+ null_type,
+ _Alloc> >::other::pointer
node_pointer;
- inline bool
+ bool
special() const
{ return m_red; }
@@ -126,11 +127,11 @@ namespace __gnu_pbds
{ std::cout << PB_DS_V2F(m_value) <<(m_red? " <r> " : " <b> "); }
#endif
- node_pointer m_p_left;
- node_pointer m_p_right;
- node_pointer m_p_parent;
- value_type m_value;
- bool m_red;
+ node_pointer m_p_left;
+ node_pointer m_p_right;
+ node_pointer m_p_parent;
+ value_type m_value;
+ bool m_red;
};
} // namespace detail
} // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp
index 7d46c95d7e0..a0e374b350c 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp
@@ -34,30 +34,11 @@
// warranty.
/**
- * @file rb_tree_.hpp
- * Contains an implementation for rb_tree_.
+ * @file rb_tree_map_/rb_tree_.hpp
+ * Contains an implementation for Red Black trees.
*/
-/*
- * This implementation uses an idea from the SGI STL (using a @a header node
- * which is needed for efficient iteration).
- */
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR
-#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR
-#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
-#endif
-#endif
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR
-#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR
-#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
-#endif
-#endif
#include <ext/pb_ds/detail/standard_policies.hpp>
-#include <ext/pb_ds/detail/basic_types.hpp>
#include <utility>
#include <vector>
#include <assert.h>
@@ -69,89 +50,78 @@ namespace __gnu_pbds
{
#define PB_DS_CLASS_T_DEC \
template<typename Key, typename Mapped, typename Cmp_Fn, \
- typename Node_And_It_Traits, typename Allocator>
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CLASS_NAME rb_tree_data_
-#endif
+ typename Node_And_It_Traits, typename _Alloc>
#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_BASE_CLASS_NAME bin_search_tree_data_
-#endif
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_CLASS_NAME rb_tree_no_data_
-#endif
+# define PB_DS_RB_TREE_NAME rb_tree_map
+# define PB_DS_RB_TREE_BASE_NAME bin_search_tree_map
+#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_BASE_CLASS_NAME bin_search_tree_no_data_
-#endif
+# define PB_DS_RB_TREE_NAME rb_tree_set
+# define PB_DS_RB_TREE_BASE_NAME bin_search_tree_set
+#endif
#define PB_DS_CLASS_C_DEC \
- PB_DS_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>
-
-#define PB_DS_BASE_C_DEC \
- PB_DS_BASE_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>
+ PB_DS_RB_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#define PB_DS_EP2VP(X)& ((X)->m_value)
-#endif
+#define PB_DS_RB_TREE_BASE \
+ PB_DS_RB_TREE_BASE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped_Data()
-#define PB_DS_EP2VP(X)& ((X)->m_value.first)
-#endif
+ /*
+ * @brief Red-Black tree.
+ *
+ * This implementation uses an idea from the SGI STL (using a
+ * @a header node which is needed for efficient iteration).
+ */
template<typename Key,
typename Mapped,
typename Cmp_Fn,
typename Node_And_It_Traits,
- typename Allocator>
- class PB_DS_CLASS_NAME : public PB_DS_BASE_C_DEC
+ typename _Alloc>
+ class PB_DS_RB_TREE_NAME : public PB_DS_RB_TREE_BASE
{
private:
- typedef PB_DS_BASE_C_DEC base_type;
- typedef typename base_type::node_pointer node_pointer;
+ typedef PB_DS_RB_TREE_BASE base_type;
+ typedef typename base_type::node_pointer node_pointer;
public:
- typedef Cmp_Fn cmp_fn;
- typedef Allocator allocator_type;
- typedef typename Allocator::size_type size_type;
- typedef typename Allocator::difference_type difference_type;
- typedef typename base_type::key_type key_type;
- typedef typename base_type::key_pointer key_pointer;
- typedef typename base_type::const_key_pointer const_key_pointer;
- typedef typename base_type::key_reference key_reference;
- typedef typename base_type::const_key_reference const_key_reference;
- typedef typename base_type::mapped_type mapped_type;
- typedef typename base_type::mapped_pointer mapped_pointer;
- typedef typename base_type::const_mapped_pointer const_mapped_pointer;
- typedef typename base_type::mapped_reference mapped_reference;
- typedef typename base_type::const_mapped_reference const_mapped_reference;
- typedef typename base_type::value_type value_type;
- typedef typename base_type::pointer pointer;
- typedef typename base_type::const_pointer const_pointer;
- typedef typename base_type::reference reference;
- typedef typename base_type::const_reference const_reference;
- typedef typename base_type::point_iterator point_iterator;
- typedef typename base_type::const_iterator const_point_iterator;
- typedef typename base_type::iterator iterator;
- typedef typename base_type::const_iterator const_iterator;
- typedef typename base_type::reverse_iterator reverse_iterator;
+ typedef rb_tree_tag container_category;
+ typedef Cmp_Fn cmp_fn;
+ typedef _Alloc allocator_type;
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef typename base_type::key_type key_type;
+ typedef typename base_type::key_pointer key_pointer;
+ typedef typename base_type::key_const_pointer key_const_pointer;
+ typedef typename base_type::key_reference key_reference;
+ typedef typename base_type::key_const_reference key_const_reference;
+ typedef typename base_type::mapped_type mapped_type;
+ typedef typename base_type::mapped_pointer mapped_pointer;
+ typedef typename base_type::mapped_const_pointer mapped_const_pointer;
+ typedef typename base_type::mapped_reference mapped_reference;
+ typedef typename base_type::mapped_const_reference mapped_const_reference;
+ typedef typename base_type::value_type value_type;
+ typedef typename base_type::pointer pointer;
+ typedef typename base_type::const_pointer const_pointer;
+ typedef typename base_type::reference reference;
+ typedef typename base_type::const_reference const_reference;
+ typedef typename base_type::point_iterator point_iterator;
+ typedef typename base_type::const_iterator point_const_iterator;
+ typedef typename base_type::iterator iterator;
+ typedef typename base_type::const_iterator const_iterator;
+ typedef typename base_type::reverse_iterator reverse_iterator;
typedef typename base_type::const_reverse_iterator const_reverse_iterator;
- typedef typename base_type::node_update node_update;
+ typedef typename base_type::node_update node_update;
+ PB_DS_RB_TREE_NAME();
- PB_DS_CLASS_NAME();
+ PB_DS_RB_TREE_NAME(const Cmp_Fn&);
- PB_DS_CLASS_NAME(const Cmp_Fn&);
+ PB_DS_RB_TREE_NAME(const Cmp_Fn&, const node_update&);
- PB_DS_CLASS_NAME(const Cmp_Fn&, const node_update&);
-
- PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+ PB_DS_RB_TREE_NAME(const PB_DS_CLASS_C_DEC&);
void
swap(PB_DS_CLASS_C_DEC&);
@@ -164,7 +134,7 @@ namespace __gnu_pbds
insert(const_reference);
inline mapped_reference
- operator[](const_key_reference r_key)
+ operator[](key_const_reference r_key)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
@@ -179,14 +149,14 @@ namespace __gnu_pbds
}
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
return ins_pair.first.m_p_nd->m_value.second;
-#else
+#else
insert(r_key);
- return base_type::s_null_mapped;
-#endif
+ return base_type::s_null_type;
+#endif
}
inline bool
- erase(const_key_reference);
+ erase(key_const_reference);
inline iterator
erase(iterator);
@@ -202,20 +172,17 @@ namespace __gnu_pbds
join(PB_DS_CLASS_C_DEC&);
void
- split(const_key_reference, PB_DS_CLASS_C_DEC&);
-
- protected:
+ split(key_const_reference, PB_DS_CLASS_C_DEC&);
private:
#ifdef _GLIBCXX_DEBUG
void
- assert_valid(const char* file, int line) const;
+ assert_valid(const char*, int) const;
size_type
- assert_node_consistent(const node_pointer, const char* file,
- int line) const;
-#endif
+ assert_node_consistent(const node_pointer, const char*, int) const;
+#endif
inline static bool
is_effectively_black(const node_pointer);
@@ -273,13 +240,8 @@ namespace __gnu_pbds
#undef PB_DS_STRUCT_ONLY_ASSERT_VALID
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
-#undef PB_DS_CLASS_NAME
-#undef PB_DS_BASE_CLASS_NAME
-#undef PB_DS_BASE_C_DEC
-#undef PB_DS_V2F
-#undef PB_DS_EP2VP
-#undef PB_DS_V2S
-
+#undef PB_DS_RB_TREE_NAME
+#undef PB_DS_RB_TREE_BASE_NAME
+#undef PB_DS_RB_TREE_BASE
} // namespace detail
} // namespace __gnu_pbds
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
index 198caca8868..54c7b2396d7 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file split_join_fn_imps.hpp
+ * @file rb_tree_map_/split_join_fn_imps.hpp
* Contains an implementation for rb_tree_.
*/
@@ -232,7 +232,7 @@ black_height(node_pointer p_nd)
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
+split(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
index 531d8e46e1c..e6f2d8974ff 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file traits.hpp
+ * @file rb_tree_map_/traits.hpp
* Contains an implementation for rb_tree_.
*/
@@ -47,75 +47,51 @@ namespace __gnu_pbds
{
namespace detail
{
+ /// Specialization.
template<typename Key,
typename Mapped,
typename Cmp_Fn,
- template<typename Const_Node_Iterator,
- class Node_Iterator,
- class Cmp_Fn_,
- class Allocator_>
- class Node_Update,
- typename Allocator>
- struct tree_traits<
- Key,
- Mapped,
- Cmp_Fn,
- Node_Update,
- rb_tree_tag,
- Allocator> : public bin_search_tree_traits<
+ template<typename Node_CItr,
+ typename Node_Itr,
+ typename Cmp_Fn_,
+ typename _Alloc_>
+ class Node_Update,
+ typename _Alloc>
+ struct tree_traits<Key, Mapped, Cmp_Fn, Node_Update, rb_tree_tag, _Alloc>
+ : public bin_search_tree_traits<
Key,
Mapped,
Cmp_Fn,
Node_Update,
rb_tree_node_<
- typename types_traits<
- Key,
- Mapped,
- Allocator,
- false>::value_type,
- typename tree_node_metadata_selector<
- Key,
- Mapped,
- Cmp_Fn,
- Node_Update,
- Allocator>::type,
- Allocator>,
- Allocator>
+ typename types_traits<Key, Mapped, _Alloc, false>::value_type,
+ typename tree_node_metadata_dispatch<Key, Mapped, Cmp_Fn, Node_Update,
+ _Alloc>::type,
+ _Alloc>,
+ _Alloc>
{ };
+ /// Specialization.
template<typename Key,
- class Cmp_Fn,
- template<typename Const_Node_Iterator,
- class Node_Iterator,
- class Cmp_Fn_,
- class Allocator_>
- class Node_Update,
- class Allocator>
- struct tree_traits<
- Key,
- null_mapped_type,
- Cmp_Fn,
- Node_Update,
- rb_tree_tag,
- Allocator> : public bin_search_tree_traits<
+ typename Cmp_Fn,
+ template<typename Node_CItr,
+ typename Node_Itr,
+ typename Cmp_Fn_,
+ typename _Alloc_>
+ class Node_Update,
+ typename _Alloc>
+ struct tree_traits<Key, null_type, Cmp_Fn, Node_Update, rb_tree_tag, _Alloc>
+ : public bin_search_tree_traits<
Key,
- null_mapped_type,
+ null_type,
Cmp_Fn,
Node_Update,
rb_tree_node_<
- typename types_traits<
- Key,
- null_mapped_type,
- Allocator,
- false>::value_type,
- typename tree_node_metadata_selector<
- Key,
- null_mapped_type,
- Cmp_Fn,
- Node_Update,
- Allocator>::type,
- Allocator>,
- Allocator>
+ typename types_traits<Key, null_type, _Alloc, false>::value_type,
+ typename tree_node_metadata_dispatch<Key, null_type, Cmp_Fn, Node_Update,
+ _Alloc>::type,
+ _Alloc>,
+ _Alloc>
{ };
} // namespace detail
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
index 35acb8f6bcd..5c9c05f2f10 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
@@ -34,40 +34,38 @@
// warranty.
/**
- * @file constructors_destructor_fn_imps.hpp
+ * @file rc_binomial_heap_/constructors_destructor_fn_imps.hpp
* Contains an implementation for rc_binomial_heap_.
*/
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-rc_binomial_heap_()
+rc_binomial_heap()
{
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-rc_binomial_heap_(const Cmp_Fn& r_cmp_fn) :
- PB_DS_BASE_C_DEC(r_cmp_fn)
+rc_binomial_heap(const Cmp_Fn& r_cmp_fn)
+: base_type(r_cmp_fn)
{
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-rc_binomial_heap_(const PB_DS_CLASS_C_DEC& other) :
- PB_DS_BASE_C_DEC(other)
+rc_binomial_heap(const PB_DS_CLASS_C_DEC& other)
+: base_type(other)
{
make_binomial_heap();
-
base_type::find_max();
-
PB_DS_ASSERT_VALID((*this))
}
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-~rc_binomial_heap_()
+~rc_binomial_heap()
{ }
PB_DS_CLASS_T_DEC
@@ -79,7 +77,6 @@ swap(PB_DS_CLASS_C_DEC& other)
PB_DS_ASSERT_VALID(other)
base_type::swap(other);
-
m_rc.swap(other.m_rc);
PB_DS_ASSERT_VALID((*this))
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
index 638810bfb44..b7a1b58fe8d 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_fn_imps.hpp
+ * @file rc_binomial_heap_/debug_fn_imps.hpp
* Contains an implementation for rc_binomial_heap_.
*/
@@ -61,14 +61,14 @@ assert_valid(const char* __file, int __line) const
return;
}
- const_node_pointer p_nd = next_2_pointer(base_type::m_p_root);
+ node_const_pointer p_nd = next_2_pointer(base_type::m_p_root);
typename rc_t::const_iterator it = m_rc.end();
--it;
while (p_nd != 0)
{
PB_DS_DEBUG_VERIFY(*it == p_nd);
- const_node_pointer p_next = p_nd->m_p_next_sibling;
+ node_const_pointer p_next = p_nd->m_p_next_sibling;
PB_DS_DEBUG_VERIFY(p_next != 0);
PB_DS_DEBUG_VERIFY(p_nd->m_metadata == p_next->m_metadata);
PB_DS_DEBUG_VERIFY(p_next->m_p_next_sibling == 0 ||
@@ -81,9 +81,9 @@ assert_valid(const char* __file, int __line) const
}
PB_DS_CLASS_T_DEC
-typename PB_DS_CLASS_C_DEC::const_node_pointer
+typename PB_DS_CLASS_C_DEC::node_const_pointer
PB_DS_CLASS_C_DEC::
-next_2_pointer(const_node_pointer p_nd)
+next_2_pointer(node_const_pointer p_nd)
{
if (p_nd == 0)
return 0;
@@ -100,9 +100,9 @@ next_2_pointer(const_node_pointer p_nd)
}
PB_DS_CLASS_T_DEC
-typename PB_DS_CLASS_C_DEC::const_node_pointer
+typename PB_DS_CLASS_C_DEC::node_const_pointer
PB_DS_CLASS_C_DEC::
-next_after_0_pointer(const_node_pointer p_nd)
+next_after_0_pointer(node_const_pointer p_nd)
{
if (p_nd == 0)
return 0;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
index bf000625009..a8c619e5a1c 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file erase_fn_imps.hpp
+ * @file rc_binomial_heap_/erase_fn_imps.hpp
* Contains an implementation for rc_binomial_heap_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
index c252b49ad8a..aae0a72c97c 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_fn_imps.hpp
+ * @file rc_binomial_heap_/insert_fn_imps.hpp
* Contains an implementation for rc_binomial_heap_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
index 845e6726db6..ea27c47ba6b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file rc.hpp
+ * @file rc_binomial_heap_/rc.hpp
* Contains a redundant (binary counter).
*/
@@ -45,37 +45,22 @@ namespace __gnu_pbds
{
namespace detail
{
-
-#define PB_DS_CLASS_T_DEC \
- template<typename Node, class Allocator>
-
-#define PB_DS_CLASS_C_DEC \
- rc<Node, Allocator>
-
- template<typename Node, class Allocator>
+ /// Redundant binary counter.
+ template<typename _Node, typename _Alloc>
class rc
{
private:
- typedef Allocator allocator_type;
-
- typedef typename allocator_type::size_type size_type;
-
- typedef Node node;
+ typedef _Alloc allocator_type;
+ typedef typename allocator_type::size_type size_type;
+ typedef _Node node;
- typedef
- typename allocator_type::template rebind<
- node>::other::pointer
- node_pointer;
+ typedef typename _Alloc::template rebind<node> __rebind_n;
+ typedef typename __rebind_n::other::pointer node_pointer;
- typedef
- typename allocator_type::template rebind<
- node_pointer>::other::pointer
- entry_pointer;
+ typedef typename _Alloc::template rebind<node_pointer> __rebind_np;
- typedef
- typename allocator_type::template rebind<
- node_pointer>::other::const_pointer
- const_entry_pointer;
+ typedef typename __rebind_np::other::pointer entry_pointer;
+ typedef typename __rebind_np::other::const_pointer entry_const_pointer;
enum
{
@@ -83,20 +68,18 @@ namespace __gnu_pbds
};
public:
- typedef node_pointer entry;
+ typedef node_pointer entry;
+ typedef entry_const_pointer const_iterator;
- typedef const_entry_pointer const_iterator;
-
- public:
rc();
- rc(const PB_DS_CLASS_C_DEC& other);
+ rc(const rc&);
inline void
- swap(PB_DS_CLASS_C_DEC& other);
+ swap(rc&);
inline void
- push(entry p_nd);
+ push(entry);
inline node_pointer
top() const;
@@ -121,34 +104,33 @@ namespace __gnu_pbds
#ifdef _GLIBCXX_DEBUG
void
- assert_valid(const char* file, int line) const;
-#endif
+ assert_valid(const char*, int) const;
+#endif
#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
void
trace() const;
-#endif
+#endif
private:
- node_pointer m_a_entries[max_entries];
-
- size_type m_over_top;
+ node_pointer m_a_entries[max_entries];
+ size_type m_over_top;
};
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
+ template<typename _Node, typename _Alloc>
+ rc<_Node, _Alloc>::
rc() : m_over_top(0)
{ PB_DS_ASSERT_VALID((*this)) }
- PB_DS_CLASS_T_DEC
- PB_DS_CLASS_C_DEC::
- rc(const PB_DS_CLASS_C_DEC& other) : m_over_top(0)
+ template<typename _Node, typename _Alloc>
+ rc<_Node, _Alloc>::
+ rc(const rc<_Node, _Alloc>& other) : m_over_top(0)
{ PB_DS_ASSERT_VALID((*this)) }
- PB_DS_CLASS_T_DEC
+ template<typename _Node, typename _Alloc>
inline void
- PB_DS_CLASS_C_DEC::
- swap(PB_DS_CLASS_C_DEC& other)
+ rc<_Node, _Alloc>::
+ swap(rc<_Node, _Alloc>& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
@@ -163,9 +145,9 @@ namespace __gnu_pbds
PB_DS_ASSERT_VALID(other)
}
- PB_DS_CLASS_T_DEC
+ template<typename _Node, typename _Alloc>
inline void
- PB_DS_CLASS_C_DEC::
+ rc<_Node, _Alloc>::
push(entry p_nd)
{
PB_DS_ASSERT_VALID((*this))
@@ -174,9 +156,9 @@ namespace __gnu_pbds
PB_DS_ASSERT_VALID((*this))
}
- PB_DS_CLASS_T_DEC
+ template<typename _Node, typename _Alloc>
inline void
- PB_DS_CLASS_C_DEC::
+ rc<_Node, _Alloc>::
pop()
{
PB_DS_ASSERT_VALID((*this))
@@ -185,9 +167,9 @@ namespace __gnu_pbds
PB_DS_ASSERT_VALID((*this))
}
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::node_pointer
- PB_DS_CLASS_C_DEC::
+ template<typename _Node, typename _Alloc>
+ inline typename rc<_Node, _Alloc>::node_pointer
+ rc<_Node, _Alloc>::
top() const
{
PB_DS_ASSERT_VALID((*this))
@@ -195,24 +177,24 @@ namespace __gnu_pbds
return *(m_a_entries + m_over_top - 1);
}
- PB_DS_CLASS_T_DEC
+ template<typename _Node, typename _Alloc>
inline bool
- PB_DS_CLASS_C_DEC::
+ rc<_Node, _Alloc>::
empty() const
{
PB_DS_ASSERT_VALID((*this))
return m_over_top == 0;
}
- PB_DS_CLASS_T_DEC
- inline typename PB_DS_CLASS_C_DEC::size_type
- PB_DS_CLASS_C_DEC::
+ template<typename _Node, typename _Alloc>
+ inline typename rc<_Node, _Alloc>::size_type
+ rc<_Node, _Alloc>::
size() const
{ return m_over_top; }
- PB_DS_CLASS_T_DEC
+ template<typename _Node, typename _Alloc>
void
- PB_DS_CLASS_C_DEC::
+ rc<_Node, _Alloc>::
clear()
{
PB_DS_ASSERT_VALID((*this))
@@ -220,30 +202,30 @@ namespace __gnu_pbds
PB_DS_ASSERT_VALID((*this))
}
- PB_DS_CLASS_T_DEC
- const typename PB_DS_CLASS_C_DEC::const_iterator
- PB_DS_CLASS_C_DEC::
+ template<typename _Node, typename _Alloc>
+ const typename rc<_Node, _Alloc>::const_iterator
+ rc<_Node, _Alloc>::
begin() const
{ return& m_a_entries[0]; }
- PB_DS_CLASS_T_DEC
- const typename PB_DS_CLASS_C_DEC::const_iterator
- PB_DS_CLASS_C_DEC::
+ template<typename _Node, typename _Alloc>
+ const typename rc<_Node, _Alloc>::const_iterator
+ rc<_Node, _Alloc>::
end() const
{ return& m_a_entries[m_over_top]; }
#ifdef _GLIBCXX_DEBUG
- PB_DS_CLASS_T_DEC
+ template<typename _Node, typename _Alloc>
void
- PB_DS_CLASS_C_DEC::
+ rc<_Node, _Alloc>::
assert_valid(const char* __file, int __line) const
{ PB_DS_DEBUG_VERIFY(m_over_top < max_entries); }
-#endif
+#endif
#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
- PB_DS_CLASS_T_DEC
+ template<typename _Node, typename _Alloc>
void
- PB_DS_CLASS_C_DEC::
+ rc<_Node, _Alloc>::
trace() const
{
std::cout << "rc" << std::endl;
@@ -251,12 +233,8 @@ namespace __gnu_pbds
std::cerr << m_a_entries[i] << std::endl;
std::cout << std::endl;
}
-#endif
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
+#endif
} // namespace detail
} // namespace __gnu_pbds
-#endif
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
index 767bf108861..e4d67049108 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
@@ -34,12 +34,8 @@
// warranty.
/**
- * @file rc_binomial_heap_.hpp
- * Contains an implementation for rc_binomial_heap_.
- */
-
-/*
- * Redundant-counter binomial heap.
+ * @file rc_binomial_heap_/rc_binomial_heap_.hpp
+ * Contains an implementation for redundant-counter binomial heap.
*/
#include <ext/pb_ds/detail/cond_dealtor.hpp>
@@ -53,114 +49,92 @@ namespace __gnu_pbds
namespace detail
{
#define PB_DS_CLASS_T_DEC \
- template<typename Value_Type, class Cmp_Fn, class Allocator>
+ template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
- rc_binomial_heap_<Value_Type, Cmp_Fn, Allocator>
-
-#define PB_DS_BASE_C_DEC \
- binomial_heap_base_<Value_Type, Cmp_Fn, Allocator>
+ rc_binomial_heap<Value_Type, Cmp_Fn, _Alloc>
#define PB_DS_RC_C_DEC \
- rc<typename PB_DS_BASE_C_DEC::node, Allocator>
+ rc<typename binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>::node, _Alloc>
- /**
- * class description = "8y|\|0|\/|i41 h34p 74813">
- **/
- template<typename Value_Type, class Cmp_Fn, class Allocator>
- class rc_binomial_heap_ : public PB_DS_BASE_C_DEC
+ /// Base class for redundant-counter binomial heap.
+ template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
+ class rc_binomial_heap
+ : public binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>
{
-
private:
- typedef PB_DS_BASE_C_DEC base_type;
-
- typedef typename base_type::node_pointer node_pointer;
-
- typedef typename base_type::const_node_pointer const_node_pointer;
-
- typedef PB_DS_RC_C_DEC rc_t;
+ typedef binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>
+ base_type;
+ typedef typename base_type::node_pointer node_pointer;
+ typedef typename base_type::node_const_pointer node_const_pointer;
+ typedef PB_DS_RC_C_DEC rc_t;
public:
+ typedef Value_Type value_type;
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef typename base_type::pointer pointer;
+ typedef typename base_type::const_pointer const_pointer;
+ typedef typename base_type::reference reference;
+ typedef typename base_type::const_reference const_reference;
+ typedef typename base_type::point_const_iterator point_const_iterator;
+ typedef typename base_type::point_iterator point_iterator;
+ typedef typename base_type::const_iterator const_iterator;
+ typedef typename base_type::iterator iterator;
+ typedef typename base_type::cmp_fn cmp_fn;
+ typedef typename base_type::allocator_type allocator_type;
- typedef typename Allocator::size_type size_type;
-
- typedef typename Allocator::difference_type difference_type;
-
- typedef Value_Type value_type;
-
- typedef typename base_type::pointer pointer;
-
- typedef typename base_type::const_pointer const_pointer;
-
- typedef typename base_type::reference reference;
+ rc_binomial_heap();
- typedef typename base_type::const_reference const_reference;
+ rc_binomial_heap(const Cmp_Fn&);
- typedef typename base_type::const_point_iterator const_point_iterator;
+ rc_binomial_heap(const PB_DS_CLASS_C_DEC&);
- typedef typename base_type::point_iterator point_iterator;
-
- typedef typename base_type::const_iterator const_iterator;
-
- typedef typename base_type::iterator iterator;
-
- typedef typename base_type::cmp_fn cmp_fn;
-
- typedef typename base_type::allocator_type allocator_type;
-
- public:
-
- rc_binomial_heap_();
-
- rc_binomial_heap_(const Cmp_Fn& r_cmp_fn);
-
- rc_binomial_heap_(const PB_DS_CLASS_C_DEC& other);
-
- ~rc_binomial_heap_();
+ ~rc_binomial_heap();
void
- swap(PB_DS_CLASS_C_DEC& other);
+ swap(PB_DS_CLASS_C_DEC&);
inline point_iterator
- push(const_reference r_val);
+ push(const_reference);
void
- modify(point_iterator it, const_reference r_new_val);
+ modify(point_iterator, const_reference);
inline void
pop();
void
- erase(point_iterator it);
+ erase(point_iterator);
inline void
clear();
template<typename Pred>
size_type
- erase_if(Pred pred);
+ erase_if(Pred);
template<typename Pred>
void
- split(Pred pred, PB_DS_CLASS_C_DEC& other);
+ split(Pred, PB_DS_CLASS_C_DEC&);
void
- join(PB_DS_CLASS_C_DEC& other);
+ join(PB_DS_CLASS_C_DEC&);
#ifdef _GLIBCXX_DEBUG
void
- assert_valid(const char* file, int line) const;
-#endif
+ assert_valid(const char*, int) const;
+#endif
#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
void
trace() const;
-#endif
+#endif
private:
inline node_pointer
- link_with_next_sibling(node_pointer p_nd);
+ link_with_next_sibling(node_pointer);
void
make_0_exposed();
@@ -169,15 +143,14 @@ namespace __gnu_pbds
make_binomial_heap();
#ifdef _GLIBCXX_DEBUG
- static const_node_pointer
- next_2_pointer(const_node_pointer p_nd);
+ static node_const_pointer
+ next_2_pointer(node_const_pointer);
- static const_node_pointer
- next_after_0_pointer(const_node_pointer p_nd);
-#endif
+ static node_const_pointer
+ next_after_0_pointer(node_const_pointer);
+#endif
- private:
- rc_t m_rc;
+ rc_t m_rc;
};
#include <ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp>
@@ -189,7 +162,6 @@ namespace __gnu_pbds
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_BASE_C_DEC
#undef PB_DS_RC_C_DEC
} // namespace detail
} // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
index 09d637c7d58..13bf78e51fd 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file split_join_fn_imps.hpp
+ * @file rc_binomial_heap_/split_join_fn_imps.hpp
* Contains an implementation for rc_binomial_heap_.
*/
@@ -47,11 +47,9 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
- make_binomial_heap();
+ make_binomial_heap();
other.make_binomial_heap();
-
base_type::split(pred, other);
-
base_type::find_max();
other.find_max();
@@ -69,9 +67,7 @@ join(PB_DS_CLASS_C_DEC& other)
make_binomial_heap();
other.make_binomial_heap();
-
base_type::join(other);
-
base_type::find_max();
other.find_max();
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
index 1fb3b8bd489..27b5bc4b97d 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file trace_fn_imps.hpp
+ * @file rc_binomial_heap_/trace_fn_imps.hpp
* Contains an implementation for rc_binomial_heap_.
*/
@@ -46,7 +46,6 @@ PB_DS_CLASS_C_DEC::
trace() const
{
base_type::trace();
-
m_rc.trace();
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
index 33aecdf5fcc..97533a34e45 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
@@ -41,85 +41,85 @@
#ifndef PB_DS_SAMPLE_RESIZE_POLICY_HPP
#define PB_DS_SAMPLE_RESIZE_POLICY_HPP
-// A sample resize policy.
-class sample_resize_policy
+namespace __gnu_pbds
{
-public:
-
- // Size type.
- typedef std::size_t size_type;
-
- // Default constructor.
- sample_resize_policy();
-
- // Copy constructor.
- sample_range_hashing(const sample_resize_policy& other);
-
- // Swaps content.
- inline void
- swap(sample_resize_policy& other);
-
-protected:
-
- // Notifies a search started.
- inline void
- notify_insert_search_start();
-
- // Notifies a search encountered a collision.
- inline void
- notify_insert_search_collision();
-
- // Notifies a search ended.
- inline void
- notify_insert_search_end();
-
- // Notifies a search started.
- inline void
- notify_find_search_start();
-
- // Notifies a search encountered a collision.
- inline void
- notify_find_search_collision();
-
- // Notifies a search ended.
- inline void
- notify_find_search_end();
-
- // Notifies a search started.
- inline void
- notify_erase_search_start();
-
- // Notifies a search encountered a collision.
- inline void
- notify_erase_search_collision();
-
- // Notifies a search ended.
- inline void
- notify_erase_search_end();
-
- // Notifies an element was inserted.
- inline void
- notify_inserted(size_type num_e);
-
- // Notifies an element was erased.
- inline void
- notify_erased(size_type num_e);
-
- // Notifies the table was cleared.
- void
- notify_cleared();
-
- // Notifies the table was resized to new_size.
- void
- notify_resized(size_type new_size);
-
- // Queries whether a resize is needed.
- inline bool
- is_resize_needed() const;
-
- // Queries what the new size should be.
- size_type
- get_new_size(size_type size, size_type num_used_e) const;
-};
-
-#endif
+ /// A sample resize policy.
+ class sample_resize_policy
+ {
+ public:
+ // Size type.
+ typedef std::size_t size_type;
+
+ // Default constructor.
+ sample_resize_policy();
+
+ // Copy constructor.
+ sample_range_hashing(const sample_resize_policy& other);
+
+ // Swaps content.
+ inline void
+ swap(sample_resize_policy& other);
+
+ protected:
+ // Notifies a search started.
+ inline void
+ notify_insert_search_start();
+
+ // Notifies a search encountered a collision.
+ inline void
+ notify_insert_search_collision();
+
+ // Notifies a search ended.
+ inline void
+ notify_insert_search_end();
+
+ // Notifies a search started.
+ inline void
+ notify_find_search_start();
+
+ // Notifies a search encountered a collision.
+ inline void
+ notify_find_search_collision();
+
+ // Notifies a search ended.
+ inline void
+ notify_find_search_end();
+
+ // Notifies a search started.
+ inline void
+ notify_erase_search_start();
+
+ // Notifies a search encountered a collision.
+ inline void
+ notify_erase_search_collision();
+
+ // Notifies a search ended.
+ inline void
+ notify_erase_search_end();
+
+ // Notifies an element was inserted.
+ inline void
+ notify_inserted(size_type num_e);
+
+ // Notifies an element was erased.
+ inline void
+ notify_erased(size_type num_e);
+
+ // Notifies the table was cleared.
+ void
+ notify_cleared();
+
+ // Notifies the table was resized to new_size.
+ void
+ notify_resized(size_type new_size);
+
+ // Queries whether a resize is needed.
+ inline bool
+ is_resize_needed() const;
+
+ // Queries what the new size should be.
+ size_type
+ get_new_size(size_type size, size_type num_used_e) const;
+ };
+}
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
index 963c5530a46..ebc28b7cbc7 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
@@ -42,97 +42,96 @@
#ifndef PB_DS_SAMPLE_RESIZE_TRIGGER_HPP
#define PB_DS_SAMPLE_RESIZE_TRIGGER_HPP
-// A sample resize trigger policy.
-class sample_resize_trigger
+namespace __gnu_pbds
{
-public:
-
- // Size type.
- typedef std::size_t size_type;
-
- // Default constructor.
- sample_resize_trigger();
-
- // Copy constructor.
- sample_range_hashing(const sample_resize_trigger& other);
-
- // Swaps content.
- inline void
- swap(sample_resize_trigger& other);
-
-protected:
-
- // Notifies a search started.
- inline void
- notify_insert_search_start();
-
- // Notifies a search encountered a collision.
- inline void
- notify_insert_search_collision();
-
- // Notifies a search ended.
- inline void
- notify_insert_search_end();
-
- // Notifies a search started.
- inline void
- notify_find_search_start();
-
- // Notifies a search encountered a collision.
- inline void
- notify_find_search_collision();
-
- // Notifies a search ended.
- inline void
- notify_find_search_end();
-
- // Notifies a search started.
- inline void
- notify_erase_search_start();
-
- // Notifies a search encountered a collision.
- inline void
- notify_erase_search_collision();
-
- // Notifies a search ended.
- inline void
- notify_erase_search_end();
-
- // Notifies an element was inserted. the total number of entries in
- // the table is num_entries.
- inline void
- notify_inserted(size_type num_entries);
-
- // Notifies an element was erased.
- inline void
- notify_erased(size_type num_entries);
-
- // Notifies the table was cleared.
- void
- notify_cleared();
-
- // Notifies the table was resized as a result of this object's
- // signifying that a resize is needed.
- void
- notify_resized(size_type new_size);
-
- // Notifies the table was resized externally.
- void
- notify_externally_resized(size_type new_size);
-
- // Queries whether a resize is needed.
- inline bool
- is_resize_needed() const;
-
- // Queries whether a grow is needed.
- inline bool
- is_grow_needed(size_type size, size_type num_entries) const;
-
-private:
-
- // Resizes to new_size.
- virtual void
- do_resize(size_type new_size);
-};
-
-#endif
+ /// A sample resize trigger policy.
+ class sample_resize_trigger
+ {
+ public:
+ // Size type.
+ typedef std::size_t size_type;
+
+ // Default constructor.
+ sample_resize_trigger();
+
+ // Copy constructor.
+ sample_range_hashing(const sample_resize_trigger&);
+
+ // Swaps content.
+ inline void
+ swap(sample_resize_trigger&);
+
+ protected:
+ // Notifies a search started.
+ inline void
+ notify_insert_search_start();
+
+ // Notifies a search encountered a collision.
+ inline void
+ notify_insert_search_collision();
+
+ // Notifies a search ended.
+ inline void
+ notify_insert_search_end();
+
+ // Notifies a search started.
+ inline void
+ notify_find_search_start();
+
+ // Notifies a search encountered a collision.
+ inline void
+ notify_find_search_collision();
+
+ // Notifies a search ended.
+ inline void
+ notify_find_search_end();
+
+ // Notifies a search started.
+ inline void
+ notify_erase_search_start();
+
+ // Notifies a search encountered a collision.
+ inline void
+ notify_erase_search_collision();
+
+ // Notifies a search ended.
+ inline void
+ notify_erase_search_end();
+
+ // Notifies an element was inserted. the total number of entries in
+ // the table is num_entries.
+ inline void
+ notify_inserted(size_type num_entries);
+
+ // Notifies an element was erased.
+ inline void
+ notify_erased(size_type num_entries);
+
+ // Notifies the table was cleared.
+ void
+ notify_cleared();
+
+ // Notifies the table was resized as a result of this object's
+ // signifying that a resize is needed.
+ void
+ notify_resized(size_type new_size);
+
+ // Notifies the table was resized externally.
+ void
+ notify_externally_resized(size_type new_size);
+
+ // Queries whether a resize is needed.
+ inline bool
+ is_resize_needed() const;
+
+ // Queries whether a grow is needed.
+ inline bool
+ is_grow_needed(size_type size, size_type num_entries) const;
+
+ private:
+ // Resizes to new_size.
+ virtual void
+ do_resize(size_type);
+ };
+}
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
index 9b3ba031c4b..b6c49aea69d 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
@@ -41,33 +41,33 @@
#ifndef PB_DS_SAMPLE_SIZE_POLICY_HPP
#define PB_DS_SAMPLE_SIZE_POLICY_HPP
-// A sample size policy.
-class sample_size_policy
+namespace __gnu_pbds
{
-public:
-
- // Size type.
- typedef std::size_t size_type;
-
- // Default constructor.
- sample_size_policy();
-
- // Copy constructor.
- sample_range_hashing(const sample_size_policy& other);
-
- // Swaps content.
- inline void
- swap(sample_size_policy& other);
-
-protected:
-
- // Given a __size size, returns a __size that is larger.
- inline size_type
- get_nearest_larger_size(size_type size) const;
-
- // Given a __size size, returns a __size that is smaller.
- inline size_type
- get_nearest_smaller_size(size_type size) const;
-};
-
-#endif
+ /// A sample size policy.
+ class sample_size_policy
+ {
+ public:
+ // Size type.
+ typedef std::size_t size_type;
+
+ // Default constructor.
+ sample_size_policy();
+
+ // Copy constructor.
+ sample_range_hashing(const sample_size_policy&);
+
+ // Swaps content.
+ inline void
+ swap(sample_size_policy& other);
+
+ protected:
+ // Given a __size size, returns a __size that is larger.
+ inline size_type
+ get_nearest_larger_size(size_type size) const;
+
+ // Given a __size size, returns a __size that is smaller.
+ inline size_type
+ get_nearest_smaller_size(size_type size) const;
+ };
+}
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
index dea307c2bdc..2383e962552 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file constructors_destructor_fn_imps.hpp
+ * @file splay_tree_/constructors_destructor_fn_imps.hpp
* Contains an implementation class for splay_tree_.
*/
@@ -50,7 +50,7 @@ copy_from_range(It first_it, It last_it)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME()
+PB_DS_S_TREE_NAME()
{
initialize();
PB_DS_ASSERT_VALID((*this))
@@ -58,7 +58,7 @@ PB_DS_CLASS_NAME()
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
+PB_DS_S_TREE_NAME(const Cmp_Fn& r_cmp_fn) :
base_type(r_cmp_fn)
{
initialize();
@@ -67,7 +67,7 @@ PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
+PB_DS_S_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
base_type(r_cmp_fn, r_node_update)
{
initialize();
@@ -76,7 +76,7 @@ PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+PB_DS_S_TREE_NAME(const PB_DS_CLASS_C_DEC& other) :
base_type(other)
{
initialize();
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
index 453567a0632..e6a4694b291 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_fn_imps.hpp
+ * @file splay_tree_/debug_fn_imps.hpp
* Contains an implementation class for splay_tree_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
index 22f8e68c440..9546321e6f0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
@@ -34,14 +34,14 @@
// warranty.
/**
- * @file erase_fn_imps.hpp
+ * @file splay_tree_/erase_fn_imps.hpp
* Contains an implementation class for splay_tree_.
*/
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
-erase(const_key_reference r_key)
+erase(key_const_reference r_key)
{
point_iterator it = find(r_key);
if (it == base_type::end())
@@ -142,7 +142,7 @@ erase_node(node_pointer p_nd)
if (p_l != 0)
p_l->m_p_parent = p_target_r;
PB_DS_ASSERT_VALID((*this))
- this->apply_update(p_target_r, (node_update* )this);
+ this->apply_update(p_target_r, (node_update*)this);
}
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
index 9dfa926f402..6e1a4ef06e2 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
@@ -34,14 +34,14 @@
// warranty.
/**
- * @file find_fn_imps.hpp
+ * @file splay_tree_/find_fn_imps.hpp
* Contains an implementation class for splay_tree_.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::point_iterator
PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key)
+find(key_const_reference r_key)
{
node_pointer p_found = find_imp(r_key);
if (p_found != base_type::m_p_head)
@@ -50,9 +50,9 @@ find(const_key_reference r_key)
}
PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key) const
+find(key_const_reference r_key) const
{
const node_pointer p_found = find_imp(r_key);
if (p_found != base_type::m_p_head)
@@ -63,7 +63,7 @@ find(const_key_reference r_key) const
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
-find_imp(const_key_reference r_key)
+find_imp(key_const_reference r_key)
{
_GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid(__FILE__,
__LINE__);)
@@ -83,7 +83,7 @@ find_imp(const_key_reference r_key)
PB_DS_CLASS_T_DEC
inline const typename PB_DS_CLASS_C_DEC::node_pointer
PB_DS_CLASS_C_DEC::
-find_imp(const_key_reference r_key) const
+find_imp(key_const_reference r_key) const
{
PB_DS_ASSERT_VALID((*this))
node_pointer p_nd = base_type::m_p_head->m_p_parent;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
index 636b9ab255e..8996903b016 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
@@ -34,6 +34,6 @@
// warranty.
/**
- * @file info_fn_imps.hpp
+ * @file splay_tree_/info_fn_imps.hpp
* Contains an implementation.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
index 4e1179ead2f..2f895b5bffa 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_fn_imps.hpp
+ * @file splay_tree_/insert_fn_imps.hpp
* Contains an implementation class for splay_tree_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/node.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/node.hpp
index fbf398d04c9..111976d5500 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/node.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/node.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file node.hpp
+ * @file splay_tree_/node.hpp
* Contains an implementation struct for splay_tree_'s node.
*/
@@ -45,7 +45,8 @@ namespace __gnu_pbds
{
namespace detail
{
- template<typename Value_Type, class Metadata, class Allocator>
+ /// Node for splay tree.
+ template<typename Value_Type, class Metadata, typename _Alloc>
struct splay_tree_node_
{
public:
@@ -53,17 +54,17 @@ namespace __gnu_pbds
typedef Metadata metadata_type;
typedef
- typename Allocator::template rebind<
- splay_tree_node_<Value_Type, Metadata, Allocator> >::other::pointer
+ typename _Alloc::template rebind<
+ splay_tree_node_<Value_Type, Metadata, _Alloc> >::other::pointer
node_pointer;
typedef
- typename Allocator::template rebind<metadata_type>::other::reference
+ typename _Alloc::template rebind<metadata_type>::other::reference
metadata_reference;
typedef
- typename Allocator::template rebind<metadata_type>::other::const_reference
- const_metadata_reference;
+ typename _Alloc::template rebind<metadata_type>::other::const_reference
+ metadata_const_reference;
#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_
void
@@ -75,7 +76,7 @@ namespace __gnu_pbds
special() const
{ return m_special; }
- inline const_metadata_reference
+ inline metadata_const_reference
get_metadata() const
{ return m_metadata; }
@@ -91,16 +92,16 @@ namespace __gnu_pbds
metadata_type m_metadata;
};
- template<typename Value_Type, typename Allocator>
- struct splay_tree_node_<Value_Type, null_node_metadata, Allocator>
+ template<typename Value_Type, typename _Alloc>
+ struct splay_tree_node_<Value_Type, null_type, _Alloc>
{
public:
typedef Value_Type value_type;
- typedef null_node_metadata metadata_type;
+ typedef null_type metadata_type;
typedef
- typename Allocator::template rebind<
- splay_tree_node_<Value_Type, null_node_metadata, Allocator> >::other::pointer
+ typename _Alloc::template rebind<
+ splay_tree_node_<Value_Type, null_type, _Alloc> >::other::pointer
node_pointer;
inline bool
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
index b1523662c43..03568450941 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file splay_fn_imps.hpp
+ * @file splay_tree_/splay_fn_imps.hpp
* Contains an implementation class for splay_tree_.
*/
@@ -56,32 +56,32 @@ splay(node_pointer p_nd)
if (p_nd->m_p_parent->m_p_parent == base_type::m_p_head)
{
- base_type::rotate_parent(p_nd);
- _GLIBCXX_DEBUG_ASSERT(p_nd == this->m_p_head->m_p_parent);
+ base_type::rotate_parent(p_nd);
+ _GLIBCXX_DEBUG_ASSERT(p_nd == this->m_p_head->m_p_parent);
}
else
{
- const node_pointer p_parent = p_nd->m_p_parent;
- const node_pointer p_grandparent = p_parent->m_p_parent;
+ const node_pointer p_parent = p_nd->m_p_parent;
+ const node_pointer p_grandparent = p_parent->m_p_parent;
#ifdef _GLIBCXX_DEBUG
- const size_type total =
+ const size_type total =
base_type::recursive_count(p_grandparent);
- _GLIBCXX_DEBUG_ASSERT(total >= 3);
-#endif
+ _GLIBCXX_DEBUG_ASSERT(total >= 3);
+#endif
- if (p_parent->m_p_left == p_nd &&
+ if (p_parent->m_p_left == p_nd &&
p_grandparent->m_p_right == p_parent)
splay_zig_zag_left(p_nd, p_parent, p_grandparent);
- else if (p_parent->m_p_right == p_nd &&
+ else if (p_parent->m_p_right == p_nd &&
p_grandparent->m_p_left == p_parent)
splay_zig_zag_right(p_nd, p_parent, p_grandparent);
- else if (p_parent->m_p_left == p_nd &&
+ else if (p_parent->m_p_left == p_nd &&
p_grandparent->m_p_left == p_parent)
splay_zig_zig_left(p_nd, p_parent, p_grandparent);
- else
+ else
splay_zig_zig_right(p_nd, p_parent, p_grandparent);
- _GLIBCXX_DEBUG_ASSERT(total ==this->recursive_count(p_nd));
+ _GLIBCXX_DEBUG_ASSERT(total ==this->recursive_count(p_nd));
}
PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_nd)
@@ -91,7 +91,7 @@ splay(node_pointer p_nd)
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
-splay_zig_zag_left(node_pointer p_nd, node_pointer p_parent,
+splay_zig_zag_left(node_pointer p_nd, node_pointer p_parent,
node_pointer p_grandparent)
{
_GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);
@@ -99,8 +99,8 @@ splay_zig_zag_left(node_pointer p_nd, node_pointer p_parent,
PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent)
- _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_left == p_nd &&
- p_grandparent->m_p_right == p_parent);
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_left == p_nd &&
+ p_grandparent->m_p_right == p_parent);
splay_zz_start(p_nd, p_parent, p_grandparent);
@@ -127,7 +127,7 @@ splay_zig_zag_left(node_pointer p_nd, node_pointer p_parent,
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
-splay_zig_zag_right(node_pointer p_nd, node_pointer p_parent,
+splay_zig_zag_right(node_pointer p_nd, node_pointer p_parent,
node_pointer p_grandparent)
{
_GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);
@@ -135,8 +135,8 @@ splay_zig_zag_right(node_pointer p_nd, node_pointer p_parent,
PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent)
- _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_right == p_nd &&
- p_grandparent->m_p_left == p_parent);
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_right == p_nd &&
+ p_grandparent->m_p_left == p_parent);
splay_zz_start(p_nd, p_parent, p_grandparent);
@@ -163,7 +163,7 @@ splay_zig_zag_right(node_pointer p_nd, node_pointer p_parent,
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
-splay_zig_zig_left(node_pointer p_nd, node_pointer p_parent,
+splay_zig_zig_left(node_pointer p_nd, node_pointer p_parent,
node_pointer p_grandparent)
{
_GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);
@@ -171,7 +171,7 @@ splay_zig_zig_left(node_pointer p_nd, node_pointer p_parent,
PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent)
- _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_left == p_nd &&
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_left == p_nd &&
p_nd->m_p_parent->m_p_parent->m_p_left == p_nd->m_p_parent);
splay_zz_start(p_nd, p_parent, p_grandparent);
@@ -199,14 +199,14 @@ splay_zig_zig_left(node_pointer p_nd, node_pointer p_parent,
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
-splay_zig_zig_right(node_pointer p_nd, node_pointer p_parent,
+splay_zig_zig_right(node_pointer p_nd, node_pointer p_parent,
node_pointer p_grandparent)
{
_GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);
_GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);
PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_grandparent)
- _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_right == p_nd &&
- p_nd->m_p_parent->m_p_parent->m_p_right == p_nd->m_p_parent);
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_right == p_nd &&
+ p_nd->m_p_parent->m_p_parent->m_p_right == p_nd->m_p_parent);
splay_zz_start(p_nd, p_parent, p_grandparent);
@@ -227,7 +227,7 @@ splay_zig_zig_right(node_pointer p_nd, node_pointer p_parent,
if (p_c != 0)
p_c->m_p_parent = p_grandparent;
- base_type::update_to_top(p_grandparent, (node_update* )this);
+ base_type::update_to_top(p_grandparent, (node_update*)this);
splay_zz_end(p_nd, p_parent, p_grandparent);
}
@@ -237,7 +237,7 @@ PB_DS_CLASS_C_DEC::
splay_zz_start(node_pointer p_nd,
#ifdef _GLIBCXX_DEBUG
node_pointer p_parent,
-#else
+#else
node_pointer /*p_parent*/,
#endif
node_pointer p_grandparent)
@@ -268,16 +268,14 @@ splay_zz_start(node_pointer p_nd,
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
-splay_zz_end(node_pointer p_nd, node_pointer p_parent,
+splay_zz_end(node_pointer p_nd, node_pointer p_parent,
node_pointer p_grandparent)
{
if (p_nd->m_p_parent == base_type::m_p_head)
base_type::m_p_head->m_p_parent = p_nd;
- this->apply_update(p_grandparent, (node_update* )this);
- this->apply_update(p_parent, (node_update* )this);
- this->apply_update(p_nd, (node_update* )this);
-
+ this->apply_update(p_grandparent, (node_update*)this);
+ this->apply_update(p_parent, (node_update*)this);
+ this->apply_update(p_nd, (node_update*)this);
PB_DS_ASSERT_BASE_NODE_CONSISTENT(p_nd)
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp
index b6afa758eb8..4d67dba4d85 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp
@@ -34,8 +34,8 @@
// warranty.
/**
- * @file splay_tree_.hpp
- * Contains an implementation class for splay_tree_.
+ * @file splay_tree_/splay_tree_.hpp
+ * Contains an implementation class for splay trees.
*/
/*
* This implementation uses an idea from the SGI STL (using a @a header node
@@ -68,20 +68,6 @@
*
*/
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR
-#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR
-#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
-#endif
-#endif
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR
-#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR
-#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
-#endif
-#endif
-
#include <utility>
#include <vector>
#include <assert.h>
@@ -91,91 +77,75 @@ namespace __gnu_pbds
{
namespace detail
{
-#define PB_DS_CLASS_T_DEC \
- template<typename Key, typename Mapped, typename Cmp_Fn, \
- typename Node_And_It_Traits, typename Allocator>
-
#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CLASS_NAME splay_tree_data_
-#endif
+# define PB_DS_S_TREE_NAME splay_tree_map
+# define PB_DS_S_TREE_BASE_NAME bin_search_tree_map
+#endif
#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_CLASS_NAME splay_tree_no_data_
-#endif
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_BASE_CLASS_NAME bin_search_tree_data_
-#endif
+# define PB_DS_S_TREE_NAME splay_tree_set
+# define PB_DS_S_TREE_BASE_NAME bin_search_tree_set
+#endif
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_BASE_CLASS_NAME bin_search_tree_no_data_
-#endif
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Mapped, typename Cmp_Fn, \
+ typename Node_And_It_Traits, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
- PB_DS_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>
+ PB_DS_S_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
-#define PB_DS_BASE_C_DEC \
- PB_DS_BASE_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>
+#define PB_DS_S_TREE_BASE \
+ PB_DS_S_TREE_BASE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#define PB_DS_EP2VP(X)& ((X)->m_value)
-#endif
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped_Data()
-#define PB_DS_EP2VP(X)& ((X)->m_value.first)
-#endif
-
- // $p14y 7r33 7481.
+ /// Splay Tree.
template<typename Key, typename Mapped, typename Cmp_Fn,
- typename Node_And_It_Traits, typename Allocator>
- class PB_DS_CLASS_NAME : public PB_DS_BASE_C_DEC
+ typename Node_And_It_Traits, typename _Alloc>
+ class PB_DS_S_TREE_NAME : public PB_DS_S_TREE_BASE
{
private:
- typedef PB_DS_BASE_C_DEC base_type;
+ typedef PB_DS_S_TREE_BASE base_type;
#ifdef _GLIBCXX_DEBUG
typedef base_type debug_base;
#endif
- typedef typename base_type::node_pointer node_pointer;
+ typedef typename base_type::node_pointer node_pointer;
public:
- typedef Allocator allocator_type;
- typedef typename Allocator::size_type size_type;
- typedef typename Allocator::difference_type difference_type;
- typedef Cmp_Fn cmp_fn;
- typedef typename base_type::key_type key_type;
- typedef typename base_type::key_pointer key_pointer;
- typedef typename base_type::const_key_pointer const_key_pointer;
- typedef typename base_type::key_reference key_reference;
- typedef typename base_type::const_key_reference const_key_reference;
- typedef typename base_type::mapped_type mapped_type;
- typedef typename base_type::mapped_pointer mapped_pointer;
- typedef typename base_type::const_mapped_pointer const_mapped_pointer;
- typedef typename base_type::mapped_reference mapped_reference;
- typedef typename base_type::const_mapped_reference const_mapped_reference;
- typedef typename base_type::value_type value_type;
- typedef typename base_type::pointer pointer;
- typedef typename base_type::const_pointer const_pointer;
- typedef typename base_type::reference reference;
- typedef typename base_type::const_reference const_reference;
- typedef typename base_type::point_iterator point_iterator;
- typedef typename base_type::const_iterator const_point_iterator;
- typedef typename base_type::iterator iterator;
- typedef typename base_type::const_iterator const_iterator;
- typedef typename base_type::reverse_iterator reverse_iterator;
+ typedef splay_tree_tag container_category;
+ typedef _Alloc allocator_type;
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef Cmp_Fn cmp_fn;
+ typedef typename base_type::key_type key_type;
+ typedef typename base_type::key_pointer key_pointer;
+ typedef typename base_type::key_const_pointer key_const_pointer;
+ typedef typename base_type::key_reference key_reference;
+ typedef typename base_type::key_const_reference key_const_reference;
+ typedef typename base_type::mapped_type mapped_type;
+ typedef typename base_type::mapped_pointer mapped_pointer;
+ typedef typename base_type::mapped_const_pointer mapped_const_pointer;
+ typedef typename base_type::mapped_reference mapped_reference;
+ typedef typename base_type::mapped_const_reference mapped_const_reference;
+ typedef typename base_type::value_type value_type;
+ typedef typename base_type::pointer pointer;
+ typedef typename base_type::const_pointer const_pointer;
+ typedef typename base_type::reference reference;
+ typedef typename base_type::const_reference const_reference;
+ typedef typename base_type::point_iterator point_iterator;
+ typedef typename base_type::const_iterator point_const_iterator;
+ typedef typename base_type::iterator iterator;
+ typedef typename base_type::const_iterator const_iterator;
+ typedef typename base_type::reverse_iterator reverse_iterator;
typedef typename base_type::const_reverse_iterator const_reverse_iterator;
- typedef typename base_type::node_update node_update;
+ typedef typename base_type::node_update node_update;
- PB_DS_CLASS_NAME();
+ PB_DS_S_TREE_NAME();
- PB_DS_CLASS_NAME(const Cmp_Fn&);
+ PB_DS_S_TREE_NAME(const Cmp_Fn&);
- PB_DS_CLASS_NAME(const Cmp_Fn&, const node_update&);
+ PB_DS_S_TREE_NAME(const Cmp_Fn&, const node_update&);
- PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+ PB_DS_S_TREE_NAME(const PB_DS_CLASS_C_DEC&);
void
swap(PB_DS_CLASS_C_DEC&);
@@ -191,7 +161,7 @@ namespace __gnu_pbds
insert(const_reference r_value);
inline mapped_reference
- operator[](const_key_reference r_key)
+ operator[](key_const_reference r_key)
{
#ifdef PB_DS_DATA_TRUE_INDICATOR
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
@@ -203,20 +173,20 @@ namespace __gnu_pbds
splay(ins_pair.first.m_p_nd);
_GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
return ins_pair.first.m_p_nd->m_value.second;
-#else
+#else
insert(r_key);
- return base_type::s_null_mapped;
+ return base_type::s_null_type;
#endif
}
inline point_iterator
- find(const_key_reference);
+ find(key_const_reference);
- inline const_point_iterator
- find(const_key_reference) const;
+ inline point_const_iterator
+ find(key_const_reference) const;
inline bool
- erase(const_key_reference);
+ erase(key_const_reference);
inline iterator
erase(iterator it);
@@ -232,17 +202,17 @@ namespace __gnu_pbds
join(PB_DS_CLASS_C_DEC&);
void
- split(const_key_reference, PB_DS_CLASS_C_DEC&);
+ split(key_const_reference, PB_DS_CLASS_C_DEC&);
private:
inline std::pair<point_iterator, bool>
insert_leaf_imp(const_reference);
inline node_pointer
- find_imp(const_key_reference);
+ find_imp(key_const_reference);
inline const node_pointer
- find_imp(const_key_reference) const;
+ find_imp(key_const_reference) const;
#ifdef _GLIBCXX_DEBUG
void
@@ -250,7 +220,7 @@ namespace __gnu_pbds
void
assert_special_imp(const node_pointer, const char* file, int line) const;
-#endif
+#endif
void
splay(node_pointer);
@@ -295,12 +265,8 @@ namespace __gnu_pbds
#undef PB_DS_ASSERT_BASE_NODE_CONSISTENT
#undef PB_DS_CLASS_T_DEC
#undef PB_DS_CLASS_C_DEC
-#undef PB_DS_CLASS_NAME
-#undef PB_DS_BASE_CLASS_NAME
-#undef PB_DS_BASE_C_DEC
-#undef PB_DS_V2F
-#undef PB_DS_EP2VP
-#undef PB_DS_V2S
+#undef PB_DS_S_TREE_NAME
+#undef PB_DS_S_TREE_BASE_NAME
+#undef PB_DS_S_TREE_BASE
} // namespace detail
} // namespace __gnu_pbds
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
index fe4cfa57bf7..1fcfe798050 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file split_join_fn_imps.hpp
+ * @file splay_tree_/split_join_fn_imps.hpp
* Contains an implementation class for splay_tree_.
*/
@@ -66,8 +66,8 @@ join(PB_DS_CLASS_C_DEC& other)
base_type::m_p_head->m_p_parent = p_target_r;
p_target_r->m_p_parent = base_type::m_p_head;
- this->apply_update(p_target_r, (node_update* )this);
+ this->apply_update(p_target_r, (node_update*)this);
base_type::join_finish(other);
PB_DS_ASSERT_VALID((*this))
@@ -77,7 +77,7 @@ join(PB_DS_CLASS_C_DEC& other)
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
+split(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
@@ -103,7 +103,7 @@ split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
other.m_p_head->m_p_parent = p_upper_bound;
p_upper_bound->m_p_parent = other.m_p_head;
p_upper_bound->m_p_left = 0;
- this->apply_update(p_upper_bound, (node_update* )this);
+ this->apply_update(p_upper_bound, (node_update*)this);
base_type::split_finish(other);
PB_DS_ASSERT_VALID((*this))
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/traits.hpp b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/traits.hpp
index cfedc35c8db..e5020ec92f0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/traits.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/traits.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file traits.hpp
+ * @file splay_tree_/traits.hpp
* Contains an implementation for splay_tree_.
*/
@@ -47,64 +47,44 @@ namespace __gnu_pbds
{
namespace detail
{
-
+ /// Specialization.
template<typename Key,
typename Mapped,
- class Cmp_Fn,
- template<typename Const_Node_Iterator,
- class Node_Iterator,
- class Cmp_Fn_,
- class Allocator_>
- class Node_Update,
- class Allocator>
- struct tree_traits<
- Key,
- Mapped,
- Cmp_Fn,
- Node_Update,
- splay_tree_tag,
- Allocator> : public bin_search_tree_traits<
- Key,
- Mapped,
- Cmp_Fn,
- Node_Update,
- splay_tree_node_<
- typename types_traits<
- Key,
- Mapped,
- Allocator,
- false>::value_type,
- typename tree_node_metadata_selector<
- Key,
- Mapped,
- Cmp_Fn,
- Node_Update,
- Allocator>::type,
- Allocator>,
- Allocator>
+ typename Cmp_Fn,
+ template<typename Node_CItr,
+ typename Node_Itr,
+ typename Cmp_Fn_,
+ typename _Alloc_>
+ class Node_Update,
+ typename _Alloc>
+ struct tree_traits<Key, Mapped, Cmp_Fn, Node_Update, splay_tree_tag, _Alloc>
+ : public bin_search_tree_traits<Key, Mapped, Cmp_Fn, Node_Update,
+ splay_tree_node_<
+ typename types_traits<Key, Mapped, _Alloc, false>::value_type,
+ typename tree_node_metadata_dispatch<Key, Mapped, Cmp_Fn, Node_Update,
+ _Alloc>::type,
+ _Alloc>,
+ _Alloc>
{ };
+ /// Specialization.
template<typename Key,
class Cmp_Fn,
- template<typename Const_Node_Iterator,
- class Node_Iterator,
+ template<typename Node_CItr,
+ class Node_Itr,
class Cmp_Fn_,
- class Allocator_>
+ typename _Alloc_>
class Node_Update,
- class Allocator>
- struct tree_traits<Key, null_mapped_type, Cmp_Fn, Node_Update,
- splay_tree_tag, Allocator>
- : public bin_search_tree_traits<Key, null_mapped_type, Cmp_Fn,
- Node_Update,
- splay_tree_node_<typename types_traits<Key, null_mapped_type, Allocator, false>::value_type,
- typename tree_node_metadata_selector<
- Key,
- null_mapped_type,
- Cmp_Fn,
- Node_Update,
- Allocator>::type,
- Allocator>,
- Allocator>
+ typename _Alloc>
+ struct tree_traits<Key, null_type, Cmp_Fn, Node_Update,
+ splay_tree_tag, _Alloc>
+ : public bin_search_tree_traits<Key, null_type, Cmp_Fn, Node_Update,
+ splay_tree_node_<
+ typename types_traits<Key, null_type, _Alloc, false>::value_type,
+ typename tree_node_metadata_dispatch<Key, null_type, Cmp_Fn, Node_Update,
+ _Alloc>::type,
+ _Alloc>,
+ _Alloc>
{ };
} // namespace detail
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/standard_policies.hpp b/libstdc++-v3/include/ext/pb_ds/detail/standard_policies.hpp
index cfbfbb07285..cdb09d451d4 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/standard_policies.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/standard_policies.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file standard_policies.hpp
+ * @file detail/standard_policies.hpp
* Contains standard policies for containers.
*/
@@ -44,8 +44,8 @@
#include <memory>
#include <ext/pb_ds/hash_policy.hpp>
#include <ext/pb_ds/list_update_policy.hpp>
+#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>
#include <ext/pb_ds/tree_policy.hpp>
-#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <tr1/functional>
@@ -54,12 +54,14 @@ namespace __gnu_pbds
{
namespace detail
{
+ /// default_hash_fn
template<typename Key>
struct default_hash_fn
{
typedef std::tr1::hash<Key> type;
};
+ /// default_eq_fn
template<typename Key>
struct default_eq_fn
{
@@ -71,11 +73,13 @@ namespace __gnu_pbds
default_store_hash = false
};
+ /// default_comb_hash_fn
struct default_comb_hash_fn
{
typedef __gnu_pbds::direct_mask_range_hashing<> type;
};
+ /// default_resize_policy
template<typename Comb_Hash_Fn>
struct default_resize_policy
{
@@ -95,11 +99,13 @@ namespace __gnu_pbds
typedef __gnu_pbds::hash_standard_resize_policy<size_policy_type, trigger, false, size_type> type;
};
+ /// default_update_policy
struct default_update_policy
{
- typedef __gnu_pbds::move_to_front_lu_policy<> type;
+ typedef __gnu_pbds::lu_move_to_front_policy<> type;
};
+ /// default_probe_fn
template<typename Comb_Probe_Fn>
struct default_probe_fn
{
@@ -116,21 +122,21 @@ namespace __gnu_pbds
typedef typename cond_type::__type type;
};
+ /// default_trie_access_traits
template<typename Key>
- struct default_trie_e_access_traits;
+ struct default_trie_access_traits;
- template<typename Char, class Char_Traits>
- struct default_trie_e_access_traits<std::basic_string<Char, Char_Traits, std::allocator<char> > >
+ template<typename Char, typename Char_Traits>
+ struct default_trie_access_traits<std::basic_string<Char, Char_Traits, std::allocator<char> > >
{
private:
typedef std::basic_string<Char, Char_Traits, std::allocator<char> > string_type;
public:
- typedef __gnu_pbds::string_trie_e_access_traits<string_type> type;
+ typedef __gnu_pbds::trie_string_access_traits<string_type> type;
};
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_STANDARD_POLICIES_HPP
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
index e6780516517..fe0b983265f 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file constructors_destructor_fn_imps.hpp
+ * @file thin_heap_/constructors_destructor_fn_imps.hpp
* Contains an implementation for thin_heap_.
*/
@@ -51,8 +51,7 @@ copy_from_range(It first_it, It last_it)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-thin_heap_() :
- m_p_max(0)
+thin_heap() : m_p_max(0)
{
initialize();
PB_DS_ASSERT_VALID((*this))
@@ -60,9 +59,8 @@ thin_heap_() :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-thin_heap_(const Cmp_Fn& r_cmp_fn) :
- PB_DS_BASE_C_DEC(r_cmp_fn),
- m_p_max(0)
+thin_heap(const Cmp_Fn& r_cmp_fn)
+: base_type(r_cmp_fn), m_p_max(0)
{
initialize();
PB_DS_ASSERT_VALID((*this))
@@ -70,12 +68,13 @@ thin_heap_(const Cmp_Fn& r_cmp_fn) :
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-thin_heap_(const PB_DS_CLASS_C_DEC& other) :
- PB_DS_BASE_C_DEC(other)
+thin_heap(const PB_DS_CLASS_C_DEC& other)
+: base_type(other)
{
initialize();
m_p_max = base_type::m_p_root;
- for (node_pointer p_nd = base_type::m_p_root; p_nd != 0; p_nd = p_nd->m_p_next_sibling)
+ for (node_pointer p_nd = base_type::m_p_root; p_nd != 0;
+ p_nd = p_nd->m_p_next_sibling)
if (Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value))
m_p_max = p_nd;
@@ -95,7 +94,7 @@ swap(PB_DS_CLASS_C_DEC& other)
PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC::
-~thin_heap_()
+~thin_heap()
{ }
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
index 0673675a63e..3eb85414291 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file debug_fn_imps.hpp
+ * @file thin_heap_/debug_fn_imps.hpp
* Contains an implementation for thin_heap_.
*/
@@ -81,7 +81,7 @@ assert_max(const char* __file, int __line) const
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
-assert_node_consistent(const_node_pointer p_nd, bool root,
+assert_node_consistent(node_const_pointer p_nd, bool root,
const char* __file, int __line) const
{
base_type::assert_node_consistent(p_nd, root, __file, __line);
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
index fec0ce4762f..11b7d773f9b 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file erase_fn_imps.hpp
+ * @file thin_heap_/erase_fn_imps.hpp
* Contains an implementation for thin_heap_.
*/
@@ -45,15 +45,11 @@ pop()
{
PB_DS_ASSERT_VALID((*this))
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
-
_GLIBCXX_DEBUG_ASSERT(m_p_max != 0);
node_pointer p_nd = m_p_max;
-
remove_max_node();
-
base_type::actual_erase_node(p_nd);
-
PB_DS_ASSERT_VALID((*this))
}
@@ -63,7 +59,6 @@ PB_DS_CLASS_C_DEC::
remove_max_node()
{
to_aux_except_max();
-
make_from_aux();
}
@@ -73,39 +68,29 @@ PB_DS_CLASS_C_DEC::
to_aux_except_max()
{
node_pointer p_add = base_type::m_p_root;
-
while (p_add != m_p_max)
{
node_pointer p_next_add = p_add->m_p_next_sibling;
-
add_to_aux(p_add);
-
p_add = p_next_add;
}
p_add = m_p_max->m_p_l_child;
-
while (p_add != 0)
{
node_pointer p_next_add = p_add->m_p_next_sibling;
-
- p_add->m_metadata = p_add->m_p_l_child == 0?
- 0 :
- p_add->m_p_l_child->m_metadata + 1;
+ p_add->m_metadata = p_add->m_p_l_child == 0 ?
+ 0 : p_add->m_p_l_child->m_metadata + 1;
add_to_aux(p_add);
-
p_add = p_next_add;
}
p_add = m_p_max->m_p_next_sibling;
-
while (p_add != 0)
{
node_pointer p_next_add = p_add->m_p_next_sibling;
-
add_to_aux(p_add);
-
p_add = p_next_add;
}
}
@@ -116,22 +101,18 @@ PB_DS_CLASS_C_DEC::
add_to_aux(node_pointer p_nd)
{
size_type r = p_nd->m_metadata;
-
while (m_a_aux[r] != 0)
{
_GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < rank_bound());
-
if (Cmp_Fn::operator()(m_a_aux[r]->m_value, p_nd->m_value))
make_child_of(m_a_aux[r], p_nd);
else
- {
+ {
make_child_of(p_nd, m_a_aux[r]);
-
p_nd = m_a_aux[r];
- }
+ }
m_a_aux[r] = 0;
-
++r;
}
@@ -150,7 +131,6 @@ make_child_of(node_pointer p_nd, node_pointer p_new_parent)
m_a_aux[p_nd->m_metadata] == p_new_parent);
++p_new_parent->m_metadata;
-
base_type::make_child_of(p_nd, p_new_parent);
}
@@ -160,20 +140,15 @@ PB_DS_CLASS_C_DEC::
make_from_aux()
{
base_type::m_p_root = m_p_max = 0;
-
const size_type rnk_bnd = rank_bound();
-
size_type i = 0;
-
while (i < rnk_bnd)
{
if (m_a_aux[i] != 0)
- {
+ {
make_root_and_link(m_a_aux[i]);
-
m_a_aux[i] = 0;
- }
-
+ }
++i;
}
@@ -190,7 +165,6 @@ remove_node(node_pointer p_nd)
p_parent = base_type::parent(p_parent);
base_type::bubble_to_top(p_nd);
-
m_p_max = p_nd;
node_pointer p_fix = base_type::m_p_root;
@@ -209,7 +183,6 @@ PB_DS_CLASS_C_DEC::
clear()
{
base_type::clear();
-
m_p_max = 0;
}
@@ -222,11 +195,8 @@ erase(point_iterator it)
_GLIBCXX_DEBUG_ASSERT(!base_type::empty());
node_pointer p_nd = it.m_p_nd;
-
remove_node(p_nd);
-
base_type::actual_erase_node(p_nd);
-
PB_DS_ASSERT_VALID((*this))
}
@@ -237,46 +207,33 @@ PB_DS_CLASS_C_DEC::
erase_if(Pred pred)
{
PB_DS_ASSERT_VALID((*this))
-
if (base_type::empty())
{
PB_DS_ASSERT_VALID((*this))
-
return 0;
}
base_type::to_linked_list();
-
node_pointer p_out = base_type::prune(pred);
-
size_type ersd = 0;
-
while (p_out != 0)
{
++ersd;
-
node_pointer p_next = p_out->m_p_next_sibling;
-
base_type::actual_erase_node(p_out);
-
p_out = p_next;
}
node_pointer p_cur = base_type::m_p_root;
-
m_p_max = base_type::m_p_root = 0;
-
while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
-
make_root_and_link(p_cur);
-
p_cur = p_next;
}
PB_DS_ASSERT_VALID((*this))
-
return ersd;
}
@@ -296,4 +253,3 @@ rank_bound()
return (p_upper - g_a_rank_bounds);
}
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
index bbae8de91b6..d0ba860ed4f 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file find_fn_imps.hpp
+ * @file thin_heap_/find_fn_imps.hpp
* Contains an implementation for thin_heap_.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
index f1195bdff4d..67b7f3a3a1a 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file insert_fn_imps.hpp
+ * @file thin_heap_/insert_fn_imps.hpp
* Contains an implementation for thin_heap_.
*/
@@ -44,34 +44,22 @@ PB_DS_CLASS_C_DEC::
push(const_reference r_val)
{
PB_DS_ASSERT_VALID((*this))
-
node_pointer p_nd = base_type::get_new_node_for_insert(r_val);
-
p_nd->m_metadata = 0;
-
p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = 0;
-
if (base_type::m_p_root == 0)
{
p_nd->m_p_next_sibling = 0;
-
m_p_max = base_type::m_p_root = p_nd;
-
PB_DS_ASSERT_VALID((*this))
-
return point_iterator(p_nd);
}
p_nd->m_p_next_sibling = base_type::m_p_root;
-
base_type::m_p_root->m_p_prev_or_parent = 0;
-
base_type::m_p_root = p_nd;
-
update_max(p_nd);
-
PB_DS_ASSERT_VALID((*this))
-
return point_iterator(p_nd);
}
@@ -80,10 +68,8 @@ inline void
PB_DS_CLASS_C_DEC::
make_root(node_pointer p_nd)
{
- p_nd->m_metadata =
- p_nd->m_p_l_child == 0 ?
- 0 :
- 1 + p_nd->m_p_l_child->m_metadata;
+ p_nd->m_metadata = p_nd->m_p_l_child == 0
+ ? 0 : 1 + p_nd->m_p_l_child->m_metadata;
}
PB_DS_CLASS_T_DEC
@@ -92,16 +78,12 @@ PB_DS_CLASS_C_DEC::
make_root_and_link(node_pointer p_nd)
{
make_root(p_nd);
-
p_nd->m_p_prev_or_parent = 0;
-
p_nd->m_p_next_sibling = base_type::m_p_root;
-
if (base_type::m_p_root != 0)
base_type::m_p_root->m_p_prev_or_parent = 0;
base_type::m_p_root = p_nd;
-
update_max(p_nd);
}
@@ -115,7 +97,6 @@ fix(node_pointer p_y)
if (p_y->m_p_prev_or_parent == 0)
{
fix_root(p_y);
-
return;
}
else if (p_y->m_metadata == 1&& p_y->m_p_next_sibling == 0)
@@ -123,27 +104,22 @@ fix(node_pointer p_y)
if (p_y->m_p_l_child != 0)
{
fix_sibling_rank_1_unmarked(p_y);
-
return;
}
fix_sibling_rank_1_marked(p_y);
-
p_y = p_y->m_p_prev_or_parent;
}
else if (p_y->m_metadata > p_y->m_p_next_sibling->m_metadata + 1)
{
_GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child != 0);
-
if (p_y->m_metadata != p_y->m_p_l_child->m_metadata + 2)
{
fix_sibling_general_unmarked(p_y);
-
return;
}
fix_sibling_general_marked(p_y);
-
p_y = p_y->m_p_prev_or_parent;
}
else if ((p_y->m_p_l_child == 0&&
@@ -151,9 +127,7 @@ fix(node_pointer p_y)
p_y->m_metadata == p_y->m_p_l_child->m_metadata + 3))
{
node_pointer p_z = p_y->m_p_prev_or_parent;
-
fix_child(p_y);
-
p_y = p_z;
}
else
@@ -167,9 +141,7 @@ PB_DS_CLASS_C_DEC::
fix_root(node_pointer p_y)
{
_GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent == 0);
-
make_root(p_y);
-
PB_DS_ASSERT_NODE_CONSISTENT(p_y, true)
}
@@ -186,11 +158,8 @@ fix_sibling_rank_1_unmarked(node_pointer p_y)
_GLIBCXX_DEBUG_ASSERT(p_y->m_p_next_sibling == 0);
p_y->m_p_next_sibling = p_y->m_p_l_child;
-
p_y->m_p_next_sibling->m_p_prev_or_parent = p_y;
-
p_y->m_p_l_child = 0;
-
PB_DS_ASSERT_NODE_CONSISTENT(p_y, false)
}
@@ -201,9 +170,7 @@ fix_sibling_rank_1_marked(node_pointer p_y)
{
_GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);
_GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child == 0);
-
p_y->m_metadata = 0;
-
PB_DS_ASSERT_NODE_CONSISTENT(p_y, false)
}
@@ -237,9 +204,7 @@ PB_DS_CLASS_C_DEC::
fix_sibling_general_marked(node_pointer p_y)
{
_GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != 0);
-
--p_y->m_metadata;
-
PB_DS_ASSERT_NODE_CONSISTENT(p_y, false)
}
@@ -267,33 +232,24 @@ PB_DS_CLASS_C_DEC::
modify(point_iterator it, const_reference r_new_val)
{
PB_DS_ASSERT_VALID((*this))
- node_pointer p_nd = it.m_p_nd;
-
+ node_pointer p_nd = it.m_p_nd;
_GLIBCXX_DEBUG_ASSERT(p_nd != 0);
const bool smaller = Cmp_Fn::operator()(r_new_val, p_nd->m_value);
-
p_nd->m_value = r_new_val;
-
if (smaller)
{
remove_node(p_nd);
-
p_nd->m_p_l_child = 0;
-
make_root_and_link(p_nd);
-
PB_DS_ASSERT_VALID((*this))
-
return;
}
if (p_nd->m_p_prev_or_parent == 0)
{
update_max(p_nd);
-
PB_DS_ASSERT_VALID((*this))
-
return;
}
@@ -309,9 +265,7 @@ modify(point_iterator it, const_reference r_new_val)
p_y->m_p_next_sibling = p_nd->m_p_next_sibling;
fix(p_y);
-
make_root_and_link(p_nd);
-
PB_DS_ASSERT_VALID((*this))
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
index 96bb818894b..279cf6611eb 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file split_join_fn_imps.hpp
+ * @file thin_heap_/split_join_fn_imps.hpp
* Contains an implementation for thin_heap_.
*/
@@ -48,47 +48,34 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
PB_DS_ASSERT_VALID(other)
other.clear();
-
if (base_type::empty())
{
PB_DS_ASSERT_VALID((*this))
PB_DS_ASSERT_VALID(other)
-
return;
}
base_type::to_linked_list();
-
node_pointer p_out = base_type::prune(pred);
while (p_out != 0)
{
_GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);
--base_type::m_size;
-
++other.m_size;
-
node_pointer p_next = p_out->m_p_next_sibling;
-
other.make_root_and_link(p_out);
-
p_out = p_next;
}
PB_DS_ASSERT_VALID(other)
-
node_pointer p_cur = base_type::m_p_root;
-
m_p_max = 0;
-
base_type::m_p_root = 0;
-
while (p_cur != 0)
{
node_pointer p_next = p_cur->m_p_next_sibling;
-
make_root_and_link(p_cur);
-
p_cur = p_next;
}
@@ -105,18 +92,13 @@ join(PB_DS_CLASS_C_DEC& other)
PB_DS_ASSERT_VALID(other)
node_pointer p_other = other.m_p_root;
-
while (p_other != 0)
{
node_pointer p_next = p_other->m_p_next_sibling;
-
make_root_and_link(p_other);
-
p_other = p_next;
}
-
base_type::m_size += other.m_size;
-
other.m_p_root = 0;
other.m_size = 0;
other.m_p_max = 0;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
index 9741ef9cf1c..fb30eb1b774 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
@@ -34,112 +34,79 @@
// warranty.
/**
- * @file thin_heap_.hpp
+ * @file thin_heap_/thin_heap_.hpp
* Contains an implementation class for a thin heap.
*/
#ifndef PB_DS_THIN_HEAP_HPP
#define PB_DS_THIN_HEAP_HPP
-/*
- * Thin heaps.
- * Tarjan and Kaplan.
- */
-
#include <algorithm>
#include <ext/pb_ds/detail/cond_dealtor.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>
-#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>
#include <debug/debug.h>
namespace __gnu_pbds
{
namespace detail
{
-
#define PB_DS_CLASS_T_DEC \
- template<typename Value_Type, class Cmp_Fn, class Allocator>
+ template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
- thin_heap_<Value_Type, Cmp_Fn, Allocator>
+ thin_heap<Value_Type, Cmp_Fn, _Alloc>
#ifdef _GLIBCXX_DEBUG
-#define PB_DS_BASE_C_DEC \
- left_child_next_sibling_heap_<Value_Type, Cmp_Fn, \
- typename Allocator::size_type, Allocator, true>
-#else
-#define PB_DS_BASE_C_DEC \
- left_child_next_sibling_heap_<Value_Type, Cmp_Fn, \
- typename Allocator::size_type, Allocator>
-#endif
+#define PB_DS_BASE_T_P \
+ <Value_Type, Cmp_Fn, typename _Alloc::size_type, _Alloc, true>
+#else
+#define PB_DS_BASE_T_P \
+ <Value_Type, Cmp_Fn, typename _Alloc::size_type, _Alloc>
+#endif
/**
- * class description = "t|-|i|\| h34p">
- **/
- template<typename Value_Type, class Cmp_Fn, class Allocator>
- class thin_heap_ : public PB_DS_BASE_C_DEC
+ * Thin heap.
+ * Base class for @ref priority_queue.
+ *
+ * See Tarjan and Kaplan.
+ */
+ template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
+ class thin_heap
+ : public left_child_next_sibling_heap PB_DS_BASE_T_P
{
-
private:
- typedef PB_DS_BASE_C_DEC base_type;
+ typedef typename _Alloc::template rebind<Value_Type>::other __rebind_a;
+ typedef left_child_next_sibling_heap PB_DS_BASE_T_P base_type;
protected:
- typedef typename base_type::node node;
-
- typedef typename base_type::node_pointer node_pointer;
-
- typedef typename base_type::const_node_pointer const_node_pointer;
+ typedef typename base_type::node node;
+ typedef typename base_type::node_pointer node_pointer;
+ typedef typename base_type::node_const_pointer node_const_pointer;
public:
+ typedef Value_Type value_type;
+ typedef Cmp_Fn cmp_fn;
+ typedef _Alloc allocator_type;
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
- typedef typename Allocator::size_type size_type;
-
- typedef typename Allocator::difference_type difference_type;
-
- typedef Value_Type value_type;
-
- typedef
- typename Allocator::template rebind<
- value_type>::other::pointer
- pointer;
-
- typedef
- typename Allocator::template rebind<
- value_type>::other::const_pointer
- const_pointer;
-
- typedef
- typename Allocator::template rebind<
- value_type>::other::reference
- reference;
-
- typedef
- typename Allocator::template rebind<
- value_type>::other::const_reference
- const_reference;
+ typedef typename __rebind_a::pointer pointer;
+ typedef typename __rebind_a::const_pointer const_pointer;
+ typedef typename __rebind_a::reference reference;
+ typedef typename __rebind_a::const_reference const_reference;
- typedef
- typename PB_DS_BASE_C_DEC::const_point_iterator
- const_point_iterator;
+ typedef typename base_type::point_iterator point_iterator;
+ typedef typename base_type::point_const_iterator point_const_iterator;
+ typedef typename base_type::iterator iterator;
+ typedef typename base_type::const_iterator const_iterator;
- typedef typename PB_DS_BASE_C_DEC::point_iterator point_iterator;
-
- typedef typename PB_DS_BASE_C_DEC::const_iterator const_iterator;
-
- typedef typename PB_DS_BASE_C_DEC::iterator iterator;
-
- typedef Cmp_Fn cmp_fn;
-
- typedef Allocator allocator_type;
-
- public:
inline point_iterator
- push(const_reference r_val);
+ push(const_reference);
void
- modify(point_iterator it, const_reference r_new_val);
+ modify(point_iterator, const_reference);
inline const_reference
top() const;
@@ -148,51 +115,50 @@ namespace __gnu_pbds
pop();
void
- erase(point_iterator it);
+ erase(point_iterator);
inline void
clear();
template<typename Pred>
size_type
- erase_if(Pred pred);
+ erase_if(Pred);
template<typename Pred>
void
- split(Pred pred, PB_DS_CLASS_C_DEC& other);
+ split(Pred, PB_DS_CLASS_C_DEC&);
void
- join(PB_DS_CLASS_C_DEC& other);
+ join(PB_DS_CLASS_C_DEC&);
protected:
+ thin_heap();
- thin_heap_();
+ thin_heap(const Cmp_Fn&);
- thin_heap_(const Cmp_Fn& r_cmp_fn);
-
- thin_heap_(const PB_DS_CLASS_C_DEC& other);
+ thin_heap(const PB_DS_CLASS_C_DEC&);
void
- swap(PB_DS_CLASS_C_DEC& other);
+ swap(PB_DS_CLASS_C_DEC&);
- ~thin_heap_();
+ ~thin_heap();
template<typename It>
void
- copy_from_range(It first_it, It last_it);
+ copy_from_range(It, It);
#ifdef _GLIBCXX_DEBUG
void
- assert_valid(const char* file, int line) const;
+ assert_valid(const char*, int) const;
void
- assert_max(const char* file, int line) const;
-#endif
+ assert_max(const char*, int) const;
+#endif
#ifdef PB_DS_THIN_HEAP_TRACE_
void
trace() const;
-#endif
+#endif
private:
enum
@@ -200,40 +166,38 @@ namespace __gnu_pbds
max_rank = (sizeof(size_type) << 4) + 2
};
- private:
-
void
initialize();
inline void
- update_max(node_pointer p_nd);
+ update_max(node_pointer);
inline void
- fix(node_pointer p_nd);
+ fix(node_pointer);
inline void
- fix_root(node_pointer p_y);
+ fix_root(node_pointer);
inline void
- fix_sibling_rank_1_unmarked(node_pointer p_y);
+ fix_sibling_rank_1_unmarked(node_pointer);
inline void
- fix_sibling_rank_1_marked(node_pointer p_y);
+ fix_sibling_rank_1_marked(node_pointer);
inline void
- fix_sibling_general_unmarked(node_pointer p_y);
+ fix_sibling_general_unmarked(node_pointer);
inline void
- fix_sibling_general_marked(node_pointer p_y);
+ fix_sibling_general_marked(node_pointer);
inline void
- fix_child(node_pointer p_y);
+ fix_child(node_pointer);
inline static void
- make_root(node_pointer p_nd);
+ make_root(node_pointer);
inline void
- make_root_and_link(node_pointer p_nd);
+ make_root_and_link(node_pointer);
inline void
remove_max_node();
@@ -242,7 +206,7 @@ namespace __gnu_pbds
to_aux_except_max();
inline void
- add_to_aux(node_pointer p_nd);
+ add_to_aux(node_pointer);
inline void
make_from_aux();
@@ -251,27 +215,24 @@ namespace __gnu_pbds
rank_bound();
inline void
- make_child_of(node_pointer p_nd, node_pointer p_new_parent);
+ make_child_of(node_pointer, node_pointer);
inline void
- remove_node(node_pointer p_nd);
+ remove_node(node_pointer);
inline node_pointer
- join(node_pointer p_lhs, node_pointer p_rhs) const;
+ join(node_pointer, node_pointer) const;
#ifdef _GLIBCXX_DEBUG
void
- assert_node_consistent(const_node_pointer p_nd, bool root,
- const char* file, int line) const;
+ assert_node_consistent(node_const_pointer, bool, const char*, int) const;
void
- assert_aux_null(const char* file, int line) const;
-#endif
-
- private:
- node_pointer m_p_max;
+ assert_aux_null(const char*, int) const;
+#endif
- node_pointer m_a_aux[max_rank];
+ node_pointer m_p_max;
+ node_pointer m_a_aux[max_rank];
};
enum
@@ -338,7 +299,7 @@ namespace __gnu_pbds
_GLIBCXX_DEBUG_ONLY(assert_node_consistent(_Node, _Bool, \
__FILE__, __LINE__);)
-#define PB_DS_ASSERT_AUX_NULL(X) \
+#define PB_DS_ASSERT_AUX_NULL(X) \
_GLIBCXX_DEBUG_ONLY(X.assert_aux_null(__FILE__, __LINE__);)
#include <ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp>
@@ -353,9 +314,9 @@ namespace __gnu_pbds
#undef PB_DS_ASSERT_NODE_CONSISTENT
#undef PB_DS_CLASS_C_DEC
#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_BASE_C_DEC
+#undef PB_DS_BASE_T_P
} // namespace detail
} // namespace __gnu_pbds
-#endif
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
index fc309d5c1ce..63a356414d1 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file trace_fn_imps.hpp
+ * @file thin_heap_/trace_fn_imps.hpp
* Contains an implementation class for left_child_next_sibling_heap_.
*/
@@ -46,9 +46,7 @@ PB_DS_CLASS_C_DEC::
trace() const
{
std::cerr << std::endl;
-
std::cerr << "m_p_max " << m_p_max << std::endl;
-
base_type::trace();
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp b/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
index c182886ee1d..1279b4dca49 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,83 +34,62 @@
// warranty.
/**
- * @file node_metadata_selector.hpp
+ * @file tree_policy/node_metadata_selector.hpp
* Contains an implementation class for trees.
*/
-#ifndef PB_DS_TREE_NODE_METADATA_SELECTOR_HPP
-#define PB_DS_TREE_NODE_METADATA_SELECTOR_HPP
+#ifndef PB_DS_TREE_NODE_METADATA_DISPATCH_HPP
+#define PB_DS_TREE_NODE_METADATA_DISPATCH_HPP
-#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>
#include <ext/pb_ds/detail/types_traits.hpp>
namespace __gnu_pbds
{
namespace detail
{
+ /// Tree metadata helper.
+ template<typename Node_Update, bool _BTp>
+ struct tree_metadata_helper;
- template<typename Node_Update, bool Null>
- struct tree_metadata_helper
- {
- typedef typename Node_Update::metadata_type type;
- };
+ template<typename Node_Update>
+ struct tree_metadata_helper<Node_Update, false>
+ {
+ typedef typename Node_Update::metadata_type type;
+ };
template<typename Node_Update>
- struct tree_metadata_helper<
- Node_Update,
- true>
- {
- typedef null_node_metadata type;
- };
+ struct tree_metadata_helper<Node_Update, true>
+ {
+ typedef null_type type;
+ };
+ /// Tree node metadata dispatch.
template<typename Key,
typename Data,
- class Cmp_Fn,
- template<typename Const_Node_Iterator,
- class Const_Iterator,
- class Cmp_Fn_,
- class Allocator_>
- class Node_Update,
- class Allocator>
- struct tree_node_metadata_selector
+ typename Cmp_Fn,
+ template<typename Node_CItr,
+ typename Const_Iterator,
+ typename Cmp_Fn_,
+ typename _Alloc_>
+ class Node_Update,
+ typename _Alloc>
+ struct tree_node_metadata_dispatch
{
private:
- typedef
- dumconst_node_iterator<
- Key,
- Data,
- Allocator>
- dumconst_node_it;
+ typedef dumnode_const_iterator<Key, Data, _Alloc> __it_type;
+ typedef Node_Update<__it_type, __it_type, Cmp_Fn, _Alloc> __node_u;
+ typedef null_node_update<__it_type, __it_type, Cmp_Fn, _Alloc> __nnode_u;
enum
{
- null_update =
- is_same<
- Node_Update<
- dumconst_node_it,
- dumconst_node_it,
- Cmp_Fn,
- Allocator>,
- null_tree_node_update<
- dumconst_node_it,
- dumconst_node_it,
- Cmp_Fn,
- Allocator> >::value
+ null_update = is_same<__node_u, __nnode_u>::value
};
public:
- typedef
- typename tree_metadata_helper<
- Node_Update<
- dumconst_node_it,
- dumconst_node_it,
- Cmp_Fn,
- Allocator>,
- null_update>::type
- type;
+ typedef typename tree_metadata_helper<__node_u, null_update>::type type;
};
-
} // namespace detail
} // namespace __gnu_pbds
-#endif // #ifndef PB_DS_TREE_NODE_METADATA_SELECTOR_HPP
+#endif // #ifndef PB_DS_TREE_NODE_METADATA_DISPATCH_HPP
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
deleted file mode 100644
index 006a3eb0476..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file null_node_update_imp.hpp
- * Contains an implementation of null_node_update.
- */
-
-PB_DS_CLASS_T_DEC
-template<typename Const_Node_Iterator_,
- typename Node_Iterator_,
- class Cmp_Fn_,
- typename Allocator_>
-inline void
-PB_DS_CLASS_C_DEC::
-swap(null_tree_node_update< Const_Node_Iterator_, Node_Iterator_, Cmp_Fn_, Allocator_>& /*other*/)
-{ }
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
index d3b27925f7e..84397f3dffc 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file order_statistics_imp.hpp
+ * @file tree_policy/order_statistics_imp.hpp
* Contains forward declarations for order_statistics_key
*/
@@ -44,95 +44,75 @@ PB_DS_CLASS_C_DEC::
find_by_order(size_type order)
{
node_iterator it = node_begin();
-
node_iterator end_it = node_end();
while (it != end_it)
{
node_iterator l_it = it.get_l_child();
-
- const size_type o = (l_it == end_it)?
- 0 :
- l_it.get_metadata();
+ const size_type o = (l_it == end_it)? 0 : l_it.get_metadata();
if (order == o)
- return (*it);
+ return *it;
else if (order < o)
it = l_it;
else
{
order -= o + 1;
-
it = it.get_r_child();
}
}
- return (PB_DS_BASE_C_DEC::end_iterator());
+ return base_type::end_iterator();
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
find_by_order(size_type order) const
-{
- return (const_cast<PB_DS_CLASS_C_DEC* >(this)->find_by_order(order));
-}
+{ return const_cast<PB_DS_CLASS_C_DEC*>(this)->find_by_order(order); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
-order_of_key(const_key_reference r_key) const
+order_of_key(key_const_reference r_key) const
{
- const_node_iterator it = node_begin();
-
- const_node_iterator end_it = node_end();
-
- const cmp_fn& r_cmp_fn =
- const_cast<PB_DS_CLASS_C_DEC* >(this)->get_cmp_fn();
+ node_const_iterator it = node_begin();
+ node_const_iterator end_it = node_end();
+ const cmp_fn& r_cmp_fn = const_cast<PB_DS_CLASS_C_DEC*>(this)->get_cmp_fn();
size_type ord = 0;
-
while (it != end_it)
{
- const_node_iterator l_it = it.get_l_child();
+ node_const_iterator l_it = it.get_l_child();
if (r_cmp_fn(r_key, this->extract_key(*(*it))))
it = l_it;
else if (r_cmp_fn(this->extract_key(*(*it)), r_key))
{
-
- ord += (l_it == end_it)?
- 1 :
- 1 + l_it.get_metadata();
-
+ ord += (l_it == end_it)? 1 : 1 + l_it.get_metadata();
it = it.get_r_child();
}
else
{
- ord += (l_it == end_it)?
- 0 :
- l_it.get_metadata();
-
+ ord += (l_it == end_it)? 0 : l_it.get_metadata();
it = end_it;
}
}
-
- return (ord);
+ return ord;
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
-operator()(node_iterator node_it, const_node_iterator end_nd_it) const
+operator()(node_iterator node_it, node_const_iterator end_nd_it) const
{
- node_iterator l_child_it = node_it.get_l_child();
- const size_type l_rank =(l_child_it == end_nd_it)? 0 : l_child_it.get_metadata();
+ node_iterator l_it = node_it.get_l_child();
+ const size_type l_rank = (l_it == end_nd_it) ? 0 : l_it.get_metadata();
- node_iterator r_child_it = node_it.get_r_child();
- const size_type r_rank =(r_child_it == end_nd_it)? 0 : r_child_it.get_metadata();
+ node_iterator r_it = node_it.get_r_child();
+ const size_type r_rank = (r_it == end_nd_it) ? 0 : r_it.get_metadata();
- const_cast<metadata_reference>(node_it.get_metadata())=
- 1 + l_rank + r_rank;
+ const_cast<metadata_reference>(node_it.get_metadata())= 1 + l_rank + r_rank;
}
PB_DS_CLASS_T_DEC
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp b/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
index b8c19a587f8..cb455da42d6 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
@@ -34,39 +34,29 @@
// warranty.
/**
- * @file sample_tree_node_update.hpp
+ * @file tree_policy/sample_tree_node_update.hpp
* Contains a samle node update functor.
*/
#ifndef PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP
#define PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP
-// A sample node updator.
-template<typename Const_Node_Iterator,
-
- class Node_Iterator,
-
- class Cmp_Fn,
-
- class Allocator
- >
-class sample_tree_node_update
+namespace __gnu_pbds
{
-
-public:
-
- // Metadata type.
- typedef std::size_t metadata_type;
-
-protected:
-
- // Default constructor.
- sample_tree_node_update();
-
- // Updates the rank of a node through a node_iterator node_it; end_nd_it is the end node iterator.
- inline void
- operator()(node_iterator node_it, const_node_iterator end_nd_it) const;
-
-};
-
+ /// A sample node updator.
+ template<typename Const_Node_Iter, typename Node_Iter, typename Cmp_Fn,
+ typename _Alloc>
+ class sample_tree_node_update
+ {
+ typedef std::size_t metadata_type;
+
+ // Default constructor.
+ sample_tree_node_update();
+
+ // Updates the rank of a node through a node_iterator node_it;
+ // end_nd_it is the end node iterator.
+ inline void
+ operator()(node_iterator node_it, node_const_iterator end_nd_it) const;
+ };
+}
#endif // #ifndef PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/tree_trace_base.hpp b/libstdc++-v3/include/ext/pb_ds/detail/tree_trace_base.hpp
index e4bd6564904..78cee868043 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/tree_trace_base.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/tree_trace_base.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file tree_trace_base.hpp
+ * @file detail/tree_trace_base.hpp
* Contains tree-related policies.
*/
@@ -43,82 +43,64 @@
#ifdef PB_DS_TREE_TRACE
-#include <ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp>
-#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+#include <ext/pb_ds/detail/branch_policy/branch_policy.hpp>
+#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>
namespace __gnu_pbds
{
-
namespace detail
{
-
#ifdef PB_DS_TREE_TRACE
#define PB_DS_CLASS_T_DEC \
- template< \
- class Const_Node_Iterator, \
- class Node_Iterator, \
- class Cmp_Fn, \
- bool Node_Based, \
- class Allocator>
+ template<typename Node_CItr, typename Node_Itr, \
+ typename Cmp_Fn, bool Node_Based, typename _Alloc>
#define PB_DS_CLASS_C_DEC \
- tree_trace_base< \
- Const_Node_Iterator, \
- Node_Iterator, \
- Cmp_Fn, \
- Node_Based, \
- Allocator>
-
-#define PB_DS_BASE_C_DEC \
- basic_tree_policy_base< \
- Const_Node_Iterator, \
- Node_Iterator, \
- Allocator>
-
- template<typename Const_Node_Iterator,
- class Node_Iterator,
- class Cmp_Fn,
- bool Node_Based,
- class Allocator>
- class tree_trace_base : private PB_DS_BASE_C_DEC
+ tree_trace_base<Node_CItr, Node_Itr, Cmp_Fn, \
+ Node_Based, _Alloc>
+
+#define PB_DS_TRACE_BASE \
+ branch_policy<Node_CItr, Node_Itr, _Alloc>
+
+ /// Tracing base class.
+ template<typename Node_CItr, typename Node_Itr,
+ typename Cmp_Fn, bool Node_Based, typename _Alloc>
+ class tree_trace_base : private PB_DS_TRACE_BASE
{
public:
void
trace() const;
private:
- typedef PB_DS_BASE_C_DEC base_type;
-
- typedef Const_Node_Iterator const_node_iterator;
+ typedef PB_DS_TRACE_BASE base_type;
+ typedef Node_CItr node_const_iterator;
+ typedef typename _Alloc::size_type size_type;
- typedef typename Allocator::size_type size_type;
-
- private:
void
- trace_node(const_node_iterator nd_it, size_type level) const;
+ trace_node(node_const_iterator, size_type) const;
virtual bool
empty() const = 0;
- virtual const_node_iterator
+ virtual node_const_iterator
node_begin() const = 0;
- virtual const_node_iterator
+ virtual node_const_iterator
node_end() const = 0;
static void
- print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,true>);
+ print_node_pointer(Node_CItr, integral_constant<int,true>);
static void
- print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,false>);
+ print_node_pointer(Node_CItr, integral_constant<int,false>);
template<typename Metadata_>
static void
- trace_it_metadata(Const_Node_Iterator nd_it, type_to_type<Metadata_>);
+ trace_it_metadata(Node_CItr, type_to_type<Metadata_>);
static void
- trace_it_metadata(Const_Node_Iterator, type_to_type<null_node_metadata>);
+ trace_it_metadata(Node_CItr, type_to_type<null_type>);
};
PB_DS_CLASS_T_DEC
@@ -127,83 +109,71 @@ namespace __gnu_pbds
trace() const
{
if (empty())
- return;
-
+ return;
trace_node(node_begin(), 0);
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
- trace_node(const_node_iterator nd_it, size_type level) const
+ trace_node(node_const_iterator nd_it, size_type level) const
{
if (nd_it.get_r_child() != node_end())
- trace_node(nd_it.get_r_child(), level + 1);
+ trace_node(nd_it.get_r_child(), level + 1);
for (size_type i = 0; i < level; ++i)
- std::cerr << ' ';
+ std::cerr << ' ';
print_node_pointer(nd_it, integral_constant<int,Node_Based>());
std::cerr << base_type::extract_key(*(*nd_it));
- typedef
- type_to_type<
- typename const_node_iterator::metadata_type>
- m_type_ind_t;
+ typedef type_to_type<typename node_const_iterator::metadata_type>
+ m_type_ind_t;
trace_it_metadata(nd_it, m_type_ind_t());
std::cerr << std::endl;
if (nd_it.get_l_child() != node_end())
- trace_node(nd_it.get_l_child(), level + 1);
+ trace_node(nd_it.get_l_child(), level + 1);
}
PB_DS_CLASS_T_DEC
template<typename Metadata_>
void
PB_DS_CLASS_C_DEC::
- trace_it_metadata(Const_Node_Iterator nd_it, type_to_type<Metadata_>)
+ trace_it_metadata(Node_CItr nd_it, type_to_type<Metadata_>)
{
- std::cerr << " (" <<
- static_cast<unsigned long>(nd_it.get_metadata()) << ") ";
+ const unsigned long ul = static_cast<unsigned long>(nd_it.get_metadata());
+ std::cerr << " (" << ul << ") ";
}
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
- trace_it_metadata(Const_Node_Iterator, type_to_type<null_node_metadata>)
+ trace_it_metadata(Node_CItr, type_to_type<null_type>)
{ }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
- print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,true>)
- {
- std::cerr << nd_it.m_p_nd << " ";
- }
+ print_node_pointer(Node_CItr nd_it, integral_constant<int,true>)
+ { std::cerr << nd_it.m_p_nd << " "; }
PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
- print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,false>)
- {
- std::cerr <<* nd_it << " ";
- }
+ print_node_pointer(Node_CItr nd_it, integral_constant<int,false>)
+ { std::cerr << *nd_it << " "; }
#undef PB_DS_CLASS_T_DEC
-
#undef PB_DS_CLASS_C_DEC
-
-#undef PB_DS_BASE_C_DEC
-
+#undef PB_DS_TRACE_BASE
#endif // #ifdef PB_DS_TREE_TRACE
} // namespace detail
-
} // namespace __gnu_pbds
#endif // #ifdef PB_DS_TREE_TRACE
#endif // #ifndef PB_DS_TREE_TRACE_BASE_HPP
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
index b4de31fd0ca..b20181b8aef 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,83 +34,62 @@
// warranty.
/**
- * @file node_metadata_selector.hpp
+ * @file trie_policy/node_metadata_selector.hpp
* Contains an implementation class for tries.
*/
-#ifndef PB_DS_TRIE_NODE_METADATA_SELECTOR_HPP
-#define PB_DS_TRIE_NODE_METADATA_SELECTOR_HPP
+#ifndef PB_DS_TRIE_NODE_METADATA_DISPATCH_HPP
+#define PB_DS_TRIE_NODE_METADATA_DISPATCH_HPP
-#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>
#include <ext/pb_ds/detail/types_traits.hpp>
namespace __gnu_pbds
{
namespace detail
{
+ /// Trie metadata helper.
+ template<typename Node_Update, bool _BTp>
+ struct trie_metadata_helper;
- template<typename Node_Update, bool Null>
- struct trie_metadata_helper
- {
- typedef typename Node_Update::metadata_type type;
- };
+ template<typename Node_Update>
+ struct trie_metadata_helper<Node_Update, false>
+ {
+ typedef typename Node_Update::metadata_type type;
+ };
template<typename Node_Update>
- struct trie_metadata_helper<
- Node_Update,
- true>
- {
- typedef null_node_metadata type;
- };
+ struct trie_metadata_helper<Node_Update, true>
+ {
+ typedef null_type type;
+ };
+ /// Trie node metadata dispatch.
template<typename Key,
typename Data,
- class Cmp_Fn,
- template<typename Const_Node_Iterator,
- class Const_Iterator,
- class Cmp_Fn_,
- class Allocator_>
- class Node_Update,
- class Allocator>
- struct trie_node_metadata_selector
+ typename Cmp_Fn,
+ template<typename Node_CItr,
+ typename Const_Iterator,
+ typename Cmp_Fn_,
+ typename _Alloc_>
+ class Node_Update,
+ typename _Alloc>
+ struct trie_node_metadata_dispatch
{
private:
- typedef
- dumconst_node_iterator<
- Key,
- Data,
- Allocator>
- dumconst_node_it;
+ typedef dumnode_const_iterator<Key, Data, _Alloc> __it_type;
+ typedef Node_Update<__it_type, __it_type, Cmp_Fn, _Alloc> __node_u;
+ typedef null_node_update<__it_type, __it_type, Cmp_Fn, _Alloc> __nnode_u;
enum
{
- null_update =
- is_same<
- Node_Update<
- dumconst_node_it,
- dumconst_node_it,
- Cmp_Fn,
- Allocator>,
- null_trie_node_update<
- dumconst_node_it,
- dumconst_node_it,
- Cmp_Fn,
- Allocator> >::value
+ null_update = is_same<__node_u, __nnode_u>::value
};
public:
- typedef
- typename trie_metadata_helper<
- Node_Update<
- dumconst_node_it,
- dumconst_node_it,
- Cmp_Fn,
- Allocator>,
- null_update>::type
- type;
+ typedef typename trie_metadata_helper<__node_u, null_update>::type type;
};
-
} // namespace detail
} // namespace __gnu_pbds
-#endif // #ifndef PB_DS_TRIE_NODE_METADATA_SELECTOR_HPP
+#endif // #ifndef PB_DS_TRIE_NODE_METADATA_DISPATCH_HPP
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
deleted file mode 100644
index 65245e9dc99..00000000000
--- a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file null_node_update_imp.hpp
- * Contains an implementation of null_node_update.
- */
-
-PB_DS_CLASS_T_DEC
-template<typename Const_Node_Iterator_,
- typename Node_Iterator_,
- class E_Access_Traits_,
- typename Allocator_>
-inline void
-PB_DS_CLASS_C_DEC::
-swap(null_trie_node_update< Const_Node_Iterator_, Node_Iterator_, E_Access_Traits_, Allocator_>& /*other*/)
-{ }
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
index cb8e2474121..ff9595e94a0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file order_statistics_imp.hpp
+ * @file trie_policy/order_statistics_imp.hpp
* Contains forward declarations for order_statistics_key
*/
@@ -44,35 +44,31 @@ PB_DS_CLASS_C_DEC::
find_by_order(size_type order)
{
if (empty())
- return (end());
+ return end();
++order;
-
node_iterator nd_it = node_begin();
while (true)
{
if (order > nd_it.get_metadata())
- return (++base_type::rightmost_it(nd_it));
+ return ++base_type::rightmost_it(nd_it);
const size_type num_children = nd_it.num_children();
-
if (num_children == 0)
- return (*nd_it);
+ return *nd_it;
for (size_type i = 0; i < num_children; ++i)
- {
+ {
node_iterator child_nd_it = nd_it.get_child(i);
-
if (order <= child_nd_it.get_metadata())
- {
+ {
i = num_children;
-
nd_it = child_nd_it;
- }
+ }
else
order -= child_nd_it.get_metadata();
- }
+ }
}
}
@@ -80,81 +76,70 @@ PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
find_by_order(size_type order) const
-{
- return (const_cast<PB_DS_CLASS_C_DEC* >(this)->find_by_order(order));
-}
+{ return const_cast<PB_DS_CLASS_C_DEC*>(this)->find_by_order(order); }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
-order_of_key(const_key_reference r_key) const
+order_of_key(key_const_reference r_key) const
{
- const E_Access_Traits& r_traits =
- const_cast<PB_DS_CLASS_C_DEC* >(this)->get_e_access_traits();
+ const _ATraits& r_traits =
+ const_cast<PB_DS_CLASS_C_DEC* >(this)->get_access_traits();
- return (order_of_prefix(
- r_traits.begin(r_key),
- r_traits.end(r_key)));
+ return order_of_prefix(r_traits.begin(r_key), r_traits.end(r_key));
}
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
-order_of_prefix(typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e) const
+order_of_prefix(typename access_traits::const_iterator b,
+ typename access_traits::const_iterator e) const
{
if (empty())
- return (0);
-
- const E_Access_Traits& r_traits =
- const_cast<PB_DS_CLASS_C_DEC* >(this)->get_e_access_traits();
-
- const_node_iterator nd_it = node_begin();
+ return 0;
- const_node_iterator end_nd_it = node_end();
+ const _ATraits& r_traits =
+ const_cast<PB_DS_CLASS_C_DEC*>(this)->get_access_traits();
+ node_const_iterator nd_it = node_begin();
+ node_const_iterator end_nd_it = node_end();
size_type ord = 0;
while (true)
{
const size_type num_children = nd_it.num_children();
-
if (num_children == 0)
- {
- const_key_reference r_key =
- base_type::extract_key(*(*nd_it));
-
- typename e_access_traits::const_iterator key_b =
+ {
+ key_const_reference r_key = base_type::extract_key(*(*nd_it));
+ typename access_traits::const_iterator key_b =
r_traits.begin(r_key);
- typename e_access_traits::const_iterator key_e =
+ typename access_traits::const_iterator key_e =
r_traits.end(r_key);
- return ((base_type::less( key_b, key_e, b, e, r_traits))?
- ord + 1 :
- ord);
- }
-
- const_node_iterator next_nd_it = end_nd_it;
+ return (base_type::less(key_b, key_e, b, e, r_traits)) ?
+ ord + 1 : ord;
+ }
+ node_const_iterator next_nd_it = end_nd_it;
size_type i = num_children - 1;
do
- {
- const_node_iterator child_nd_it = nd_it.get_child(i);
+ {
+ node_const_iterator child_nd_it = nd_it.get_child(i);
if (next_nd_it != end_nd_it)
ord += child_nd_it.get_metadata();
- else if (!base_type::less(
- b, e,
+ else if (!base_type::less(b, e,
child_nd_it.valid_prefix().first,
child_nd_it.valid_prefix().second,
r_traits))
next_nd_it = child_nd_it;
- }
+ }
while (i-- > 0);
if (next_nd_it == end_nd_it)
- return (ord);
+ return ord;
nd_it = next_nd_it;
}
@@ -163,19 +148,13 @@ order_of_prefix(typename e_access_traits::const_iterator b, typename e_access_tr
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
-operator()(node_iterator nd_it, const_node_iterator /*end_nd_it*/) const
+operator()(node_iterator nd_it, node_const_iterator /*end_nd_it*/) const
{
const size_type num_children = nd_it.num_children();
-
size_type children_rank = 0;
-
for (size_type i = 0; i < num_children; ++i)
children_rank += nd_it.get_child(i).get_metadata();
- const_cast<size_type& >(nd_it.get_metadata()) =(num_children == 0)? 1 : children_rank;
+ const size_type res = (num_children == 0) ? 1 : children_rank;
+ const_cast<size_type&>(nd_it.get_metadata()) = res;
}
-
-PB_DS_CLASS_T_DEC
-PB_DS_CLASS_C_DEC::
-~trie_order_statistics_node_update()
-{ }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
index ff2799e3e95..04771dd725e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file prefix_search_node_update_imp.hpp
+ * @file trie_policy/prefix_search_node_update_imp.hpp
* Contains an implementation of prefix_search_node_update.
*/
@@ -43,13 +43,10 @@ std::pair<
typename PB_DS_CLASS_C_DEC::const_iterator,
typename PB_DS_CLASS_C_DEC::const_iterator>
PB_DS_CLASS_C_DEC::
-prefix_range(const_key_reference r_key) const
+prefix_range(key_const_reference r_key) const
{
- const e_access_traits& r_traits = get_e_access_traits();
-
- return (prefix_range(
- r_traits.begin(r_key),
- r_traits.end(r_key)));
+ const access_traits& r_traits = get_access_traits();
+ return (prefix_range(r_traits.begin(r_key), r_traits.end(r_key)));
}
PB_DS_CLASS_T_DEC
@@ -57,11 +54,10 @@ std::pair<
typename PB_DS_CLASS_C_DEC::iterator,
typename PB_DS_CLASS_C_DEC::iterator>
PB_DS_CLASS_C_DEC::
-prefix_range(const_key_reference r_key)
+prefix_range(key_const_reference r_key)
{
- return (prefix_range(
- get_e_access_traits().begin(r_key),
- get_e_access_traits().end(r_key)));
+ return (prefix_range(get_access_traits().begin(r_key),
+ get_access_traits().end(r_key)));
}
PB_DS_CLASS_T_DEC
@@ -69,13 +65,13 @@ std::pair<
typename PB_DS_CLASS_C_DEC::const_iterator,
typename PB_DS_CLASS_C_DEC::const_iterator>
PB_DS_CLASS_C_DEC::
-prefix_range(typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e) const
+prefix_range(typename access_traits::const_iterator b,
+ typename access_traits::const_iterator e) const
{
const std::pair<iterator, iterator> non_const_ret =
const_cast<PB_DS_CLASS_C_DEC* >(this)->prefix_range(b, e);
- return (std::make_pair(
- const_iterator(non_const_ret.first),
+ return (std::make_pair(const_iterator(non_const_ret.first),
const_iterator(non_const_ret.second)));
}
@@ -84,14 +80,13 @@ std::pair<
typename PB_DS_CLASS_C_DEC::iterator,
typename PB_DS_CLASS_C_DEC::iterator>
PB_DS_CLASS_C_DEC::
-prefix_range(typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e)
+prefix_range(typename access_traits::const_iterator b,
+ typename access_traits::const_iterator e)
{
- Node_Iterator nd_it = node_begin();
- Node_Iterator end_nd_it = node_end();
-
- const e_access_traits& r_traits =
- get_e_access_traits();
+ Node_Itr nd_it = node_begin();
+ Node_Itr end_nd_it = node_end();
+ const access_traits& r_traits = get_access_traits();
const size_type given_range_length = std::distance(b, e);
while (true)
@@ -100,17 +95,14 @@ prefix_range(typename e_access_traits::const_iterator b, typename e_access_trait
return (std::make_pair(end(), end()));
const size_type common_range_length =
- PB_DS_BASE_C_DEC::common_prefix_len(nd_it, b, e, r_traits);
+ base_type::common_prefix_len(nd_it, b, e, r_traits);
if (common_range_length >= given_range_length)
- {
+ {
iterator ret_b = this->leftmost_it(nd_it);
-
iterator ret_e = this->rightmost_it(nd_it);
-
return (std::make_pair(ret_b, ++ret_e));
- }
-
+ }
nd_it = next_child(nd_it, b, e, end_nd_it, r_traits);
}
}
@@ -118,34 +110,30 @@ prefix_range(typename e_access_traits::const_iterator b, typename e_access_trait
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::node_iterator
PB_DS_CLASS_C_DEC::
-next_child(node_iterator nd_it, typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e, node_iterator end_nd_it, const e_access_traits& r_traits)
+next_child(node_iterator nd_it, typename access_traits::const_iterator b,
+ typename access_traits::const_iterator e, node_iterator end_nd_it,
+ const access_traits& r_traits)
{
const size_type num_children = nd_it.num_children();
-
node_iterator ret = end_nd_it;
-
size_type max_length = 0;
-
for (size_type i = 0; i < num_children; ++i)
{
node_iterator pot = nd_it.get_child(i);
-
const size_type common_range_length =
- PB_DS_BASE_C_DEC::common_prefix_len( pot, b, e, r_traits);
+ base_type::common_prefix_len(pot, b, e, r_traits);
if (common_range_length > max_length)
- {
+ {
ret = pot;
-
max_length = common_range_length;
- }
+ }
}
-
return (ret);
}
PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
-operator()(node_iterator /*nd_it*/, const_node_iterator /*end_nd_it*/) const
+operator()(node_iterator /*nd_it*/, node_const_iterator /*end_nd_it*/) const
{ }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_access_traits.hpp
index 2ecad89c9a7..59edfbb5760 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_access_traits.hpp
@@ -34,56 +34,44 @@
// warranty.
/**
- * @file sample_trie_e_access_traits.hpp
+ * @file trie_policy/sample_trie_access_traits.hpp
* Contains a sample probe policy.
*/
#ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP
#define PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP
-// A sample trie element-access traits.
-class sample_trie_e_access_traits
+namespace __gnu_pbds
{
-
-public:
-
- // Size type.
- typedef std::size_t size_type;
-
- // Key type.
- typedef std::string key_type;
-
- // Const key reference type.
- typedef
- typename Allocator::template rebind<
- key_type>::other::const_reference
- const_key_reference;
-
- // Element const iterator type.
- typedef std::string::const_iterator const_iterator;
-
- // Element type.
- typedef char e_type;
-
- enum
- {
- max_size = 4
- };
-
-public:
-
- // Returns a const_iterator to the first element of r_key.
- inline static const_iterator
- begin(const_key_reference r_key);
-
- // Returns a const_iterator to the after-last element of r_key.
- inline static const_iterator
- end(const_key_reference r_key);
-
- // Maps an element to a position.
- inline static size_type
- e_pos(e_type e);
-
-};
-
+ /// A sample trie element access traits.
+ struct sample_trie_access_traits
+ {
+ typedef std::size_t size_type;
+ typedef std::string key_type;
+
+ typedef typename _Alloc::template rebind<key_type> __rebind_k;
+ typedef typename __rebind_k::other::const_reference key_const_reference;
+ typedef std::string::const_iterator const_iterator;
+
+ // Element type.
+ typedef char e_type;
+
+ enum
+ {
+ max_size = 4
+ };
+
+ // Returns a const_iterator to the first element of r_key.
+ inline static const_iterator
+ begin(key_const_reference);
+
+ // Returns a const_iterator to the after-last element of r_key.
+ inline static const_iterator
+ end(key_const_reference);
+
+ // Maps an element to a position.
+ inline static size_type
+ e_pos(e_type);
+ };
+}
#endif // #ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
index 8b2c6b591f7..6c97aee052a 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
@@ -34,39 +34,31 @@
// warranty.
/**
- * @file sample_trie_node_update.hpp
+ * @file trie_policy/sample_trie_node_update.hpp
* Contains a samle node update functor.
*/
#ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP
#define PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP
-// A sample node updator.
-template<typename Const_Node_Iterator,
-
- class Node_Iterator,
-
- class E_Access_Traits,
-
- class Allocator
- >
-class sample_trie_node_update
+namespace __gnu_pbds
{
-
-public:
-
- // Metadata type.
- typedef std::size_t metadata_type;
-
-protected:
-
- // Default constructor.
- sample_trie_node_update();
-
- // Updates the rank of a node through a node_iterator node_it; end_nd_it is the end node iterator.
- inline void
- operator()(node_iterator node_it, const_node_iterator end_nd_it) const;
-
-};
-
+ /// A sample node updator.
+ template<typename Node_CItr, typename Node_Itr,
+ typename _ATraits, typename _Alloc>
+ class sample_trie_node_update
+ {
+ public:
+ typedef std::size_t metadata_type;
+
+ protected:
+ // Default constructor.
+ sample_trie_node_update();
+
+ // Updates the rank of a node through a node_iterator node_it;
+ // end_nd_it is the end node iterator.
+ inline void
+ operator()(node_iterator, node_const_iterator) const;
+ };
+}
#endif // #ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
index db912a008fa..2668a87d922 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
@@ -34,157 +34,121 @@
// warranty.
/**
- * @file trie_policy_base.hpp
+ * @file trie_policy/trie_policy_base.hpp
* Contains an implementation of trie_policy_base.
*/
#ifndef PB_DS_TRIE_POLICY_BASE_HPP
#define PB_DS_TRIE_POLICY_BASE_HPP
-#include <ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp>
+#include <ext/pb_ds/detail/branch_policy/branch_policy.hpp>
namespace __gnu_pbds
{
namespace detail
{
-
-#define PB_DS_CLASS_T_DEC \
- template< \
- class Const_Node_Iterator, \
- class Node_Iterator, \
- class E_Access_Traits, \
- typename Allocator>
-
-#define PB_DS_CLASS_C_DEC \
- trie_policy_base< \
- Const_Node_Iterator, \
- Node_Iterator, \
- E_Access_Traits, \
- Allocator>
-
-#define PB_DS_BASE_C_DEC \
- basic_tree_policy_base< \
- Const_Node_Iterator, \
- Node_Iterator, \
- Allocator>
-
- template<typename Const_Node_Iterator,
- class Node_Iterator,
- class E_Access_Traits,
- class Allocator>
- class trie_policy_base : public PB_DS_BASE_C_DEC
+ /// Base class for trie policies.
+ template<typename Node_CItr, typename Node_Itr,
+ typename _ATraits, typename _Alloc>
+ class trie_policy_base
+ : public branch_policy<Node_CItr, Node_Itr, _Alloc>
{
+ typedef branch_policy<Node_CItr, Node_Itr, _Alloc> base_type;
public:
-
- typedef E_Access_Traits e_access_traits;
-
- typedef Allocator allocator_type;
-
- typedef typename allocator_type::size_type size_type;
-
- typedef null_node_metadata metadata_type;
-
- typedef Const_Node_Iterator const_node_iterator;
-
- typedef Node_Iterator node_iterator;
-
- typedef typename const_node_iterator::value_type const_iterator;
-
- typedef typename node_iterator::value_type iterator;
-
- public:
-
- typedef typename PB_DS_BASE_C_DEC::key_type key_type;
-
- typedef
- typename PB_DS_BASE_C_DEC::const_key_reference
- const_key_reference;
+ typedef _ATraits access_traits;
+ typedef _Alloc allocator_type;
+ typedef typename allocator_type::size_type size_type;
+ typedef null_type metadata_type;
+ typedef Node_CItr node_const_iterator;
+ typedef Node_Itr node_iterator;
+ typedef typename node_const_iterator::value_type const_iterator;
+ typedef typename node_iterator::value_type iterator;
+ typedef typename base_type::key_type key_type;
+ typedef typename base_type::key_const_reference key_const_reference;
protected:
-
virtual const_iterator
end() const = 0;
virtual iterator
end() = 0;
- virtual const_node_iterator
+ virtual node_const_iterator
node_begin() const = 0;
virtual node_iterator
node_begin() = 0;
- virtual const_node_iterator
+ virtual node_const_iterator
node_end() const = 0;
virtual node_iterator
node_end() = 0;
- virtual const e_access_traits&
- get_e_access_traits() const = 0;
+ virtual const access_traits&
+ get_access_traits() const = 0;
private:
- typedef
- std::pair<
- typename e_access_traits::const_iterator,
- typename e_access_traits::const_iterator>
- prefix_range_t;
-
- typedef PB_DS_BASE_C_DEC base_type;
+ typedef typename access_traits::const_iterator e_const_iterator;
+ typedef std::pair<e_const_iterator, e_const_iterator> prefix_range_t;
protected:
static size_type
- common_prefix_len(node_iterator nd_it, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits);
+ common_prefix_len(node_iterator, e_const_iterator,
+ e_const_iterator, const access_traits&);
static iterator
- leftmost_it(node_iterator nd_it);
+ leftmost_it(node_iterator);
static iterator
- rightmost_it(node_iterator nd_it);
+ rightmost_it(node_iterator);
static bool
- less(typename e_access_traits::const_iterator b_l, typename e_access_traits::const_iterator e_l, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits);
+ less(e_const_iterator, e_const_iterator, e_const_iterator,
+ e_const_iterator, const access_traits&);
};
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Node_CItr, typename Node_Itr, \
+ typename _ATraits, typename _Alloc>
+
+#define PB_DS_CLASS_C_DEC \
+ trie_policy_base<Node_CItr, Node_Itr, _ATraits, _Alloc>
+
PB_DS_CLASS_T_DEC
typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
- common_prefix_len(node_iterator nd_it, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits)
+ common_prefix_len(node_iterator nd_it, e_const_iterator b_r,
+ e_const_iterator e_r, const access_traits& r_traits)
{
prefix_range_t pref_range = nd_it.valid_prefix();
- typename e_access_traits::const_iterator b_l = pref_range.first;
- typename e_access_traits::const_iterator e_l = pref_range.second;
+ e_const_iterator b_l = pref_range.first;
+ e_const_iterator e_l = pref_range.second;
- const size_type range_length_l =
- std::distance(b_l, e_l);
-
- const size_type range_length_r =
- std::distance(b_r, e_r);
+ const size_type range_length_l = std::distance(b_l, e_l);
+ const size_type range_length_r = std::distance(b_r, e_r);
if (range_length_r < range_length_l)
{
std::swap(b_l, b_r);
-
std::swap(e_l, e_r);
}
size_type ret = 0;
-
while (b_l != e_l)
{
if (r_traits.e_pos(*b_l) != r_traits.e_pos(*b_r))
- return (ret);
+ return ret;
++ret;
-
++b_l;
-
++b_r;
}
- return (ret);
+ return ret;
}
PB_DS_CLASS_T_DEC
@@ -193,9 +157,9 @@ namespace __gnu_pbds
leftmost_it(node_iterator nd_it)
{
if (nd_it.num_children() == 0)
- return (*nd_it);
+ return *nd_it;
- return (leftmost_it(nd_it.get_child(0)));
+ return leftmost_it(nd_it.get_child(0));
}
PB_DS_CLASS_T_DEC
@@ -206,44 +170,38 @@ namespace __gnu_pbds
const size_type num_children = nd_it.num_children();
if (num_children == 0)
- return (*nd_it);
+ return *nd_it;
- return (rightmost_it(nd_it.get_child(num_children - 1)));
+ return rightmost_it(nd_it.get_child(num_children - 1));
}
PB_DS_CLASS_T_DEC
bool
PB_DS_CLASS_C_DEC::
- less(typename e_access_traits::const_iterator b_l, typename e_access_traits::const_iterator e_l, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits)
+ less(e_const_iterator b_l, e_const_iterator e_l,
+ e_const_iterator b_r, e_const_iterator e_r,
+ const access_traits& r_traits)
{
while (b_l != e_l)
{
if (b_r == e_r)
- return (false);
-
- size_type l_pos =
- r_traits.e_pos(*b_l);
- size_type r_pos =
- r_traits.e_pos(*b_r);
+ return false;
+ size_type l_pos = r_traits.e_pos(*b_l);
+ size_type r_pos = r_traits.e_pos(*b_r);
if (l_pos != r_pos)
return (l_pos < r_pos);
++b_l;
++b_r;
}
-
- return (b_r != e_r);
+ return b_r != e_r;
}
#undef PB_DS_CLASS_T_DEC
-
#undef PB_DS_CLASS_C_DEC
-#undef PB_DS_BASE_C_DEC
-
} // namespace detail
} // namespace __gnu_pbds
#endif // #ifndef PB_DS_TRIE_POLICY_BASE_HPP
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp
index 228a4a5dc32..c6d9c490136 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file string_trie_e_access_traits_imp.hpp
+ * @file trie_policy/trie_string_access_traits_imp.hpp
* Contains a policy for extracting character positions from
* a string for a vector-based PATRICIA tree
*/
@@ -53,7 +53,7 @@ e_pos(e_type e)
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
-begin(const_key_reference r_key)
+begin(key_const_reference r_key)
{
return (begin_imp(r_key, s_rev_ind));
}
@@ -61,7 +61,7 @@ begin(const_key_reference r_key)
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
-end(const_key_reference r_key)
+end(key_const_reference r_key)
{
return (end_imp(r_key, s_rev_ind));
}
@@ -69,7 +69,7 @@ end(const_key_reference r_key)
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
-begin_imp(const_key_reference r_key, detail::false_type)
+begin_imp(key_const_reference r_key, detail::false_type)
{
return (r_key.begin());
}
@@ -77,7 +77,7 @@ begin_imp(const_key_reference r_key, detail::false_type)
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
-begin_imp(const_key_reference r_key, detail::true_type)
+begin_imp(key_const_reference r_key, detail::true_type)
{
return (r_key.rbegin());
}
@@ -85,7 +85,7 @@ begin_imp(const_key_reference r_key, detail::true_type)
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
-end_imp(const_key_reference r_key, detail::false_type)
+end_imp(key_const_reference r_key, detail::false_type)
{
return (r_key.end());
}
@@ -93,7 +93,7 @@ end_imp(const_key_reference r_key, detail::false_type)
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::const_iterator
PB_DS_CLASS_C_DEC::
-end_imp(const_key_reference r_key, detail::true_type)
+end_imp(key_const_reference r_key, detail::true_type)
{
return (r_key.rend());
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/type_utils.hpp b/libstdc++-v3/include/ext/pb_ds/detail/type_utils.hpp
index 143110c0ad9..79899857b0d 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/type_utils.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/type_utils.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file type_utils.hpp
+ * @file detail/type_utils.hpp
* Contains utilities for handnling types. All of these classes are based on
* Modern C++ by Andrei Alxandrescu.
*/
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/types_traits.hpp b/libstdc++-v3/include/ext/pb_ds/detail/types_traits.hpp
index 6d5a0783808..50db9b2bc90 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/types_traits.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/types_traits.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,14 +34,16 @@
// warranty.
/**
- * @file types_traits.hpp
+ * @file detail/types_traits.hpp
* Contains a traits class of types used by containers.
*/
#ifndef PB_DS_TYPES_TRAITS_HPP
#define PB_DS_TYPES_TRAITS_HPP
-#include <ext/pb_ds/detail/basic_types.hpp>
+#include <algorithm>
+#include <utility>
+#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/detail/type_utils.hpp>
#include <utility>
@@ -49,34 +51,238 @@ namespace __gnu_pbds
{
namespace detail
{
- template<typename Key, typename Mapped, typename Alloc, bool Store_Extra>
- struct vt_base_selector
- {
- typedef value_type_base<Key, Mapped, Alloc, Store_Extra> type;
- };
+ /// Primary template.
+ template<typename Key, typename Mapped>
+ struct no_throw_copies
+ {
+ static const bool __simple = is_simple<Key>::value
+ && is_simple<Mapped>::value;
+ typedef integral_constant<int, __simple> indicator;
+ };
+
+ /// Specialization.
+ template<typename Key>
+ struct no_throw_copies<Key, null_type>
+ {
+ typedef integral_constant<int, is_simple<Key>::value> indicator;
+ };
+
+
+ //@{
+ /**
+ * Data properties computation.
+ */
+
+ /// Stored value.
+ template<typename _Tv>
+ struct stored_value
+ {
+ typedef _Tv value_type;
+ value_type m_value;
+ };
+
+ /// Stored hash.
+ template<typename _Th>
+ struct stored_hash
+ {
+ typedef _Th hash_type;
+ hash_type m_hash;
+ };
+
+ /// Primary template for representation of stored data.
+ /// Two types of data can be stored: value and hash.
+ template<typename _Tv, typename _Th>
+ struct stored_data
+ : public stored_value<_Tv>, public stored_hash<_Th>
+ { };
+
+ /// Specialization for representation of stored data of just value type.
+ template<typename _Tv>
+ struct stored_data<_Tv, null_type>
+ : public stored_value<_Tv>
+ { };
+
+ /// Primary template.
+ template<typename Key, typename Mapped, typename _Alloc, bool Store_Hash>
+ struct type_base;
+
+ /**
+ * Specialization of type_base for the case where the hash value
+ * is not stored alongside each value.
+ */
+ template<typename Key, typename Mapped, typename _Alloc>
+ struct type_base<Key, Mapped, _Alloc, false>
+ {
+ public:
+ typedef typename _Alloc::size_type size_type;
+
+ private:
+ typedef typename _Alloc::template rebind<Mapped> __rebind_m;
+ typedef typename __rebind_m::other __rebind_ma;
+ typedef std::pair<const Key, Mapped> __value_type;
+ typedef typename _Alloc::template rebind<__value_type> __rebind_v;
+ typedef typename __rebind_v::other __rebind_va;
+
+ public:
+ typedef typename __rebind_ma::value_type mapped_type;
+ typedef typename __rebind_ma::pointer mapped_pointer;
+ typedef typename __rebind_ma::const_pointer mapped_const_pointer;
+ typedef typename __rebind_ma::reference mapped_reference;
+ typedef typename __rebind_ma::const_reference mapped_const_reference;
+
+ typedef typename __rebind_va::value_type value_type;
+ typedef typename __rebind_va::pointer pointer;
+ typedef typename __rebind_va::const_pointer const_pointer;
+ typedef typename __rebind_va::reference reference;
+ typedef typename __rebind_va::const_reference const_reference;
+
+ typedef stored_data<value_type, null_type> stored_data_type;
+ };
+
+ /**
+ * Specialization of type_base for the case where the hash value
+ * is stored alongside each value.
+ */
+ template<typename Key, typename Mapped, typename _Alloc>
+ struct type_base<Key, Mapped, _Alloc, true>
+ {
+ public:
+ typedef typename _Alloc::size_type size_type;
+
+ private:
+ typedef typename _Alloc::template rebind<Mapped> __rebind_m;
+ typedef typename __rebind_m::other __rebind_ma;
+ typedef std::pair<const Key, Mapped> __value_type;
+ typedef typename _Alloc::template rebind<__value_type> __rebind_v;
+ typedef typename __rebind_v::other __rebind_va;
+
+ public:
+ typedef typename __rebind_ma::value_type mapped_type;
+ typedef typename __rebind_ma::pointer mapped_pointer;
+ typedef typename __rebind_ma::const_pointer mapped_const_pointer;
+ typedef typename __rebind_ma::reference mapped_reference;
+ typedef typename __rebind_ma::const_reference mapped_const_reference;
+
+ typedef typename __rebind_va::value_type value_type;
+ typedef typename __rebind_va::pointer pointer;
+ typedef typename __rebind_va::const_pointer const_pointer;
+ typedef typename __rebind_va::reference reference;
+ typedef typename __rebind_va::const_reference const_reference;
+
+ typedef stored_data<value_type, size_type> stored_data_type;
+ };
+
+
+ /**
+ * Specialization of type_base for the case where the hash value
+ * is not stored alongside each value.
+ */
+ template<typename Key, typename _Alloc>
+ struct type_base<Key, null_type, _Alloc, false>
+ {
+ public:
+ typedef typename _Alloc::size_type size_type;
+ typedef Key value_type;
+
+ private:
+ typedef typename _Alloc::template rebind<null_type> __rebind_m;
+ typedef typename __rebind_m::other __rebind_ma;
+ typedef typename _Alloc::template rebind<value_type> __rebind_v;
+ typedef typename __rebind_v::other __rebind_va;
+
+ public:
+ typedef typename __rebind_ma::value_type mapped_type;
+ typedef typename __rebind_ma::pointer mapped_pointer;
+ typedef typename __rebind_ma::const_pointer mapped_const_pointer;
+ typedef typename __rebind_ma::reference mapped_reference;
+ typedef typename __rebind_ma::const_reference mapped_const_reference;
+
+ typedef typename __rebind_va::pointer pointer;
+ typedef typename __rebind_va::const_pointer const_pointer;
+ typedef typename __rebind_va::reference reference;
+ typedef typename __rebind_va::const_reference const_reference;
+
+ typedef stored_data<value_type, null_type> stored_data_type;
+
+ static null_type s_null_type;
+ };
+
+ template<typename Key, typename _Alloc>
+ null_type
+ type_base<Key, null_type, _Alloc, false>::s_null_type;
+
+
+ /**
+ * Specialization of type_base for the case where the hash value
+ * is stored alongside each value.
+ */
+ template<typename Key, typename _Alloc>
+ struct type_base<Key, null_type, _Alloc, true>
+ {
+ public:
+ typedef typename _Alloc::size_type size_type;
+ typedef Key value_type;
+
+ private:
+ typedef typename _Alloc::template rebind<null_type> __rebind_m;
+ typedef typename __rebind_m::other __rebind_ma;
+ typedef typename _Alloc::template rebind<value_type> __rebind_v;
+ typedef typename __rebind_v::other __rebind_va;
+
+ public:
+ typedef typename __rebind_ma::value_type mapped_type;
+ typedef typename __rebind_ma::pointer mapped_pointer;
+ typedef typename __rebind_ma::const_pointer mapped_const_pointer;
+ typedef typename __rebind_ma::reference mapped_reference;
+ typedef typename __rebind_ma::const_reference mapped_const_reference;
+
+ typedef typename __rebind_va::pointer pointer;
+ typedef typename __rebind_va::const_pointer const_pointer;
+ typedef typename __rebind_va::reference reference;
+ typedef typename __rebind_va::const_reference const_reference;
+
+ typedef stored_data<value_type, size_type> stored_data_type;
+
+ static null_type s_null_type;
+ };
+
+ template<typename Key, typename _Alloc>
+ null_type
+ type_base<Key, null_type, _Alloc, true>::s_null_type;
+
+
+ /// Type base dispatch.
+ template<typename Key, typename Mapped, typename _Alloc, bool Store_Hash>
+ struct type_dispatch
+ {
+ typedef type_base<Key, Mapped, _Alloc, Store_Hash> type;
+ };
+
+ /// Traits for abstract types.
+ template<typename Key, typename Mapped, typename _Alloc, bool Store_Hash>
+ struct types_traits
+ : public type_dispatch<Key, Mapped, _Alloc, Store_Hash>::type
+ {
+ private:
+ typedef no_throw_copies<Key, Mapped> __nothrowcopy;
+ typedef typename _Alloc::template rebind<Key>::other __rebind_a;
+
+ public:
+ typedef typename _Alloc::size_type size_type;
+ typedef typename __rebind_a::value_type key_type;
+ typedef typename __rebind_a::pointer key_pointer;
+ typedef typename __rebind_a::const_pointer key_const_pointer;
+ typedef typename __rebind_a::reference key_reference;
+ typedef typename __rebind_a::const_reference key_const_reference;
+ typedef std::pair<size_type, size_type> comp_hash;
+ typedef integral_constant<int, Store_Hash> store_extra;
+ typedef typename __nothrowcopy::indicator no_throw_indicator;
- template<typename Key, typename Mapped, typename Alloc, bool Store_Extra>
- struct types_traits
- : public vt_base_selector<Key, Mapped, Alloc, Store_Extra>::type
- {
- typedef typename Alloc::template rebind<Key>::other key_allocator;
- typedef typename key_allocator::value_type key_type;
- typedef typename key_allocator::pointer key_pointer;
- typedef typename key_allocator::const_pointer const_key_pointer;
- typedef typename key_allocator::reference key_reference;
- typedef typename key_allocator::const_reference const_key_reference;
- typedef typename Alloc::size_type size_type;
-
- // Extra value (used when the extra value is stored with each value).
- typedef std::pair<size_type, size_type> comp_hash;
-
- typedef integral_constant<int, Store_Extra> store_extra;
- store_extra m_store_extra_indicator;
-
- typedef typename no_throw_copies<Key, Mapped>::indicator no_throw_copies;
- no_throw_copies m_no_throw_copies_indicator;
+ store_extra m_store_extra_indicator;
+ no_throw_indicator m_no_throw_copies_indicator;
};
+ //@}
} // namespace detail
} // namespace __gnu_pbds
-#endif
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
index 1641792b5fe..d1221413c66 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
@@ -34,14 +34,14 @@
// warranty.
/**
- * @file const_iterator.hpp
+ * @file unordered_iterator/const_iterator.hpp
* Contains an iterator class used for const ranging over the elements of the
- * table.
+ * table.
*/
// Const range-type iterator.
class const_iterator_ :
- public const_point_iterator_
+ public point_const_iterator_
{
@@ -51,7 +51,7 @@ public:
typedef std::forward_iterator_tag iterator_category;
// Difference type.
- typedef typename Allocator::difference_type difference_type;
+ typedef typename _Alloc::difference_type difference_type;
// Iterator's value type.
typedef value_type_ value_type;
@@ -99,7 +99,7 @@ public:
protected:
- typedef const_point_iterator_ base_type;
+ typedef point_const_iterator_ base_type;
protected:
@@ -109,7 +109,7 @@ protected:
* of a table.
* */
inline
- const_iterator_(const_pointer_ p_value, PB_DS_GEN_POS pos, const PB_DS_CLASS_C_DEC* p_tbl) : const_point_iterator_(p_value),
+ const_iterator_(const_pointer_ p_value, PB_DS_GEN_POS pos, const PB_DS_CLASS_C_DEC* p_tbl) : point_const_iterator_(p_value),
m_p_tbl(p_tbl),
m_pos(pos)
{ }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
index 1aaa6824a83..52b90a511e0 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
@@ -51,7 +51,7 @@ public:
typedef std::forward_iterator_tag iterator_category;
// Difference type.
- typedef typename Allocator::difference_type difference_type;
+ typedef typename _Alloc::difference_type difference_type;
// Iterator's value type.
typedef value_type_ value_type;
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp
index 1cda69bb834..257067a8952 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp
@@ -34,7 +34,7 @@
// warranty.
/**
- * @file const_point_iterator.hpp
+ * @file unordered_iterator/point_const_iterator.hpp
* Contains an iterator class returned by the tables' const find and insert
* methods.
*/
@@ -42,7 +42,7 @@
class point_iterator_;
// Const point-type iterator.
-class const_point_iterator_
+class point_const_iterator_
{
public:
@@ -71,26 +71,26 @@ public:
public:
inline
- const_point_iterator_(const_pointer p_value) : m_p_value(p_value)
+ point_const_iterator_(const_pointer p_value) : m_p_value(p_value)
{ }
// Default constructor.
inline
- const_point_iterator_()
+ point_const_iterator_()
: m_p_value(0)
{ }
// Copy constructor.
inline
- const_point_iterator_(const const_point_iterator_& other)
+ point_const_iterator_(const point_const_iterator_& other)
: m_p_value(other.m_p_value)
{ }
// Copy constructor.
inline
- const_point_iterator_(const point_iterator_& other)
+ point_const_iterator_(const point_iterator_& other)
: m_p_value(other.m_p_value)
{ }
@@ -122,7 +122,7 @@ public:
// Compares content to a different iterator object.
inline bool
- operator==(const const_point_iterator_& other) const
+ operator==(const point_const_iterator_& other) const
{
return (m_p_value == other.m_p_value);
}
@@ -136,7 +136,7 @@ public:
// Compares content (negatively) to a different iterator object.
inline bool
- operator!=(const const_point_iterator_& other) const
+ operator!=(const point_const_iterator_& other) const
{
return (m_p_value != other.m_p_value);
}
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
index e17a5bf1728..f74f03d7a48 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
@@ -109,7 +109,7 @@ public:
// Compares content to a different iterator object.
inline bool
- operator==(const const_point_iterator_& other) const
+ operator==(const point_const_iterator_& other) const
{
return (m_p_value == other.m_p_value);
}
@@ -123,7 +123,7 @@ public:
// Compares content (negatively) to a different iterator object.
inline bool
- operator!=(const const_point_iterator_& other) const
+ operator!=(const point_const_iterator_& other) const
{
return (m_p_value != other.m_p_value);
}
@@ -133,7 +133,7 @@ public:
{ }
protected:
- friend class const_point_iterator_;
+ friend class point_const_iterator_;
friend class PB_DS_CLASS_C_DEC;