From a345e45d144c0e83aed85b6d29f64af3d21b4453 Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Tue, 24 May 2011 02:38:19 +0000 Subject: re PR libstdc++/37144 (A bug in include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp) 2011-05-23 Benjamin Kosnik 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. From-SVN: r174100 --- libstdc++-v3/ChangeLog | 509 ++++++++ libstdc++-v3/doc/Makefile.am | 10 +- libstdc++-v3/doc/Makefile.in | 9 +- libstdc++-v3/doc/doxygen/user.cfg.in | 499 ++++--- ...ity_queue_random_int_push_timing_test_local.png | Bin 6710 -> 23669 bytes .../cc_hash_random_int_find_timing_test_local.png | Bin 8534 -> 48189 bytes ...random_int_subscript_timing_test_find_local.png | Bin 8445 -> 47325 bytes ...ndom_int_subscript_timing_test_insert_local.png | Bin 9396 -> 46842 bytes ...ndom_int_subscript_timing_test_insert_local.png | Bin 9557 -> 42763 bytes .../gp_hash_random_int_find_timing_test_local.png | Bin 7916 -> 33303 bytes ...random_int_subscript_timing_test_find_local.png | Bin 7570 -> 33148 bytes ...ndom_int_subscript_timing_test_insert_local.png | Bin 8499 -> 34794 bytes .../hash_random_int_erase_mem_usage_test_local.png | Bin 7405 -> 31203 bytes ...hash_zlob_random_int_find_timing_test_local.png | Bin 8436 -> 38509 bytes ..._text_find_timing_test_large_s2p_hash_local.png | Bin 7299 -> 30126 bytes ..._text_find_timing_test_large_s2p_tree_local.png | Bin 6706 -> 26937 bytes ..._text_find_timing_test_small_s2p_hash_local.png | Bin 6732 -> 29768 bytes ..._text_find_timing_test_small_s2p_tree_local.png | Bin 6396 -> 26702 bytes ..._insert_mem_usage_test_large_s2p_hash_local.png | Bin 7275 -> 32571 bytes ..._insert_mem_usage_test_large_s2p_tree_local.png | Bin 7191 -> 29526 bytes ..._insert_mem_usage_test_small_s2p_hash_local.png | Bin 6845 -> 31758 bytes ..._insert_mem_usage_test_small_s2p_tree_local.png | Bin 6925 -> 29258 bytes ...ext_insert_timing_test_large_s2p_hash_local.png | Bin 7000 -> 30954 bytes ...ext_insert_timing_test_large_s2p_tree_local.png | Bin 6764 -> 27038 bytes ...ext_insert_timing_test_small_s2p_hash_local.png | Bin 7035 -> 31038 bytes ...ext_insert_timing_test_small_s2p_tree_local.png | Bin 6853 -> 26974 bytes ...ority_queue_text_push_pop_timing_test_local.png | Bin 6892 -> 26303 bytes ..._priority_queue_text_push_timing_test_local.png | Bin 6760 -> 25070 bytes ...queue_random_int_push_pop_timing_test_local.png | Bin 9275 -> 46818 bytes ...ity_queue_random_int_push_timing_test_local.png | Bin 8986 -> 41433 bytes .../priority_queue_text_join_timing_test_local.png | Bin 7989 -> 38222 bytes ...ty_queue_text_modify_down_timing_test_local.png | Bin 7633 -> 37071 bytes ..._modify_down_timing_test_pairing_thin_local.png | Bin 5878 -> 22019 bytes ...rity_queue_text_modify_up_timing_test_local.png | Bin 7748 -> 36882 bytes ...xt_modify_up_timing_test_pairing_thin_local.png | Bin 6105 -> 22214 bytes ...riority_queue_text_pop_mem_usage_test_local.png | Bin 7424 -> 31248 bytes ...ority_queue_text_push_pop_timing_test_local.png | Bin 9006 -> 46440 bytes .../priority_queue_text_push_timing_test_local.png | Bin 8477 -> 43334 bytes ...random_int_find_find_timing_test_tree_local.png | Bin 7377 -> 30133 bytes .../html/ext/pb_ds/sample_trie_access_traits.html | 231 ++++ .../ext/pb_ds/sample_trie_e_access_traits.html | 231 ---- .../ext/pb_ds/string_trie_e_access_traits.html | 400 ------ .../ext/pb_ds/text_find_timing_test_hash_local.png | Bin 9361 -> 39495 bytes .../text_find_timing_test_tree_like_local.png | Bin 7650 -> 34994 bytes .../tree_order_statistics_timing_test_local.png | Bin 6739 -> 29805 bytes .../pb_ds/tree_split_join_timing_test_local.png | Bin 6734 -> 30904 bytes ...ree_text_insert_timing_test_node_tree_local.png | Bin 6690 -> 28340 bytes ...tree_text_insert_timing_test_pat_trie_local.png | Bin 6011 -> 22337 bytes ...e_text_insert_timing_test_vector_tree_local.png | Bin 6270 -> 22889 bytes .../pb_ds/tree_text_lor_find_timing_test_local.png | Bin 7796 -> 28354 bytes .../html/ext/pb_ds/trie_string_access_traits.html | 400 ++++++ libstdc++-v3/include/Makefile.am | 45 +- libstdc++-v3/include/Makefile.in | 45 +- libstdc++-v3/include/ext/pb_ds/assoc_container.hpp | 295 ++--- .../include/ext/pb_ds/detail/basic_types.hpp | 211 --- .../detail/bin_search_tree_/bin_search_tree_.hpp | 392 +++--- .../bin_search_tree_/cond_dtor_entry_dealtor.hpp | 70 - .../cond_key_dtor_entry_dealtor.hpp | 81 -- .../constructors_destructor_fn_imps.hpp | 12 +- .../detail/bin_search_tree_/debug_fn_imps.hpp | 6 +- .../detail/bin_search_tree_/erase_fn_imps.hpp | 21 +- .../pb_ds/detail/bin_search_tree_/find_fn_imps.hpp | 87 +- .../pb_ds/detail/bin_search_tree_/info_fn_imps.hpp | 2 +- .../detail/bin_search_tree_/insert_fn_imps.hpp | 28 +- .../detail/bin_search_tree_/iterators_fn_imps.hpp | 10 +- .../detail/bin_search_tree_/node_iterators.hpp | 48 +- .../detail/bin_search_tree_/point_iterators.hpp | 48 +- .../bin_search_tree_/policy_access_fn_imps.hpp | 10 +- .../detail/bin_search_tree_/r_erase_fn_imps.hpp | 21 +- .../detail/bin_search_tree_/rotate_fn_imps.hpp | 4 +- .../detail/bin_search_tree_/split_join_fn_imps.hpp | 4 +- .../ext/pb_ds/detail/bin_search_tree_/traits.hpp | 111 +- .../ext/pb_ds/detail/binary_heap_/binary_heap_.hpp | 277 ++-- .../pb_ds/detail/binary_heap_/const_iterator.hpp | 65 +- .../detail/binary_heap_/const_point_iterator.hpp | 144 --- .../constructors_destructor_fn_imps.hpp | 48 +- .../pb_ds/detail/binary_heap_/debug_fn_imps.hpp | 8 +- .../ext/pb_ds/detail/binary_heap_/entry_cmp.hpp | 68 +- .../ext/pb_ds/detail/binary_heap_/entry_pred.hpp | 68 +- .../pb_ds/detail/binary_heap_/erase_fn_imps.hpp | 71 +- .../ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp | 24 +- .../ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp | 14 +- .../pb_ds/detail/binary_heap_/insert_fn_imps.hpp | 85 +- .../detail/binary_heap_/iterators_fn_imps.hpp | 18 +- .../detail/binary_heap_/point_const_iterator.hpp | 144 +++ .../detail/binary_heap_/policy_access_fn_imps.hpp | 2 +- .../pb_ds/detail/binary_heap_/resize_policy.hpp | 187 ++- .../detail/binary_heap_/split_join_fn_imps.hpp | 52 +- .../pb_ds/detail/binary_heap_/trace_fn_imps.hpp | 2 +- .../pb_ds/detail/binomial_heap_/binomial_heap_.hpp | 64 +- .../constructors_destructor_fn_imps.hpp | 15 +- .../pb_ds/detail/binomial_heap_/debug_fn_imps.hpp | 2 +- .../binomial_heap_base_/binomial_heap_base_.hpp | 151 +-- .../constructors_destructor_fn_imps.hpp | 30 +- .../detail/binomial_heap_base_/debug_fn_imps.hpp | 4 +- .../detail/binomial_heap_base_/erase_fn_imps.hpp | 35 +- .../detail/binomial_heap_base_/find_fn_imps.hpp | 5 +- .../detail/binomial_heap_base_/insert_fn_imps.hpp | 66 +- .../binomial_heap_base_/split_join_fn_imps.hpp | 69 +- .../pb_ds/detail/branch_policy/branch_policy.hpp | 124 ++ .../detail/branch_policy/null_node_metadata.hpp | 66 + .../ext/pb_ds/detail/branch_policy/traits.hpp | 95 ++ .../pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp | 273 ++-- .../detail/cc_hash_table_map_/cmp_fn_imps.hpp | 6 +- .../cond_key_dtor_entry_dealtor.hpp | 77 +- .../constructor_destructor_fn_imps.hpp | 27 +- ...onstructor_destructor_no_store_hash_fn_imps.hpp | 4 +- .../constructor_destructor_store_hash_fn_imps.hpp | 6 +- .../detail/cc_hash_table_map_/debug_fn_imps.hpp | 2 +- .../debug_no_store_hash_fn_imps.hpp | 4 +- .../debug_store_hash_fn_imps.hpp | 2 +- .../cc_hash_table_map_/entry_list_fn_imps.hpp | 2 +- .../detail/cc_hash_table_map_/erase_fn_imps.hpp | 2 +- .../erase_no_store_hash_fn_imps.hpp | 23 +- .../erase_store_hash_fn_imps.hpp | 21 +- .../detail/cc_hash_table_map_/find_fn_imps.hpp | 10 +- .../cc_hash_table_map_/find_store_hash_fn_imps.hpp | 2 +- .../detail/cc_hash_table_map_/info_fn_imps.hpp | 6 +- .../detail/cc_hash_table_map_/insert_fn_imps.hpp | 2 +- .../insert_no_store_hash_fn_imps.hpp | 4 +- .../insert_store_hash_fn_imps.hpp | 4 +- .../cc_hash_table_map_/iterators_fn_imps.hpp | 2 +- .../cc_hash_table_map_/policy_access_fn_imps.hpp | 2 +- .../detail/cc_hash_table_map_/resize_fn_imps.hpp | 2 +- .../resize_no_store_hash_fn_imps.hpp | 4 +- .../resize_store_hash_fn_imps.hpp | 4 +- .../detail/cc_hash_table_map_/size_fn_imps.hpp | 4 +- .../cc_hash_table_map_/standard_policies.hpp | 2 +- .../detail/cc_hash_table_map_/trace_fn_imps.hpp | 2 +- .../include/ext/pb_ds/detail/cond_dealtor.hpp | 111 +- .../detail/constructors_destructor_fn_imps.hpp | 2 +- .../ext/pb_ds/detail/container_base_dispatch.hpp | 209 ++- .../include/ext/pb_ds/detail/debug_map_base.hpp | 139 +- .../include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp | 3 +- .../include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp | 152 +-- .../constructor_destructor_fn_imps.hpp | 20 +- ...onstructor_destructor_no_store_hash_fn_imps.hpp | 4 +- .../constructor_destructor_store_hash_fn_imps.hpp | 4 +- .../detail/gp_hash_table_map_/debug_fn_imps.hpp | 2 +- .../debug_no_store_hash_fn_imps.hpp | 4 +- .../debug_store_hash_fn_imps.hpp | 4 +- .../detail/gp_hash_table_map_/erase_fn_imps.hpp | 4 +- .../erase_no_store_hash_fn_imps.hpp | 4 +- .../erase_store_hash_fn_imps.hpp | 4 +- .../detail/gp_hash_table_map_/find_fn_imps.hpp | 10 +- .../find_no_store_hash_fn_imps.hpp | 4 +- .../gp_hash_table_map_/find_store_hash_fn_imps.hpp | 2 +- .../pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp | 259 ++-- .../detail/gp_hash_table_map_/info_fn_imps.hpp | 4 +- .../detail/gp_hash_table_map_/insert_fn_imps.hpp | 2 +- .../insert_no_store_hash_fn_imps.hpp | 6 +- .../insert_store_hash_fn_imps.hpp | 6 +- .../detail/gp_hash_table_map_/iterator_fn_imps.hpp | 4 +- .../gp_hash_table_map_/policy_access_fn_imps.hpp | 4 +- .../detail/gp_hash_table_map_/resize_fn_imps.hpp | 4 +- .../resize_no_store_hash_fn_imps.hpp | 6 +- .../resize_store_hash_fn_imps.hpp | 6 +- .../gp_hash_table_map_/standard_policies.hpp | 2 +- .../detail/gp_hash_table_map_/trace_fn_imps.hpp | 2 +- .../ext/pb_ds/detail/hash_fn/probe_fn_base.hpp | 2 +- .../ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp | 83 +- .../ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp | 71 +- .../ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp | 51 +- .../pb_ds/detail/hash_fn/sample_range_hashing.hpp | 61 +- .../pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp | 48 +- .../detail/hash_fn/sample_ranged_probe_fn.hpp | 50 +- .../const_iterator.hpp | 57 +- .../const_point_iterator.hpp | 154 --- .../constructors_destructor_fn_imps.hpp | 12 +- .../debug_fn_imps.hpp | 16 +- .../erase_fn_imps.hpp | 4 +- .../left_child_next_sibling_heap_/info_fn_imps.hpp | 2 +- .../insert_fn_imps.hpp | 2 +- .../iterators_fn_imps.hpp | 2 +- .../left_child_next_sibling_heap_.hpp | 246 ++-- .../detail/left_child_next_sibling_heap_/node.hpp | 79 +- .../null_metadata.hpp | 55 - .../point_const_iterator.hpp | 154 +++ .../policy_access_fn_imps.hpp | 2 +- .../trace_fn_imps.hpp | 13 +- .../constructor_destructor_fn_imps.hpp | 22 +- .../detail/list_update_map_/debug_fn_imps.hpp | 2 +- .../list_update_map_/entry_metadata_base.hpp | 4 +- .../detail/list_update_map_/erase_fn_imps.hpp | 4 +- .../pb_ds/detail/list_update_map_/find_fn_imps.hpp | 8 +- .../pb_ds/detail/list_update_map_/info_fn_imps.hpp | 2 +- .../detail/list_update_map_/insert_fn_imps.hpp | 4 +- .../detail/list_update_map_/iterators_fn_imps.hpp | 2 +- .../ext/pb_ds/detail/list_update_map_/lu_map_.hpp | 166 ++- .../detail/list_update_map_/trace_fn_imps.hpp | 2 +- .../list_update_policy/counter_lu_metadata.hpp | 86 -- .../list_update_policy/counter_lu_policy_imp.hpp | 51 - .../list_update_policy/lu_counter_metadata.hpp | 88 ++ .../list_update_policy/mtf_lu_policy_imp.hpp | 55 - .../list_update_policy/sample_update_policy.hpp | 52 +- .../ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp | 74 -- .../constructors_destructor_fn_imps.hpp | 92 +- .../pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp | 5 +- .../pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp | 36 +- .../ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp | 2 +- .../pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp | 2 +- .../detail/ov_tree_map_/iterators_fn_imps.hpp | 14 +- .../pb_ds/detail/ov_tree_map_/node_iterators.hpp | 45 +- .../ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp | 322 ++--- .../detail/ov_tree_map_/policy_access_fn_imps.hpp | 4 +- .../detail/ov_tree_map_/split_join_fn_imps.hpp | 15 +- .../ext/pb_ds/detail/ov_tree_map_/traits.hpp | 78 +- .../constructors_destructor_fn_imps.hpp | 31 +- .../pb_ds/detail/pairing_heap_/debug_fn_imps.hpp | 2 +- .../pb_ds/detail/pairing_heap_/erase_fn_imps.hpp | 2 +- .../pb_ds/detail/pairing_heap_/find_fn_imps.hpp | 3 +- .../pb_ds/detail/pairing_heap_/insert_fn_imps.hpp | 15 +- .../pb_ds/detail/pairing_heap_/pairing_heap_.hpp | 139 +- .../detail/pairing_heap_/split_join_fn_imps.hpp | 19 +- .../ext/pb_ds/detail/pat_trie_/child_iterator.hpp | 93 -- .../detail/pat_trie_/cond_dtor_entry_dealtor.hpp | 79 -- .../detail/pat_trie_/const_child_iterator.hpp | 111 -- .../pat_trie_/constructors_destructor_fn_imps.hpp | 58 +- .../ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp | 25 +- .../ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp | 114 +- .../ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp | 134 +- .../include/ext/pb_ds/detail/pat_trie_/head.hpp | 129 -- .../ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp | 6 +- .../pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp | 209 +-- .../ext/pb_ds/detail/pat_trie_/internal_node.hpp | 603 --------- .../pb_ds/detail/pat_trie_/iterators_fn_imps.hpp | 12 +- .../include/ext/pb_ds/detail/pat_trie_/leaf.hpp | 169 --- .../ext/pb_ds/detail/pat_trie_/node_base.hpp | 131 -- .../ext/pb_ds/detail/pat_trie_/node_iterators.hpp | 338 ----- .../pb_ds/detail/pat_trie_/node_metadata_base.hpp | 86 -- .../ext/pb_ds/detail/pat_trie_/pat_trie_.hpp | 482 ++++--- .../ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp | 1357 ++++++++++++++++++++ .../ext/pb_ds/detail/pat_trie_/point_iterators.hpp | 484 ------- .../detail/pat_trie_/policy_access_fn_imps.hpp | 12 +- .../ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp | 6 +- .../ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp | 10 +- .../ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp | 160 ++- .../detail/pat_trie_/split_join_branch_bag.hpp | 93 -- .../pb_ds/detail/pat_trie_/synth_access_traits.hpp | 218 ++++ .../detail/pat_trie_/synth_e_access_traits.hpp | 229 ---- .../ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp | 16 +- .../include/ext/pb_ds/detail/pat_trie_/traits.hpp | 328 +---- .../ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp | 8 +- .../pb_ds/detail/priority_queue_base_dispatch.hpp | 61 +- .../constructors_destructor_fn_imps.hpp | 10 +- .../pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp | 2 +- .../pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp | 4 +- .../ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp | 2 +- .../ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp | 2 +- .../pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp | 2 +- .../include/ext/pb_ds/detail/rb_tree_map_/node.hpp | 67 +- .../ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp | 166 +-- .../detail/rb_tree_map_/split_join_fn_imps.hpp | 4 +- .../ext/pb_ds/detail/rb_tree_map_/traits.hpp | 86 +- .../constructors_destructor_fn_imps.hpp | 17 +- .../detail/rc_binomial_heap_/debug_fn_imps.hpp | 14 +- .../detail/rc_binomial_heap_/erase_fn_imps.hpp | 2 +- .../detail/rc_binomial_heap_/insert_fn_imps.hpp | 2 +- .../ext/pb_ds/detail/rc_binomial_heap_/rc.hpp | 134 +- .../detail/rc_binomial_heap_/rc_binomial_heap_.hpp | 124 +- .../rc_binomial_heap_/split_join_fn_imps.hpp | 8 +- .../detail/rc_binomial_heap_/trace_fn_imps.hpp | 3 +- .../detail/resize_policy/sample_resize_policy.hpp | 162 +-- .../detail/resize_policy/sample_resize_trigger.hpp | 185 ++- .../detail/resize_policy/sample_size_policy.hpp | 58 +- .../constructors_destructor_fn_imps.hpp | 10 +- .../ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp | 2 +- .../ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp | 6 +- .../ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp | 12 +- .../ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp | 2 +- .../pb_ds/detail/splay_tree_/insert_fn_imps.hpp | 2 +- .../include/ext/pb_ds/detail/splay_tree_/node.hpp | 27 +- .../ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp | 62 +- .../ext/pb_ds/detail/splay_tree_/splay_tree_.hpp | 160 +-- .../detail/splay_tree_/split_join_fn_imps.hpp | 8 +- .../ext/pb_ds/detail/splay_tree_/traits.hpp | 82 +- .../include/ext/pb_ds/detail/standard_policies.hpp | 24 +- .../thin_heap_/constructors_destructor_fn_imps.hpp | 19 +- .../ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp | 4 +- .../ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp | 58 +- .../ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp | 2 +- .../ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp | 54 +- .../pb_ds/detail/thin_heap_/split_join_fn_imps.hpp | 20 +- .../ext/pb_ds/detail/thin_heap_/thin_heap_.hpp | 185 ++- .../ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp | 4 +- .../detail/tree_policy/node_metadata_selector.hpp | 85 +- .../detail/tree_policy/null_node_update_imp.hpp | 50 - .../detail/tree_policy/order_statistics_imp.hpp | 58 +- .../detail/tree_policy/sample_tree_node_update.hpp | 46 +- .../include/ext/pb_ds/detail/tree_trace_base.hpp | 114 +- .../detail/trie_policy/node_metadata_selector.hpp | 85 +- .../detail/trie_policy/null_node_update_imp.hpp | 50 - .../detail/trie_policy/order_statistics_imp.hpp | 93 +- .../trie_policy/prefix_search_node_update_imp.hpp | 62 +- .../trie_policy/sample_trie_access_traits.hpp | 77 ++ .../trie_policy/sample_trie_e_access_traits.hpp | 89 -- .../detail/trie_policy/sample_trie_node_update.hpp | 48 +- .../string_trie_e_access_traits_imp.hpp | 99 -- .../pb_ds/detail/trie_policy/trie_policy_base.hpp | 156 +-- .../trie_policy/trie_string_access_traits_imp.hpp | 99 ++ .../include/ext/pb_ds/detail/type_utils.hpp | 2 +- .../include/ext/pb_ds/detail/types_traits.hpp | 264 +++- .../detail/unordered_iterator/const_iterator.hpp | 12 +- .../unordered_iterator/const_point_iterator.hpp | 151 --- .../pb_ds/detail/unordered_iterator/iterator.hpp | 2 +- .../unordered_iterator/point_const_iterator.hpp | 151 +++ .../detail/unordered_iterator/point_iterator.hpp | 6 +- libstdc++-v3/include/ext/pb_ds/hash_policy.hpp | 36 +- .../include/ext/pb_ds/list_update_policy.hpp | 166 ++- libstdc++-v3/include/ext/pb_ds/priority_queue.hpp | 50 +- libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp | 293 +++-- libstdc++-v3/include/ext/pb_ds/tree_policy.hpp | 82 +- libstdc++-v3/include/ext/pb_ds/trie_policy.hpp | 234 ++-- libstdc++-v3/scripts/make_graph.py | 18 +- libstdc++-v3/scripts/run_doxygen | 4 + .../testsuite/data/make_graph_test_infos.xml | 1 - .../testsuite/ext/pb_ds/example/basic_multimap.cc | 2 +- .../ext/pb_ds/example/basic_priority_queue.cc | 4 +- .../testsuite/ext/pb_ds/example/basic_set.cc | 12 +- .../testsuite/ext/pb_ds/example/ranged_hash.cc | 4 +- .../testsuite/ext/pb_ds/example/tree_intervals.cc | 24 +- .../ext/pb_ds/example/tree_order_statistics.cc | 2 +- .../testsuite/ext/pb_ds/example/trie_dna.cc | 10 +- .../ext/pb_ds/example/trie_prefix_search.cc | 4 +- .../pb_ds/regression/hash_data_map_rand_debug.cc | 189 +++ .../regression/hash_no_data_map_rand_debug.cc | 189 +++ .../pb_ds/regression/list_update_data_map_rand.cc | 2 +- .../regression/list_update_data_map_rand_debug.cc | 116 ++ .../list_update_no_data_map_rand_debug.cc | 116 ++ .../pb_ds/regression/priority_queue_rand_debug.cc | 142 ++ .../pb_ds/regression/tree_data_map_rand_debug.cc | 144 +++ .../regression/tree_no_data_map_rand_debug.cc | 144 +++ .../pb_ds/regression/trie_data_map_rand_debug.cc | 131 ++ .../regression/trie_no_data_map_rand_debug.cc | 131 ++ .../ext/pb_ds/hash_random_int_erase_mem_usage.cc | 4 +- .../ext/pb_ds/priority_queue_text_pop_mem_usage.cc | 15 +- .../ext/pb_ds/tree_order_statistics_timing.cc | 4 +- .../ext/pb_ds/tree_split_join_timing.cc | 4 +- .../util/common_type/assoc/common_type.hpp | 296 ++--- .../common_type/assoc/detail/ds_string_form.hpp | 6 +- .../detail/list_update_policy_string_form.hpp | 10 +- .../assoc/detail/probe_fn_string_form.hpp | 12 +- .../assoc/detail/size_policy_string_form.hpp | 4 +- .../detail/tree_supports_order_statistics.hpp | 2 +- .../detail/trie_supports_order_statistics.hpp | 4 +- .../assoc/detail/trie_supports_prefix_search.hpp | 4 +- .../assoc/detail/trigger_policy_string_form.hpp | 20 +- .../util/common_type/assoc/native_set.hpp | 4 +- .../util/common_type/assoc/string_form.hpp | 4 +- .../util/common_type/assoc/template_policy.hpp | 60 +- .../common_type/priority_queue/common_type.hpp | 12 +- .../testsuite/util/native_type/native_hash_map.hpp | 4 +- .../util/native_type/native_hash_multimap.hpp | 6 +- .../testsuite/util/native_type/native_hash_set.hpp | 4 +- .../testsuite/util/native_type/native_map.hpp | 4 +- .../testsuite/util/native_type/native_multimap.hpp | 8 +- .../util/native_type/native_priority_queue.hpp | 18 +- .../testsuite/util/native_type/native_set.hpp | 4 +- .../performance/assoc/multimap_common_type.hpp | 56 +- .../util/performance/assoc/timing/common_type.hpp | 4 +- .../assoc/timing/multimap_find_test.hpp | 2 +- .../testsuite/util/regression/common_type.hpp | 33 +- .../rand/assoc/container_rand_regression_test.h | 2 +- .../rand/assoc/container_rand_regression_test.tcc | 61 +- .../regression/rand/assoc/rand_regression_test.hpp | 28 +- .../container_rand_regression_test.tcc | 14 +- .../rand/priority_queue/rand_regression_test.hpp | 25 +- .../regression/trait/assoc/native_type_trait.hpp | 50 +- .../util/regression/trait/assoc/trait.hpp | 10 +- .../util/regression/trait/assoc/type_trait.hpp | 12 +- libstdc++-v3/testsuite/util/testsuite_containers.h | 2 +- 371 files changed, 10706 insertions(+), 11654 deletions(-) create mode 100644 libstdc++-v3/doc/html/ext/pb_ds/sample_trie_access_traits.html delete mode 100644 libstdc++-v3/doc/html/ext/pb_ds/sample_trie_e_access_traits.html delete mode 100644 libstdc++-v3/doc/html/ext/pb_ds/string_trie_e_access_traits.html create mode 100644 libstdc++-v3/doc/html/ext/pb_ds/trie_string_access_traits.html delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/basic_types.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp create mode 100644 libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp create mode 100644 libstdc++-v3/include/ext/pb_ds/detail/branch_policy/branch_policy.hpp create mode 100644 libstdc++-v3/include/ext/pb_ds/detail/branch_policy/null_node_metadata.hpp create mode 100644 libstdc++-v3/include/ext/pb_ds/detail/branch_policy/traits.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp create mode 100644 libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp create mode 100644 libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/head.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/leaf.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp create mode 100644 libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp create mode 100644 libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp create mode 100644 libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_access_traits.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp create mode 100644 libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp delete mode 100644 libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp create mode 100644 libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp create mode 100644 libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand_debug.cc create mode 100644 libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand_debug.cc create mode 100644 libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand_debug.cc create mode 100644 libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand_debug.cc create mode 100644 libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand_debug.cc create mode 100644 libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand_debug.cc create mode 100644 libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc create mode 100644 libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand_debug.cc create mode 100644 libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand_debug.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 76afc47..9c1cc03 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,512 @@ +2011-05-23 Benjamin Kosnik + + 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. + 2011-05-23 Paolo Carlini * include/bits/streambuf_iterator.h: Use noexcept per the FDIS. diff --git a/libstdc++-v3/doc/Makefile.am b/libstdc++-v3/doc/Makefile.am index b564f1c..7e75cc7 100644 --- a/libstdc++-v3/doc/Makefile.am +++ b/libstdc++-v3/doc/Makefile.am @@ -136,9 +136,17 @@ doc-install-xml: doc-xml # HTML htmldir="$(DESTDIR)@docdir@" -stamp-html: stamp-html-docbook stamp-html-doxygen +stamp-html: stamp-html-copy stamp-html-doxygen $(STAMP) stamp-html +copydir=${docbook_outdir}/html/manual/ext/ +stamp-html-copy: stamp-html-docbook + cp -r ${top_srcdir}/doc/html/ext ${docbook_outdir}/html/manual/ext + cd ${docbook_outdir}/html/manual/ext + rm -rf ${docbook_outdir}/html/manual/ext/.svn + rm -rf ${docbook_outdir}/html/manual/ext/pb_ds/.svn + $(STAMP) stamp-html-copy + doc-html: stamp-html doc-install-html: doc-html diff --git a/libstdc++-v3/doc/Makefile.in b/libstdc++-v3/doc/Makefile.in index e177733..8247b60 100644 --- a/libstdc++-v3/doc/Makefile.in +++ b/libstdc++-v3/doc/Makefile.in @@ -324,6 +324,7 @@ AM_CPPFLAGS = $(GLIBCXX_INCLUDES) # XML xmldir = "$(DESTDIR)@docdir@" +copydir = ${docbook_outdir}/html/manual/ext/ # EPUB # Assumes ruby installed @@ -649,8 +650,14 @@ doc-install-xml: doc-xml test -z ${xmldir} || $(mkinstalldirs) ${xmldir} $(INSTALL_DATA) ${manual_xml} ${xmldir} $(INSTALL_DATA) ${api_xml} ${xmldir} -stamp-html: stamp-html-docbook stamp-html-doxygen +stamp-html: stamp-html-copy stamp-html-doxygen $(STAMP) stamp-html +stamp-html-copy: stamp-html-docbook + cp -r ${top_srcdir}/doc/html/ext ${docbook_outdir}/html/manual/ext + cd ${docbook_outdir}/html/manual/ext + rm -rf ${docbook_outdir}/html/manual/ext/.svn + rm -rf ${docbook_outdir}/html/manual/ext/pb_ds/.svn + $(STAMP) stamp-html-copy doc-html: stamp-html diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in index 920a4cd..6332dc1 100644 --- a/libstdc++-v3/doc/doxygen/user.cfg.in +++ b/libstdc++-v3/doc/doxygen/user.cfg.in @@ -1,4 +1,4 @@ -# Doxyfile 1.7.2 +# Doxyfile 1.7.4 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -33,6 +33,19 @@ PROJECT_NAME = libstdc++ PROJECT_NUMBER = +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location @@ -57,7 +70,7 @@ CREATE_SUBDIRS = NO # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English @@ -179,10 +192,9 @@ TAB_SIZE = 4 # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. -ALIASES = doctodo="@todo\nNeeds documentation! See http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html" - -ALIASES += headername{1}="Instead, include <\1>." -ALIASES += headername{2}="Instead, include <\1> or <\2>." +ALIASES = "doctodo=@todo\nNeeds documentation! See http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html" \ + "headername{1}=Instead, include <\1>." \ + "headername{2}=Instead, include <\1> or <\2>." # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. @@ -266,6 +278,13 @@ DISTRIBUTE_GROUP_DOC = YES SUBGROUPING = YES +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct @@ -282,7 +301,7 @@ TYPEDEF_HIDES_STRUCT = NO # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penality. +# causing a significant performance penalty. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will roughly double the @@ -441,6 +460,15 @@ SORT_GROUP_NAMES = YES SORT_BY_SCOPE_NAME = YES +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. @@ -585,142 +613,165 @@ WARN_LOGFILE = # with spaces. INPUT = @srcdir@/doc/doxygen/doxygroups.cc \ - @srcdir@/libsupc++/cxxabi.h \ - @srcdir@/libsupc++/exception \ - @srcdir@/libsupc++/initializer_list \ - @srcdir@/libsupc++/new \ - @srcdir@/libsupc++/typeinfo \ - include/algorithm \ - include/array \ - include/atomic \ - include/bitset \ - include/chrono \ - include/complex \ - include/condition_variable \ - include/deque \ - include/forward_list \ - include/fstream \ - include/functional \ - include/future \ - include/iomanip \ - include/ios \ - include/iosfwd \ - include/iostream \ - include/istream \ - include/iterator \ - include/limits \ - include/list \ - include/locale \ - include/map \ - include/memory \ - include/mutex \ - include/numeric \ - include/ostream \ - include/queue \ - include/random \ - include/ratio \ - include/regex \ - include/set \ - include/sstream \ - include/stack \ - include/stdexcept \ - include/streambuf \ - include/string \ - include/system_error \ - include/thread \ - include/tuple \ - include/typeindex \ - include/type_traits \ - include/unordered_map \ - include/unordered_set \ - include/utility \ - include/valarray \ - include/vector \ - include/cassert \ - include/ccomplex \ - include/cctype \ - include/cerrno \ - include/cfenv \ - include/cfloat \ - include/cinttypes \ - include/ciso646 \ - include/climits \ - include/clocale \ - include/cmath \ - include/csetjmp \ - include/csignal \ - include/cstdarg \ - include/cstdbool \ - include/cstddef \ - include/cstdint \ - include/cstdio \ - include/cstdlib \ - include/cstring \ - include/ctgmath \ - include/ctime \ - include/cwchar \ - include/cwctype \ - include/backward/hash_map \ - include/backward/hash_set \ - include/backward/strstream \ - include/debug/bitset \ - include/debug/deque \ - include/debug/forward_list \ - include/debug/list \ - include/debug/map \ - include/debug/set \ - include/debug/string \ - include/debug/unordered_map \ - include/debug/unordered_set \ - include/debug/vector \ - include/profile/bitset \ - include/profile/deque \ - include/profile/forward_list \ - include/profile/list \ - include/profile/map \ - include/profile/set \ - include/profile/unordered_map \ - include/profile/unordered_set \ - include/profile/vector \ - include/ext/algorithm \ - include/ext/functional \ - include/ext/iterator \ - include/ext/memory \ - include/ext/numeric \ - include/ext/rb_tree \ - include/ext/rope \ - include/ext/slist \ - include/parallel/algorithm \ - include/parallel/numeric \ - include/tr1/ccomplex \ - include/tr1/cctype \ - include/tr1/cfenv \ - include/tr1/cfloat \ - include/tr1/cinttypes \ - include/tr1/climits \ - include/tr1/cmath \ - include/tr1/complex \ - include/tr1/cstdarg \ - include/tr1/cstdbool \ - include/tr1/cstdint \ - include/tr1/cstdio \ - include/tr1/cstdlib \ - include/tr1/ctgmath \ - include/tr1/ctime \ - include/tr1/cwchar \ - include/tr1/cwctype \ - include/decimal/decimal \ - include/ \ - include/@host_alias@/bits \ - include/backward \ - include/bits \ - include/debug \ - include/parallel \ - include/profile \ - include/profile/impl \ - include/ext \ - include/ext/pb_ds \ - include/ext/pb_ds/detail + @srcdir@/libsupc++/cxxabi.h \ + @srcdir@/libsupc++/exception \ + @srcdir@/libsupc++/initializer_list \ + @srcdir@/libsupc++/new \ + @srcdir@/libsupc++/typeinfo \ + include/algorithm \ + include/array \ + include/atomic \ + include/bitset \ + include/chrono \ + include/complex \ + include/condition_variable \ + include/deque \ + include/forward_list \ + include/fstream \ + include/functional \ + include/future \ + include/iomanip \ + include/ios \ + include/iosfwd \ + include/iostream \ + include/istream \ + include/iterator \ + include/limits \ + include/list \ + include/locale \ + include/map \ + include/memory \ + include/mutex \ + include/numeric \ + include/ostream \ + include/queue \ + include/random \ + include/ratio \ + include/regex \ + include/set \ + include/sstream \ + include/stack \ + include/stdexcept \ + include/streambuf \ + include/string \ + include/system_error \ + include/thread \ + include/tuple \ + include/typeindex \ + include/type_traits \ + include/unordered_map \ + include/unordered_set \ + include/utility \ + include/valarray \ + include/vector \ + include/cassert \ + include/ccomplex \ + include/cctype \ + include/cerrno \ + include/cfenv \ + include/cfloat \ + include/cinttypes \ + include/ciso646 \ + include/climits \ + include/clocale \ + include/cmath \ + include/csetjmp \ + include/csignal \ + include/cstdarg \ + include/cstdbool \ + include/cstddef \ + include/cstdint \ + include/cstdio \ + include/cstdlib \ + include/cstring \ + include/ctgmath \ + include/ctime \ + include/cwchar \ + include/cwctype \ + include/ \ + include/bits \ + include/@host_alias@/bits \ + include/backward \ + include/backward/hash_map \ + include/backward/hash_set \ + include/backward/strstream \ + include/debug \ + include/debug/bitset \ + include/debug/deque \ + include/debug/forward_list \ + include/debug/list \ + include/debug/map \ + include/debug/set \ + include/debug/string \ + include/debug/unordered_map \ + include/debug/unordered_set \ + include/debug/vector \ + include/profile \ + include/profile/impl \ + include/profile/bitset \ + include/profile/deque \ + include/profile/forward_list \ + include/profile/list \ + include/profile/map \ + include/profile/set \ + include/profile/unordered_map \ + include/profile/unordered_set \ + include/profile/vector \ + include/ext/algorithm \ + include/ext/functional \ + include/ext/iterator \ + include/ext/memory \ + include/ext/numeric \ + include/ext/rb_tree \ + include/ext/rope \ + include/ext/slist \ + include/parallel \ + include/parallel/algorithm \ + include/parallel/numeric \ + include/tr1/ccomplex \ + include/tr1/cctype \ + include/tr1/cfenv \ + include/tr1/cfloat \ + include/tr1/cinttypes \ + include/tr1/climits \ + include/tr1/cmath \ + include/tr1/complex \ + include/tr1/cstdarg \ + include/tr1/cstdbool \ + include/tr1/cstdint \ + include/tr1/cstdio \ + include/tr1/cstdlib \ + include/tr1/ctgmath \ + include/tr1/ctime \ + include/tr1/cwchar \ + include/tr1/cwctype \ + include/decimal/decimal \ + include/ext \ + include/ext/pb_ds \ + include/ext/pb_ds/detail \ + include/ext/pb_ds/detail/binary_heap_ \ + include/ext/pb_ds/detail/binomial_heap_ \ + include/ext/pb_ds/detail/binomial_heap_base_ \ + include/ext/pb_ds/detail/bin_search_tree_ \ + include/ext/pb_ds/detail/branch_policy \ + include/ext/pb_ds/detail/cc_hash_table_map_ \ + include/ext/pb_ds/detail/eq_fn \ + include/ext/pb_ds/detail/gp_hash_table_map_ \ + include/ext/pb_ds/detail/hash_fn \ + include/ext/pb_ds/detail/left_child_next_sibling_heap_ \ + include/ext/pb_ds/detail/list_update_map_ \ + include/ext/pb_ds/detail/list_update_policy \ + include/ext/pb_ds/detail/ov_tree_map_ \ + include/ext/pb_ds/detail/pairing_heap_ \ + include/ext/pb_ds/detail/pat_trie_ \ + include/ext/pb_ds/detail/rb_tree_map_ \ + include/ext/pb_ds/detail/rc_binomial_heap_ \ + include/ext/pb_ds/detail/resize_policy \ + include/ext/pb_ds/detail/splay_tree_ \ + include/ext/pb_ds/detail/thin_heap_ \ + include/ext/pb_ds/detail/tree_policy \ + include/ext/pb_ds/detail/trie_policy \ + include/ext/pb_ds/detail/unordered_iterator # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is @@ -736,11 +787,11 @@ INPUT_ENCODING = UTF-8 # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py -# *.f90 *.f *.vhd *.vhdl +# *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = *.h \ - *.hpp \ - *.tcc + *.hpp \ + *.tcc # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. @@ -755,7 +806,7 @@ RECURSIVE = NO EXCLUDE = Makefile # The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded +# directories that are symbolic links (a Unix file system feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO @@ -766,9 +817,10 @@ EXCLUDE_SYMLINKS = NO # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* -EXCLUDE_PATTERNS = stamp-* doxygroups.cc \ - *.gch \ - */.svn/* +EXCLUDE_PATTERNS = stamp-* \ + doxygroups.cc \ + *.gch \ + */.svn/* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the @@ -821,8 +873,8 @@ INPUT_FILTER = # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = @@ -832,6 +884,14 @@ FILTER_PATTERNS = FILTER_SOURCE_FILES = NO +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- @@ -934,7 +994,13 @@ HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a -# standard header. +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is adviced to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when changing the value of configuration settings such as GENERATE_TREEVIEW! HTML_HEADER = @@ -953,6 +1019,15 @@ HTML_FOOTER = HTML_STYLESHEET = +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the stylesheet and background images # according to this color. Hue is specified as an angle on a colorwheel, @@ -1155,9 +1230,10 @@ ECLIPSE_DOC_ID = org.doxygen.Project DISABLE_INDEX = YES -# This tag can be used to set the number of enum values (range [0,1..20]) -# that doxygen will group on one line in the generated HTML documentation. -# Note that a value of 0 will completely suppress the enum values from appearing in the overview section. +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. ENUM_VALUES_PER_LINE = 4 @@ -1216,7 +1292,8 @@ USE_MATHJAX = NO # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the mathjax.org site, so you can quickly see the result without installing +# MATHJAX_RELPATH should be ../mathjax. The default value points to the +# mathjax.org site, so you can quickly see the result without installing # MathJax, but it is strongly recommended to install a local copy of MathJax # before deployment. @@ -1295,6 +1372,13 @@ EXTRA_PACKAGES = amsmath LATEX_HEADER = +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references @@ -1504,7 +1588,7 @@ MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. +# pointed to by INCLUDE_PATH will be searched when a #include is found. SEARCH_INCLUDES = YES @@ -1512,7 +1596,7 @@ SEARCH_INCLUDES = YES # contain include files that are not input files but should be processed by # the preprocessor. -INCLUDE_PATH = +INCLUDE_PATH = include # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the @@ -1530,57 +1614,59 @@ INCLUDE_FILE_PATTERNS = # instead of the = operator. PREDEFINED = __cplusplus \ - __GTHREADS \ - _GLIBCXX_HAS_GTHREADS \ - __GXX_EXPERIMENTAL_CXX0X__ \ - _GLIBCXX_INCLUDE_AS_CXX0X \ - "_GLIBCXX_PURE= " \ - "_GLIBCXX_CONST= " \ - "_GLIBCXX_NORETURN= " \ - "_GLIBCXX_NOTHROW= " \ - "_GLIBCXX_STD_C= " \ - "_GLIBCXX_STD_A= " \ + __GTHREADS \ + _GLIBCXX_HAS_GTHREADS \ + __GXX_EXPERIMENTAL_CXX0X__ \ + _GLIBCXX_INCLUDE_AS_CXX0X \ + "_GLIBCXX_PURE= " \ + "_GLIBCXX_CONST= " \ + "_GLIBCXX_NORETURN= " \ + "_GLIBCXX_NOTHROW= " \ + "_GLIBCXX_STD_C= " \ + "_GLIBCXX_STD_A= " \ "_GLIBCXX_VISIBILITY(V)= " \ - "_GLIBCXX_BEGIN_NAMESPACE_VERSION= " \ - "_GLIBCXX_BEGIN_NAMESPACE_ALGO= " \ - "_GLIBCXX_BEGIN_NAMESPACE_CONTAINER= " \ - "_GLIBCXX_BEGIN_NAMESPACE_LDBL= " \ - "_GLIBCXX_END_NAMESPACE_VERSION= " \ - "_GLIBCXX_END_NAMESPACE_ALGO= " \ - "_GLIBCXX_END_NAMESPACE_CONTAINER= " \ - "_GLIBCXX_END_NAMESPACE_LDBL= " \ - "_GLIBCXX_TEMPLATE_ARGS=... " \ - _GLIBCXX_DEPRECATED \ - _GLIBCXX_CONSTEXPR=constexpr \ - _GLIBCXX_USE_CONSTEXPR=constexpr \ - _GLIBCXX_USE_WCHAR_T \ - _GLIBCXX_USE_LONG_LONG \ - _GLIBCXX_USE_C99_STDINT_TR1 \ - _GLIBCXX_ATOMIC_BUILTINS_1 \ - _GLIBCXX_ATOMIC_BUILTINS_2 \ - _GLIBCXX_ATOMIC_BUILTINS_4 \ - _GLIBCXX_ATOMIC_BUILTINS_8 \ - _GLIBCXX_USE_SCHED_YIELD \ - _GLIBCXX_USE_NANOSLEEP \ - __GXX_RTTI \ - __glibcxx_function_requires=// \ - __glibcxx_class_requires=// \ - __glibcxx_class_requires2=// \ - __glibcxx_class_requires3=// \ - __glibcxx_class_requires4=// + "_GLIBCXX_BEGIN_NAMESPACE_VERSION= " \ + "_GLIBCXX_BEGIN_NAMESPACE_ALGO= " \ + "_GLIBCXX_BEGIN_NAMESPACE_CONTAINER= " \ + "_GLIBCXX_BEGIN_NAMESPACE_LDBL= " \ + "_GLIBCXX_END_NAMESPACE_VERSION= " \ + "_GLIBCXX_END_NAMESPACE_ALGO= " \ + "_GLIBCXX_END_NAMESPACE_CONTAINER= " \ + "_GLIBCXX_END_NAMESPACE_LDBL= " \ + "_GLIBCXX_TEMPLATE_ARGS=... " \ + _GLIBCXX_DEPRECATED \ + _GLIBCXX_CONSTEXPR=constexpr \ + _GLIBCXX_USE_CONSTEXPR=constexpr \ + _GLIBCXX_USE_WCHAR_T \ + _GLIBCXX_USE_LONG_LONG \ + _GLIBCXX_USE_C99_STDINT_TR1 \ + _GLIBCXX_ATOMIC_BUILTINS_1 \ + _GLIBCXX_ATOMIC_BUILTINS_2 \ + _GLIBCXX_ATOMIC_BUILTINS_4 \ + _GLIBCXX_ATOMIC_BUILTINS_8 \ + _GLIBCXX_USE_SCHED_YIELD \ + _GLIBCXX_USE_NANOSLEEP \ + PB_DS_DATA_TRUE_INDICATOR \ + __EXCEPTIONS \ + __GXX_RTTI \ + __glibcxx_function_requires=// \ + __glibcxx_class_requires=// \ + __glibcxx_class_requires2=// \ + __glibcxx_class_requires3=// \ + __glibcxx_class_requires4=// # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. SKIP_FUNCTION_MACROS = YES @@ -1671,11 +1757,10 @@ HAVE_DOT = YES DOT_NUM_THREADS = 0 -# By default doxygen will write a font called FreeSans.ttf to the output -# directory and reference it in all dot files that doxygen generates. This -# font does not include all possible unicode characters however, so when you need -# these (or just want a differently looking font) you can specify the font name -# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# By default doxygen will write a font called Helvetica to the output +# directory and reference it in all dot files that doxygen generates. +# When you want a differently looking font you can specify the font name +# using DOT_FONTNAME. You need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. @@ -1767,7 +1852,7 @@ GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif. +# generated by dot. Possible values are svg, png, jpg, or gif. # If left blank png will be used. DOT_IMAGE_FORMAT = png diff --git a/libstdc++-v3/doc/html/ext/pb_ds/binary_priority_queue_random_int_push_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/binary_priority_queue_random_int_push_timing_test_local.png index 76e02f1..c69cf1e 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/binary_priority_queue_random_int_push_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/binary_priority_queue_random_int_push_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/cc_hash_random_int_find_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/cc_hash_random_int_find_timing_test_local.png index 4f578c6..40404c8 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/cc_hash_random_int_find_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/cc_hash_random_int_find_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/cc_hash_random_int_subscript_timing_test_find_local.png b/libstdc++-v3/doc/html/ext/pb_ds/cc_hash_random_int_subscript_timing_test_find_local.png index ca4db96..bb5f30b 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/cc_hash_random_int_subscript_timing_test_find_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/cc_hash_random_int_subscript_timing_test_find_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/cc_hash_random_int_subscript_timing_test_insert_local.png b/libstdc++-v3/doc/html/ext/pb_ds/cc_hash_random_int_subscript_timing_test_insert_local.png index 48fcf76..8dc7735 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/cc_hash_random_int_subscript_timing_test_insert_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/cc_hash_random_int_subscript_timing_test_insert_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/ccgp_hash_random_int_subscript_timing_test_insert_local.png b/libstdc++-v3/doc/html/ext/pb_ds/ccgp_hash_random_int_subscript_timing_test_insert_local.png index 2449e1d..2b8c0e7 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/ccgp_hash_random_int_subscript_timing_test_insert_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/ccgp_hash_random_int_subscript_timing_test_insert_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/gp_hash_random_int_find_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/gp_hash_random_int_find_timing_test_local.png index 1b31b7f..299737d 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/gp_hash_random_int_find_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/gp_hash_random_int_find_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/gp_hash_random_int_subscript_timing_test_find_local.png b/libstdc++-v3/doc/html/ext/pb_ds/gp_hash_random_int_subscript_timing_test_find_local.png index c693ed3..7e4d7fa 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/gp_hash_random_int_subscript_timing_test_find_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/gp_hash_random_int_subscript_timing_test_find_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/gp_hash_random_int_subscript_timing_test_insert_local.png b/libstdc++-v3/doc/html/ext/pb_ds/gp_hash_random_int_subscript_timing_test_insert_local.png index 9fa08a0..587ff1d 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/gp_hash_random_int_subscript_timing_test_insert_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/gp_hash_random_int_subscript_timing_test_insert_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/hash_random_int_erase_mem_usage_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/hash_random_int_erase_mem_usage_test_local.png index dbd3ee9..66bb0eb 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/hash_random_int_erase_mem_usage_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/hash_random_int_erase_mem_usage_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/hash_zlob_random_int_find_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/hash_zlob_random_int_find_timing_test_local.png index 0be2f00..81848ba 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/hash_zlob_random_int_find_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/hash_zlob_random_int_find_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_large_s2p_hash_local.png b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_large_s2p_hash_local.png index 32a61ca..121af9e 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_large_s2p_hash_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_large_s2p_hash_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_large_s2p_tree_local.png b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_large_s2p_tree_local.png index 10b3980..3ac90d5 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_large_s2p_tree_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_large_s2p_tree_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_small_s2p_hash_local.png b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_small_s2p_hash_local.png index a8fa261..4fc3d59 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_small_s2p_hash_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_small_s2p_hash_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_small_s2p_tree_local.png b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_small_s2p_tree_local.png index b3d1061..123c3a6 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_small_s2p_tree_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_small_s2p_tree_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_large_s2p_hash_local.png b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_large_s2p_hash_local.png index 8af7100..73a35ce 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_large_s2p_hash_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_large_s2p_hash_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_large_s2p_tree_local.png b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_large_s2p_tree_local.png index 63c0c8d..fce364c 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_large_s2p_tree_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_large_s2p_tree_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_small_s2p_hash_local.png b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_small_s2p_hash_local.png index 589dccde..df0becc 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_small_s2p_hash_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_small_s2p_hash_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_small_s2p_tree_local.png b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_small_s2p_tree_local.png index d7322f2..9bacb35 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_small_s2p_tree_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_small_s2p_tree_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_large_s2p_hash_local.png b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_large_s2p_hash_local.png index 5f89460..de6ee23 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_large_s2p_hash_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_large_s2p_hash_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_large_s2p_tree_local.png b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_large_s2p_tree_local.png index 2b496b4..307ca2d 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_large_s2p_tree_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_large_s2p_tree_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_small_s2p_hash_local.png b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_small_s2p_hash_local.png index 4af78fa..4174fab 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_small_s2p_hash_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_small_s2p_hash_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_small_s2p_tree_local.png b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_small_s2p_tree_local.png index 40b5b2c..c5f4e57 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_small_s2p_tree_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_small_s2p_tree_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/pairing_priority_queue_text_push_pop_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/pairing_priority_queue_text_push_pop_timing_test_local.png index 97ca4e9..81f7a59 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/pairing_priority_queue_text_push_pop_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/pairing_priority_queue_text_push_pop_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/pairing_priority_queue_text_push_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/pairing_priority_queue_text_push_timing_test_local.png index cedcb4c..472d869 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/pairing_priority_queue_text_push_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/pairing_priority_queue_text_push_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_random_int_push_pop_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_random_int_push_pop_timing_test_local.png index 51f8211..b8cc153 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_random_int_push_pop_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_random_int_push_pop_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_random_int_push_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_random_int_push_timing_test_local.png index dead185..51fa718 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_random_int_push_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_random_int_push_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_join_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_join_timing_test_local.png index 1701b4d..67318f0 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_join_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_join_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_down_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_down_timing_test_local.png index 2fa9c79..d8d3b7a 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_down_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_down_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_down_timing_test_pairing_thin_local.png b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_down_timing_test_pairing_thin_local.png index 977d167..23ac5e7 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_down_timing_test_pairing_thin_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_down_timing_test_pairing_thin_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_up_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_up_timing_test_local.png index 31575b4..dc48e39 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_up_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_up_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_up_timing_test_pairing_thin_local.png b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_up_timing_test_pairing_thin_local.png index b878dde..9a73934 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_up_timing_test_pairing_thin_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_up_timing_test_pairing_thin_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_pop_mem_usage_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_pop_mem_usage_test_local.png index c1413fc..d1966e3 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_pop_mem_usage_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_pop_mem_usage_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_push_pop_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_push_pop_timing_test_local.png index a7c5f89..fd52d5a 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_push_pop_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_push_pop_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_push_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_push_timing_test_local.png index da7297b..18cca76 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_push_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_push_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/random_int_find_find_timing_test_tree_local.png b/libstdc++-v3/doc/html/ext/pb_ds/random_int_find_find_timing_test_tree_local.png index 8310520..dd7c184 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/random_int_find_find_timing_test_tree_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/random_int_find_find_timing_test_tree_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/sample_trie_access_traits.html b/libstdc++-v3/doc/html/ext/pb_ds/sample_trie_access_traits.html new file mode 100644 index 0000000..a46c91b --- /dev/null +++ b/libstdc++-v3/doc/html/ext/pb_ds/sample_trie_access_traits.html @@ -0,0 +1,231 @@ + + + + + + + sample_trie_e_access_traits Interface + + + + +
+

sample_trie_e_access_traits Interface

+ +

A sample trie element-access traits.

+ +

This class serves to show the interface an element- access + traits class needs to support.

+ +

Defined in: + sample_trie_e_access_traits.hpp

+ +

Public Types and + Constants

+ +

General definitions.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDefinitionDescription
+
+size_type
+
+
+
+size_t, e.g.
+
+
+

Size type.

+
+
+key_type
+
+
+
+std::string, e.g.
+
+
+

Key type.

+
+
+const_key_reference
+
+
+
+const string &, e.g.
+
+
+

Const key reference type.

+
+ +

Element definitions.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDefinitionDescription
+
+const_iterator
+
+
+
+string::const_iterator, e.g.
+
+
+

Element const iterator type.

+
+
+e_type
+
+
+
+char, e.g.
+
+
+

Element type.

+
+
+max_size
+
+
+
+4, e.g.
+
+
+

Number of distinct elements.

+
+ +

Public Methods

+ +

Access methods.

+ + + + + + + + + + + + + + + + + + + + + + + + + +
MethodDescription
+
+inline static const_iterator
+  begin
+  (const_key_reference r_key)
+
+
+

Returns a const_iterator to + the first element of r_key.

+
+
+inline static const_iterator
+  end
+  (const_key_reference r_key)
+
+
+

Returns a const_iterator to + the after-last element of r_key.

+
+
+inline static size_type
+  e_pos
+  (e_type e)
+
+
+

Maps an element to a + position.

+
+
+ + diff --git a/libstdc++-v3/doc/html/ext/pb_ds/sample_trie_e_access_traits.html b/libstdc++-v3/doc/html/ext/pb_ds/sample_trie_e_access_traits.html deleted file mode 100644 index a46c91b..0000000 --- a/libstdc++-v3/doc/html/ext/pb_ds/sample_trie_e_access_traits.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - sample_trie_e_access_traits Interface - - - - -
-

sample_trie_e_access_traits Interface

- -

A sample trie element-access traits.

- -

This class serves to show the interface an element- access - traits class needs to support.

- -

Defined in: - sample_trie_e_access_traits.hpp

- -

Public Types and - Constants

- -

General definitions.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeDefinitionDescription
-
-size_type
-
-
-
-size_t, e.g.
-
-
-

Size type.

-
-
-key_type
-
-
-
-std::string, e.g.
-
-
-

Key type.

-
-
-const_key_reference
-
-
-
-const string &, e.g.
-
-
-

Const key reference type.

-
- -

Element definitions.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeDefinitionDescription
-
-const_iterator
-
-
-
-string::const_iterator, e.g.
-
-
-

Element const iterator type.

-
-
-e_type
-
-
-
-char, e.g.
-
-
-

Element type.

-
-
-max_size
-
-
-
-4, e.g.
-
-
-

Number of distinct elements.

-
- -

Public Methods

- -

Access methods.

- - - - - - - - - - - - - - - - - - - - - - - - - -
MethodDescription
-
-inline static const_iterator
-  begin
-  (const_key_reference r_key)
-
-
-

Returns a const_iterator to - the first element of r_key.

-
-
-inline static const_iterator
-  end
-  (const_key_reference r_key)
-
-
-

Returns a const_iterator to - the after-last element of r_key.

-
-
-inline static size_type
-  e_pos
-  (e_type e)
-
-
-

Maps an element to a - position.

-
-
- - diff --git a/libstdc++-v3/doc/html/ext/pb_ds/string_trie_e_access_traits.html b/libstdc++-v3/doc/html/ext/pb_ds/string_trie_e_access_traits.html deleted file mode 100644 index 4ce9e86..0000000 --- a/libstdc++-v3/doc/html/ext/pb_ds/string_trie_e_access_traits.html +++ /dev/null @@ -1,400 +0,0 @@ - - - - - - - string_trie_e_access_traits Interface - - - - -
-

string_trie_e_access_traits Interface

- -

Element access traits for string types.

- -

Defined in: trie_policy.hpp

- -

Template Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterDescriptionDefault Value
-
-class String 
-
-
-

String type.

-
std::string
-
-typename String::value_type Min_E_Val 
-
-
-

Minimal element.

-
SCHAR_MIN
-
-typename String::value_type Max_E_Val 
-
-
-

Maximal element.

-
SCHAR_MAX
-
-bool Reverse 
-
-
-

Indicates whether reverse iteration should be - used.

-
false
-
-class Allocator 
-
-
-

Allocator type.

-
-
-std::allocator<char>
-
-
- -

Public Types and - Constants

- -

General Definitions

- - - - - - - - - - - - - - - - - -
TypeDefinitionDescription
-
-size_type
-
-
-
-typename Allocator::size_type
-
-
-

Size type.

-
- -

Key-Type Definitions

- - - - - - - - - - - - - - - - - - - - - - - - - -
TypeDefinitionDescription
-
-key_type
-
-
-
-String
-
-
-

Key type.

-
-
-const_key_reference
-
-
-
-typename Allocator::template rebind<
-    key_type>::other::const_reference
-
-
-

Const key reference type.

-
- -

Element-Type - Definitions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeDefinitionDescription
-
-reverse
-
-
-
-Reverse
-
-
-

Reverse - iteration indicator.

-
-
-const_iterator
-
-
-
-typename __gnu_pbds::detail::__conditional_type<
-    Reverse,
-    typename String::const_reverse_iterator,
-    typename String::const_iterator>::__type
-
-
-

Element const iterator type.

-
-
-e_type
-
-
-
-typename std::iterator_traits<const_iterator>::value_type
-
-
-

Element type.

-
-
-min_e_val
-
-
-
-Min_E_Val
-
-
-

Minimal element.

-
-
-max_e_val
-
-
-
-Max_E_Val
-
-
-

Maximal element.

-
-
-max_size
-
-
-
-max_e_val - min_e_val + 1
-
-
-

Number of distinct elements.

-
- -

Public Methods

- -

Access Methods

- - - - - - - - - - - - - - - - - - - - - - - - - -
MethodDescription
-
-inline static const_iterator
-  begin
-  (const_key_reference r_key)
-
-
-

Returns a const_iterator to - the first element of r_key.

-
-
-inline static const_iterator
-  end
-  (const_key_reference r_key)
-
-
-

Returns a const_iterator to - the after-last element of r_key.

-
-
-inline static size_type
-  e_pos
-  (e_type e)
-
-
-

Maps an eelement to a - position.

-
-
- - diff --git a/libstdc++-v3/doc/html/ext/pb_ds/text_find_timing_test_hash_local.png b/libstdc++-v3/doc/html/ext/pb_ds/text_find_timing_test_hash_local.png index d85980f..5364778 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/text_find_timing_test_hash_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/text_find_timing_test_hash_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/text_find_timing_test_tree_like_local.png b/libstdc++-v3/doc/html/ext/pb_ds/text_find_timing_test_tree_like_local.png index b7fdc47..8ec5cfb 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/text_find_timing_test_tree_like_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/text_find_timing_test_tree_like_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/tree_order_statistics_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/tree_order_statistics_timing_test_local.png index 2b92174..9f46319 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/tree_order_statistics_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/tree_order_statistics_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/tree_split_join_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/tree_split_join_timing_test_local.png index 131d24a..fe5ba81 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/tree_split_join_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/tree_split_join_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/tree_text_insert_timing_test_node_tree_local.png b/libstdc++-v3/doc/html/ext/pb_ds/tree_text_insert_timing_test_node_tree_local.png index bb10008..c98488c 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/tree_text_insert_timing_test_node_tree_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/tree_text_insert_timing_test_node_tree_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/tree_text_insert_timing_test_pat_trie_local.png b/libstdc++-v3/doc/html/ext/pb_ds/tree_text_insert_timing_test_pat_trie_local.png index 228de14..eff7eef 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/tree_text_insert_timing_test_pat_trie_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/tree_text_insert_timing_test_pat_trie_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/tree_text_insert_timing_test_vector_tree_local.png b/libstdc++-v3/doc/html/ext/pb_ds/tree_text_insert_timing_test_vector_tree_local.png index cecb8a1..f67156d 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/tree_text_insert_timing_test_vector_tree_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/tree_text_insert_timing_test_vector_tree_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/tree_text_lor_find_timing_test_local.png b/libstdc++-v3/doc/html/ext/pb_ds/tree_text_lor_find_timing_test_local.png index 26f7151..960803b 100644 Binary files a/libstdc++-v3/doc/html/ext/pb_ds/tree_text_lor_find_timing_test_local.png and b/libstdc++-v3/doc/html/ext/pb_ds/tree_text_lor_find_timing_test_local.png differ diff --git a/libstdc++-v3/doc/html/ext/pb_ds/trie_string_access_traits.html b/libstdc++-v3/doc/html/ext/pb_ds/trie_string_access_traits.html new file mode 100644 index 0000000..4ce9e86 --- /dev/null +++ b/libstdc++-v3/doc/html/ext/pb_ds/trie_string_access_traits.html @@ -0,0 +1,400 @@ + + + + + + + string_trie_e_access_traits Interface + + + + +
+

string_trie_e_access_traits Interface

+ +

Element access traits for string types.

+ +

Defined in: trie_policy.hpp

+ +

Template Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterDescriptionDefault Value
+
+class String 
+
+
+

String type.

+
std::string
+
+typename String::value_type Min_E_Val 
+
+
+

Minimal element.

+
SCHAR_MIN
+
+typename String::value_type Max_E_Val 
+
+
+

Maximal element.

+
SCHAR_MAX
+
+bool Reverse 
+
+
+

Indicates whether reverse iteration should be + used.

+
false
+
+class Allocator 
+
+
+

Allocator type.

+
+
+std::allocator<char>
+
+
+ +

Public Types and + Constants

+ +

General Definitions

+ + + + + + + + + + + + + + + + + +
TypeDefinitionDescription
+
+size_type
+
+
+
+typename Allocator::size_type
+
+
+

Size type.

+
+ +

Key-Type Definitions

+ + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDefinitionDescription
+
+key_type
+
+
+
+String
+
+
+

Key type.

+
+
+const_key_reference
+
+
+
+typename Allocator::template rebind<
+    key_type>::other::const_reference
+
+
+

Const key reference type.

+
+ +

Element-Type + Definitions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDefinitionDescription
+
+reverse
+
+
+
+Reverse
+
+
+

Reverse + iteration indicator.

+
+
+const_iterator
+
+
+
+typename __gnu_pbds::detail::__conditional_type<
+    Reverse,
+    typename String::const_reverse_iterator,
+    typename String::const_iterator>::__type
+
+
+

Element const iterator type.

+
+
+e_type
+
+
+
+typename std::iterator_traits<const_iterator>::value_type
+
+
+

Element type.

+
+
+min_e_val
+
+
+
+Min_E_Val
+
+
+

Minimal element.

+
+
+max_e_val
+
+
+
+Max_E_Val
+
+
+

Maximal element.

+
+
+max_size
+
+
+
+max_e_val - min_e_val + 1
+
+
+

Number of distinct elements.

+
+ +

Public Methods

+ +

Access Methods

+ + + + + + + + + + + + + + + + + + + + + + + + + +
MethodDescription
+
+inline static const_iterator
+  begin
+  (const_key_reference r_key)
+
+
+

Returns a const_iterator to + the first element of r_key.

+
+
+inline static const_iterator
+  end
+  (const_key_reference r_key)
+
+
+

Returns a const_iterator to + the after-last element of r_key.

+
+
+inline static size_type
+  e_pos
+  (e_type e)
+
+
+

Maps an eelement to a + position.

+
+
+ + diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 27aff0d..73b8589 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -201,7 +201,7 @@ pb_subdirs = \ ${pb_builddir}/detail/pairing_heap_ \ ${pb_builddir}/detail/splay_tree_ \ ${pb_builddir}/detail/list_update_map_ \ - ${pb_builddir}/detail/basic_tree_policy \ + ${pb_builddir}/detail/branch_policy \ ${pb_builddir}/detail/trie_policy \ ${pb_builddir}/detail/gp_hash_table_map_ \ ${pb_builddir}/detail/tree_policy \ @@ -236,13 +236,12 @@ pb_headers1 = \ ${pb_srcdir}/tag_and_trait.hpp \ ${pb_srcdir}/tree_policy.hpp \ ${pb_srcdir}/trie_policy.hpp \ - ${pb_srcdir}/detail/basic_tree_policy/basic_tree_policy_base.hpp \ - ${pb_srcdir}/detail/basic_tree_policy/null_node_metadata.hpp \ - ${pb_srcdir}/detail/basic_tree_policy/traits.hpp \ - ${pb_srcdir}/detail/basic_types.hpp \ + ${pb_srcdir}/detail/branch_policy/branch_policy.hpp \ + ${pb_srcdir}/detail/branch_policy/null_node_metadata.hpp \ + ${pb_srcdir}/detail/branch_policy/traits.hpp \ ${pb_srcdir}/detail/binary_heap_/binary_heap_.hpp \ ${pb_srcdir}/detail/binary_heap_/const_iterator.hpp \ - ${pb_srcdir}/detail/binary_heap_/const_point_iterator.hpp \ + ${pb_srcdir}/detail/binary_heap_/point_const_iterator.hpp \ ${pb_srcdir}/detail/binary_heap_/constructors_destructor_fn_imps.hpp \ ${pb_srcdir}/detail/binary_heap_/debug_fn_imps.hpp \ ${pb_srcdir}/detail/binary_heap_/entry_cmp.hpp \ @@ -266,9 +265,7 @@ pb_headers1 = \ ${pb_srcdir}/detail/binomial_heap_/binomial_heap_.hpp \ ${pb_srcdir}/detail/binomial_heap_/constructors_destructor_fn_imps.hpp \ ${pb_srcdir}/detail/binomial_heap_/debug_fn_imps.hpp \ - ${pb_srcdir}/detail/bin_search_tree_/bin_search_tree_.hpp \ - ${pb_srcdir}/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp \ - ${pb_srcdir}/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp + ${pb_srcdir}/detail/bin_search_tree_/bin_search_tree_.hpp pb_headers2 = \ ${pb_srcdir}/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp \ @@ -359,7 +356,7 @@ pb_headers4 = \ ${pb_srcdir}/detail/hash_fn/sample_ranged_probe_fn.hpp \ ${pb_srcdir}/detail/hash_fn/sample_range_hashing.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/const_iterator.hpp \ - ${pb_srcdir}/detail/left_child_next_sibling_heap_/const_point_iterator.hpp \ + ${pb_srcdir}/detail/left_child_next_sibling_heap_/point_const_iterator.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp \ @@ -368,7 +365,6 @@ pb_headers4 = \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/node.hpp \ - ${pb_srcdir}/detail/left_child_next_sibling_heap_/null_metadata.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp \ ${pb_srcdir}/detail/list_update_map_/constructor_destructor_fn_imps.hpp \ @@ -381,12 +377,9 @@ pb_headers4 = \ ${pb_srcdir}/detail/list_update_map_/iterators_fn_imps.hpp \ ${pb_srcdir}/detail/list_update_map_/lu_map_.hpp \ ${pb_srcdir}/detail/list_update_map_/trace_fn_imps.hpp \ - ${pb_srcdir}/detail/list_update_policy/counter_lu_metadata.hpp \ - ${pb_srcdir}/detail/list_update_policy/counter_lu_policy_imp.hpp \ - ${pb_srcdir}/detail/list_update_policy/mtf_lu_policy_imp.hpp \ + ${pb_srcdir}/detail/list_update_policy/lu_counter_metadata.hpp \ ${pb_srcdir}/detail/list_update_policy/sample_update_policy.hpp \ ${pb_srcdir}/detail/debug_map_base.hpp \ - ${pb_srcdir}/detail/ov_tree_map_/cond_dtor.hpp \ ${pb_srcdir}/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp \ ${pb_srcdir}/detail/ov_tree_map_/debug_fn_imps.hpp \ ${pb_srcdir}/detail/ov_tree_map_/erase_fn_imps.hpp \ @@ -407,30 +400,20 @@ pb_headers5 = \ ${pb_srcdir}/detail/pairing_heap_/insert_fn_imps.hpp \ ${pb_srcdir}/detail/pairing_heap_/pairing_heap_.hpp \ ${pb_srcdir}/detail/pairing_heap_/split_join_fn_imps.hpp \ - ${pb_srcdir}/detail/pat_trie_/child_iterator.hpp \ - ${pb_srcdir}/detail/pat_trie_/cond_dtor_entry_dealtor.hpp \ - ${pb_srcdir}/detail/pat_trie_/const_child_iterator.hpp \ ${pb_srcdir}/detail/pat_trie_/constructors_destructor_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/debug_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/erase_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/find_fn_imps.hpp \ - ${pb_srcdir}/detail/pat_trie_/head.hpp \ ${pb_srcdir}/detail/pat_trie_/info_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/insert_join_fn_imps.hpp \ - ${pb_srcdir}/detail/pat_trie_/internal_node.hpp \ ${pb_srcdir}/detail/pat_trie_/iterators_fn_imps.hpp \ - ${pb_srcdir}/detail/pat_trie_/leaf.hpp \ - ${pb_srcdir}/detail/pat_trie_/node_base.hpp \ - ${pb_srcdir}/detail/pat_trie_/node_iterators.hpp \ - ${pb_srcdir}/detail/pat_trie_/node_metadata_base.hpp \ ${pb_srcdir}/detail/pat_trie_/pat_trie_.hpp \ - ${pb_srcdir}/detail/pat_trie_/point_iterators.hpp \ + ${pb_srcdir}/detail/pat_trie_/pat_trie_base.hpp \ ${pb_srcdir}/detail/pat_trie_/policy_access_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/r_erase_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/rotate_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/split_fn_imps.hpp \ - ${pb_srcdir}/detail/pat_trie_/split_join_branch_bag.hpp \ - ${pb_srcdir}/detail/pat_trie_/synth_e_access_traits.hpp \ + ${pb_srcdir}/detail/pat_trie_/synth_access_traits.hpp \ ${pb_srcdir}/detail/pat_trie_/trace_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/traits.hpp \ ${pb_srcdir}/detail/pat_trie_/update_fn_imps.hpp \ @@ -487,22 +470,20 @@ pb_headers7 = \ ${pb_srcdir}/detail/thin_heap_/thin_heap_.hpp \ ${pb_srcdir}/detail/thin_heap_/trace_fn_imps.hpp \ ${pb_srcdir}/detail/tree_policy/node_metadata_selector.hpp \ - ${pb_srcdir}/detail/tree_policy/null_node_update_imp.hpp \ ${pb_srcdir}/detail/tree_policy/order_statistics_imp.hpp \ ${pb_srcdir}/detail/tree_policy/sample_tree_node_update.hpp \ ${pb_srcdir}/detail/tree_trace_base.hpp \ ${pb_srcdir}/detail/trie_policy/node_metadata_selector.hpp \ - ${pb_srcdir}/detail/trie_policy/null_node_update_imp.hpp \ ${pb_srcdir}/detail/trie_policy/order_statistics_imp.hpp \ ${pb_srcdir}/detail/trie_policy/prefix_search_node_update_imp.hpp \ - ${pb_srcdir}/detail/trie_policy/sample_trie_e_access_traits.hpp \ + ${pb_srcdir}/detail/trie_policy/sample_trie_access_traits.hpp \ ${pb_srcdir}/detail/trie_policy/sample_trie_node_update.hpp \ - ${pb_srcdir}/detail/trie_policy/string_trie_e_access_traits_imp.hpp \ + ${pb_srcdir}/detail/trie_policy/trie_string_access_traits_imp.hpp \ ${pb_srcdir}/detail/trie_policy/trie_policy_base.hpp \ ${pb_srcdir}/detail/types_traits.hpp \ ${pb_srcdir}/detail/type_utils.hpp \ ${pb_srcdir}/detail/unordered_iterator/const_iterator.hpp \ - ${pb_srcdir}/detail/unordered_iterator/const_point_iterator.hpp \ + ${pb_srcdir}/detail/unordered_iterator/point_const_iterator.hpp \ ${pb_srcdir}/detail/unordered_iterator/iterator.hpp \ ${pb_srcdir}/detail/unordered_iterator/point_iterator.hpp diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index e7f7951..aa90813 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -451,7 +451,7 @@ pb_subdirs = \ ${pb_builddir}/detail/pairing_heap_ \ ${pb_builddir}/detail/splay_tree_ \ ${pb_builddir}/detail/list_update_map_ \ - ${pb_builddir}/detail/basic_tree_policy \ + ${pb_builddir}/detail/branch_policy \ ${pb_builddir}/detail/trie_policy \ ${pb_builddir}/detail/gp_hash_table_map_ \ ${pb_builddir}/detail/tree_policy \ @@ -486,13 +486,12 @@ pb_headers1 = \ ${pb_srcdir}/tag_and_trait.hpp \ ${pb_srcdir}/tree_policy.hpp \ ${pb_srcdir}/trie_policy.hpp \ - ${pb_srcdir}/detail/basic_tree_policy/basic_tree_policy_base.hpp \ - ${pb_srcdir}/detail/basic_tree_policy/null_node_metadata.hpp \ - ${pb_srcdir}/detail/basic_tree_policy/traits.hpp \ - ${pb_srcdir}/detail/basic_types.hpp \ + ${pb_srcdir}/detail/branch_policy/branch_policy.hpp \ + ${pb_srcdir}/detail/branch_policy/null_node_metadata.hpp \ + ${pb_srcdir}/detail/branch_policy/traits.hpp \ ${pb_srcdir}/detail/binary_heap_/binary_heap_.hpp \ ${pb_srcdir}/detail/binary_heap_/const_iterator.hpp \ - ${pb_srcdir}/detail/binary_heap_/const_point_iterator.hpp \ + ${pb_srcdir}/detail/binary_heap_/point_const_iterator.hpp \ ${pb_srcdir}/detail/binary_heap_/constructors_destructor_fn_imps.hpp \ ${pb_srcdir}/detail/binary_heap_/debug_fn_imps.hpp \ ${pb_srcdir}/detail/binary_heap_/entry_cmp.hpp \ @@ -516,9 +515,7 @@ pb_headers1 = \ ${pb_srcdir}/detail/binomial_heap_/binomial_heap_.hpp \ ${pb_srcdir}/detail/binomial_heap_/constructors_destructor_fn_imps.hpp \ ${pb_srcdir}/detail/binomial_heap_/debug_fn_imps.hpp \ - ${pb_srcdir}/detail/bin_search_tree_/bin_search_tree_.hpp \ - ${pb_srcdir}/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp \ - ${pb_srcdir}/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp + ${pb_srcdir}/detail/bin_search_tree_/bin_search_tree_.hpp pb_headers2 = \ ${pb_srcdir}/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp \ @@ -609,7 +606,7 @@ pb_headers4 = \ ${pb_srcdir}/detail/hash_fn/sample_ranged_probe_fn.hpp \ ${pb_srcdir}/detail/hash_fn/sample_range_hashing.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/const_iterator.hpp \ - ${pb_srcdir}/detail/left_child_next_sibling_heap_/const_point_iterator.hpp \ + ${pb_srcdir}/detail/left_child_next_sibling_heap_/point_const_iterator.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp \ @@ -618,7 +615,6 @@ pb_headers4 = \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/node.hpp \ - ${pb_srcdir}/detail/left_child_next_sibling_heap_/null_metadata.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp \ ${pb_srcdir}/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp \ ${pb_srcdir}/detail/list_update_map_/constructor_destructor_fn_imps.hpp \ @@ -631,12 +627,9 @@ pb_headers4 = \ ${pb_srcdir}/detail/list_update_map_/iterators_fn_imps.hpp \ ${pb_srcdir}/detail/list_update_map_/lu_map_.hpp \ ${pb_srcdir}/detail/list_update_map_/trace_fn_imps.hpp \ - ${pb_srcdir}/detail/list_update_policy/counter_lu_metadata.hpp \ - ${pb_srcdir}/detail/list_update_policy/counter_lu_policy_imp.hpp \ - ${pb_srcdir}/detail/list_update_policy/mtf_lu_policy_imp.hpp \ + ${pb_srcdir}/detail/list_update_policy/lu_counter_metadata.hpp \ ${pb_srcdir}/detail/list_update_policy/sample_update_policy.hpp \ ${pb_srcdir}/detail/debug_map_base.hpp \ - ${pb_srcdir}/detail/ov_tree_map_/cond_dtor.hpp \ ${pb_srcdir}/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp \ ${pb_srcdir}/detail/ov_tree_map_/debug_fn_imps.hpp \ ${pb_srcdir}/detail/ov_tree_map_/erase_fn_imps.hpp \ @@ -657,30 +650,20 @@ pb_headers5 = \ ${pb_srcdir}/detail/pairing_heap_/insert_fn_imps.hpp \ ${pb_srcdir}/detail/pairing_heap_/pairing_heap_.hpp \ ${pb_srcdir}/detail/pairing_heap_/split_join_fn_imps.hpp \ - ${pb_srcdir}/detail/pat_trie_/child_iterator.hpp \ - ${pb_srcdir}/detail/pat_trie_/cond_dtor_entry_dealtor.hpp \ - ${pb_srcdir}/detail/pat_trie_/const_child_iterator.hpp \ ${pb_srcdir}/detail/pat_trie_/constructors_destructor_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/debug_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/erase_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/find_fn_imps.hpp \ - ${pb_srcdir}/detail/pat_trie_/head.hpp \ ${pb_srcdir}/detail/pat_trie_/info_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/insert_join_fn_imps.hpp \ - ${pb_srcdir}/detail/pat_trie_/internal_node.hpp \ ${pb_srcdir}/detail/pat_trie_/iterators_fn_imps.hpp \ - ${pb_srcdir}/detail/pat_trie_/leaf.hpp \ - ${pb_srcdir}/detail/pat_trie_/node_base.hpp \ - ${pb_srcdir}/detail/pat_trie_/node_iterators.hpp \ - ${pb_srcdir}/detail/pat_trie_/node_metadata_base.hpp \ ${pb_srcdir}/detail/pat_trie_/pat_trie_.hpp \ - ${pb_srcdir}/detail/pat_trie_/point_iterators.hpp \ + ${pb_srcdir}/detail/pat_trie_/pat_trie_base.hpp \ ${pb_srcdir}/detail/pat_trie_/policy_access_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/r_erase_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/rotate_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/split_fn_imps.hpp \ - ${pb_srcdir}/detail/pat_trie_/split_join_branch_bag.hpp \ - ${pb_srcdir}/detail/pat_trie_/synth_e_access_traits.hpp \ + ${pb_srcdir}/detail/pat_trie_/synth_access_traits.hpp \ ${pb_srcdir}/detail/pat_trie_/trace_fn_imps.hpp \ ${pb_srcdir}/detail/pat_trie_/traits.hpp \ ${pb_srcdir}/detail/pat_trie_/update_fn_imps.hpp \ @@ -737,22 +720,20 @@ pb_headers7 = \ ${pb_srcdir}/detail/thin_heap_/thin_heap_.hpp \ ${pb_srcdir}/detail/thin_heap_/trace_fn_imps.hpp \ ${pb_srcdir}/detail/tree_policy/node_metadata_selector.hpp \ - ${pb_srcdir}/detail/tree_policy/null_node_update_imp.hpp \ ${pb_srcdir}/detail/tree_policy/order_statistics_imp.hpp \ ${pb_srcdir}/detail/tree_policy/sample_tree_node_update.hpp \ ${pb_srcdir}/detail/tree_trace_base.hpp \ ${pb_srcdir}/detail/trie_policy/node_metadata_selector.hpp \ - ${pb_srcdir}/detail/trie_policy/null_node_update_imp.hpp \ ${pb_srcdir}/detail/trie_policy/order_statistics_imp.hpp \ ${pb_srcdir}/detail/trie_policy/prefix_search_node_update_imp.hpp \ - ${pb_srcdir}/detail/trie_policy/sample_trie_e_access_traits.hpp \ + ${pb_srcdir}/detail/trie_policy/sample_trie_access_traits.hpp \ ${pb_srcdir}/detail/trie_policy/sample_trie_node_update.hpp \ - ${pb_srcdir}/detail/trie_policy/string_trie_e_access_traits_imp.hpp \ + ${pb_srcdir}/detail/trie_policy/trie_string_access_traits_imp.hpp \ ${pb_srcdir}/detail/trie_policy/trie_policy_base.hpp \ ${pb_srcdir}/detail/types_traits.hpp \ ${pb_srcdir}/detail/type_utils.hpp \ ${pb_srcdir}/detail/unordered_iterator/const_iterator.hpp \ - ${pb_srcdir}/detail/unordered_iterator/const_point_iterator.hpp \ + ${pb_srcdir}/detail/unordered_iterator/point_const_iterator.hpp \ ${pb_srcdir}/detail/unordered_iterator/iterator.hpp \ ${pb_srcdir}/detail/unordered_iterator/point_iterator.hpp diff --git a/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp b/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp index 12a3fc5..d366f43 100644 --- a/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp +++ b/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp @@ -1,6 +1,6 @@ // -*- C++ -*- -// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 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 @@ -46,90 +46,20 @@ #include #include #include -#include +#include namespace __gnu_pbds { - /** @defgroup pbds Policy-Based Data Structures - * @ingroup extensions - * - * This is a library of policy-based elementary data structures: - * associative containers and priority queues. It is designed for - * high-performance, flexibility, semantic safety, and conformance - * to the corresponding containers in std (except for some points - * where it differs by design). - * - * For details, see: - * http://gcc.gnu.org/onlinedocs/libstdc++/ext/pb_ds/index.html - * + /** + * @addtogroup pbds * @{ */ - -#define PB_DS_BASE_C_DEC \ - detail::container_base_dispatch::type - - /// An abstract basic associative container. - template - class container_base : public PB_DS_BASE_C_DEC - { - private: - typedef typename PB_DS_BASE_C_DEC base_type; - - public: - typedef Tag container_category; - typedef Allocator allocator_type; - typedef typename allocator_type::size_type size_type; - typedef typename allocator_type::difference_type difference_type; - - // key_type - typedef typename allocator_type::template rebind::other::value_type key_type; - typedef typename allocator_type::template rebind::other key_rebind; - typedef typename key_rebind::reference key_reference; - typedef typename key_rebind::const_reference const_key_reference; - typedef typename key_rebind::pointer key_pointer; - typedef typename key_rebind::const_pointer const_key_pointer; - - // mapped_type - typedef Mapped mapped_type; - typedef typename allocator_type::template rebind::other mapped_rebind; - typedef typename mapped_rebind::reference mapped_reference; - typedef typename mapped_rebind::const_reference const_mapped_reference; - typedef typename mapped_rebind::pointer mapped_pointer; - typedef typename mapped_rebind::const_pointer const_mapped_pointer; - - // value_type - typedef typename base_type::value_type value_type; - typedef typename allocator_type::template rebind::other value_rebind; - typedef typename value_rebind::reference reference; - typedef typename value_rebind::const_reference const_reference; - typedef typename value_rebind::pointer pointer; - typedef typename value_rebind::const_pointer const_pointer; - - // iterators - typedef typename base_type::iterator iterator; - typedef typename base_type::const_iterator const_iterator; - typedef typename base_type::point_iterator point_iterator; - typedef typename base_type::const_point_iterator const_point_iterator; - - virtual - ~container_base() { } - - protected: -#define PB_DS_CLASS_NAME container_base -#include -#undef PB_DS_CLASS_NAME - }; - -#undef PB_DS_BASE_C_DEC - -#define PB_DS_BASE_C_DEC \ - container_base >::type, Policy_TL>::type, Allocator> +#define PB_DS_HASH_BASE \ + detail::container_base_dispatch >::type, Policy_Tl>::type>::type /// An abstract basic hash-based associative container. template - class basic_hash_table : public PB_DS_BASE_C_DEC + typename Policy_Tl, + typename _Alloc> + class basic_hash_table : public PB_DS_HASH_BASE { private: - typedef PB_DS_BASE_C_DEC base_type; + typedef typename PB_DS_HASH_BASE base_type; public: virtual @@ -156,17 +86,17 @@ namespace __gnu_pbds #undef PB_DS_CLASS_NAME private: - basic_hash_table& + basic_hash_table& operator=(const base_type&); }; -#undef PB_DS_BASE_C_DEC +#undef PB_DS_HASH_BASE -#define PB_DS_BASE_C_DEC \ +#define PB_DS_CC_HASH_BASE \ basic_hash_table::type, Allocator> + typename __gnu_cxx::typelist::create1::type, _Alloc> /// A concrete collision-chaining hash-based associative container. template::type, bool Store_Hash = detail::default_store_hash, - typename Allocator = std::allocator > - class cc_hash_table : public PB_DS_BASE_C_DEC + typename _Alloc = std::allocator > + class cc_hash_table : public PB_DS_CC_HASH_BASE { private: - typedef PB_DS_BASE_C_DEC base_type; + typedef PB_DS_CC_HASH_BASE base_type; public: - typedef Hash_Fn hash_fn; - typedef Eq_Fn eq_fn; - typedef Resize_Policy resize_policy; - typedef Comb_Hash_Fn comb_hash_fn; + typedef cc_hash_tag container_category; + typedef Hash_Fn hash_fn; + typedef Eq_Fn eq_fn; + typedef Resize_Policy resize_policy; + typedef Comb_Hash_Fn comb_hash_fn; // Default constructor. cc_hash_table() { } // Constructor taking some policy objects. r_hash_fn will be // copied by the Hash_Fn object of the container object. - cc_hash_table(const hash_fn& h) + cc_hash_table(const hash_fn& h) : base_type(h) { } // Constructor taking some policy objects. r_hash_fn will be @@ -217,8 +148,8 @@ namespace __gnu_pbds // r_comb_hash_fn will be copied by the comb_hash_fn object of the // container object, and r_resize_policy will be copied by the // resize_policy object of the container object. - cc_hash_table(const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch, - const resize_policy& rp) + cc_hash_table(const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch, + const resize_policy& rp) : base_type(h, e, ch, rp) { } // Constructor taking __iterators to a range of value_types. The @@ -269,7 +200,7 @@ namespace __gnu_pbds // object of the container object, and r_resize_policy will be // copied by the resize_policy object of the container object. template - cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, + cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch, const resize_policy& rp) : base_type(h, e, ch, rp) { this->copy_from_range(first, last); } @@ -281,7 +212,7 @@ namespace __gnu_pbds virtual ~cc_hash_table() { } - cc_hash_table& + cc_hash_table& operator=(const cc_hash_table& other) { if (this != &other) @@ -297,13 +228,13 @@ namespace __gnu_pbds { base_type::swap(other); } }; -#undef PB_DS_BASE_C_DEC +#undef PB_DS_CC_HASH_BASE -#define PB_DS_BASE_C_DEC \ +#define PB_DS_GP_HASH_BASE \ basic_hash_table::type, Allocator> + typename __gnu_cxx::typelist::create2::type, _Alloc> /// A concrete general-probing hash-based associative container. template::type, typename Resize_Policy = typename detail::default_resize_policy::type, bool Store_Hash = detail::default_store_hash, - typename Allocator = std::allocator > - class gp_hash_table : public PB_DS_BASE_C_DEC + typename _Alloc = std::allocator > + class gp_hash_table : public PB_DS_GP_HASH_BASE { private: - typedef PB_DS_BASE_C_DEC base_type; + typedef PB_DS_GP_HASH_BASE base_type; public: - typedef Hash_Fn hash_fn; - typedef Eq_Fn eq_fn; - typedef Comb_Probe_Fn comb_probe_fn; - typedef Probe_Fn probe_fn; - typedef Resize_Policy resize_policy; + typedef gp_hash_tag container_category; + typedef Hash_Fn hash_fn; + typedef Eq_Fn eq_fn; + typedef Comb_Probe_Fn comb_probe_fn; + typedef Probe_Fn probe_fn; + typedef Resize_Policy resize_policy; // Default constructor. gp_hash_table() { } @@ -356,7 +288,7 @@ namespace __gnu_pbds // r_comb_probe_fn will be copied by the comb_probe_fn object of // the container object, and r_probe_fn will be copied by the // probe_fn object of the container object. - gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp, + gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp, const probe_fn& p) : base_type(h, e, cp, p) { } @@ -367,7 +299,7 @@ namespace __gnu_pbds // the container object, r_probe_fn will be copied by the probe_fn // object of the container object, and r_resize_policy will be // copied by the Resize_Policy object of the container object. - gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp, + gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp, const probe_fn& p, const resize_policy& rp) : base_type(h, e, cp, p, rp) { } @@ -406,7 +338,7 @@ namespace __gnu_pbds // object, and r_comb_probe_fn will be copied by the comb_probe_fn // object of the container object. template - gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, + gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp) : base_type(h, e, cp) { base_type::copy_from_range(first, last); } @@ -420,7 +352,7 @@ namespace __gnu_pbds // object of the container object, and r_probe_fn will be copied // by the probe_fn object of the container object. template - gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, + gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp, const probe_fn& p) : base_type(h, e, cp, p) { base_type::copy_from_range(first, last); } @@ -436,8 +368,8 @@ namespace __gnu_pbds // r_resize_policy will be copied by the resize_policy object of // the container object. template - gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, - const comb_probe_fn& cp, const probe_fn& p, + gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, + const comb_probe_fn& cp, const probe_fn& p, const resize_policy& rp) : base_type(h, e, cp, p, rp) { base_type::copy_from_range(first, last); } @@ -449,7 +381,7 @@ namespace __gnu_pbds virtual ~gp_hash_table() { } - gp_hash_table& + gp_hash_table& operator=(const gp_hash_table& other) { if (this != &other) @@ -465,56 +397,58 @@ namespace __gnu_pbds { base_type::swap(other); } }; -#undef PB_DS_BASE_C_DEC - +#undef PB_DS_GP_HASH_BASE -#define PB_DS_BASE_C_DEC \ - container_base +#define PB_DS_BRANCH_BASE \ + detail::container_base_dispatch::type /// An abstract basic tree-like (tree, trie) associative container. - template - class basic_tree : public PB_DS_BASE_C_DEC + template + class basic_branch : public PB_DS_BRANCH_BASE { private: - typedef PB_DS_BASE_C_DEC base_type; + typedef typename PB_DS_BRANCH_BASE base_type; public: - typedef Node_Update node_update; + typedef Node_Update node_update; virtual - ~basic_tree() { } + ~basic_branch() { } protected: -#define PB_DS_CLASS_NAME basic_tree +#define PB_DS_CLASS_NAME basic_branch #include #undef PB_DS_CLASS_NAME }; -#undef PB_DS_BASE_C_DEC +#undef PB_DS_BRANCH_BASE -#define PB_DS_TREE_NODE_AND_IT_TRAITS_C_DEC \ - detail::tree_traits +#define PB_DS_TREE_NODE_AND_IT_TRAITS \ + detail::tree_traits -#define PB_DS_BASE_C_DEC \ - basic_tree::type, Allocator> +#define PB_DS_TREE_BASE \ + basic_branch::type, _Alloc> - /// A concrete basic tree-based associative container. + /// A basic tree-based associative container. template, typename Tag = rb_tree_tag, - template - class Node_Update = __gnu_pbds::null_tree_node_update, - typename Allocator = std::allocator > - class tree : public PB_DS_BASE_C_DEC + template + class Node_Update = null_node_update, + typename _Alloc = std::allocator > + class tree : public PB_DS_TREE_BASE { private: - typedef PB_DS_BASE_C_DEC base_type; + typedef PB_DS_TREE_BASE base_type; public: // Comparison functor type. - typedef Cmp_Fn cmp_fn; + typedef Cmp_Fn cmp_fn; tree() { } @@ -545,7 +479,7 @@ namespace __gnu_pbds virtual ~tree() { } - tree& + tree& operator=(const tree& other) { if (this != &other) @@ -561,43 +495,46 @@ namespace __gnu_pbds { base_type::swap(other); } }; -#undef PB_DS_BASE_C_DEC -#undef PB_DS_TREE_NODE_AND_IT_TRAITS_C_DEC +#undef PB_DS_TREE_BASE +#undef PB_DS_TREE_NODE_AND_IT_TRAITS -#define PB_DS_TRIE_NODE_AND_ITS_TRAITS \ - detail::trie_traits +#define PB_DS_TRIE_NODE_AND_IT_TRAITS \ + detail::trie_traits -#define PB_DS_BASE_C_DEC \ - basic_tree::type, Allocator> +#define PB_DS_TRIE_BASE \ + basic_branch::type, _Alloc> - /// A concrete basic trie-based associative container. + /// A basic trie-based associative container. template::type, + typename _ATraits = \ + typename detail::default_trie_access_traits::type, typename Tag = pat_trie_tag, - template - class Node_Update = null_trie_node_update, - typename Allocator = std::allocator > - class trie : public PB_DS_BASE_C_DEC + template + class Node_Update = null_node_update, + typename _Alloc = std::allocator > + class trie : public PB_DS_TRIE_BASE { private: - typedef PB_DS_BASE_C_DEC base_type; + typedef PB_DS_TRIE_BASE base_type; public: // Element access traits type. - typedef E_Access_Traits e_access_traits; + typedef _ATraits access_traits; trie() { } - // Constructor taking some policy objects. r_e_access_traits will - // be copied by the E_Access_Traits object of the container + // Constructor taking some policy objects. r_access_traits will + // be copied by the _ATraits object of the container // object. - trie(const e_access_traits& t) + trie(const access_traits& t) : base_type(t) { } // Constructor taking __iterators to a range of value_types. The @@ -611,7 +548,7 @@ namespace __gnu_pbds // some policy objects. The value_types between first_it and // last_it will be inserted into the container object. template - trie(It first, It last, const e_access_traits& t) + trie(It first, It last, const access_traits& t) : base_type(t) { base_type::copy_from_range(first, last); } @@ -621,7 +558,7 @@ namespace __gnu_pbds virtual ~trie() { } - trie& + trie& operator=(const trie& other) { if (this != &other) @@ -637,29 +574,29 @@ namespace __gnu_pbds { base_type::swap(other); } }; -#undef PB_DS_BASE_C_DEC -#undef PB_DS_TRIE_NODE_AND_ITS_TRAITS +#undef PB_DS_TRIE_BASE +#undef PB_DS_TRIE_NODE_AND_IT_TRAITS -#define PB_DS_BASE_C_DEC \ - container_base::type, Allocator> +#define PB_DS_LU_BASE \ + detail::container_base_dispatch::type>::type /// A list-update based associative container. template::type, class Update_Policy = detail::default_update_policy::type, - class Allocator = std::allocator > - class list_update : public PB_DS_BASE_C_DEC + class _Alloc = std::allocator > + class list_update : public PB_DS_LU_BASE { private: - typedef PB_DS_BASE_C_DEC base_type; + typedef typename PB_DS_LU_BASE base_type; public: - typedef Eq_Fn eq_fn; - typedef Update_Policy update_policy; - typedef Allocator allocator; + typedef list_update_tag container_category; + typedef Eq_Fn eq_fn; + typedef Update_Policy update_policy; list_update() { } @@ -676,7 +613,7 @@ namespace __gnu_pbds virtual ~list_update() { } - list_update& + list_update& operator=(const list_update& other) { if (this !=& other) @@ -692,9 +629,9 @@ namespace __gnu_pbds { base_type::swap(other); } }; -#undef PB_DS_BASE_C_DEC +#undef PB_DS_LU_BASE // @} group pbds } // namespace __gnu_pbds -#endif +#endif 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 aac1397..0000000 --- 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 -// . - -// 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 -#include -#include -#include - -namespace __gnu_pbds -{ - namespace detail - { - template - struct value_type_base; - - /** - * Specialization of value_type_base for the case where the hash value - * is not stored alongside each value. - **/ - template - struct value_type_base - { - typedef typename Allocator::template rebind::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 >::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 - struct value_type_base - { - typedef typename Allocator::template rebind::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 >::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 - -#define PB_DS_CLASS_C_DEC \ - value_type_base - - /** - * Specialization of value_type_base for the case where the hash value - * is not stored alongside each value. - **/ - template - struct value_type_base - { - typedef typename Allocator::template rebind::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::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 - -#define PB_DS_CLASS_C_DEC \ - value_type_base - - /** - * Specialization of value_type_base for the case where the hash value - * is stored alongside each value. - **/ - template - struct value_type_base - { - typedef typename Allocator::template rebind::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::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 - struct no_throw_copies - { - typedef integral_constant::value && is_simple::value> indicator; - }; - - template - struct no_throw_copies - { - typedef integral_constant::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 a73414a..a875e30 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 +#include #include #include -#include -#include #include #include #include +#ifdef _GLIBCXX_DEBUG +#include +#endif #include #include #include @@ -58,201 +56,129 @@ namespace __gnu_pbds { namespace detail { - -#define PB_DS_CLASS_T_DEC \ - template - #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, \ - typename Allocator::template rebind::other::const_reference> -#endif +#define PB_DS_CLASS_T_DEC \ + template -#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 -#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 + +#ifdef _GLIBCXX_DEBUG +#define PB_DS_DEBUG_MAP_BASE_C_DEC \ + debug_map_base, \ + typename _Alloc::template rebind::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 - class PB_DS_CLASS_NAME : +#define PB_DS_TREE_TRACE_BASE_C_DEC \ + tree_trace_base +#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 + 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::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 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 - 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 + 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 - 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 - 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 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 370574c..0000000 --- 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 -// . - -// 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::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 612eceb..0000000 --- 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 -// . - -// 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 d7b5985..2815b42 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 86d5c2e87..1f77e31 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 60a5490..1d1b170 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 6b50dc8..03b7fe8 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 b3e4611..54cd52e 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 eb0f76d..5a9a03e 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(static_cast(&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 e5f6a4d..8076084 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 b4ea453..d64bdf7 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 _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(p_nd)) + bin_search_tree_const_node_it_(const node_pointer p_nd = 0) + : m_p_nd(const_cast(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 - 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(p_nd)) + bin_search_tree_node_it_(const node_pointer p_nd = 0) + : PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(const_cast(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 959df68..d999248 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 _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 - 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 63f307d..5b71c40 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 bcf3ce6..cfcccad 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 c2090a1..63c757c 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(0))); + node_const_iterator(static_cast(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 00fbdf4..be2fd34 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 58c30c3..3066c38 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 _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 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 _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 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_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 4d65d2b..ee408e8 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 #include #include @@ -53,7 +49,7 @@ #include #include #include -#include +#include #include #ifdef PB_DS_BINARY_HEAP_TRACE_ #include @@ -66,126 +62,85 @@ namespace __gnu_pbds namespace detail { #define PB_DS_CLASS_T_DEC \ - template + template #define PB_DS_CLASS_C_DEC \ - binary_heap_ + binary_heap #define PB_DS_ENTRY_CMP_DEC \ - entry_cmp::value, Allocator>::type + entry_cmp::value>::type #define PB_DS_RESIZE_POLICY_DEC \ - __gnu_pbds::detail::resize_policy + __gnu_pbds::detail::resize_policy /** - * class description = "Base class for some types of h3ap$"> - **/ - template - 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 + 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 cond_dealtor_t; private: enum { - simple_value = is_simple::value + simple_value = is_simple::value }; - typedef integral_constant 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 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 __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::__type + entry; - typedef Value_Type value_type; + typedef typename _Alloc::template rebind::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_ + 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_ + 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 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 - 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 - 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 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(*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(*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(*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(*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 #include #include @@ -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 aa86f5e..a6ac261 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 +#include #include namespace __gnu_pbds { namespace detail { +#define PB_DS_BIN_HEAP_CIT_BASE \ + binary_heap_point_const_iterator_ -#define PB_DS_CLASS_C_DEC \ - binary_heap_const_iterator_ - -#define PB_DS_BASE_C_DEC \ - binary_heap_const_point_iterator_ - - // Const point-type iterator. + /// Const point-type iterator. template - 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_/const_point_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp deleted file mode 100644 index 3d75e86..0000000 --- a/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp +++ /dev/null @@ -1,144 +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 -// . - -// 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_point_iterator.hpp - * Contains an iterator class returned by the table's const find and insert - * methods. - */ - -#ifndef PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP -#define PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP - -#include -#include - -namespace __gnu_pbds -{ - namespace detail - { - // Const point-type iterator. - template - class binary_heap_const_point_iterator_ - { - protected: - typedef typename Allocator::template rebind::other::pointer entry_pointer; - - public: - // Category. - typedef trivial_iterator_tag iterator_category; - - // Difference type. - typedef trivial_iterator_difference_type difference_type; - - // Iterator's value type. - typedef Value_Type value_type; - - // Iterator's pointer type. - typedef typename Allocator::template rebind::other::pointer - pointer; - - // Iterator's const pointer type. - typedef - typename Allocator::template rebind::other::const_pointer - const_pointer; - - // Iterator's reference type. - typedef - typename Allocator::template rebind::other::reference - reference; - - // Iterator's const reference type. - typedef - typename Allocator::template rebind::other::const_reference - const_reference; - - inline - binary_heap_const_point_iterator_(entry_pointer p_e) : m_p_e(p_e) - { } - - // Default constructor. - inline - binary_heap_const_point_iterator_() : m_p_e(0) { } - - // Copy constructor. - inline - binary_heap_const_point_iterator_(const binary_heap_const_point_iterator_& other) - : m_p_e(other.m_p_e) - { } - - // Access. - inline const_pointer - operator->() const - { - _GLIBCXX_DEBUG_ASSERT(m_p_e != 0); - return to_ptr(integral_constant()); - } - - // Access. - inline const_reference - operator*() const - { - _GLIBCXX_DEBUG_ASSERT(m_p_e != 0); - return *to_ptr(integral_constant()); - } - - // Compares content to a different iterator object. - inline bool - operator==(const binary_heap_const_point_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 - { return m_p_e != other.m_p_e; } - - private: - inline const_pointer - to_ptr(true_type) const - { return m_p_e; } - - inline const_pointer - to_ptr(false_type) const - { return *m_p_e; } - - public: - entry_pointer m_p_e; - }; - } // namespace detail -} // namespace __gnu_pbds - -#endif 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 bdaa7ff..9602385 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(*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 a2c6f30..b1b0f5b 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 b0a9b5b..42e799f 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 + struct entry_cmp; - template - struct entry_cmp - { - typedef Cmp_Fn type; - }; - - template - 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 + struct entry_cmp<_VTp, Cmp_Fn, _Alloc, true> { - public: - inline - type() - { } + /// Compare. + typedef Cmp_Fn type; + }; + + /// Specialization, false. + template + 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 185529e..001876e 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 + struct entry_pred; - template - struct entry_pred - { - typedef Pred type; - }; - - template - 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 + struct entry_pred<_VTp, Pred, _Alloc, true> { - public: - inline - type() - { } + typedef Pred type; + }; + + /// Specialization, false. + template + 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 2b6c9b7..f204d81 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(*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::type + typedef typename entry_pred::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(*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 116e9bc..c445dc0 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 d292793..ae36d31 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 c6c41e5..1e1ed96 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(*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 db0a64e..daaf2e4 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_/point_const_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp new file mode 100644 index 0000000..8736260 --- /dev/null +++ b/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp @@ -0,0 +1,144 @@ +// -*- 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 +// . + +// 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 binary_heap_/point_const_iterator.hpp + * Contains an iterator class returned by the table's const find and insert + * methods. + */ + +#ifndef PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP +#define PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP + +#include +#include + +namespace __gnu_pbds +{ + namespace detail + { + // Const point-type iterator. + template + class binary_heap_point_const_iterator_ + { + protected: + typedef typename _Alloc::template rebind::other::pointer entry_pointer; + + public: + // Category. + typedef trivial_iterator_tag iterator_category; + + // Difference type. + typedef trivial_iterator_difference_type difference_type; + + // Iterator's value type. + typedef Value_Type value_type; + + // Iterator's pointer type. + typedef typename _Alloc::template rebind::other::pointer + pointer; + + // Iterator's const pointer type. + typedef + typename _Alloc::template rebind::other::const_pointer + const_pointer; + + // Iterator's reference type. + typedef + typename _Alloc::template rebind::other::reference + reference; + + // Iterator's const reference type. + typedef + typename _Alloc::template rebind::other::const_reference + const_reference; + + inline + binary_heap_point_const_iterator_(entry_pointer p_e) : m_p_e(p_e) + { } + + // Default constructor. + inline + binary_heap_point_const_iterator_() : m_p_e(0) { } + + // Copy constructor. + inline + binary_heap_point_const_iterator_(const binary_heap_point_const_iterator_& other) + : m_p_e(other.m_p_e) + { } + + // Access. + inline const_pointer + operator->() const + { + _GLIBCXX_DEBUG_ASSERT(m_p_e != 0); + return to_ptr(integral_constant()); + } + + // Access. + inline const_reference + operator*() const + { + _GLIBCXX_DEBUG_ASSERT(m_p_e != 0); + return *to_ptr(integral_constant()); + } + + // Compares content to a different iterator object. + inline bool + 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_point_const_iterator_& other) const + { return m_p_e != other.m_p_e; } + + private: + inline const_pointer + to_ptr(true_type) const + { return m_p_e; } + + inline const_pointer + to_ptr(false_type) const + { return *m_p_e; } + + public: + entry_pointer m_p_e; + }; + } // namespace detail +} // namespace __gnu_pbds + +#endif 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 11a7b89..f378222 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 c589387..e3d74bf 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 - -#define PB_DS_CLASS_C_DEC resize_policy - - template + /// Resize policy for binary heap. + template 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 + const _Tp resize_policy<_Tp>::min_size; - PB_DS_CLASS_T_DEC + template 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 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 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 + 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 + 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(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 + 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 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 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(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 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 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 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 675b4ec..0d09b53 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::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(*this)); - std::make_heap(other.m_a_entries, other.m_a_entries + other.m_size, static_cast(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(*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 36bd66f..2704ec6 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 a6d6098..d8704f6 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 + template #define PB_DS_CLASS_C_DEC \ - binomial_heap_ - -#define PB_DS_BASE_C_DEC \ - binomial_heap_base_ + binomial_heap - /** - * class description = "8y|\|0|\/|i41 h34p 74813"> - **/ - template - class binomial_heap_ : public PB_DS_BASE_C_DEC + /// Binomial heap. + template + class binomial_heap + : public binomial_heap_base { 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 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 #include #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 ebe1f2e..ee8d89c 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 80c0b04..12949ae 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 b2add18..9d260d0 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 #include #include -#include namespace __gnu_pbds { namespace detail { - #define PB_DS_CLASS_T_DEC \ - template + template #define PB_DS_CLASS_C_DEC \ - binomial_heap_base_ + binomial_heap_base #ifdef _GLIBCXX_DEBUG -#define PB_DS_BASE_C_DEC \ - left_child_next_sibling_heap_ -#else -#define PB_DS_BASE_C_DEC \ - left_child_next_sibling_heap_ -#endif - - /** - * class description = "8y|\|0|\/|i41 h34p 74813"> - **/ - template - class binomial_heap_base_ : public PB_DS_BASE_C_DEC - { +#define PB_DS_B_HEAP_BASE \ + left_child_next_sibling_heap +#else +#define PB_DS_B_HEAP_BASE \ + left_child_next_sibling_heap +#endif + /// Base class for binomial heap. + template + class binomial_heap_base + : public PB_DS_B_HEAP_BASE + { private: - typedef PB_DS_BASE_C_DEC base_type; + typedef typename _Alloc::template rebind::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 size_type - erase_if(Pred pred); + erase_if(Pred); template 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 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 fa86c230..ef9d0e3 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 6f2aa2a..137ec4b 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 e7a2dc4..2cdc456 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 f832cb6..8059917 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 11bd5e1..30f49db 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 6564c54..44bc4ed 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 0000000..efe39f2 --- /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 +// . + +// 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 + +namespace __gnu_pbds +{ + /// A null node updator, indicating that no node updates are required. + template + struct null_node_update : public null_type + { }; + + namespace detail + { + /// Primary template, base class for branch structure policies. + template + struct branch_policy + { + protected: + typedef typename Node_Itr::value_type it_type; + typedef typename std::iterator_traits::value_type value_type; + typedef typename value_type::first_type key_type; + + typedef typename remove_const::type rcvalue_type; + typedef typename remove_const::type rckey_type; + + typedef typename _Alloc::template rebind::other rebind_v; + typedef typename _Alloc::template rebind::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(this)->end(); } + + virtual + ~branch_policy() { } + }; + + /// Specialization for const iterators. + template + struct branch_policy + { + protected: + typedef typename Node_CItr::value_type it_type; + typedef typename std::iterator_traits::value_type value_type; + typedef typename remove_const::type rcvalue_type; + typedef typename _Alloc::template rebind::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/branch_policy/null_node_metadata.hpp b/libstdc++-v3/include/ext/pb_ds/detail/branch_policy/null_node_metadata.hpp new file mode 100644 index 0000000..caa8dd7 --- /dev/null +++ b/libstdc++-v3/include/ext/pb_ds/detail/branch_policy/null_node_metadata.hpp @@ -0,0 +1,66 @@ +// -*- 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 +// . + +// 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/null_node_metadata.hpp + * Contains an implementation class for tree-like classes. + */ + +#ifndef PB_DS_0_NODE_METADATA_HPP +#define PB_DS_0_NODE_METADATA_HPP + +#include + +namespace __gnu_pbds +{ + namespace detail + { + /// Constant node iterator. + template + struct dumnode_const_iterator + { + private: + typedef types_traits __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 diff --git a/libstdc++-v3/include/ext/pb_ds/detail/branch_policy/traits.hpp b/libstdc++-v3/include/ext/pb_ds/detail/branch_policy/traits.hpp new file mode 100644 index 0000000..92f9f44 --- /dev/null +++ b/libstdc++-v3/include/ext/pb_ds/detail/branch_policy/traits.hpp @@ -0,0 +1,95 @@ +// -*- 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 +// . + +// 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/traits.hpp + * Contains an implementation class for tree-like classes. + */ + +#ifndef PB_DS_NODE_AND_IT_TRAITS_HPP +#define PB_DS_NODE_AND_IT_TRAITS_HPP + +#include +#include +#include +#include + +#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 + { + /// Tree traits class, primary template. + template + class Node_Update, + typename Tag, + typename _Alloc> + struct tree_traits; + + /// Trie traits class, primary template. + template + class Node_Update, + typename Tag, + typename _Alloc> + struct trie_traits; + + } // namespace detail +} // namespace __gnu_pbds + +#include +#include +#include +#include + +#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 149a206..f1c2540 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 #ifdef _GLIBCXX_DEBUG #include -#endif +#endif #ifdef PB_DS_HT_MAP_TRACE_ #include -#endif +#endif #include 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 -#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 #define PB_DS_HASH_EQ_FN_C_DEC \ - hash_eq_fn + hash_eq_fn #define PB_DS_RANGED_HASH_FN_C_DEC \ - ranged_hash_fn + ranged_hash_fn -#define PB_DS_TYPES_TRAITS_C_DEC \ - types_traits +#define PB_DS_CC_HASH_TRAITS_BASE \ + types_traits #ifdef _GLIBCXX_DEBUG #define PB_DS_DEBUG_MAP_BASE_C_DEC \ - debug_map_base::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::other::const_reference> #endif - // <011i$i0|\|-<|-|4i|\|i|\|g |-|4$|-| 74813. + /// Collision chaining hash. template - 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::other::pointer m_p_next; + typename _Alloc::template rebind::other::pointer m_p_next; }; - typedef cond_dealtor cond_dealtor_t; + typedef cond_dealtor cond_dealtor_t; - typedef typename Allocator::template rebind::other entry_allocator; + typedef typename _Alloc::template rebind::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::other entry_pointer_allocator; + typedef typename _Alloc::template rebind::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 +#define PB_DS_GEN_POS std::pair -#include +#include #include #include #include @@ -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 @@ -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 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 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& 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& 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& 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::value + store_hash_ok = !Store_Hash + || !is_same::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 c61eff9..4f7116f 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(*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 fa3f31d..5b2db9b 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 -#define PB_DS_CLASS_C_DEC PB_DS_CKDED_CLASS_NAME - - /** - * A conditional key destructor, used for exception handling. - **/ + /// Conditional dey destructor, cc_hash. template - 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 inline - PB_DS_CLASS_C_DEC:: - ~PB_DS_CKDED_CLASS_NAME() + cond_dealtor:: + ~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 8278fd7..9d37d9f 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 4f1cce6..1f68349 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 a2b6fa1..f6a73af 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 d10ff78..c5af1d3 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 4a02bbf..1c19cac 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 07f2998..76ad8c6 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 0799911..7440403 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 c6febe4..c9c4b1c 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 ffe3210..1e2661e 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 09d34f2..a4cddea 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 32ca47d..e3f363f 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(*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 1db51c9..d532c4f 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 2b42996..99eea41 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(*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 0679dbe..dc7d44c 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 acbd8a7..ba89873 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 1224880..f455397 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 a7592b7..5be4a9c 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 9a661b3..5bf12c8 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 4e3f48d..66145b8 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 6577630..f438508 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 c1adb61..1901b80 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 0d5ec85..ff11890 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 b9c1ee2..3c07f95 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 497977d..ede1d6a 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 1ee48a2..eb87bea 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 - -#define PB_DS_COND_DEALTOR_CLASS_C_DEC \ - cond_dealtor< \ - Entry, \ - Allocator> - - template - class cond_dealtor - { - public: - typedef - typename Allocator::template rebind::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 + class cond_dealtor + { + typedef typename _Alloc::template rebind __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 cond_dealtor::entry_allocator + cond_dealtor::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 20c9988..a960b7d 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 2964b2d..37217d9 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 -#undef PB_DS_DATA_TRUE_INDICATOR - -#define PB_DS_DATA_FALSE_INDICATOR -#include -#undef PB_DS_DATA_FALSE_INDICATOR - -#define PB_DS_DATA_TRUE_INDICATOR +#include #include -#undef PB_DS_DATA_TRUE_INDICATOR - -#define PB_DS_DATA_FALSE_INDICATOR -#include -#undef PB_DS_DATA_FALSE_INDICATOR - -#define PB_DS_DATA_TRUE_INDICATOR -#include -#undef PB_DS_DATA_TRUE_INDICATOR - -#define PB_DS_DATA_FALSE_INDICATOR #include -#undef PB_DS_DATA_FALSE_INDICATOR - -#define PB_DS_DATA_TRUE_INDICATOR -#include -#undef PB_DS_DATA_TRUE_INDICATOR - -#define PB_DS_DATA_FALSE_INDICATOR #include -#undef PB_DS_DATA_FALSE_INDICATOR - -#define PB_DS_DATA_TRUE_INDICATOR -#include -#undef PB_DS_DATA_TRUE_INDICATOR - -#define PB_DS_DATA_FALSE_INDICATOR #include -#undef PB_DS_DATA_FALSE_INDICATOR - -#define PB_DS_DATA_TRUE_INDICATOR -#include -#undef PB_DS_DATA_TRUE_INDICATOR - -#define PB_DS_DATA_FALSE_INDICATOR #include -#undef PB_DS_DATA_FALSE_INDICATOR - -#define PB_DS_DATA_TRUE_INDICATOR #include #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 +#include +#include +#include +#include +#include +#include #include #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 - struct container_base_dispatch; - - template - struct container_base_dispatch + /// Specialization for list-update map. + template + struct container_base_dispatch { private: typedef __gnu_cxx::typelist::at_index at0; typedef typename at0::type at0t; typedef __gnu_cxx::typelist::at_index at1; typedef typename at1::type at1t; - + public: - typedef lu_map_data_ type; + /// Dispatched type. + typedef lu_map type; }; - template - struct container_base_dispatch + /// Specialization for list-update set. + template + struct container_base_dispatch { private: typedef __gnu_cxx::typelist::at_index at0; @@ -154,34 +130,39 @@ namespace detail typedef typename at1::type at1t; public: - typedef lu_map_no_data_ type; + /// Dispatched type. + typedef lu_set type; }; - template - struct container_base_dispatch + /// Specialization for PATRICIA trie map. + template + struct container_base_dispatch { private: typedef __gnu_cxx::typelist::at_index at1; typedef typename at1::type at1t; public: - typedef pat_trie_data_ type; + typedef pat_trie_map type; }; - template - struct container_base_dispatch + /// Specialization for PATRICIA trie set. + template + struct container_base_dispatch { private: typedef __gnu_cxx::typelist::at_index at1; typedef typename at1::type at1t; public: - typedef pat_trie_no_data_ type; + /// Dispatched type. + typedef pat_trie_set type; }; - template - struct container_base_dispatch + /// Specialization for R-B tree map. + template + struct container_base_dispatch { private: typedef __gnu_cxx::typelist::at_index at0; @@ -190,12 +171,14 @@ namespace detail typedef typename at1::type at1t; public: - typedef rb_tree_data_ type; + /// Dispatched type. + typedef rb_tree_map type; }; - template - struct container_base_dispatch + /// Specialization for R-B tree set. + template + struct container_base_dispatch { private: typedef __gnu_cxx::typelist::at_index at0; @@ -204,12 +187,13 @@ namespace detail typedef typename at1::type at1t; public: - typedef rb_tree_no_data_ type; + typedef rb_tree_set type; }; - template - struct container_base_dispatch + /// Specialization splay tree map. + template + struct container_base_dispatch { private: typedef __gnu_cxx::typelist::at_index at0; @@ -218,12 +202,14 @@ namespace detail typedef typename at1::type at1t; public: - typedef splay_tree_data_ type; + /// Dispatched type. + typedef splay_tree_map type; }; - template - struct container_base_dispatch + /// Specialization splay tree set. + template + struct container_base_dispatch { private: typedef __gnu_cxx::typelist::at_index at0; @@ -232,11 +218,13 @@ namespace detail typedef typename at1::type at1t; public: - typedef splay_tree_no_data_ type; + /// Dispatched type. + typedef splay_tree_set type; }; - template - struct container_base_dispatch + /// Specialization ordered-vector tree map. + template + struct container_base_dispatch { private: typedef __gnu_cxx::typelist::at_index at0; @@ -245,12 +233,14 @@ namespace detail typedef typename at1::type at1t; public: - typedef ov_tree_data_ type; + /// Dispatched type. + typedef ov_tree_map type; }; - template - struct container_base_dispatch + /// Specialization ordered-vector tree set. + template + struct container_base_dispatch { private: typedef __gnu_cxx::typelist::at_index at0; @@ -259,11 +249,13 @@ namespace detail typedef typename at1::type at1t; public: - typedef ov_tree_no_data_ type; + /// Dispatched type. + typedef ov_tree_set type; }; - template - struct container_base_dispatch + /// Specialization colision-chaining hash map. + template + struct container_base_dispatch { private: typedef __gnu_cxx::typelist::at_index at0; @@ -278,13 +270,15 @@ namespace detail typedef typename at4::type at4t; public: - typedef cc_ht_map_data_ type; + /// Dispatched type. + typedef cc_ht_map type; }; - template - struct container_base_dispatch + /// Specialization colision-chaining hash set. + template + struct container_base_dispatch { private: typedef __gnu_cxx::typelist::at_index at0; @@ -299,12 +293,14 @@ namespace detail typedef typename at4::type at4t; public: - typedef cc_ht_map_no_data_ type; }; - template - struct container_base_dispatch + /// Specialization general-probe hash map. + template + struct container_base_dispatch { private: typedef __gnu_cxx::typelist::at_index at0; @@ -321,13 +317,15 @@ namespace detail typedef typename at5::type at5t; public: - typedef gp_ht_map_data_ type; + /// Dispatched type. + typedef gp_ht_map type; }; - template - struct container_base_dispatch + /// Specialization general-probe hash set. + template + struct container_base_dispatch { private: typedef __gnu_cxx::typelist::at_index at0; @@ -344,10 +342,11 @@ namespace detail typedef typename at5::type at5t; public: - typedef gp_ht_map_no_data_ type; + /// Dispatched type. + typedef gp_ht_set 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 a9a0b42..c1709ba 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 + template #define PB_DS_CLASS_C_DEC \ debug_map_base - template + /// Debug base class. + template class debug_map_base { private: - typedef typename std::allocator key_allocator; - typedef typename key_allocator::size_type size_type; - typedef Const_Key_Reference const_key_reference; - typedef std::_GLIBCXX_STD_C::list 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_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_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 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 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 ec95bca..389bdcd 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 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 b21c252..6255d55 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 - struct hash_eq_fn; + template + struct hash_eq_fn; -#define PB_DS_CLASS_T_DEC \ - template - -#define PB_DS_CLASS_C_DEC \ - hash_eq_fn - - /** - * Specialization 1- The client requests that hash values not be stored. - **/ - template - struct hash_eq_fn : public Eq_Fn + /// Specialization 1 - The client requests that hash values not be stored. + template + struct hash_eq_fn : public Eq_Fn { - typedef Eq_Fn eq_fn_base; - - typedef typename Allocator::template rebind::other key_allocator; - - typedef typename key_allocator::const_reference const_key_reference; + typedef Eq_Fn eq_fn_base; + typedef typename _Alloc::template rebind::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 - -#define PB_DS_CLASS_C_DEC \ - hash_eq_fn - - /** - * Specialization 2- The client requests that hash values be stored. - **/ - template - struct hash_eq_fn : - public Eq_Fn - { - typedef typename Allocator::size_type size_type; - - typedef Eq_Fn eq_fn_base; - typedef typename Allocator::template rebind::other key_allocator; + /// Specialization 2 - The client requests that hash values be stored. + template + struct hash_eq_fn : public Eq_Fn + { + typedef typename _Alloc::size_type size_type; + typedef Eq_Fn eq_fn_base; + typedef typename _Alloc::template rebind::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 90f1709..8a51541 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 ec80698..d077cbf 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 5f30487..ff83c20 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 eca853a..cad9a73 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 ba8f54e..ff9bdae 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 2c2833e..488b6b9 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 e57d5cc..0e6227b 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 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 67e64e9..d95b9a7 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 02dc63e..9ccad4f 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 d8b32fe..e6e9c5f 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(*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 298604c..2af9781 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 a44b832..80c7788 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 a9179d5..4ce94ae 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 @@ -47,7 +47,7 @@ #include #ifdef PB_DS_HT_MAP_TRACE_ #include -#endif +#endif #ifdef _GLIBCXX_DEBUG #include #endif @@ -57,73 +57,66 @@ namespace __gnu_pbds { namespace detail { -#define PB_DS_CLASS_T_DEC \ - template - #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 #define PB_DS_CLASS_C_DEC \ - PB_DS_CLASS_NAME + PB_DS_GP_HASH_NAME #define PB_DS_HASH_EQ_FN_C_DEC \ - hash_eq_fn + hash_eq_fn #define PB_DS_RANGED_PROBE_FN_C_DEC \ - ranged_probe_fn + ranged_probe_fn -#define PB_DS_TYPES_TRAITS_C_DEC \ - types_traits +#define PB_DS_GP_HASH_TRAITS_BASE \ + types_traits #ifdef _GLIBCXX_DEBUG #define PB_DS_DEBUG_MAP_BASE_C_DEC \ - debug_map_base::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::other::const_reference> #endif + + /// General probing hash. template - 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::other entry_allocator; + typedef typename _Alloc::template rebind::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 +#include #include #include #include @@ -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 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 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 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 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::value + store_hash_ok = !Store_Hash + || !is_same::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 423a928..8fa762b 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 101ce8c..0373177 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 95c9054..03b2c9b 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 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 a27d9d2..856306a 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 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 ff1f80f..695b03e 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 b1a3f7a..22afeb7 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 70381f1..76b6174 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 1d2839e..8819238 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 765e962..c291747 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 dac0639..74aeba4 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 c3fe13c..0e6a7da 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 970cfc1..19855ac1 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 + template 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 2489927..8567851 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 #include #include @@ -50,33 +49,33 @@ namespace __gnu_pbds { namespace detail { - template class ranged_hash_fn; #define PB_DS_CLASS_T_DEC \ - template #define PB_DS_CLASS_C_DEC \ - ranged_hash_fn + ranged_hash_fn /** * Specialization 1 * The client supplies a hash function and a ranged hash function, * and requests that hash values not be stored. **/ - template - 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 #define PB_DS_CLASS_C_DEC \ - ranged_hash_fn + ranged_hash_fn /** * Specialization 2 * The client supplies a hash function and a ranged hash function, * and requests that hash values be stored. **/ - template - class ranged_hash_fn + class ranged_hash_fn : 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 comp_hash; typedef Hash_Fn hash_fn_base; typedef Comb_Hash_Fn comb_hash_fn_base; - typedef typename Allocator::template rebind::other key_allocator; - typedef typename key_allocator::const_reference const_key_reference; + typedef typename _Alloc::template rebind::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 + template #define PB_DS_CLASS_C_DEC \ - ranged_hash_fn + ranged_hash_fn /** * 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 - class ranged_hash_fn - : public null_hash_fn, public Comb_Hash_Fn + template + class ranged_hash_fn + : 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 + template #define PB_DS_CLASS_C_DEC \ - ranged_hash_fn + ranged_hash_fn /** * 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 - class ranged_hash_fn - : public null_hash_fn, public Comb_Hash_Fn + template + class ranged_hash_fn + : 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 ddfba9d..b13de65 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 #include #include @@ -50,35 +49,35 @@ namespace __gnu_pbds { namespace detail { - template class ranged_probe_fn; #define PB_DS_CLASS_T_DEC \ - template #define PB_DS_CLASS_C_DEC \ - ranged_probe_fn + ranged_probe_fn /** * Specialization 1 * The client supplies a probe function and a ranged probe * function, and requests that hash values not be stored. **/ - template - class ranged_probe_fn : 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::other key_allocator; - typedef typename key_allocator::const_reference const_key_reference; + typedef typename _Alloc::template rebind::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 #define PB_DS_CLASS_C_DEC \ - ranged_probe_fn + ranged_probe_fn /** * Specialization 2- The client supplies a probe function and a ranged * probe function, and requests that hash values not be stored. **/ - template - class ranged_probe_fn : 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 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::other key_allocator; - typedef typename key_allocator::const_reference const_key_reference; + typedef typename _Alloc::template rebind::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 - class ranged_probe_fn - : public Comb_Probe_Fn, public null_hash_fn, public null_probe_fn + template + class ranged_probe_fn + : 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::other key_allocator; - typedef typename key_allocator::const_reference const_key_reference; + typedef typename _Alloc::template rebind::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 7dcd825..3ca9001 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 988f111..3092376 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 8fa04d1..cc9aaab 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 2bcfdf5..b362f3d 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 2448f3c..e51abe1 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 +#include #include namespace __gnu_pbds { namespace detail { +#define PB_DS_CLASS_C_DEC \ + left_child_next_sibling_heap_const_iterator_ -#define PB_DS_CLASS_C_DEC \ - left_child_next_sibling_heap_const_iterator_ +#define PB_DS_BASIC_HEAP_CIT_BASE \ + left_child_next_sibling_heap_node_point_const_iterator_ -#define PB_DS_BASE_C_DEC \ - left_child_next_sibling_heap_node_const_point_iterator_ - - // Const point-type iterator. - template - class left_child_next_sibling_heap_const_iterator_ : public PB_DS_BASE_C_DEC + /// Const point-type iterator. + template + 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_/const_point_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp deleted file mode 100644 index 712a76fb..0000000 --- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp +++ /dev/null @@ -1,154 +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 -// . - -// 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_point_iterator.hpp - * Contains an iterator class returned by the table's const find and insert - * methods. - */ - -#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP -#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP - -#include -#include - -namespace __gnu_pbds -{ - namespace detail - { - -#define PB_DS_CLASS_T_DEC \ - template - -#define PB_DS_CLASS_C_DEC \ - left_child_next_sibling_heap_node_const_point_iterator_ - - // Const point-type iterator. - template - class left_child_next_sibling_heap_node_const_point_iterator_ - { - - protected: - typedef typename Allocator::template rebind::other::pointer node_pointer; - - public: - - // Category. - typedef trivial_iterator_tag iterator_category; - - // Difference type. - typedef trivial_iterator_difference_type difference_type; - - // Iterator's value type. - typedef typename Node::value_type value_type; - - // Iterator's pointer type. - typedef - typename Allocator::template rebind< - value_type>::other::pointer - pointer; - - // Iterator's const pointer type. - typedef - typename Allocator::template rebind< - value_type>::other::const_pointer - const_pointer; - - // Iterator's reference type. - typedef - typename Allocator::template rebind< - value_type>::other::reference - reference; - - // Iterator's const reference type. - typedef - typename Allocator::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) - { } - - // Default constructor. - inline - left_child_next_sibling_heap_node_const_point_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) - { } - - // Access. - inline const_pointer - operator->() const - { - _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0); - return &m_p_nd->m_value; - } - - // Access. - inline const_reference - operator*() const - { - _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0); - return m_p_nd->m_value; - } - - // Compares content to a different iterator object. - inline bool - operator==(const PB_DS_CLASS_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_CLASS_C_DEC& other) const - { return m_p_nd != other.m_p_nd; } - - public: - node_pointer m_p_nd; - }; - -#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/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 5bec709..5cec97b 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 77c23c1..500fac1 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 056cc38..c7d5602 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 75e6561..3535a03 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 9ffc912..e5031c8 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 ec09cf6..40b0a17 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 d311546..b6f3b51 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 #include #include -#include +#include #include #ifdef PB_DS_LC_NS_HEAP_TRACE_ #include -#endif +#endif #include 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 + +#define PB_DS_CLASS_C_DEC \ + left_child_next_sibling_heap +#else +#define PB_DS_CLASS_T_DEC \ + template + +#define PB_DS_CLASS_C_DEC \ + left_child_next_sibling_heap +#endif + + /// Base class for a basic heap. template -#else - template -#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_ >::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 }; - typedef integral_constant no_throw_copies_t; + typedef integral_constant no_throw_copies_t; + typedef typename _Alloc::template rebind __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_ + 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_ 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 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 static void - trace_node_metadata(const_node_pointer p_nd, type_to_type); + trace_node_metadata(node_const_pointer, type_to_type); static void - trace_node_metadata(const_node_pointer, type_to_type); -#endif + trace_node_metadata(node_const_pointer, + type_to_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 @@ -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 1cdfe28..d74b86c 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 - namespace __gnu_pbds { namespace detail { - - template + /// Node. + template 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::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 - struct left_child_next_sibling_heap_node_< - Value_Type, - null_left_child_next_sibling_heap_node_metadata, - Allocator> + template + 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::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_/null_metadata.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp deleted file mode 100644 index 5f04e14..0000000 --- a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2005, 2006, 2008, 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 -// . - -// 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_metadata.hpp - * Contains an implementation struct for this type of heap's node. - */ - -#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_0_METADATA_HPP -#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_0_METADATA_HPP - -namespace __gnu_pbds -{ - namespace detail - { - - struct null_left_child_next_sibling_heap_node_metadata - { }; - - } // namespace detail -} // namespace __gnu_pbds - -#endif // #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_0_METADATA_HPP diff --git a/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp new file mode 100644 index 0000000..5b29254 --- /dev/null +++ b/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp @@ -0,0 +1,154 @@ +// -*- 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 +// . + +// 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 left_child_next_sibling_heap_/point_const_iterator.hpp + * Contains an iterator class returned by the table's const find and insert + * methods. + */ + +#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP +#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP + +#include +#include + +namespace __gnu_pbds +{ + namespace detail + { + +#define PB_DS_CLASS_T_DEC \ + template + +#define PB_DS_CLASS_C_DEC \ + left_child_next_sibling_heap_node_point_const_iterator_ + + /// Const point-type iterator. + template + class left_child_next_sibling_heap_node_point_const_iterator_ + { + + protected: + typedef typename _Alloc::template rebind::other::pointer node_pointer; + + public: + + // Category. + typedef trivial_iterator_tag iterator_category; + + // Difference type. + typedef trivial_iterator_difference_type difference_type; + + // Iterator's value type. + typedef typename Node::value_type value_type; + + // Iterator's pointer type. + typedef + typename _Alloc::template rebind< + value_type>::other::pointer + pointer; + + // Iterator's const pointer type. + typedef + typename _Alloc::template rebind< + value_type>::other::const_pointer + const_pointer; + + // Iterator's reference type. + typedef + typename _Alloc::template rebind< + value_type>::other::reference + reference; + + // Iterator's const reference type. + typedef + typename _Alloc::template rebind< + value_type>::other::const_reference + const_reference; + + public: + + inline + 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_point_const_iterator_() : m_p_nd(0) + { } + + // Copy constructor. + inline + left_child_next_sibling_heap_node_point_const_iterator_(const PB_DS_CLASS_C_DEC& other) : m_p_nd(other.m_p_nd) + { } + + // Access. + inline const_pointer + operator->() const + { + _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0); + return &m_p_nd->m_value; + } + + // Access. + inline const_reference + operator*() const + { + _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0); + return m_p_nd->m_value; + } + + // Compares content to a different iterator object. + inline bool + operator==(const PB_DS_CLASS_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_CLASS_C_DEC& other) const + { return m_p_nd != other.m_p_nd; } + + public: + node_pointer m_p_nd; + }; + +#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/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 350b4d0..b2d0d85 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 d421002..28ee13e 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()); - 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 void PB_DS_CLASS_C_DEC:: -trace_node_metadata(const_node_pointer p_nd, type_to_type) +trace_node_metadata(node_const_pointer p_nd, type_to_type) { std::cerr << "(" << p_nd->m_metadata << ") "; } @@ -89,7 +84,7 @@ trace_node_metadata(const_node_pointer p_nd, type_to_type) PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -trace_node_metadata(const_node_pointer, type_to_type) +trace_node_metadata(node_const_pointer, type_to_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 17ddaaf..8ec39a6 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 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 9839180..510c905 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 021ef50..f1e440a 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 + struct lu_map_entry_metadata_base { }; } // 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 dd60ea6..bbd7b83 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 9164b92..0d5f98a 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) PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: -apply_update(entry_pointer, type_to_type) -{ return s_update_policy(s_null_lu_metadata); } +apply_update(entry_pointer, type_to_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 31f743c..294d73a 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 2677683..9c250df 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) PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: -init_entry_metadata(entry_pointer, type_to_type) +init_entry_metadata(entry_pointer, type_to_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 ac31638..2a1aa6c 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 329f2fa..9e48f17 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 #ifdef _GLIBCXX_DEBUG #include -#endif +#endif #ifdef PB_DS_LU_MAP_TRACE_ #include -#endif +#endif #include namespace __gnu_pbds { namespace detail { -#define PB_DS_CLASS_T_DEC \ - template - #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 #define PB_DS_CLASS_C_DEC \ - PB_DS_CLASS_NAME + PB_DS_LU_NAME -#define PB_DS_TYPES_TRAITS_C_DEC \ - types_traits +#define PB_DS_LU_TRAITS_BASE \ + types_traits #ifdef _GLIBCXX_DEBUG #define PB_DS_DEBUG_MAP_BASE_C_DEC \ debug_map_base::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::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 - 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 traits_base::value_type m_value; - typename Allocator::template rebind::other::pointer m_p_next; + typename _Alloc::template rebind::other::pointer m_p_next; }; - typedef typename Allocator::template rebind::other entry_allocator; + typedef typename _Alloc::template rebind::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::other entry_pointer_allocator; + typedef typename _Alloc::template rebind::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 +#include #include #include #include @@ -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 cond_dealtor_t; + typedef cond_dealtor 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 - 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 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 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); inline static void - init_entry_metadata(entry_pointer, type_to_type); + init_entry_metadata(entry_pointer, type_to_type); void deallocate_all(); @@ -323,18 +311,18 @@ namespace __gnu_pbds apply_update(entry_pointer, type_to_type); inline static bool - apply_update(entry_pointer, type_to_type); + apply_update(entry_pointer, type_to_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 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 s_metadata_type_indicator; + static null_type s_null_type; - mutable entry_pointer m_p_l; + mutable entry_pointer m_p_l; }; #include @@ -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 0096109..1ee219a 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_metadata.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp deleted file mode 100644 index 8e476cb..0000000 --- a/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp +++ /dev/null @@ -1,86 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2005, 2006, 2007, 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 -// . - -// 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_metadata.hpp - * Contains implementation of a lu counter policy's metadata. - */ - -namespace __gnu_pbds -{ - namespace detail - { - template - class counter_lu_policy_base; - - // A list-update metadata type that moves elements to the front of - // the list based on the counter algorithm. - template - class counter_lu_metadata - { - public: - typedef Size_Type size_type; - - private: - counter_lu_metadata(size_type init_count) : m_count(init_count) - { } - - friend class counter_lu_policy_base; - - mutable size_type m_count; - }; - - template - class counter_lu_policy_base - { - protected: - typedef Size_Type size_type; - - counter_lu_metadata - operator()(size_type max_size) const - { return counter_lu_metadata(std::rand() % max_size); } - - template - 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/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 f74a9fb..0000000 --- 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 -// . - -// 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 -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/lu_counter_metadata.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp new file mode 100644 index 0000000..74ab813 --- /dev/null +++ b/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp @@ -0,0 +1,88 @@ +// -*- 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 +// . + +// 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 lu_counter_metadata.hpp + * Contains implementation of a lu counter policy's metadata. + */ + +namespace __gnu_pbds +{ + namespace detail + { + template + class lu_counter_policy_base; + + /// A list-update metadata type that moves elements to the front of + /// the list based on the counter algorithm. + template + class lu_counter_metadata + { + public: + typedef Size_Type size_type; + + private: + lu_counter_metadata(size_type init_count) : m_count(init_count) + { } + + friend class lu_counter_policy_base; + + mutable size_type m_count; + }; + + /// Base class for list-update counter policy. + template + class lu_counter_policy_base + { + protected: + typedef Size_Type size_type; + + lu_counter_metadata + operator()(size_type max_size) const + { return lu_counter_metadata(std::rand() % max_size); } + + template + 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 34426c5..0000000 --- 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 -// . - -// 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 c5da1e9..13ee6e1 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 e2c4b9a..0000000 --- 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 -// . - -// 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 -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 1c3b9dd..494ded2 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::other> map_type; -#else - typedef - std::set< - key_type, - Cmp_Fn, - typename Allocator::template rebind< - Key>::other> +#else + typedef std::set::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 cd(a_values, target_it, len); while (source_it != source_end_it) { - new (const_cast(static_cast(target_it))) - value_type(*source_it++); - + void* __v = const_cast(static_cast(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 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(*this), + static_cast(other)); + std::swap(static_cast(*this), + static_cast(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 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 1ba96d8e..8c27a465 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 a9bfab6..31eb7c7 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(static_cast(target_it))) + { + new (const_cast(static_cast(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(static_cast(target_it))) + new (const_cast(static_cast(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 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 7eeb85b..6beee71 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 51d1b4d..e96628b 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 40f1100..af86686 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(mid_pointer(begin(), end())), + return node_const_iterator(const_cast(mid_pointer(begin(), end())), const_cast(begin()), const_cast(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 3517896..79c9504 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_ + ov_tree_node_const_it_ - // Const node reference. - template + /// Const node reference. + template 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::value + has_metadata = !is_same::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_ + ov_tree_node_it_ - // Node reference. - template + /// Node reference. + template 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 0643659..20a4350 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 #include +#include #include #include #include -#include #include -#include #include +#ifdef _GLIBCXX_DEBUG +#include +#endif #include #include #include @@ -58,159 +60,171 @@ namespace __gnu_pbds { namespace detail { -#define PB_DS_CLASS_T_DEC \ - template - #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 #define PB_DS_CLASS_C_DEC \ - PB_DS_OV_TREE_CLASS_NAME + PB_DS_OV_TREE_NAME -#define PB_DS_TYPES_TRAITS_C_DEC \ - types_traits +#define PB_DS_OV_TREE_TRAITS_BASE \ + types_traits #ifdef _GLIBCXX_DEBUG #define PB_DS_DEBUG_MAP_BASE_C_DEC \ debug_map_base, \ - typename Allocator::template rebind::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::other::const_reference> +#endif #ifdef PB_DS_TREE_TRACE #define PB_DS_TREE_TRACE_BASE_C_DEC \ - tree_trace_base + Cmp_Fn, false, _Alloc> #endif #ifndef PB_DS_CHECK_KEY_EXISTS # error Missing definition #endif - // Ordered-vector tree associative-container. - template - class PB_DS_OV_TREE_CLASS_NAME : + /// Ordered-vector tree associative-container. + template + 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::type non_const_value_type; - typedef typename Allocator::template rebind::other value_allocator; - typedef typename value_allocator::pointer value_vector; - - - typedef Cmp_Fn cmp_fn_base; + typedef typename _Alloc::template rebind::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::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::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 + 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 + 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 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(*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(*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(*this).find(r_key)); } + inline point_const_iterator + find(key_const_reference r_key) const + { return (const_cast(*this).find(r_key)); } bool - erase(const_key_reference); + erase(key_const_reference); template 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 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 cd(a_values, target_it, m_size + 1); while (source_it != it) { - new (const_cast(static_cast(target_it))) + new (const_cast(static_cast(target_it))) value_type(*source_it++); ++target_it; } - new (const_cast(static_cast(ret_it = target_it))) + new (const_cast(static_cast(ret_it = target_it))) value_type(r_value); ++target_it; while (source_it != source_end_it) { - new (const_cast(static_cast(target_it))) + new (const_cast(static_cast(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 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 @@ -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 c06d6f8..eafe0b0 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 567a52e..a12c232 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 63cb0f7..359e599 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 _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 _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 6a70ea4..0b836c5 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 7212db2..802c95e 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 be3a41c..d6303c3 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 c02373b..49b2ca6 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 07e6b00..ced5eeb 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 3bdb82f..85e098a 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 #include #include -#include #include namespace __gnu_pbds { namespace detail { - #define PB_DS_CLASS_T_DEC \ - template + template #define PB_DS_CLASS_C_DEC \ - pairing_heap_ + pairing_heap #ifdef _GLIBCXX_DEBUG -#define PB_DS_BASE_C_DEC \ - left_child_next_sibling_heap_ -#else -#define PB_DS_BASE_C_DEC \ - left_child_next_sibling_heap_ -#endif - - /** - * class description = "P4ri|\|g h3ap$"> - **/ - template - class pairing_heap_ : public PB_DS_BASE_C_DEC - { +#define PB_DS_P_HEAP_BASE \ + left_child_next_sibling_heap +#else +#define PB_DS_P_HEAP_BASE \ + left_child_next_sibling_heap +#endif + /// Pairing heap. + template + 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::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 size_type - erase_if(Pred pred); + erase_if(Pred); template 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 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 #include @@ -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 e5469b9..a74ed63 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 b7cdf23..0000000 --- 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 -// . - -// 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 184b986..0000000 --- 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 -// . - -// 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 730148e..0000000 --- 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 -// . - -// 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 6201b1d..8370a2e 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(p_other_nd); - + leaf_const_pointer p_other_lf = static_cast(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(p_other_nd); + inode_const_pointer p_icp = static_cast(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 1beceb5..0aa4b28c 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(this)->find_imp(PB_DS_V2F(*it)); + node_const_pointer p_nd = + const_cast(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(p_nd)->begin(); - it != static_cast(p_nd)->end(); + for (typename inode::const_iterator it = static_cast(p_nd)->begin(); + it != static_cast(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 cbf1b41..c0ccd10 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(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(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(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(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(p_parent); + _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == i_node); + p_nd = static_cast(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(p_nd->m_p_parent); + p_nd = static_cast(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(p_nd)->begin(); - it != static_cast(p_nd)->end(); + _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node); + for (typename inode::iterator it = + static_cast(p_nd)->begin(); + it != static_cast(p_nd)->end(); ++it) - { + { node_pointer p_child =* it; clear_imp(p_child); - } - s_internal_node_allocator.deallocate(static_cast(p_nd), 1); + } + s_inode_allocator.deallocate(static_cast(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(p_nd)->~leaf(); s_leaf_allocator.deallocate(static_cast(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(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(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(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(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(p_l->m_p_parent); + inode_pointer p_parent = static_cast(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(m_p_head->m_p_min)) + if (p_l == static_cast(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(m_p_head->m_p_max)) + if (p_l == static_cast(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 e2e20f1..bbef9d7 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(p_nd)->value()), r_key)) + if (synth_access_traits::equal_keys(PB_DS_V2F(static_cast(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(this)->find_imp(r_key); + node_const_pointer p_nd = const_cast(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(p_nd)->value()), r_key)) + if (synth_access_traits::equal_keys(PB_DS_V2F(static_cast(p_nd)->value()), r_key)) { PB_DS_CHECK_KEY_EXISTS(r_key) return const_iterator(const_cast(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(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(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(p_nd)->value()), r_key)) + if (!synth_access_traits::cmp_keys(PB_DS_V2F(static_cast(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(p_nd)->get_e_ind(); + static_cast(p_nd)->get_e_ind(); p_nd = - static_cast(p_nd)->get_lower_bound_child_node( b_it, e_it, checked_ind, this); + static_cast(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(this)->lower_bound_imp(r_key)); + return point_const_iterator(const_cast(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(p_nd)->value()))); + if (p_nd->m_type == leaf_node) + return (synth_access_traits::begin(PB_DS_V2F(static_cast(p_nd)->value()))); - _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type); - return static_cast(p_nd)->pref_b_it(); + _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node); + return static_cast(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(p_nd)->value()))); + if (p_nd->m_type == leaf_node) + return (synth_access_traits::end(PB_DS_V2F(static_cast(p_nd)->value()))); - _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type); - return static_cast(p_nd)->pref_e_it(); + _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node); + return static_cast(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(p_nd); - return static_cast(p_nd)->leftmost_descendant(); + if (p_nd->m_type == leaf_node) + return static_cast(p_nd); + return static_cast(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(p_nd); - return static_cast(p_nd)->leftmost_descendant(); + return static_cast(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(p_nd); - return static_cast(p_nd)->rightmost_descendant(); + if (p_nd->m_type == leaf_node) + return static_cast(p_nd); + return static_cast(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(p_nd); - return static_cast(p_nd)->rightmost_descendant(); + return static_cast(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 bca847d..0000000 --- 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 -// . - -// 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 -#include - -namespace __gnu_pbds -{ - namespace detail - { -#define PB_DS_CLASS_T_DEC \ - template - -#define PB_DS_CLASS_C_DEC \ - pat_trie_head - -#define PB_DS_BASE_C_DEC \ - pat_trie_node_base - - template - 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 81d7096..8246b51 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 9afce8b..1b11280 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(m_p_head->m_p_max)->value()), - PB_DS_V2F(static_cast(other.m_p_head->m_p_min)->value())); + synth_access_traits::cmp_keys(PB_DS_V2F(static_cast(m_p_head->m_p_max)->value()), + PB_DS_V2F(static_cast(other.m_p_head->m_p_min)->value())); const bool lesser = - synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast(other.m_p_head->m_p_max)->value()), - PB_DS_V2F(static_cast(m_p_head->m_p_min)->value())); + synth_access_traits::cmp_keys(PB_DS_V2F(static_cast(other.m_p_head->m_p_max)->value()), + PB_DS_V2F(static_cast(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(p_l), - static_cast(p_r), r_bag); + if (p_r->m_type == leaf_node) + { + rec_join_prep(static_cast(p_l), + static_cast(p_r), r_bag); return; - } + } - _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type); - rec_join_prep(static_cast(p_l), - static_cast(p_r), r_bag); + _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node); + rec_join_prep(static_cast(p_l), + static_cast(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(p_l), - static_cast(p_r), r_bag); + rec_join_prep(static_cast(p_l), + static_cast(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(p_l), - static_cast(p_r), r_bag); + rec_join_prep(static_cast(p_l), + static_cast(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(p_l), static_cast(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(p_l), - static_cast(p_r), + static_cast(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(p_l), + node_pointer p_ret = rec_join(static_cast(p_l), static_cast(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(p_l), - static_cast(p_r), + _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node); + node_pointer p_ret = rec_join(static_cast(p_l), + static_cast(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(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(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(m_p_head->m_p_min)->value()))) + synth_access_traits::cmp_keys(PB_DS_V2F(p_new_lf->value()), + PB_DS_V2F(static_cast(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(m_p_head->m_p_max)->value()), PB_DS_V2F(p_new_lf->value()))) + synth_access_traits::cmp_keys(PB_DS_V2F(static_cast(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 cb8b674..0000000 --- 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 -// . - -// 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 - -namespace __gnu_pbds -{ - namespace detail - { -#define PB_DS_CLASS_T_DEC \ - template - -#define PB_DS_CLASS_C_DEC \ - pat_trie_internal_node - -#define PB_DS_BASE_C_DEC \ - pat_trie_node_base - -#define PB_DS_LEAF_C_DEC \ - pat_trie_leaf - - template - 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::other access_rebind; - typedef typename access_rebind::const_pointer const_e_access_traits_pointer; - - typedef typename Allocator::template rebind::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::other leaf_rebind; - typedef typename leaf_rebind::pointer leaf_pointer; - typedef typename leaf_rebind::const_pointer const_leaf_pointer; - - typedef typename Allocator::template rebind::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::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 -#include - - 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::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(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(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(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(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(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(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(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(p_nd); - return const_cast(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(p_nd)->value()); - - b_it = p_traits->begin(r_key); - e_it = p_traits->end(r_key); - } - else - { - b_it = static_cast(p_nd)->pref_b_it(); - e_it = static_cast(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(p_pot)); - _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == pat_trie_internal_node_type); - return static_cast(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(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(p_pot); - _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == pat_trie_internal_node_type); - return static_cast(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(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(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(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(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 85199f8..d53f1b2 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 de8057a..0000000 --- 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 -// . - -// 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 - -namespace __gnu_pbds -{ - namespace detail - { - -#define PB_DS_CLASS_T_DEC \ - template - -#define PB_DS_CLASS_C_DEC \ - pat_trie_leaf - -#define PB_DS_BASE_C_DEC \ - pat_trie_node_base - -#define PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC \ - pat_trie_subtree_debug_info - - template - 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 6e131e4..0000000 --- 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 -// . - -// 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 - -namespace __gnu_pbds -{ - namespace detail - { -#define PB_DS_CLASS_T_DEC \ - template - -#define PB_DS_CLASS_C_DEC \ - pat_trie_node_base - -#define PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC \ - pat_trie_subtree_debug_info - - enum pat_trie_node_type - { - pat_trie_internal_node_type, - pat_trie_leaf_node_type, - pat_trie_head_node_type - }; - - template - 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 c574628..0000000 --- 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 -// . - -// 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 - -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 - 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(m_p_nd)->value()))); - - _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type); - - return (static_cast(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(m_p_nd)->value()))); - - _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type); - - return (static_cast(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(p_nd)), m_p_traits(p_traits) - { } - - // Subtree valid prefix. - inline std::pair - 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(m_p_nd)->begin(), static_cast(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(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 - 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(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_/node_metadata_base.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp deleted file mode 100644 index 36272ed..0000000 --- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp +++ /dev/null @@ -1,86 +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 -// . - -// 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_metadata_base.hpp - * Contains an internal PB_DS_BASE_C_DEC for a patricia tree. - */ - -#ifndef PB_DS_PAT_TRIE_NODE_METADATA_BASE_HPP -#define PB_DS_PAT_TRIE_NODE_METADATA_BASE_HPP - -#include - -namespace __gnu_pbds -{ - namespace detail - { - - template - 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 - struct pat_trie_node_metadata_base< - null_node_metadata, - Allocator> - { - public: - typedef null_node_metadata metadata_type; - }; - - } // namespace detail -} // namespace __gnu_pbds - -#endif // #ifndef PB_DS_PAT_TRIE_NODE_BASE_HPP - 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 5313c0b..46bb016 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 -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef _GLIBCXX_DEBUG #include -#endif +#endif #include namespace __gnu_pbds { namespace detail { -#define PB_DS_CLASS_T_DEC \ - template - #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 #define PB_DS_CLASS_C_DEC \ - PB_DS_CLASS_NAME + PB_DS_PAT_TRIE_NAME -#define PB_DS_TYPES_TRAITS_C_DEC \ - types_traits +#define PB_DS_PAT_TRIE_TRAITS_BASE \ + types_traits #ifdef _GLIBCXX_DEBUG #define PB_DS_DEBUG_MAP_BASE_C_DEC \ - debug_map_base >, typename Allocator::template rebind::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 >, \ + typename _Alloc::template rebind::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 - 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 + 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 __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 __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 __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 __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::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::other::const_pointer const_node_pointer; + void + set_call_destructor() + { m_call_destructor = true; } - typedef typename Allocator::template rebind::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::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::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::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 + /// 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 +#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 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 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 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 static void - trace_node_metadata(const_node_pointer, type_to_type); + trace_node_metadata(node_const_pointer, type_to_type); static void - trace_node_metadata(const_node_pointer, type_to_type); -#endif + trace_node_metadata(node_const_pointer, type_to_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 @@ -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 0000000..b3718b5 --- /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 +// . + +// 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 + +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 + struct _Metadata + { + typedef Metadata metadata_type; + typedef _Alloc allocator_type; + typedef typename _Alloc::template rebind __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 + struct _Metadata + { + typedef null_type metadata_type; + typedef _Alloc allocator_type; + }; + + + /// Node base. + template + 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 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 + 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 + 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 + 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 __rebind_n; + typedef typename __rebind_n::other::const_pointer node_const_pointer; + + typedef _Leaf<_ATraits, Metadata> leaf; + typedef typename _Alloc::template rebind::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::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 + +#define PB_DS_CONST_ODIR_IT_C_DEC \ + _CIter + +#define PB_DS_IT_C_DEC \ + _Iter + +#define PB_DS_ODIR_IT_C_DEC \ + _Iter + + + /// Const iterator. + template + 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 __rebind_n; + typedef typename __rebind_n::other::pointer node_pointer; + typedef typename _Alloc::template rebind __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 __rebind_h; + typedef typename __rebind_h::other::pointer head_pointer; + + typedef typename _Alloc::template rebind __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(m_p_nd)->value(); + } + + const_reference + operator*() const + { + _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == leaf_node); + return static_cast(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()); + return *this; + } + + _CIter + operator++(int) + { + _CIter ret_it(m_p_nd); + operator++(); + return ret_it; + } + + _CIter& + operator--() + { + dec(integral_constant()); + 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(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(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(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(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(p_nd); + return static_cast(p_nd)->leftmost_descendant(); + } + + static leaf_pointer + rightmost_descendant(node_pointer p_nd) + { + if (p_nd->m_type == leaf_node) + return static_cast(p_nd); + return static_cast(p_nd)->rightmost_descendant(); + } + }; + + + /// Iterator. + template + class _Iter + : public _CIter + { + public: + typedef _CIter + 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(base_type::m_p_nd)->value(); + } + + reference + operator*() const + { + _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == leaf_node); + return static_cast(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 + +#define PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC \ + _Node_iter + + /// Node const iterator. + template + class _Node_citer + { + protected: + typedef typename _Alloc::template rebind __rebind_n; + typedef typename __rebind_n::other::pointer node_pointer; + + typedef typename _Alloc::template rebind __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 __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(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(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(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(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 __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(p_nd)), m_p_traits(p_traits) + { } + + // Subtree valid prefix. + std::pair + 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(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(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 + class _Node_iter + : public _Node_citer + { + private: + typedef _Node_citer base_type; + typedef typename _Alloc::template rebind __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(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 + +#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::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(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(p_first); + m_pref_b_it = p_traits->begin(access_traits::extract_key(p->value())); + } + else + { + inode_pointer p = static_cast(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(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(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(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(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(p_nd); + return const_cast(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(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(p_nd)->pref_b_it(); + e_it = static_cast(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(p_pot)); + _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == i_node); + return static_cast(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(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(p_pot); + _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == i_node); + return static_cast(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(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(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(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(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 a3e1506..0000000 --- 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 -// . - -// 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 - -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 - 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(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(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()); - 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()); - 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(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(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(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(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(p_nd); - return static_cast(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(p_nd); - return static_cast(p_nd)->rightmost_descendant(); - } - - public: - node_pointer m_p_nd; - }; - - // Iterator. - template - 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(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(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 79bfe42..0afc2d4 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 7b2ebd5..6a5582d 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 c7fcdb7..683b3a9 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 06add93..c2aa9cd 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(m_p_head->m_p_min)->value()))) + if (synth_access_traits::cmp_keys(r_key, + PB_DS_V2F(static_cast(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(m_p_head->m_p_max)->value()))) + if (!synth_access_traits::cmp_keys(r_key, + PB_DS_V2F(static_cast(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(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(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(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 9cecae5..0000000 --- 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 -// . - -// 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_access_traits.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp new file mode 100644 index 0000000..7cce3c5 --- /dev/null +++ b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp @@ -0,0 +1,218 @@ +// -*- 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 +// . + +// 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_/synth_access_traits.hpp + * Contains an implementation class for a patricia tree. + */ + +#ifndef PB_DS_SYNTH_E_ACCESS_TRAITS_HPP +#define PB_DS_SYNTH_E_ACCESS_TRAITS_HPP + +#include + +namespace __gnu_pbds +{ + namespace detail + { + +#define PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC \ + template + +#define PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC \ + synth_access_traits + + /// Synthetic element access traits. + template + 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; + + synth_access_traits(); + + synth_access_traits(const base_type&); + + inline bool + equal_prefixes(const_iterator, const_iterator, const_iterator, + const_iterator, bool compare_after = true) const; + + bool + equal_keys(key_const_reference, key_const_reference) const; + + bool + cmp_prefixes(const_iterator, const_iterator, const_iterator, + const_iterator, bool compare_after = false) const; + + bool + cmp_keys(key_const_reference, key_const_reference) const; + + inline static key_const_reference + extract_key(const_reference); + +#ifdef _GLIBCXX_DEBUG + bool + operator()(key_const_reference, key_const_reference); +#endif + + private: + inline static key_const_reference + extract_key(const_reference, true_type); + + inline static key_const_reference + extract_key(const_reference, false_type); + + static integral_constant s_set_ind; + }; + + PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC + integral_constant + PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::s_set_ind; + + PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC + PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: + synth_access_traits() + { } + + PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC + PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: + 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(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; + if (base_type::e_pos(*b_l) != base_type::e_pos(*b_r)) + return false; + ++b_l; + ++b_r; + } + return (!compare_after || b_r == e_r); + } + + PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC + bool + PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: + 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); + } + + PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC + bool + PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: + 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); + if (l_pos != r_pos) + return l_pos < r_pos; + ++b_l; + ++b_r; + } + + if (!compare_after) + 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(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); + } + + PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC + 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); } + + PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC + 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; } + + PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC + 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; } + +#ifdef _GLIBCXX_DEBUG + PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC + bool + PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: + 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 + + } // namespace detail +} // namespace __gnu_pbds + +#endif 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_e_access_traits.hpp deleted file mode 100644 index abf5f11..0000000 --- a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp +++ /dev/null @@ -1,229 +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 -// . - -// 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 synth_e_access_traits.hpp - * Contains an implementation class for a patricia tree. - */ - -#ifndef PB_DS_SYNTH_E_ACCESS_TRAITS_HPP -#define PB_DS_SYNTH_E_ACCESS_TRAITS_HPP - -#include - -namespace __gnu_pbds -{ - namespace detail - { - -#define PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC \ - template - -#define PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC \ - synth_e_access_traits< \ - Type_Traits, \ - Set, \ - E_Access_Traits> - - template - struct synth_e_access_traits : public E_Access_Traits - { - - 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_e_access_traits(const E_Access_Traits& r_traits); - - 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; - - bool - equal_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) 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; - - bool - cmp_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const; - - inline static const_key_reference - extract_key(const_reference r_val); - -#ifdef _GLIBCXX_DEBUG - bool - operator()(const_key_reference r_lhs, const_key_reference r_rhs); -#endif - - private: - inline static const_key_reference - extract_key(const_reference r_val, true_type); - - inline static const_key_reference - extract_key(const_reference r_val, false_type); - - private: - static integral_constant s_set_ind; - }; - - PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC - integral_constant - PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::s_set_ind; - - PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC - PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: - synth_e_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) - { } - - 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 - { - while (b_l != e_l) - { - if (b_r == e_r) - return (false); - if (base_type::e_pos(*b_l) != base_type::e_pos(*b_r)) - return (false); - ++b_l; - ++b_r; - } - return (!compare_after || b_r == e_r); - } - - 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 - { - 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 - { - 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); - if (l_pos != r_pos) - return (l_pos < r_pos); - ++b_l; - ++b_r; - } - - if (!compare_after) - 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 - { - 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 - PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: - extract_key(const_reference r_val) - { - 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 - PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: - extract_key(const_reference r_val, true_type) - { - return (r_val); - } - - PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC - inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::const_key_reference - PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC:: - extract_key(const_reference r_val, false_type) - { - 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 - -#undef PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC -#undef PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC - - } // namespace detail -} // namespace __gnu_pbds - -#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 39cf28a..c8b5454 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 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(p_nd); + inode_const_pointer p_internal = static_cast(p_nd); std::cerr << " " << static_cast(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 void PB_DS_CLASS_C_DEC:: -trace_node_metadata(const_node_pointer p_nd, type_to_type) +trace_node_metadata(node_const_pointer p_nd, type_to_type) { std::cerr << "(" << static_cast(p_nd->get_metadata()) << ") "; } @@ -106,7 +104,7 @@ trace_node_metadata(const_node_pointer p_nd, type_to_type) PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -trace_node_metadata(const_node_pointer, type_to_type) +trace_node_metadata(node_const_pointer, type_to_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 c8e7f58..2e64c52 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 -#include -#include -#include -#include -#include -#include +#include +#include namespace __gnu_pbds { namespace detail { - + /// Specialization. template - class Node_Update, - class Allocator> - struct trie_traits< - Key, - Mapped, - E_Access_Traits, - Node_Update, - pat_trie_tag, - Allocator> + typename _ATraits, + template + class Node_Update, + typename _Alloc> + struct trie_traits { private: - typedef types_traits< Key, Mapped, Allocator, false> type_traits; + typedef pat_trie_base base_type; + typedef types_traits 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::type metadata_type; + typedef base_type::_Metadata 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 synth_access_traits; - typedef - pat_trie_head< - type_traits, - synth_e_access_traits, - metadata_type, - Allocator> - head; + typedef base_type::_Node_base node; + typedef base_type::_Head head; + typedef base_type::_Leaf leaf; + typedef base_type::_Inode inode; - typedef - pat_trie_internal_node< - type_traits, - synth_e_access_traits, - metadata_type, - Allocator> - internal_node; + typedef base_type::_Iter iterator; + typedef base_type::_CIter const_iterator; + typedef base_type::_Iter reverse_iterator; + typedef base_type::_CIter 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_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_iterator; - typedef - pat_trie_it_< - type_traits, - node, - leaf, - head, - internal_node, - false, - Allocator> - reverse_iterator; + typedef Node_Update 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* null_node_update_pointer; }; + /// Specialization. template - class Node_Update, - class Allocator> - struct trie_traits< - Key, - null_mapped_type, - E_Access_Traits, - Node_Update, - pat_trie_tag, - Allocator> + typename _ATraits, + template + class Node_Update, + typename _Alloc> + struct trie_traits { private: - typedef - types_traits< - Key, - null_mapped_type, - Allocator, - false> - type_traits; + typedef pat_trie_base base_type; + typedef types_traits 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::type metadata_type; + typedef base_type::_Metadata metadata; + typedef _ATraits access_traits; + typedef __gnu_pbds::detail::synth_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 node; + typedef base_type::_Head head; + typedef base_type::_Leaf leaf; + typedef base_type::_Inode inode; - typedef - pat_trie_node_base< - type_traits, - synth_e_access_traits, - metadata_type, - Allocator> - node; + typedef base_type::_CIter const_iterator; + typedef const_iterator iterator; + typedef base_type::_CIter 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_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_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* 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 8c0304f..12ef07b 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 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 c48ba7c..739d2b1 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 - struct priority_queue_base_dispatch; - - template - struct priority_queue_base_dispatch + namespace detail + { + /// Specialization for pairing_heap. + template + 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 - struct priority_queue_base_dispatch + /// Specialization for binomial_heap. + template + 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 - struct priority_queue_base_dispatch + /// Specialization for rc_binary_heap. + template + 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 - struct priority_queue_base_dispatch + /// Specialization for binary_heap. + template + 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 - struct priority_queue_base_dispatch + /// Specialization for thin_heap. + template + 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 19adc8e..669c00c 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 fe90b0a..40961ed 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 0ef925f..14e7532 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 9378e15..9203dd4 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 0bf6973..0903e21 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 55bd4ed..97dc848 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 3f24c76..b6f80b2 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 +#include namespace __gnu_pbds { namespace detail { - template + /// Node for Red-Black trees. + template 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 - struct rb_tree_node_ + template + struct rb_tree_node_ { 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? " " : " "); } #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 7d46c95..a0e374b 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 -#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 -#endif -#endif #include -#include #include #include #include @@ -69,89 +50,78 @@ namespace __gnu_pbds { #define PB_DS_CLASS_T_DEC \ template - -#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 - -#define PB_DS_BASE_C_DEC \ - PB_DS_BASE_CLASS_NAME + PB_DS_RB_TREE_NAME -#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 -#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 - 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 198caca..54c7b23 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 531d8e4..e6f2d89 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 - class Node_Update, - typename Allocator> - struct tree_traits< - Key, - Mapped, - Cmp_Fn, - Node_Update, - rb_tree_tag, - Allocator> : public bin_search_tree_traits< + template + class Node_Update, + typename _Alloc> + struct tree_traits + : 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::value_type, + typename tree_node_metadata_dispatch::type, + _Alloc>, + _Alloc> { }; + /// Specialization. template - 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 + class Node_Update, + typename _Alloc> + struct tree_traits + : 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::value_type, + typename tree_node_metadata_dispatch::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 35acb8f..5c9c05f 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 638810bf..b7a1b58 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 bf00062..a8c619e5 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 c252b49..aae0a72 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 845e672..ea27c47 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 - -#define PB_DS_CLASS_C_DEC \ - rc - - template + /// Redundant binary counter. + template 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 __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 __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 + 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 + rc<_Node, _Alloc>:: + rc(const rc<_Node, _Alloc>& other) : m_over_top(0) { PB_DS_ASSERT_VALID((*this)) } - PB_DS_CLASS_T_DEC + template 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 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 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 + 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 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 + inline typename rc<_Node, _Alloc>::size_type + rc<_Node, _Alloc>:: size() const { return m_over_top; } - PB_DS_CLASS_T_DEC + template 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 + 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 + 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 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 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 767bf10..e4d6704 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 @@ -53,114 +49,92 @@ namespace __gnu_pbds namespace detail { #define PB_DS_CLASS_T_DEC \ - template + template #define PB_DS_CLASS_C_DEC \ - rc_binomial_heap_ - -#define PB_DS_BASE_C_DEC \ - binomial_heap_base_ + rc_binomial_heap #define PB_DS_RC_C_DEC \ - rc + rc::node, _Alloc> - /** - * class description = "8y|\|0|\/|i41 h34p 74813"> - **/ - template - class rc_binomial_heap_ : public PB_DS_BASE_C_DEC + /// Base class for redundant-counter binomial heap. + template + class rc_binomial_heap + : public binomial_heap_base { - 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 + 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 size_type - erase_if(Pred pred); + erase_if(Pred); template 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 @@ -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 09d637c..13bf78e 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 1fb3b8b..27b5bc4 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 33aecdf..97533a3 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 963c553..ebc28b7 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 9b3ba03..b6c49ae 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 dea307c..2383e96 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 453567a..e6a4694 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 22f8e68..9546321 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 9dfa926..6e1a4ef 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 636b9ab..8996903 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 4e1179e..2f895b5 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 fbf398d..111976d 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 + /// Node for splay tree. + template struct splay_tree_node_ { public: @@ -53,17 +54,17 @@ namespace __gnu_pbds typedef Metadata metadata_type; typedef - typename Allocator::template rebind< - splay_tree_node_ >::other::pointer + typename _Alloc::template rebind< + splay_tree_node_ >::other::pointer node_pointer; typedef - typename Allocator::template rebind::other::reference + typename _Alloc::template rebind::other::reference metadata_reference; typedef - typename Allocator::template rebind::other::const_reference - const_metadata_reference; + typename _Alloc::template rebind::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 - struct splay_tree_node_ + template + struct splay_tree_node_ { 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_ >::other::pointer + typename _Alloc::template rebind< + splay_tree_node_ >::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 b152366..0356845 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 b6afa75..4d67dba 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 -#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 -#endif -#endif - #include #include #include @@ -91,91 +77,75 @@ namespace __gnu_pbds { namespace detail { -#define PB_DS_CLASS_T_DEC \ - template - #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 #define PB_DS_CLASS_C_DEC \ - PB_DS_CLASS_NAME + PB_DS_S_TREE_NAME -#define PB_DS_BASE_C_DEC \ - PB_DS_BASE_CLASS_NAME +#define PB_DS_S_TREE_BASE \ + PB_DS_S_TREE_BASE_NAME -#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 - 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 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 fe4cfa5..1fcfe79 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 cfedc35..e5020ec 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 - 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 + class Node_Update, + typename _Alloc> + struct tree_traits + : public bin_search_tree_traits::value_type, + typename tree_node_metadata_dispatch::type, + _Alloc>, + _Alloc> { }; + /// Specialization. template + typename _Alloc_> class Node_Update, - class Allocator> - struct tree_traits - : public bin_search_tree_traits::value_type, - typename tree_node_metadata_selector< - Key, - null_mapped_type, - Cmp_Fn, - Node_Update, - Allocator>::type, - Allocator>, - Allocator> + typename _Alloc> + struct tree_traits + : public bin_search_tree_traits::value_type, + typename tree_node_metadata_dispatch::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 cfbfbb0..cdb09d4 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 #include #include +#include #include -#include #include #include #include @@ -54,12 +54,14 @@ namespace __gnu_pbds { namespace detail { + /// default_hash_fn template struct default_hash_fn { typedef std::tr1::hash type; }; + /// default_eq_fn template 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 struct default_resize_policy { @@ -95,11 +99,13 @@ namespace __gnu_pbds typedef __gnu_pbds::hash_standard_resize_policy 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 struct default_probe_fn { @@ -116,21 +122,21 @@ namespace __gnu_pbds typedef typename cond_type::__type type; }; + /// default_trie_access_traits template - struct default_trie_e_access_traits; + struct default_trie_access_traits; - template - struct default_trie_e_access_traits > > + template + struct default_trie_access_traits > > { private: typedef std::basic_string > string_type; public: - typedef __gnu_pbds::string_trie_e_access_traits type; + typedef __gnu_pbds::trie_string_access_traits 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 e678051..fe0b983 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 0673675..3eb8541 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 fec0ce4..11b7d77 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 bbae8de..d0ba860 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 f1195bd..67b7f3a 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 96bb818..279cf66 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 9741ef9..fb30eb1 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 #include #include #include -#include #include namespace __gnu_pbds { namespace detail { - #define PB_DS_CLASS_T_DEC \ - template + template #define PB_DS_CLASS_C_DEC \ - thin_heap_ + thin_heap #ifdef _GLIBCXX_DEBUG -#define PB_DS_BASE_C_DEC \ - left_child_next_sibling_heap_ -#else -#define PB_DS_BASE_C_DEC \ - left_child_next_sibling_heap_ -#endif +#define PB_DS_BASE_T_P \ + +#else +#define PB_DS_BASE_T_P \ + +#endif /** - * class description = "t|-|i|\| h34p"> - **/ - template - class thin_heap_ : public PB_DS_BASE_C_DEC + * Thin heap. + * Base class for @ref priority_queue. + * + * See Tarjan and Kaplan. + */ + template + 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::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 size_type - erase_if(Pred pred); + erase_if(Pred); template 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 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 @@ -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 fc309d5..63a3564 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 c182886..1279b4d 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 +#include #include namespace __gnu_pbds { namespace detail { + /// Tree metadata helper. + template + struct tree_metadata_helper; - template - struct tree_metadata_helper - { - typedef typename Node_Update::metadata_type type; - }; + template + struct tree_metadata_helper + { + typedef typename Node_Update::metadata_type type; + }; template - struct tree_metadata_helper< - Node_Update, - true> - { - typedef null_node_metadata type; - }; + struct tree_metadata_helper + { + typedef null_type type; + }; + /// Tree node metadata dispatch. template - class Node_Update, - class Allocator> - struct tree_node_metadata_selector + typename Cmp_Fn, + template + 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 __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 006a3eb..0000000 --- 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 -// . - -// 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 -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 d3b2792..84397f3 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(this)->find_by_order(order)); -} +{ return const_cast(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(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(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(node_it.get_metadata())= - 1 + l_rank + r_rank; + const_cast(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 b8c19a5..cb455da 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 -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 + 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 e4bd656..78cee86 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 -#include +#include +#include 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 #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 - class tree_trace_base : private PB_DS_BASE_C_DEC + tree_trace_base + +#define PB_DS_TRACE_BASE \ + branch_policy + + /// Tracing base class. + template + 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); + print_node_pointer(Node_CItr, integral_constant); static void - print_node_pointer(Const_Node_Iterator nd_it, integral_constant); + print_node_pointer(Node_CItr, integral_constant); template static void - trace_it_metadata(Const_Node_Iterator nd_it, type_to_type); + trace_it_metadata(Node_CItr, type_to_type); static void - trace_it_metadata(Const_Node_Iterator, type_to_type); + trace_it_metadata(Node_CItr, type_to_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()); 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 + 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 void PB_DS_CLASS_C_DEC:: - trace_it_metadata(Const_Node_Iterator nd_it, type_to_type) + trace_it_metadata(Node_CItr nd_it, type_to_type) { - std::cerr << " (" << - static_cast(nd_it.get_metadata()) << ") "; + const unsigned long ul = static_cast(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) + trace_it_metadata(Node_CItr, type_to_type) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: - print_node_pointer(Const_Node_Iterator nd_it, integral_constant) - { - std::cerr << nd_it.m_p_nd << " "; - } + print_node_pointer(Node_CItr nd_it, integral_constant) + { 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) - { - std::cerr <<* nd_it << " "; - } + print_node_pointer(Node_CItr nd_it, integral_constant) + { 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 b4de31f..b20181b 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 +#include #include namespace __gnu_pbds { namespace detail { + /// Trie metadata helper. + template + struct trie_metadata_helper; - template - struct trie_metadata_helper - { - typedef typename Node_Update::metadata_type type; - }; + template + struct trie_metadata_helper + { + typedef typename Node_Update::metadata_type type; + }; template - struct trie_metadata_helper< - Node_Update, - true> - { - typedef null_node_metadata type; - }; + struct trie_metadata_helper + { + typedef null_type type; + }; + /// Trie node metadata dispatch. template - class Node_Update, - class Allocator> - struct trie_node_metadata_selector + typename Cmp_Fn, + template + 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 __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 65245e9..0000000 --- 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 -// . - -// 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 -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 cb8e247..ff9595e 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(this)->find_by_order(order)); -} +{ return const_cast(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(this)->get_e_access_traits(); + const _ATraits& r_traits = + const_cast(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(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(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(nd_it.get_metadata()) =(num_children == 0)? 1 : children_rank; + const size_type res = (num_children == 0) ? 1 : children_rank; + const_cast(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 ff2799e..04771dd 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 non_const_ret = const_cast(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_access_traits.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_access_traits.hpp new file mode 100644 index 0000000..59edfbb --- /dev/null +++ b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_access_traits.hpp @@ -0,0 +1,77 @@ +// -*- 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 +// . + +// 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 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 + +namespace __gnu_pbds +{ + /// 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 __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_e_access_traits.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp deleted file mode 100644 index 2ecad89..0000000 --- a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp +++ /dev/null @@ -1,89 +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 -// . - -// 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 sample_trie_e_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 -{ - -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); - -}; - -#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 8b2c6b5..6c97aee 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 -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 + 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/string_trie_e_access_traits_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp deleted file mode 100644 index 228a4a5..0000000 --- a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp +++ /dev/null @@ -1,99 +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 -// . - -// 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 string_trie_e_access_traits_imp.hpp - * Contains a policy for extracting character positions from - * a string for a vector-based PATRICIA tree - */ - -PB_DS_CLASS_T_DEC -detail::integral_constant PB_DS_CLASS_C_DEC::s_rev_ind; - -PB_DS_CLASS_T_DEC -inline typename PB_DS_CLASS_C_DEC::size_type -PB_DS_CLASS_C_DEC:: -e_pos(e_type e) -{ - return (static_cast(e - min_e_val)); -} - -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) -{ - return (begin_imp(r_key, s_rev_ind)); -} - -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) -{ - return (end_imp(r_key, s_rev_ind)); -} - -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) -{ - return (r_key.begin()); -} - -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) -{ - return (r_key.rbegin()); -} - -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) -{ - return (r_key.end()); -} - -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) -{ - return (r_key.rend()); -} 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 db912a0..2668a87 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 +#include 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 - class trie_policy_base : public PB_DS_BASE_C_DEC + /// Base class for trie policies. + template + class trie_policy_base + : public branch_policy { + typedef branch_policy 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 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 + +#define PB_DS_CLASS_C_DEC \ + trie_policy_base + 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/trie_string_access_traits_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp new file mode 100644 index 0000000..c6d9c49 --- /dev/null +++ b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp @@ -0,0 +1,99 @@ +// -*- 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 +// . + +// 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 trie_policy/trie_string_access_traits_imp.hpp + * Contains a policy for extracting character positions from + * a string for a vector-based PATRICIA tree + */ + +PB_DS_CLASS_T_DEC +detail::integral_constant PB_DS_CLASS_C_DEC::s_rev_ind; + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +e_pos(e_type e) +{ + return (static_cast(e - min_e_val)); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +begin(key_const_reference r_key) +{ + return (begin_imp(r_key, s_rev_ind)); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +end(key_const_reference r_key) +{ + return (end_imp(r_key, s_rev_ind)); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +begin_imp(key_const_reference r_key, detail::false_type) +{ + return (r_key.begin()); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +begin_imp(key_const_reference r_key, detail::true_type) +{ + return (r_key.rbegin()); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +end_imp(key_const_reference r_key, detail::false_type) +{ + return (r_key.end()); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +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 143110c..7989985 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 6d5a078..50db9b2 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 +#include +#include +#include #include #include @@ -49,34 +51,238 @@ namespace __gnu_pbds { namespace detail { - template - struct vt_base_selector - { - typedef value_type_base type; - }; + /// Primary template. + template + struct no_throw_copies + { + static const bool __simple = is_simple::value + && is_simple::value; + typedef integral_constant indicator; + }; + + /// Specialization. + template + struct no_throw_copies + { + typedef integral_constant::value> indicator; + }; + + + //@{ + /** + * Data properties computation. + */ + + /// Stored value. + template + struct stored_value + { + typedef _Tv value_type; + value_type m_value; + }; + + /// Stored hash. + template + 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 + struct stored_data + : public stored_value<_Tv>, public stored_hash<_Th> + { }; + + /// Specialization for representation of stored data of just value type. + template + struct stored_data<_Tv, null_type> + : public stored_value<_Tv> + { }; + + /// Primary template. + template + struct type_base; + + /** + * Specialization of type_base for the case where the hash value + * is not stored alongside each value. + */ + template + struct type_base + { + public: + typedef typename _Alloc::size_type size_type; + + private: + typedef typename _Alloc::template rebind __rebind_m; + typedef typename __rebind_m::other __rebind_ma; + typedef std::pair __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 stored_data_type; + }; + + /** + * Specialization of type_base for the case where the hash value + * is stored alongside each value. + */ + template + struct type_base + { + public: + typedef typename _Alloc::size_type size_type; + + private: + typedef typename _Alloc::template rebind __rebind_m; + typedef typename __rebind_m::other __rebind_ma; + typedef std::pair __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 stored_data_type; + }; + + + /** + * Specialization of type_base for the case where the hash value + * is not stored alongside each value. + */ + template + struct type_base + { + public: + typedef typename _Alloc::size_type size_type; + typedef Key value_type; + + private: + typedef typename _Alloc::template rebind __rebind_m; + typedef typename __rebind_m::other __rebind_ma; + typedef typename _Alloc::template rebind __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 stored_data_type; + + static null_type s_null_type; + }; + + template + null_type + type_base::s_null_type; + + + /** + * Specialization of type_base for the case where the hash value + * is stored alongside each value. + */ + template + struct type_base + { + public: + typedef typename _Alloc::size_type size_type; + typedef Key value_type; + + private: + typedef typename _Alloc::template rebind __rebind_m; + typedef typename __rebind_m::other __rebind_ma; + typedef typename _Alloc::template rebind __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 stored_data_type; + + static null_type s_null_type; + }; + + template + null_type + type_base::s_null_type; + + + /// Type base dispatch. + template + struct type_dispatch + { + typedef type_base type; + }; + + /// Traits for abstract types. + template + struct types_traits + : public type_dispatch::type + { + private: + typedef no_throw_copies __nothrowcopy; + typedef typename _Alloc::template rebind::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 comp_hash; + typedef integral_constant store_extra; + typedef typename __nothrowcopy::indicator no_throw_indicator; - template - struct types_traits - : public vt_base_selector::type - { - typedef typename Alloc::template rebind::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 comp_hash; - - typedef integral_constant store_extra; - store_extra m_store_extra_indicator; - - typedef typename no_throw_copies::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 1641792..d122141 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/const_point_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp deleted file mode 100644 index 1cda69b..0000000 --- a/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp +++ /dev/null @@ -1,151 +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 -// . - -// 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_point_iterator.hpp - * Contains an iterator class returned by the tables' const find and insert - * methods. - */ - -class point_iterator_; - -// Const point-type iterator. -class const_point_iterator_ -{ - -public: - - // Category. - typedef trivial_iterator_tag iterator_category; - - // Difference type. - typedef trivial_iterator_difference_type difference_type; - - // Iterator's value type. - typedef value_type_ value_type; - - // Iterator's pointer type. - typedef pointer_ pointer; - - // Iterator's const pointer type. - typedef const_pointer_ const_pointer; - - // Iterator's reference type. - typedef reference_ reference; - - // Iterator's const reference type. - typedef const_reference_ const_reference; - -public: - - inline - const_point_iterator_(const_pointer p_value) : m_p_value(p_value) - { } - - // Default constructor. - inline - const_point_iterator_() - - : m_p_value(0) - { } - - // Copy constructor. - inline - const_point_iterator_(const const_point_iterator_& other) - - : m_p_value(other.m_p_value) - { } - - // Copy constructor. - inline - const_point_iterator_(const point_iterator_& other) - - : m_p_value(other.m_p_value) - { } - - // Access. - inline const_pointer - operator->() const - { - _GLIBCXX_DEBUG_ASSERT(m_p_value != 0); - - return (m_p_value); - } - - // Access. - inline const_reference - operator*() const - { - _GLIBCXX_DEBUG_ASSERT(m_p_value != 0); - - return (*m_p_value); - } - - // Compares content to a different iterator object. - inline bool - operator==(const point_iterator_& other) const - { - return (m_p_value == other.m_p_value); - } - - // Compares content to a different iterator object. - inline bool - operator==(const const_point_iterator_& other) const - { - return (m_p_value == other.m_p_value); - } - - // Compares content (negatively) to a different iterator object. - inline bool - operator!=(const point_iterator_& other) const - { - return (m_p_value != other.m_p_value); - } - - // Compares content (negatively) to a different iterator object. - inline bool - operator!=(const const_point_iterator_& other) const - { - return (m_p_value != other.m_p_value); - } - -protected: - const_pointer m_p_value; - - friend class point_iterator_; - - friend class PB_DS_CLASS_C_DEC; -}; - 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 1aaa682..52b90a5 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/point_const_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp new file mode 100644 index 0000000..257067a8 --- /dev/null +++ b/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp @@ -0,0 +1,151 @@ +// -*- 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 +// . + +// 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 unordered_iterator/point_const_iterator.hpp + * Contains an iterator class returned by the tables' const find and insert + * methods. + */ + +class point_iterator_; + +// Const point-type iterator. +class point_const_iterator_ +{ + +public: + + // Category. + typedef trivial_iterator_tag iterator_category; + + // Difference type. + typedef trivial_iterator_difference_type difference_type; + + // Iterator's value type. + typedef value_type_ value_type; + + // Iterator's pointer type. + typedef pointer_ pointer; + + // Iterator's const pointer type. + typedef const_pointer_ const_pointer; + + // Iterator's reference type. + typedef reference_ reference; + + // Iterator's const reference type. + typedef const_reference_ const_reference; + +public: + + inline + point_const_iterator_(const_pointer p_value) : m_p_value(p_value) + { } + + // Default constructor. + inline + point_const_iterator_() + + : m_p_value(0) + { } + + // Copy constructor. + inline + point_const_iterator_(const point_const_iterator_& other) + + : m_p_value(other.m_p_value) + { } + + // Copy constructor. + inline + point_const_iterator_(const point_iterator_& other) + + : m_p_value(other.m_p_value) + { } + + // Access. + inline const_pointer + operator->() const + { + _GLIBCXX_DEBUG_ASSERT(m_p_value != 0); + + return (m_p_value); + } + + // Access. + inline const_reference + operator*() const + { + _GLIBCXX_DEBUG_ASSERT(m_p_value != 0); + + return (*m_p_value); + } + + // Compares content to a different iterator object. + inline bool + operator==(const point_iterator_& other) const + { + return (m_p_value == other.m_p_value); + } + + // Compares content to a different iterator object. + inline bool + operator==(const point_const_iterator_& other) const + { + return (m_p_value == other.m_p_value); + } + + // Compares content (negatively) to a different iterator object. + inline bool + operator!=(const point_iterator_& other) const + { + return (m_p_value != other.m_p_value); + } + + // Compares content (negatively) to a different iterator object. + inline bool + operator!=(const point_const_iterator_& other) const + { + return (m_p_value != other.m_p_value); + } + +protected: + const_pointer m_p_value; + + friend class point_iterator_; + + friend class PB_DS_CLASS_C_DEC; +}; + 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 e17a5bf..f74f03d 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; diff --git a/libstdc++-v3/include/ext/pb_ds/hash_policy.hpp b/libstdc++-v3/include/ext/pb_ds/hash_policy.hpp index cefa3a1..1fa9303 100644 --- a/libstdc++-v3/include/ext/pb_ds/hash_policy.hpp +++ b/libstdc++-v3/include/ext/pb_ds/hash_policy.hpp @@ -53,20 +53,10 @@ namespace __gnu_pbds { - // A null hash function, indicating that the combining hash function - // is actually a ranged hash function. - struct null_hash_fn - { }; - - // A null probe function, indicating that the combining probe - // function is actually a ranged probe function. - struct null_probe_fn - { }; - #define PB_DS_CLASS_T_DEC template #define PB_DS_CLASS_C_DEC linear_probe_fn - // A probe sequence policy using fixed increments. + /// A probe sequence policy using fixed increments. template class linear_probe_fn { @@ -90,7 +80,7 @@ namespace __gnu_pbds #define PB_DS_CLASS_T_DEC template #define PB_DS_CLASS_C_DEC quadratic_probe_fn - // A probe sequence policy using square increments. + /// A probe sequence policy using square increments. template class quadratic_probe_fn { @@ -114,7 +104,7 @@ namespace __gnu_pbds #define PB_DS_CLASS_T_DEC template #define PB_DS_CLASS_C_DEC direct_mask_range_hashing - // A mask range-hashing class (uses a bit-mask). + /// A mask range-hashing class (uses a bit-mask). template class direct_mask_range_hashing : public detail::mask_based_range_hashing @@ -146,7 +136,7 @@ namespace __gnu_pbds #define PB_DS_CLASS_T_DEC template #define PB_DS_CLASS_C_DEC direct_mod_range_hashing - // A mod range-hashing class (uses the modulo function). + /// A mod range-hashing class (uses the modulo function). template class direct_mod_range_hashing : public detail::mod_based_range_hashing @@ -179,8 +169,8 @@ namespace __gnu_pbds #define PB_DS_CLASS_C_DEC hash_load_check_resize_trigger #define PB_DS_SIZE_BASE_C_DEC detail::hash_load_check_resize_trigger_size_base - // A resize trigger policy based on a load check. It keeps the - // load factor between some load factors load_min and load_max. + /// A resize trigger policy based on a load check. It keeps the + /// load factor between some load factors load_min and load_max. template class hash_load_check_resize_trigger : private PB_DS_SIZE_BASE_C_DEC { @@ -294,8 +284,8 @@ namespace __gnu_pbds #define PB_DS_CLASS_T_DEC template #define PB_DS_CLASS_C_DEC cc_hash_max_collision_check_resize_trigger - // A resize trigger policy based on collision checks. It keeps the - // simulated load factor lower than some given load factor. + /// A resize trigger policy based on collision checks. It keeps the + /// simulated load factor lower than some given load factor. template class cc_hash_max_collision_check_resize_trigger { @@ -395,8 +385,8 @@ namespace __gnu_pbds #define PB_DS_CLASS_T_DEC template #define PB_DS_CLASS_C_DEC hash_exponential_size_policy - // A size policy whose sequence of sizes form an exponential - // sequence (typically powers of 2. + /// A size policy whose sequence of sizes form an exponential + /// sequence (typically powers of 2. template class hash_exponential_size_policy { @@ -433,8 +423,8 @@ namespace __gnu_pbds #define PB_DS_CLASS_T_DEC #define PB_DS_CLASS_C_DEC hash_prime_size_policy - // A size policy whose sequence of sizes form a nearly-exponential - // sequence of primes. + /// A size policy whose sequence of sizes form a nearly-exponential + /// sequence of primes. class hash_prime_size_policy { public: @@ -469,7 +459,7 @@ namespace __gnu_pbds #define PB_DS_CLASS_C_DEC hash_standard_resize_policy - // A resize policy which delegates operations to size and trigger policies. + /// A resize policy which delegates operations to size and trigger policies. template, typename Trigger_Policy = hash_load_check_resize_trigger<>, bool External_Size_Access = false, diff --git a/libstdc++-v3/include/ext/pb_ds/list_update_policy.hpp b/libstdc++-v3/include/ext/pb_ds/list_update_policy.hpp index 54a67c6..e879b80 100644 --- a/libstdc++-v3/include/ext/pb_ds/list_update_policy.hpp +++ b/libstdc++-v3/include/ext/pb_ds/list_update_policy.hpp @@ -1,6 +1,6 @@ // -*- C++ -*- -// Copyright (C) 2005, 2006, 2007, 2009, 2010 +// 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 @@ -44,96 +44,86 @@ #include #include -#include +#include +#include namespace __gnu_pbds { - // A null type that means that each link in a list-based container - // does not actually need metadata. - struct null_lu_metadata - { }; - -#define PB_DS_CLASS_T_DEC template -#define PB_DS_CLASS_C_DEC move_to_front_lu_policy - - // A list-update policy that unconditionally moves elements to the - // front of the list. - template > - class move_to_front_lu_policy - { - public: - typedef Allocator allocator_type; - - // Metadata on which this functor operates. - typedef null_lu_metadata metadata_type; - - // Reference to metadata on which this functor operates. - typedef typename allocator_type::template rebind::other metadata_rebind; - typedef typename metadata_rebind::reference metadata_reference; - - // Creates a metadata object. - metadata_type - operator()() const; - - // Decides whether a metadata object should be moved to the front - // of the list. - inline bool - operator()(metadata_reference r_metadata) const; - - private: - static null_lu_metadata s_metadata; - }; - -#include - -#undef PB_DS_CLASS_T_DEC -#undef PB_DS_CLASS_C_DEC - -#define PB_DS_CLASS_T_DEC template -#define PB_DS_CLASS_C_DEC counter_lu_policy - - // A list-update policy that moves elements to the front of the list - // based on the counter algorithm. - template > - class counter_lu_policy - : private detail::counter_lu_policy_base - { - public: - typedef Allocator allocator_type; - - enum - { - max_count = Max_Count - }; - - typedef typename allocator_type::size_type size_type; - - // Metadata on which this functor operates. - typedef detail::counter_lu_metadata metadata_type; - - // Reference to metadata on which this functor operates. - typedef typename Allocator::template rebind::other metadata_rebind; - typedef typename metadata_rebind::reference metadata_reference; - - // Creates a metadata object. - metadata_type - operator()() const; - - // Decides whether a metadata object should be moved to the front - // of the list. - bool - operator()(metadata_reference r_metadata) const; - - private: - typedef detail::counter_lu_policy_base base_type; - }; - -#include - -#undef PB_DS_CLASS_T_DEC -#undef PB_DS_CLASS_C_DEC - + /** + * A list-update policy that unconditionally moves elements to the + * front of the list. A null type means that each link in a + * list-based container does not actually need metadata. + */ + template > + class lu_move_to_front_policy + { + public: + typedef _Alloc allocator_type; + + // Metadata on which this functor operates. + typedef null_type metadata_type; + + private: + typedef typename _Alloc::template rebind __rebind_m; + + public: + // Reference to metadata on which this functor operates. + typedef typename __rebind_m::other::reference metadata_reference; + + // Creates a metadata object. + metadata_type + operator()() const + { return s_metadata; } + + // Decides whether a metadata object should be moved to the front + // of the list. + inline bool + operator()(metadata_reference r_metadata) const + { return true; } + + private: + static null_type s_metadata; + }; + + /** + * A list-update policy that moves elements to the front of the + * list based on the counter algorithm. + */ + template > + class lu_counter_policy + : private detail::lu_counter_policy_base + { + public: + typedef _Alloc allocator_type; + typedef typename allocator_type::size_type size_type; + + enum + { + max_count = Max_Count + }; + + // Metadata on which this functor operates. + typedef detail::lu_counter_metadata metadata_type; + + private: + typedef detail::lu_counter_policy_base base_type; + typedef typename _Alloc::template rebind __rebind_m; + + public: + // Reference to metadata on which this functor operates. + typedef typename __rebind_m::other::reference metadata_reference; + + // Creates a metadata object. + metadata_type + operator()() const + { return base_type::operator()(max_count); } + + // Decides whether a metadata object should be moved to the front + // of the list. + bool + operator()(metadata_reference r_data) const + { return base_type::operator()(r_data, max_count); } + }; } // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp b/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp index b6088e7..8cd7a26 100644 --- a/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp +++ b/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp @@ -48,38 +48,42 @@ namespace __gnu_pbds { - // A priority queue. - template, + /** + * @brief A priority queue composed of one specific heap policy. + * @ingroup pbds + */ + template, typename Tag = pairing_heap_tag, - typename Allocator = std::allocator > - class priority_queue - : public detail::priority_queue_base_dispatch::type + typename _Alloc = std::allocator > + class priority_queue + : public detail::container_base_dispatch<_Tv, Cmp_Fn, _Alloc, Tag>::type { - private: - typedef typename - detail::priority_queue_base_dispatch::type base_type; - public: - typedef Value_Type value_type; + typedef _Tv value_type; typedef Cmp_Fn cmp_fn; typedef Tag container_category; - typedef Allocator allocator_type; + typedef _Alloc allocator_type; typedef typename allocator_type::size_type size_type; typedef typename allocator_type::difference_type difference_type; - typedef typename allocator_type::template rebind::other value_rebind; - typedef typename value_rebind::reference reference; - typedef typename value_rebind::const_reference const_reference; - typedef typename value_rebind::pointer pointer; - typedef typename value_rebind::const_pointer const_pointer; + private: + typedef typename detail::container_base_dispatch<_Tv, Cmp_Fn, _Alloc, + Tag>::type + base_type; + typedef typename _Alloc::template rebind<_Tv> __rebind_v; + typedef typename __rebind_v::other __rebind_va; + + public: + typedef typename __rebind_va::reference reference; + typedef typename __rebind_va::const_reference const_reference; + typedef typename __rebind_va::pointer pointer; + typedef typename __rebind_va::const_pointer const_pointer; - 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::point_const_iterator point_const_iterator; typedef typename base_type::iterator iterator; + typedef typename base_type::const_iterator const_iterator; priority_queue() { } @@ -109,7 +113,7 @@ namespace __gnu_pbds virtual ~priority_queue() { } - priority_queue& + priority_queue& operator=(const priority_queue& other) { if (this != &other) @@ -126,4 +130,4 @@ namespace __gnu_pbds }; } // namespace __gnu_pbds -#endif +#endif diff --git a/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp b/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp index ef44533..d5df54f 100644 --- a/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp +++ b/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp @@ -1,6 +1,7 @@ // -*- C++ -*- -// Copyright (C) 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2008, 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 @@ -36,7 +37,7 @@ /** * @file tag_and_trait.hpp * Contains tags and traits, e.g., ones describing underlying - * data structures. + * data structures. */ #ifndef PB_DS_TAG_AND_TRAIT_HPP @@ -51,59 +52,91 @@ */ namespace __gnu_pbds { - // A trivial iterator tag. Signifies that the iterators has none of - // the STL's movement abilities. + /** @defgroup pbds Policy-Based Data Structures + * @ingroup extensions + * + * This is a library of policy-based elementary data structures: + * associative containers and priority queues. It is designed for + * high-performance, flexibility, semantic safety, and conformance + * to the corresponding containers in std (except for some points + * where it differs by design). + * + * For details, see: + * http://gcc.gnu.org/onlinedocs/libstdc++/ext/pb_ds/index.html + * + * @{ + */ + + /** + * @defgroup tags Tags + * @{ + */ + /// A trivial iterator tag. Signifies that the iterators has none of + /// the STL's movement abilities. struct trivial_iterator_tag { }; - // Prohibit moving trivial iterators. + /// Prohibit moving trivial iterators. typedef void trivial_iterator_difference_type; - // Signifies a basic invalidation guarantee that any iterator, - // pointer, or reference to a container object's mapped value type - // is valid as long as the container is not modified. + /** + * @defgroup invalidation_tags Invalidation Guarantees. + * @ingroup tags + * @{ + */ + + /** + * Signifies a basic invalidation guarantee that any iterator, + * pointer, or reference to a container object's mapped value type + * is valid as long as the container is not modified. + */ struct basic_invalidation_guarantee { }; - // Signifies an invalidation guarantee that includes all those of - // its base, and additionally, that any point-type iterator, - // pointer, or reference to a container object's mapped value type - // is valid as long as its corresponding entry has not be erased, - // regardless of modifications to the container object. + /** + * Signifies an invalidation guarantee that includes all those of + * its base, and additionally, that any point-type iterator, + * pointer, or reference to a container object's mapped value type + * is valid as long as its corresponding entry has not be erased, + * regardless of modifications to the container object. + */ struct point_invalidation_guarantee : public basic_invalidation_guarantee { }; - // Signifies an invalidation guarantee that includes all those of - // its base, and additionally, that any range-type iterator - // (including the returns of begin() and end()) is in the correct - // relative positions to other range-type iterators as long as its - // corresponding entry has not be erased, regardless of - // modifications to the container object. + /** + * Signifies an invalidation guarantee that includes all those of + * its base, and additionally, that any range-type iterator + * (including the returns of begin() and end()) is in the correct + * relative positions to other range-type iterators as long as its + * corresponding entry has not be erased, regardless of + * modifications to the container object. + */ struct range_invalidation_guarantee : public point_invalidation_guarantee { }; + //@} - /// A mapped-policy indicating that an associative container is a set. - // XXX should this be a trait of the form is_set ?? - struct null_mapped_type { }; - - + /** + * @defgroup ds_tags Data Structure Tag Hierarchy. + * @ingroup tags + * @{ + */ /// Base data structure tag. struct container_tag { }; - /// Basic string container, inclusive of strings, ropes, etc. - struct string_tag : public container_tag { }; - /// Basic sequence. struct sequence_tag : public container_tag { }; + /// Basic string container, inclusive of strings, ropes, etc. + struct string_tag : public sequence_tag { }; + /// Basic associative-container. - struct associative_container_tag : public container_tag { }; + struct associative_tag : public container_tag { }; - /// Basic hash. - struct basic_hash_tag : public associative_container_tag { }; + /// Basic hash structure. + struct basic_hash_tag : public associative_tag { }; /// Collision-chaining hash. struct cc_hash_tag : public basic_hash_tag { }; @@ -111,11 +144,11 @@ namespace __gnu_pbds /// General-probing hash. struct gp_hash_tag : public basic_hash_tag { }; - /// Basic tree. - struct basic_tree_tag : public associative_container_tag { }; + /// Basic branch structure. + struct basic_branch_tag : public associative_tag { }; /// tree. - struct tree_tag : public basic_tree_tag { }; + struct tree_tag : public basic_branch_tag { }; /// Red-black tree. struct rb_tree_tag : public tree_tag { }; @@ -127,13 +160,13 @@ namespace __gnu_pbds struct ov_tree_tag : public tree_tag { }; /// trie. - struct trie_tag : public basic_tree_tag { }; + struct trie_tag : public basic_branch_tag { }; /// PATRICIA trie. struct pat_trie_tag : public trie_tag { }; /// List-update. - struct list_update_tag : public associative_container_tag { }; + struct list_update_tag : public associative_tag { }; /// Basic priority-queue. struct priority_queue_tag : public container_tag { }; @@ -152,203 +185,238 @@ namespace __gnu_pbds /// Thin heap. struct thin_heap_tag : public priority_queue_tag { }; - - - /// Base traits type for containers. - template - struct container_traits_base; - + //@} + //@} + + + /** + * @defgroup traits Traits + * @{ + */ + + /** + * @brief Represents no type, or absence of type, for template tricks. + * + * In a mapped-policy, indicates that an associative container is a set. + * + * In a list-update policy, indicates that each link does not need + * metadata. + * + * In a hash policy, indicates that the combining hash function + * is actually a ranged hash function. + * + * In a probe policy, indicates that the combining probe function + * is actually a ranged probe function. + */ + struct null_type { }; + + + /// Primary template, container traits base. + template + struct container_traits_base; + + /// Specialization, cc hash. template<> struct container_traits_base { - typedef cc_hash_tag container_category; - typedef point_invalidation_guarantee invalidation_guarantee; + typedef cc_hash_tag container_category; + typedef point_invalidation_guarantee invalidation_guarantee; enum { - order_preserving = false, - erase_can_throw = false, + order_preserving = false, + erase_can_throw = false, split_join_can_throw = false, reverse_iteration = false }; }; + /// Specialization, gp hash. template<> struct container_traits_base { - typedef gp_hash_tag container_category; - typedef basic_invalidation_guarantee invalidation_guarantee; + typedef gp_hash_tag container_category; + typedef basic_invalidation_guarantee invalidation_guarantee; enum { - order_preserving = false, + order_preserving = false, erase_can_throw = false, split_join_can_throw = false, reverse_iteration = false }; }; + /// Specialization, rb tree. template<> struct container_traits_base { - typedef rb_tree_tag container_category; - typedef range_invalidation_guarantee invalidation_guarantee; + typedef rb_tree_tag container_category; + typedef range_invalidation_guarantee invalidation_guarantee; enum { - order_preserving = true, - erase_can_throw = false, + order_preserving = true, + erase_can_throw = false, split_join_can_throw = false, - reverse_iteration = true + reverse_iteration = true }; }; + /// Specialization, splay tree. template<> struct container_traits_base { - typedef splay_tree_tag container_category; - typedef range_invalidation_guarantee invalidation_guarantee; + typedef splay_tree_tag container_category; + typedef range_invalidation_guarantee invalidation_guarantee; enum { - order_preserving = true, - erase_can_throw = false, - split_join_can_throw = false, - reverse_iteration = true + order_preserving = true, + erase_can_throw = false, + split_join_can_throw = false, + reverse_iteration = true }; }; + /// Specialization, ov tree. template<> struct container_traits_base { - typedef ov_tree_tag container_category; - typedef basic_invalidation_guarantee invalidation_guarantee; + typedef ov_tree_tag container_category; + typedef basic_invalidation_guarantee invalidation_guarantee; enum { - order_preserving = true, - erase_can_throw = true, - split_join_can_throw = true, - reverse_iteration = false + order_preserving = true, + erase_can_throw = true, + split_join_can_throw = true, + reverse_iteration = false }; }; + /// Specialization, pat trie. template<> struct container_traits_base { - typedef pat_trie_tag container_category; - typedef range_invalidation_guarantee invalidation_guarantee; + typedef pat_trie_tag container_category; + typedef range_invalidation_guarantee invalidation_guarantee; enum { - order_preserving = true, - erase_can_throw = false, - split_join_can_throw = true, - reverse_iteration = true + order_preserving = true, + erase_can_throw = false, + split_join_can_throw = true, + reverse_iteration = true }; }; + /// Specialization, list update. template<> struct container_traits_base { - typedef list_update_tag container_category; - typedef point_invalidation_guarantee invalidation_guarantee; + typedef list_update_tag container_category; + typedef point_invalidation_guarantee invalidation_guarantee; enum { - order_preserving = false, - erase_can_throw = false, + order_preserving = false, + erase_can_throw = false, split_join_can_throw = false, - reverse_iteration = false + reverse_iteration = false }; }; - + /// Specialization, pairing heap. template<> struct container_traits_base { - typedef pairing_heap_tag container_category; - typedef point_invalidation_guarantee invalidation_guarantee; + typedef pairing_heap_tag container_category; + typedef point_invalidation_guarantee invalidation_guarantee; enum { - order_preserving = false, - erase_can_throw = false, + order_preserving = false, + erase_can_throw = false, split_join_can_throw = false, - reverse_iteration = false + reverse_iteration = false }; }; + /// Specialization, thin heap. template<> struct container_traits_base { - typedef thin_heap_tag container_category; - typedef point_invalidation_guarantee invalidation_guarantee; + typedef thin_heap_tag container_category; + typedef point_invalidation_guarantee invalidation_guarantee; enum { - order_preserving = false, - erase_can_throw = false, + order_preserving = false, + erase_can_throw = false, split_join_can_throw = false, - reverse_iteration = false + reverse_iteration = false }; }; + /// Specialization, binomial heap. template<> struct container_traits_base { - typedef binomial_heap_tag container_category; - typedef point_invalidation_guarantee invalidation_guarantee; + typedef binomial_heap_tag container_category; + typedef point_invalidation_guarantee invalidation_guarantee; enum { - order_preserving = false, - erase_can_throw = false, + order_preserving = false, + erase_can_throw = false, split_join_can_throw = false, - reverse_iteration = false + reverse_iteration = false }; }; + /// Specialization, rc binomial heap. template<> struct container_traits_base { - typedef rc_binomial_heap_tag container_category; - typedef point_invalidation_guarantee invalidation_guarantee; + typedef rc_binomial_heap_tag container_category; + typedef point_invalidation_guarantee invalidation_guarantee; enum { - order_preserving = false, - erase_can_throw = false, + order_preserving = false, + erase_can_throw = false, split_join_can_throw = false, - reverse_iteration = false + reverse_iteration = false }; }; + /// Specialization, binary heap. template<> struct container_traits_base { - typedef binary_heap_tag container_category; - typedef basic_invalidation_guarantee invalidation_guarantee; + typedef binary_heap_tag container_category; + typedef basic_invalidation_guarantee invalidation_guarantee; enum { - order_preserving = false, - erase_can_throw = false, + order_preserving = false, + erase_can_throw = false, split_join_can_throw = true, - reverse_iteration = false + reverse_iteration = false }; }; - /// container_traits + /// Container traits. // See Matt Austern for the name, S. Meyers MEFC++ #2, others. template - struct container_traits + struct container_traits : public container_traits_base { - typedef Cntnr container_type; - typedef typename Cntnr::container_category container_category; - typedef container_traits_base base_type; + typedef Cntnr container_type; + typedef typename Cntnr::container_category container_category; + typedef container_traits_base base_type; typedef typename base_type::invalidation_guarantee invalidation_guarantee; enum @@ -359,6 +427,17 @@ namespace __gnu_pbds reverse_iteration = base_type::reverse_iteration }; }; + //@} + + + namespace detail + { + /// Dispatch mechanism, primary template for associative types. + template + struct container_base_dispatch; + } // namespace __detail + //@} } // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/include/ext/pb_ds/tree_policy.hpp b/libstdc++-v3/include/ext/pb_ds/tree_policy.hpp index 4af1adb..4df9df1 100644 --- a/libstdc++-v3/include/ext/pb_ds/tree_policy.hpp +++ b/libstdc++-v3/include/ext/pb_ds/tree_policy.hpp @@ -1,6 +1,6 @@ // -*- C++ -*- -// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 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 @@ -44,61 +44,54 @@ #include #include #include -#include +#include namespace __gnu_pbds { - // A null node updator, indicating that no node updates are required. - template - struct null_tree_node_update - { }; - #define PB_DS_CLASS_T_DEC \ - template + template #define PB_DS_CLASS_C_DEC \ - tree_order_statistics_node_update + tree_order_statistics_node_update -#define PB_DS_BASE_C_DEC \ - detail::basic_tree_policy_base +#define PB_DS_BRANCH_POLICY_BASE \ + detail::branch_policy - // Functor updating ranks of entrees. - template - class tree_order_statistics_node_update : private PB_DS_BASE_C_DEC + /// Functor updating ranks of entrees. + template + class tree_order_statistics_node_update : private PB_DS_BRANCH_POLICY_BASE { private: - typedef PB_DS_BASE_C_DEC base_type; + typedef PB_DS_BRANCH_POLICY_BASE base_type; public: - typedef Cmp_Fn cmp_fn; - typedef Allocator allocator_type; - typedef typename allocator_type::size_type size_type; - typedef typename base_type::key_type key_type; - typedef typename base_type::const_key_reference const_key_reference; - - typedef size_type 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; + typedef Cmp_Fn cmp_fn; + typedef _Alloc allocator_type; + typedef typename allocator_type::size_type size_type; + typedef typename base_type::key_type key_type; + typedef typename base_type::key_const_reference key_const_reference; + + typedef size_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; // Finds an entry by __order. Returns a const_iterator to the // entry with the __order order, or a const_iterator to the // container object's end if order is at least the size of the // container object. inline const_iterator - find_by_order(size_type order) const; + find_by_order(size_type) const; // Finds an entry by __order. Returns an iterator to the entry // with the __order order, or an iterator to the container // object's end if order is at least the size of the container // object. inline iterator - find_by_order(size_type order); + find_by_order(size_type); // Returns the order of a key within a sequence. For exapmle, if // r_key is the smallest key, this method will return 0; if r_key @@ -106,32 +99,33 @@ namespace __gnu_pbds // return 1; if r_key is a key larger than the largest key, this // method will return the size of r_c. inline size_type - order_of_key(const_key_reference r_key) const; + order_of_key(key_const_reference) const; private: // Const reference to the container's value-type. - typedef typename base_type::const_reference const_reference; + typedef typename base_type::const_reference const_reference; // Const pointer to the container's value-type. - typedef typename base_type::const_pointer const_pointer; + typedef typename base_type::const_pointer const_pointer; + + typedef typename _Alloc::template rebind::other __rebind_m; - typedef typename allocator_type::template rebind::other metadata_rebind; // Const metadata reference. - typedef typename metadata_rebind::const_reference const_metadata_reference; + typedef typename __rebind_m::const_reference metadata_const_reference; // Metadata reference. - typedef typename metadata_rebind::reference metadata_reference; + typedef typename __rebind_m::reference metadata_reference; - // Returns the const_node_iterator associated with the tree's root node. - virtual const_node_iterator + // Returns the node_const_iterator associated with the tree's root node. + virtual node_const_iterator node_begin() const = 0; // Returns the node_iterator associated with the tree's root node. virtual node_iterator node_begin() = 0; - // Returns the const_node_iterator associated with a just-after leaf node. - virtual const_node_iterator + // Returns the node_const_iterator associated with a just-after leaf node. + virtual node_const_iterator node_end() const = 0; // Returns the node_iterator associated with a just-after leaf node. @@ -146,7 +140,7 @@ namespace __gnu_pbds // 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; + operator()(node_iterator, node_const_iterator) const; virtual ~tree_order_statistics_node_update(); @@ -156,7 +150,7 @@ namespace __gnu_pbds #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC -#undef PB_DS_BASE_C_DEC +#undef PB_DS_BRANCH_POLICY_BASE } // namespace __gnu_pbds diff --git a/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp b/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp index fc45210..8fd4900 100644 --- a/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp +++ b/libstdc++-v3/include/ext/pb_ds/trie_policy.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 @@ -48,33 +49,27 @@ namespace __gnu_pbds { - // A null node updator, indicating that no node updates are required. - template - struct null_trie_node_update - { }; - -#define PB_DS_CLASS_T_DEC \ - template +#define PB_DS_CLASS_T_DEC \ + template -#define PB_DS_CLASS_C_DEC \ - string_trie_e_access_traits +#define PB_DS_CLASS_C_DEC \ + trie_string_access_traits - // Element access traits for string types. + /// Element access traits for string types. template::__min, - typename String::value_type Max_E_Val = detail::__numeric_traits::__max, + typename String::value_type Min_E_Val = detail::__numeric_traits::__min, + typename String::value_type Max_E_Val = detail::__numeric_traits::__max, bool Reverse = false, - typename Allocator = std::allocator > - struct string_trie_e_access_traits + typename _Alloc = std::allocator > + struct trie_string_access_traits { public: - typedef typename Allocator::size_type size_type; - typedef String key_type; - typedef typename Allocator::template rebind::other key_rebind; - typedef typename key_rebind::const_reference const_key_reference; + typedef typename _Alloc::size_type size_type; + typedef String key_type; + typedef typename _Alloc::template rebind __rebind_k; + typedef typename __rebind_k::other::const_reference key_const_reference; enum { @@ -82,7 +77,9 @@ namespace __gnu_pbds }; // Element const iterator type. - typedef typename detail::__conditional_type::__type const_iterator; + typedef typename detail::__conditional_type::__type const_iterator; // Element type. typedef typename std::iterator_traits::value_type e_type; @@ -96,108 +93,113 @@ namespace __gnu_pbds PB_DS_STATIC_ASSERT(min_max_size, max_size >= 2); // Returns a const_iterator to the first element of - // const_key_reference agumnet. + // key_const_reference agumnet. inline static const_iterator - begin(const_key_reference); + begin(key_const_reference); // Returns a const_iterator to the after-last element of - // const_key_reference argument. + // key_const_reference argument. inline static const_iterator - end(const_key_reference); + end(key_const_reference); // Maps an element to a position. inline static size_type e_pos(e_type e); private: - inline static const_iterator - begin_imp(const_key_reference, detail::false_type); + begin_imp(key_const_reference, detail::false_type); inline static const_iterator - begin_imp(const_key_reference, detail::true_type); + begin_imp(key_const_reference, detail::true_type); inline static const_iterator - end_imp(const_key_reference, detail::false_type); + end_imp(key_const_reference, detail::false_type); inline static const_iterator - end_imp(const_key_reference, detail::true_type); + end_imp(key_const_reference, detail::true_type); static detail::integral_constant s_rev_ind; }; -#include +#include #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #define PB_DS_CLASS_T_DEC \ - template + template #define PB_DS_CLASS_C_DEC \ - trie_prefix_search_node_update - -#define PB_DS_BASE_C_DEC \ - detail::trie_policy_base - - // A node updator that allows tries to be searched for the range of - // values that match a certain prefix. - template - class trie_prefix_search_node_update : private PB_DS_BASE_C_DEC + trie_prefix_search_node_update + +#define PB_DS_TRIE_POLICY_BASE \ + detail::trie_policy_base + + /// A node updator that allows tries to be searched for the range of + /// values that match a certain prefix. + template + class trie_prefix_search_node_update : private PB_DS_TRIE_POLICY_BASE { private: - typedef PB_DS_BASE_C_DEC base_type; + typedef PB_DS_TRIE_POLICY_BASE base_type; public: - typedef typename base_type::key_type key_type; - typedef typename base_type::const_key_reference const_key_reference; + typedef typename base_type::key_type key_type; + typedef typename base_type::key_const_reference key_const_reference; // Element access traits. - typedef E_Access_Traits e_access_traits; + typedef _ATraits access_traits; // Const element iterator. - typedef typename e_access_traits::const_iterator const_e_iterator; + typedef typename access_traits::const_iterator a_const_iterator; - // Allocator type. - typedef Allocator allocator_type; + // _Alloc type. + typedef _Alloc allocator_type; // Size type. - typedef typename allocator_type::size_type size_type; - typedef detail::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; + typedef typename allocator_type::size_type size_type; + typedef null_type metadata_type; + typedef Node_Itr node_iterator; + typedef Node_CItr node_const_iterator; + typedef typename node_iterator::value_type iterator; + typedef typename node_const_iterator::value_type const_iterator; // Finds the const iterator range corresponding to all values // whose prefixes match r_key. std::pair - prefix_range(const_key_reference) const; + prefix_range(key_const_reference) const; // Finds the iterator range corresponding to all values whose // prefixes match r_key. std::pair - prefix_range(const_key_reference); + prefix_range(key_const_reference); // Finds the const iterator range corresponding to all values // whose prefixes match [b, e). std::pair - prefix_range(const_e_iterator, const_e_iterator) const; + prefix_range(a_const_iterator, a_const_iterator) const; // Finds the iterator range corresponding to all values whose // prefixes match [b, e). std::pair - prefix_range(const_e_iterator, const_e_iterator); + prefix_range(a_const_iterator, a_const_iterator); protected: // Called to update a node's metadata. inline void - operator()(node_iterator node_it, const_node_iterator end_nd_it) const; + operator()(node_iterator node_it, node_const_iterator end_nd_it) const; private: + node_iterator + next_child(node_iterator, a_const_iterator, a_const_iterator, + node_iterator, const access_traits&); + // Returns the const iterator associated with the just-after last element. virtual const_iterator end() const = 0; @@ -206,16 +208,16 @@ namespace __gnu_pbds virtual iterator end() = 0; - // Returns the const_node_iterator associated with the trie's root node. - virtual const_node_iterator + // Returns the node_const_iterator associated with the trie's root node. + virtual node_const_iterator node_begin() const = 0; // Returns the node_iterator associated with the trie's root node. virtual node_iterator node_begin() = 0; - // Returns the const_node_iterator associated with a just-after leaf node. - virtual const_node_iterator + // Returns the node_const_iterator associated with a just-after leaf node. + virtual node_const_iterator node_end() const = 0; // Returns the node_iterator associated with a just-after leaf node. @@ -223,12 +225,8 @@ namespace __gnu_pbds node_end() = 0; // Access to the cmp_fn object. - virtual const e_access_traits& - get_e_access_traits() const = 0; - - node_iterator - next_child(node_iterator, const_e_iterator, const_e_iterator, - node_iterator, const e_access_traits&); + virtual const access_traits& + get_access_traits() const = 0; }; #include @@ -236,31 +234,32 @@ namespace __gnu_pbds #undef PB_DS_CLASS_C_DEC #define PB_DS_CLASS_C_DEC \ - trie_order_statistics_node_update - - // Functor updating ranks of entrees. - template - class trie_order_statistics_node_update : private PB_DS_BASE_C_DEC + trie_order_statistics_node_update + + /// Functor updating ranks of entrees. + template + class trie_order_statistics_node_update : private PB_DS_TRIE_POLICY_BASE { private: - typedef PB_DS_BASE_C_DEC base_type; + typedef PB_DS_TRIE_POLICY_BASE base_type; public: - typedef E_Access_Traits e_access_traits; - typedef typename e_access_traits::const_iterator const_e_iterator; - typedef Allocator allocator_type; - typedef typename allocator_type::size_type size_type; - typedef typename base_type::key_type key_type; - typedef typename base_type::const_key_reference const_key_reference; - - typedef size_type 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; + typedef _ATraits access_traits; + typedef typename access_traits::const_iterator a_const_iterator; + typedef _Alloc allocator_type; + typedef typename allocator_type::size_type size_type; + typedef typename base_type::key_type key_type; + typedef typename base_type::key_const_reference key_const_reference; + + typedef size_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; // Finds an entry by __order. Returns a const_iterator to the // entry with the __order order, or a const_iterator to the @@ -282,7 +281,7 @@ namespace __gnu_pbds // return 1; if r_key is a key larger than the largest key, this // method will return the size of r_c. inline size_type - order_of_key(const_key_reference) const; + order_of_key(key_const_reference) const; // Returns the order of a prefix within a sequence. For exapmle, // if [b, e] is the smallest prefix, this method will return 0; if @@ -290,15 +289,22 @@ namespace __gnu_pbds // will return 1; if r_key is a key larger than the largest key, // this method will return the size of r_c. inline size_type - order_of_prefix(const_e_iterator, const_e_iterator) const; + order_of_prefix(a_const_iterator, a_const_iterator) const; + + protected: + // 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; private: - typedef typename base_type::const_reference const_reference; - typedef typename base_type::const_pointer const_pointer; + typedef typename base_type::const_reference const_reference; + typedef typename base_type::const_pointer const_pointer; - typedef typename Allocator::template rebind::other metadata_rebind; - typedef typename metadata_rebind::const_reference const_metadata_reference; - typedef typename metadata_rebind::reference metadata_reference; + typedef typename _Alloc::template rebind __rebind_m; + typedef typename __rebind_m::other __rebind_ma; + typedef typename __rebind_ma::const_reference metadata_const_reference; + typedef typename __rebind_ma::reference metadata_reference; // Returns true if the container is empty. virtual bool @@ -313,17 +319,17 @@ namespace __gnu_pbds virtual iterator end() = 0; - // Returns the const_node_iterator associated with the trie's root node. - virtual const_node_iterator + // Returns the node_const_iterator associated with the trie's root node. + virtual node_const_iterator node_begin() const = 0; // Returns the node_iterator associated with the trie's root node. virtual node_iterator node_begin() = 0; - // Returns the const_node_iterator associated with a just-after + // Returns the node_const_iterator associated with a just-after // leaf node. - virtual const_node_iterator + virtual node_const_iterator node_end() const = 0; // Returns the node_iterator associated with a just-after leaf node. @@ -331,25 +337,15 @@ namespace __gnu_pbds node_end() = 0; // Access to the cmp_fn object. - virtual e_access_traits& - get_e_access_traits() = 0; - - protected: - // 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, const_node_iterator) const; - - // Destructor. - virtual - ~trie_order_statistics_node_update(); + virtual access_traits& + get_access_traits() = 0; }; #include #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC -#undef PB_DS_BASE_C_DEC +#undef PB_DS_TRIE_POLICY_BASE } // namespace __gnu_pbds diff --git a/libstdc++-v3/scripts/make_graph.py b/libstdc++-v3/scripts/make_graph.py index 61e18be..88b8d38 100755 --- a/libstdc++-v3/scripts/make_graph.py +++ b/libstdc++-v3/scripts/make_graph.py @@ -227,23 +227,28 @@ class png_maker: return self.__mmap_re.sub('\nmmap_\n', cntnr) def make(self, res, of_name): - theme.output_format = 'png' + theme.output_format = 'svg' theme.output_file = of_name theme.scale_factor = 2 -# theme.default_font_size = 5 + theme.default_font_family = "Gill Sans Std" + theme.default_line_width = 0.5 + theme.default_font_size = 7 theme.use_color = 1 theme.reinitialize() y_tick_interval = self.__get_y_tics(res) - xaxis = axis.X(format = '/a90/hL%d', +# xaxis = axis.X(format = '/a90/hL%d', + xaxis = axis.X(format = "/a-50{}%d", tic_interval = 200, label = res.x_label) - yaxis = axis.Y(format = '%.2e', +# yaxis = axis.Y(format = '%.2e', + yaxis = axis.Y(format = "/a-50{}%.2e", tic_interval = y_tick_interval, label = res.y_label) legend_lines = len(res.cntnr_list) legend_vloc = 50 + (legend_lines * 10) + legend_hloc = -0 ar = area.T(x_axis = xaxis, y_axis = yaxis, - legend = legend.T(loc=(0,-legend_vloc), + legend = legend.T(loc=(legend_hloc,-legend_vloc), frame_line_style=None, inter_row_sep=2), size=(240,110)) @@ -554,7 +559,8 @@ def main(doc_dir, res_dir, test_infos_f_name, test_name, build_name): res_gtr = res_getter(test_infos_f_name) res = res_gtr.get(res_dir, test_name) png_mkr = png_maker() - png_of_name = doc_dir + '/' + test_name + '_' + build_name + '.png' +# png_of_name = doc_dir + '/' + test_name + '_' + build_name + '.png' + png_of_name = doc_dir + '/' + test_name + '_' + build_name + '.svg' print png_of_name png_mkr.make(res, png_of_name) diff --git a/libstdc++-v3/scripts/run_doxygen b/libstdc++-v3/scripts/run_doxygen index e227ce1..48b1724 100644 --- a/libstdc++-v3/scripts/run_doxygen +++ b/libstdc++-v3/scripts/run_doxygen @@ -313,6 +313,10 @@ for f in *__detail_*; do newname=`echo $f | sed 's/__detail_/__detail::/'` mv $f $newname done +for f in *__gnu_pbds_detail_*; do + newname=`echo $f | sed 's/detail_/detail::/'` + mv $f $newname +done for f in *__parallel_*; do newname=`echo $f | sed 's/__parallel_/__parallel::/'` mv $f $newname diff --git a/libstdc++-v3/testsuite/data/make_graph_test_infos.xml b/libstdc++-v3/testsuite/data/make_graph_test_infos.xml index cffc3a0..0c2da1b 100644 --- a/libstdc++-v3/testsuite/data/make_graph_test_infos.xml +++ b/libstdc++-v3/testsuite/data/make_graph_test_infos.xml @@ -85,7 +85,6 @@ - diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multimap.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multimap.cc index bdc423a..ba593f2 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multimap.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multimap.cc @@ -123,7 +123,7 @@ int main() acc["a"][160] = 142; // Verify the number of accounts that "a" holds. - accounts_t::const_point_iterator it = acc.find("a"); + accounts_t::point_const_iterator it = acc.find("a"); assert(it != acc.end()); assert(it->second.size() == 2); diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_priority_queue.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_priority_queue.cc index 24ebe2e..b516bb7 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_priority_queue.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_priority_queue.cc @@ -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 @@ -62,7 +62,7 @@ some_op_sequence(Cntnr& r_c) typedef typename Cntnr::const_iterator const_iterator; for (const_iterator it = r_c.begin(); it != r_c.end(); ++it) - cout <<* it << endl; + cout << *it << endl; assert(!r_c.empty()); assert(r_c.size() == 10); diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_set.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_set.cc index 3d2cf14..07c74e6 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_set.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_set.cc @@ -80,19 +80,19 @@ int main() { { // Perform operations on a collision-chaining hash set. - cc_hash_table c; + cc_hash_table c; some_op_sequence(c); } { // Perform operations on a general-probing hash set. - gp_hash_table c; + gp_hash_table c; some_op_sequence(c); } { // Perform operations on a red-black tree set. - tree c; + tree c; some_op_sequence(c); } @@ -100,7 +100,7 @@ int main() // Perform operations on a splay tree set. tree< int, - null_mapped_type, + null_type, less, splay_tree_tag> c; some_op_sequence(c); @@ -110,7 +110,7 @@ int main() // Perform operations on a splay tree set. tree< int, - null_mapped_type, + null_type, less, ov_tree_tag> c; some_op_sequence(c); @@ -118,7 +118,7 @@ int main() { // Perform operations on a list-update set. - list_update c; + list_update c; some_op_sequence(c); } diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/ranged_hash.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/ranged_hash.cc index e9f33b1..e752242 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/ranged_hash.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/ranged_hash.cc @@ -125,8 +125,8 @@ main() typedef cc_hash_table< string, - null_mapped_type, - null_hash_fn, + null_type, + null_type, equal_to, simple_string_ranged_hash_fn> set_t; diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc index 406ab8e..a29756f 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc @@ -71,10 +71,10 @@ typedef pair< unsigned int, unsigned int> interval; // Functor updating maximal endpoints of entries. Algorithm taken from // "Introduction to Algorithms" by Cormen, Leiserson, and Rivest. -template + typename _Alloc> struct intervals_node_update { public: @@ -88,8 +88,8 @@ public: bool overlaps(const interval& r_interval) { - Const_Node_Iterator nd_it = node_begin(); - Const_Node_Iterator end_it = node_end(); + Node_CItr nd_it = node_begin(); + Node_CItr end_it = node_end(); while (nd_it != end_it) { @@ -99,7 +99,7 @@ public: return true; // Get the const node iterator of the node's left child. - Const_Node_Iterator l_nd_it = nd_it.get_l_child(); + Node_CItr l_nd_it = nd_it.get_l_child(); // Calculate the maximal endpoint of the left child. If the // node has no left child, then this is the node's maximal @@ -122,7 +122,7 @@ protected: // updated; end_nd_it is a const node iterator to a just-after leaf // node. inline void - operator()(Node_Iterator nd_it, Const_Node_Iterator end_nd_it) + operator()(Node_Itr nd_it, Node_CItr end_nd_it) { // The left maximal endpoint is 0 if there is no left child. const unsigned int l_max_endpoint =(nd_it.get_l_child() == end_nd_it)? @@ -138,10 +138,10 @@ protected: max((*nd_it)->second, max(l_max_endpoint, r_max_endpoint)); } - virtual Const_Node_Iterator + virtual Node_CItr node_begin() const = 0; - virtual Const_Node_Iterator + virtual Node_CItr node_end() const = 0; virtual @@ -186,7 +186,7 @@ int main() // Test a red-black tree. some_op_sequence(tree< interval, - null_mapped_type, + null_type, less, rb_tree_tag, intervals_node_update>()); @@ -194,7 +194,7 @@ int main() // Test an ordered-vector tree. some_op_sequence(tree< interval, - null_mapped_type, + null_type, less, ov_tree_tag, intervals_node_update>()); @@ -202,7 +202,7 @@ int main() // Test a splay tree. some_op_sequence(tree< interval, - null_mapped_type, + null_type, less, splay_tree_tag, intervals_node_update>()); diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/tree_order_statistics.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/tree_order_statistics.cc index 5845740..68ef8b7 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/tree_order_statistics.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/tree_order_statistics.cc @@ -57,7 +57,7 @@ using namespace __gnu_pbds; typedef tree< int, - null_mapped_type, + null_type, less, rb_tree_tag, // This policy updates nodes' metadata for order statistics. diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/trie_dna.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/trie_dna.cc index 28c8956..06ae539 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/trie_dna.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/trie_dna.cc @@ -53,12 +53,12 @@ using namespace __gnu_pbds; typedef string dna_t; // Following is an element access traits for a DNA string. -struct dna_string_e_access_traits +struct dna_string_access_traits { public: typedef size_t size_type; typedef dna_t key_type; - typedef const key_type& const_key_reference; + typedef const key_type& key_const_reference; typedef char e_type; typedef string::const_iterator const_iterator; @@ -70,12 +70,12 @@ public: // Returns a const_iterator to the firstelement of r_key. inline static const_iterator - begin(const_key_reference r_key) + begin(key_const_reference r_key) { return r_key.begin(); } // Returns a const_iterator to the after-lastelement of r_key. inline static const_iterator - end(const_key_reference r_key) + end(key_const_reference r_key) { return r_key.end(); } // Maps an element to a position. @@ -99,7 +99,7 @@ public: }; // A PATRICIA trie with DNA string element-access traits. -typedef dna_string_e_access_traits traits_type; +typedef dna_string_access_traits traits_type; typedef trie trie_type; int main() diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/trie_prefix_search.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/trie_prefix_search.cc index 98b99a7..09e025a 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/trie_prefix_search.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/trie_prefix_search.cc @@ -52,8 +52,8 @@ using namespace __gnu_pbds; // A PATRICIA trie with a prefix-search node-updator type. Note that // since the node updator is trie_prefix_search_node_update, then the // container includes its method prefix_range. -typedef null_mapped_type mapped_type; -typedef string_trie_e_access_traits<> cmp_fn; +typedef null_type mapped_type; +typedef trie_string_access_traits<> cmp_fn; typedef pat_trie_tag tag_type; typedef trie. + +/** + * @file hash_data_map_rand.cc + * Contains a random-operation test for maps and sets, separated out. + */ + +#define PB_DS_REGRESSION +//#define PB_DS_REGRESSION_TRACE + +#include +#include +#include +#include + +#ifndef ITERATIONS +# define ITERATIONS 100 +#endif + +#ifndef KEYS +# define KEYS 200 +#endif + +// Debug version of the rand regression tests, based on hash_data_map_rand + +// 1 +// Simplify things by unrolling the typelist of the different +// container types into individual statements. +// +// Unroll the typelist represented by priority_queue_types, from +// regression/common_type.hpp. This is just a compile-time list of 5 +// hash tables, with different policies for the type of table +// (gp_hash, cc_hash), for the resize policies and probe functions. +using namespace __gnu_pbds::test::detail; +using namespace __gnu_pbds; +typedef __gnu_pbds::test::basic_type basic_type; +typedef __gnu_cxx::throw_allocator_random allocator_type; +typedef std::equal_to equal_type; + + +typedef __gnu_pbds::test::direct_mod_range_hashing_t_ + cprobe_type1; + +typedef __gnu_pbds::test::direct_mask_range_hashing_t_ + cprobe_type2; + + +typedef __gnu_pbds::test::quadratic_probe_fn_t_ + probe_type1; + +typedef __gnu_pbds::test::linear_probe_fn_t_ + probe_type2; + + +typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_ + trigger_type1; + +typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_ + trigger_type2; + +typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_ + trigger_type3; + +typedef __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_ + trigger_type4; + +typedef __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_ + trigger_type5; + + +typedef hash_standard_resize_policy<__gnu_pbds::test::hash_prime_size_policy_t_, trigger_type1, false, unsigned long> resize_type1; + +typedef hash_standard_resize_policy<__gnu_pbds::test::hash_exponential_size_policy_t_, trigger_type2, true, unsigned long> + resize_type2; + +typedef hash_standard_resize_policy<__gnu_pbds::test::hash_exponential_size_policy_t_, trigger_type5, false, unsigned long> + resize_type3; + + + +// gp_hash 1 +typedef gp_hash_table + gp_hash_type1; + +// gp_hash 2 +typedef gp_hash_table + gp_hash_type2; + + +// cc_hash 1 +typedef cc_hash_table + cc_hash_type1; + +// cc_hash 2 +typedef cc_hash_table + cc_hash_type2; + +// cc_hash 3 +typedef cc_hash_table + cc_hash_type3; + +// 2 +// Specialize container_rand_regression_test for specific container +// type and test function. + +#ifdef SPECIALIZE +// For testing one specific container type. +typedef cc_hash_type1 test_type; + +void debug_break_here() { } + +namespace __gnu_pbds { + namespace test { + namespace detail { + + template<> + void + container_rand_regression_test::operator()() + { + } + } + } +} +#endif + +int +main() +{ + // Set up the test object. + size_t sd = 1303948889; + rand_reg_test test(sd, ITERATIONS, KEYS, 0.2, .6, .2, .001, .25, true); + + // 1 + // Determine the problem container, function that fails. + test(gp_hash_type1()); + test(gp_hash_type2()); + + test(cc_hash_type1()); + test(cc_hash_type2()); + test(cc_hash_type3()); + +#ifdef SPECIALIZE + // 2 + // With specified problem container set test_type typedef + // appropriately above. Then, specialize operator()(), also + // above. Finally, run this below. + using namespace std; + test_type obj; + test(obj); +#endif + + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand_debug.cc new file mode 100644 index 0000000..8729f41 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand_debug.cc @@ -0,0 +1,189 @@ +// { dg-require-time "" } +// This can take long on simulators, timing out the test. +// { dg-options "-D_GLIBCXX_DEBUG -DITERATIONS=5" { target simulator } } +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-timeout-factor 2.0 } + +// -*- C++ -*- + +// Copyright (C) 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. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// . + +/** + * @file hash_data_map_rand.cc + * Contains a random-operation test for maps and sets, separated out. + */ + +#define PB_DS_REGRESSION +//#define PB_DS_REGRESSION_TRACE + +#include +#include +#include +#include + +#ifndef ITERATIONS +# define ITERATIONS 100 +#endif + +#ifndef KEYS +# define KEYS 200 +#endif + +// Debug version of the rand regression tests, based on hash_data_map_rand + +// 1 +// Simplify things by unrolling the typelist of the different +// container types into individual statements. +// +// Unroll the typelist represented by priority_queue_types, from +// regression/common_type.hpp. This is just a compile-time list of 5 +// hash tables, with different policies for the type of table +// (gp_hash, cc_hash), for the resize policies and probe functions. +using namespace __gnu_pbds::test::detail; +using namespace __gnu_pbds; +typedef __gnu_pbds::test::basic_type basic_type; +typedef __gnu_cxx::throw_allocator_random allocator_type; +typedef std::equal_to equal_type; + + +typedef __gnu_pbds::test::direct_mod_range_hashing_t_ + cprobe_type1; + +typedef __gnu_pbds::test::direct_mask_range_hashing_t_ + cprobe_type2; + + +typedef __gnu_pbds::test::quadratic_probe_fn_t_ + probe_type1; + +typedef __gnu_pbds::test::linear_probe_fn_t_ + probe_type2; + + +typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_ + trigger_type1; + +typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_ + trigger_type2; + +typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_ + trigger_type3; + +typedef __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_ + trigger_type4; + +typedef __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_ + trigger_type5; + + +typedef hash_standard_resize_policy<__gnu_pbds::test::hash_prime_size_policy_t_, trigger_type1, false, unsigned long> resize_type1; + +typedef hash_standard_resize_policy<__gnu_pbds::test::hash_exponential_size_policy_t_, trigger_type2, true, unsigned long> + resize_type2; + +typedef hash_standard_resize_policy<__gnu_pbds::test::hash_exponential_size_policy_t_, trigger_type5, false, unsigned long> + resize_type3; + + + +// gp_hash 1 +typedef gp_hash_table + gp_hash_type1; + +// gp_hash 2 +typedef gp_hash_table + gp_hash_type2; + + +// cc_hash 1 +typedef cc_hash_table + cc_hash_type1; + +// cc_hash 2 +typedef cc_hash_table + cc_hash_type2; + +// cc_hash 3 +typedef cc_hash_table + cc_hash_type3; + +// 2 +// Specialize container_rand_regression_test for specific container +// type and test function. + +#ifdef SPECIALIZE +// For testing one specific container type. +typedef cc_hash_type1 test_type; + +void debug_break_here() { } + +namespace __gnu_pbds { + namespace test { + namespace detail { + + template<> + void + container_rand_regression_test::operator()() + { + } + } + } +} +#endif + +int +main() +{ + // Set up the test object. + size_t sd = 1303948889; + rand_reg_test test(sd, ITERATIONS, KEYS, 0.2, .6, .2, .001, .25, true); + + // 1 + // Determine the problem container, function that fails. + test(gp_hash_type1()); + test(gp_hash_type2()); + + test(cc_hash_type1()); + test(cc_hash_type2()); + test(cc_hash_type3()); + +#ifdef SPECIALIZE + // 2 + // With specified problem container set test_type typedef + // appropriately above. Then, specialize operator()(), also + // above. Finally, run this below. + using namespace std; + test_type obj; + test(obj); +#endif + + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc index 8bd7781..e91a753 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc @@ -32,7 +32,7 @@ // warranty. /** - * @file lu_data_map_rand_regression_test.cpp + * @file list_update_data_map_rand.cc * Contains a random-operation test for maps and sets. */ diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand_debug.cc new file mode 100644 index 0000000..bfb2ed4 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand_debug.cc @@ -0,0 +1,116 @@ +// { dg-require-time "" } +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-timeout-factor 2.0 } + +// -*- C++ -*- + +// Copyright (C) 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. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// . + +/** + * @file list_update_data_map_rand_debug.cc + * Contains a random-operation test for maps and sets, separated out. + */ + +#define PB_DS_REGRESSION +//#define PB_DS_REGRESSION_TRACE + +#include +#include +#include +#include + +// Debug version of the rand regression tests, based on list_update_data_map. + +// 1 +// Simplify things by unrolling the typelist of the different +// container types into individual statements. +// +// Unroll the typelist represented by list_update_types, from +// regression/common_type.hpp. This is just a compile-time list of +// list_update types, with different policies for the type of +// update (lu_move_to_front_policy, lu_counter_policy). + +using namespace __gnu_pbds::test::detail; +using namespace __gnu_pbds; +typedef __gnu_pbds::test::basic_type basic_type; +typedef __gnu_cxx::throw_allocator_random allocator_type; +typedef std::equal_to equal_type; + +typedef __gnu_pbds::test::lu_move_to_front_policy_t_ policy_type1; + +typedef __gnu_pbds::test::lu_counter_policy_t_ + policy_type2; + + +typedef list_update + list_type1; + +typedef list_update + list_type2; + +// 2 +// Specialize container_rand_regression_test for specific container +// type and test function. + +#ifdef SPECIALIZE +// For testing one specific container type. +typedef list_type1 test_type; + +void debug_break_here() { } + +namespace __gnu_pbds { + namespace test { + namespace detail { + + template<> + void + container_rand_regression_test::operator()() + { + } + + } + } +} +#endif + +int +main() +{ + // Set up the test object. + size_t sd = 1303948889; + rand_reg_test test(sd, 50, 10, .2, .6, .2, .001, .25, true); + + // 1 + // Determine the problem container, function that fails. + test(list_type1()); + test(list_type2()); + +#ifdef SPECIALIZE + // 2 + // With specified problem container set test_type typedef + // appropriately above. Then, specialize operator()(), also + // above. Finally, run this below. + using namespace std; + test_type obj; + test(obj); +#endif + + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand_debug.cc new file mode 100644 index 0000000..c39eb0d --- /dev/null +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand_debug.cc @@ -0,0 +1,116 @@ +// { dg-require-time "" } +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-timeout-factor 2.0 } + +// -*- C++ -*- + +// Copyright (C) 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. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// . + +/** + * @file list_update_data_map_rand_debug.cc + * Contains a random-operation test for maps and sets, separated out. + */ + +#define PB_DS_REGRESSION +//#define PB_DS_REGRESSION_TRACE + +#include +#include +#include +#include + +// Debug version of the rand regression tests, based on list_update_data_map. + +// 1 +// Simplify things by unrolling the typelist of the different +// container types into individual statements. +// +// Unroll the typelist represented by list_update_types, from +// regression/common_type.hpp. This is just a compile-time list of +// list_update types, with different policies for the type of +// update (lu_move_to_front_policy, lu_counter_policy). + +using namespace __gnu_pbds::test::detail; +using namespace __gnu_pbds; +typedef __gnu_pbds::test::basic_type basic_type; +typedef __gnu_cxx::throw_allocator_random allocator_type; +typedef std::equal_to equal_type; + +typedef __gnu_pbds::test::lu_move_to_front_policy_t_ policy_type1; + +typedef __gnu_pbds::test::lu_counter_policy_t_ + policy_type2; + + +typedef list_update + list_type1; + +typedef list_update + list_type2; + +// 2 +// Specialize container_rand_regression_test for specific container +// type and test function. + +#ifdef SPECIALIZE +// For testing one specific container type. +typedef list_type1 test_type; + +void debug_break_here() { } + +namespace __gnu_pbds { + namespace test { + namespace detail { + + template<> + void + container_rand_regression_test::operator()() + { + } + + } + } +} +#endif + +int +main() +{ + // Set up the test object. + size_t sd = 1303948889; + rand_reg_test test(sd, 50, 10, .2, .6, .2, .001, .25, true); + + // 1 + // Determine the problem container, function that fails. + test(list_type1()); + test(list_type2()); + +#ifdef SPECIALIZE + // 2 + // With specified problem container set test_type typedef + // appropriately above. Then, specialize operator()(), also + // above. Finally, run this below. + using namespace std; + test_type obj; + test(obj); +#endif + + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand_debug.cc new file mode 100644 index 0000000..dda9915 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand_debug.cc @@ -0,0 +1,142 @@ +// { dg-require-time "" } +// This can take long on simulators, timing out the test. +// { dg-options "-D_GLIBCXX_DEBUG -DITERATIONS=5" { target simulator } } +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-timeout-factor 2.0 } + +// -*- C++ -*- + +// Copyright (C) 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. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// . + +/** + * @file priority_queue_rand_debug.cc + * Contains a random-operation test for priority queues. + */ + +#define PB_DS_REGRESSION +//#define PB_DS_REGRESSION_TRACE + +#include +#include +#include +#include + +#ifndef ITERATIONS +# define ITERATIONS 500 +#endif + +#ifndef KEYS +# define KEYS 1000 +#endif + +// Debug version of the rand regression tests, based on priority_queue_rand + +// 1 +// Simplify things by unrolling the typelist of the different +// container types into individual statements. +// +// Unroll the typelist represented by priority_queue_types, from +// regression/common_type.hpp. This is just a compile-time list of 5 +// priority_queue types, with different policies for the type of priority_queue +// (pairing_heap_tag, binomial_heap_tag, rc_binomial_heap_tag, +// binary_heap_tag, thin_heap_tag). + +using namespace __gnu_pbds::test::detail; +using namespace __gnu_pbds; +typedef __gnu_pbds::test::basic_type basic_type; +typedef __gnu_cxx::throw_allocator_random allocator_type; + +// pairing_heap_tag +typedef priority_queue, + pairing_heap_tag, allocator_type> + priority_queue_type1; + +// binomial_heap_tag +typedef priority_queue, + binomial_heap_tag, allocator_type> + priority_queue_type2; + +// rc_binomial_heap_tag +typedef priority_queue, + rc_binomial_heap_tag, allocator_type> + priority_queue_type3; + +// binary_heap_tag +typedef priority_queue, + binary_heap_tag, allocator_type> + priority_queue_type4; + +// thin_heap_tag +typedef priority_queue, + thin_heap_tag, allocator_type> + priority_queue_type5; + + +// 2 +// Specialize container_rand_regression_test for specific container +// type and test function. + +#ifdef SPECIALIZE +// For testing one specific container type. +typedef priority_queue_type4 test_type; + +void debug_break_here() { } + +namespace __gnu_pbds { + namespace test { + namespace detail { + + template<> + void + container_rand_regression_test::operator()() + { + + } + + } + } +} +#endif + +int +main() +{ + // Set up the test object. + size_t sd = 1304368293; + rand_reg_test test(sd, ITERATIONS, KEYS, 0.2, .6, .1, .2, .001, 1, true); + + // 1 + // Determine the problem container, function that fails. + test(priority_queue_type1()); + test(priority_queue_type2()); + test(priority_queue_type3()); + test(priority_queue_type4()); + test(priority_queue_type5()); + +#ifdef SPECIALIZE + // 2 + // With specified problem container set test_type typedef + // appropriately above. Then, specialize operator()(), also + // above. Finally, run this below. + using namespace std; + test_type obj; + test(obj); +#endif + + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand_debug.cc new file mode 100644 index 0000000..934d96d --- /dev/null +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand_debug.cc @@ -0,0 +1,144 @@ +// { dg-require-time "" } +// This can take long on simulators, timing out the test. +// { dg-options "-D_GLIBCXX_DEBUG -DITERATIONS=5" { target simulator } } +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-timeout-factor 2.0 } + +// -*- C++ -*- + +// Copyright (C) 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. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// . + +/** + * @file tree_data_map_rand_debug.cc + * Contains a random-operation test for maps and sets, separated out. + */ + +#define PB_DS_REGRESSION +//#define PB_DS_REGRESSION_TRACE + +#include +#include +#include +#include + +#ifndef ITERATIONS +# define ITERATIONS 100 +#endif + +#ifndef KEYS +# define KEYS 200 +#endif + +// Debug version of the rand regression tests, based on tree_data_map. + +// 1 +// Simplify things by unrolling the typelist of the different +// container types into individual statements. +// +// Unroll the typelist represented by tree_types, from +// regression/common_type.hpp. This is just a compile-time list of 6 +// tree types, with different policies for the type of tree +// (ov_tree_tag, rb_tree_tag, splay_tree_tag) and for the node +// update (null_node_update, tree_order_statistics_node_update) + +using namespace __gnu_pbds::test::detail; +using namespace __gnu_pbds; +typedef __gnu_pbds::test::basic_type basic_type; +typedef __gnu_cxx::throw_allocator_random allocator_type; + +// ov_tree_tag +typedef tree, + ov_tree_tag, null_node_update, + allocator_type> ov_tree_type1; + +typedef tree, + ov_tree_tag, tree_order_statistics_node_update, + allocator_type> ov_tree_type2; + +// rb_tree_tag +typedef tree, + rb_tree_tag, null_node_update, + allocator_type> rb_tree_type1; + +typedef tree, + rb_tree_tag, tree_order_statistics_node_update, + allocator_type> rb_tree_type2; + +// splay_tree_tag +typedef tree, + splay_tree_tag, null_node_update, + allocator_type> splay_tree_type1; + +typedef tree, + splay_tree_tag, tree_order_statistics_node_update, + allocator_type> splay_tree_type2; + + +// 2 +// Specialize container_rand_regression_test for specific container +// type and test function. + +#ifdef SPECIALIZE +// For testing one specific container type. +typedef ov_tree_type2 test_type; + +void debug_break_here() { } + +namespace __gnu_pbds { + namespace test { + namespace detail { + + template<> + void + container_rand_regression_test::operator()() + { + } + + } + } +} +#endif + +int +main() +{ + // Set up the test object. + size_t sd = 1303948889; + rand_reg_test test(sd, ITERATIONS, KEYS, 0.2, .6, .2, .001, .25, true); + + // 1 + // Determine the problem container, function that fails. + test(ov_tree_type1()); + test(ov_tree_type2()); + test(rb_tree_type1()); + test(rb_tree_type2()); + test(splay_tree_type1()); + test(splay_tree_type2()); + +#ifdef SPECIALIZE + // 2 + // With specified problem container set test_type typedef + // appropriately above. Then, specialize operator()(), also + // above. Finally, run this below. + using namespace std; + test_type obj; + test(obj); +#endif + + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc new file mode 100644 index 0000000..146fc1f --- /dev/null +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc @@ -0,0 +1,144 @@ +// { dg-require-time "" } +// This can take long on simulators, timing out the test. +// { dg-options "-D_GLIBCXX_DEBUG -DITERATIONS=5" { target simulator } } +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-timeout-factor 2.0 } + +// -*- C++ -*- + +// Copyright (C) 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. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// . + +/** + * @file tree_data_map_rand_debug.cc + * Contains a random-operation test for maps and sets, separated out. + */ + +#define PB_DS_REGRESSION +//#define PB_DS_REGRESSION_TRACE + +#include +#include +#include +#include + +#ifndef ITERATIONS +# define ITERATIONS 100 +#endif + +#ifndef KEYS +# define KEYS 200 +#endif + +// Debug version of the rand regression tests, based on tree_data_map. + +// 1 +// Simplify things by unrolling the typelist of the different +// container types into individual statements. +// +// Unroll the typelist represented by tree_types, from +// regression/common_type.hpp. This is just a compile-time list of 6 +// tree types, with different policies for the type of tree +// (ov_tree_tag, rb_tree_tag, splay_tree_tag) and for the node +// update (null_node_update, tree_order_statistics_node_update) + +using namespace __gnu_pbds::test::detail; +using namespace __gnu_pbds; +typedef __gnu_pbds::test::basic_type basic_type; +typedef __gnu_cxx::throw_allocator_random allocator_type; + +// ov_tree_tag +typedef tree, + ov_tree_tag, null_node_update, + allocator_type> ov_tree_type1; + +typedef tree, + ov_tree_tag, tree_order_statistics_node_update, + allocator_type> ov_tree_type2; + +// rb_tree_tag +typedef tree, + rb_tree_tag, null_node_update, + allocator_type> rb_tree_type1; + +typedef tree, + rb_tree_tag, tree_order_statistics_node_update, + allocator_type> rb_tree_type2; + +// splay_tree_tag +typedef tree, + splay_tree_tag, null_node_update, + allocator_type> splay_tree_type1; + +typedef tree, + splay_tree_tag, tree_order_statistics_node_update, + allocator_type> splay_tree_type2; + + +// 2 +// Specialize container_rand_regression_test for specific container +// type and test function. + +#ifdef SPECIALIZE +// For testing one specific container type. +typedef ov_tree_type2 test_type; + +void debug_break_here() { } + +namespace __gnu_pbds { + namespace test { + namespace detail { + + template<> + void + container_rand_regression_test::operator()() + { + } + + } + } +} +#endif + +int +main() +{ + // Set up the test object. + size_t sd = 1303948889; + rand_reg_test test(sd, ITERATIONS, KEYS, 0.2, .6, .2, .001, .25, true); + + // 1 + // Determine the problem container, function that fails. + test(ov_tree_type1()); + test(ov_tree_type2()); + test(rb_tree_type1()); + test(rb_tree_type2()); + test(splay_tree_type1()); + test(splay_tree_type2()); + +#ifdef SPECIALIZE + // 2 + // With specified problem container set test_type typedef + // appropriately above. Then, specialize operator()(), also + // above. Finally, run this below. + using namespace std; + test_type obj; + test(obj); +#endif + + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand_debug.cc new file mode 100644 index 0000000..5d7ada8 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand_debug.cc @@ -0,0 +1,131 @@ +// { dg-require-time "" } +// This can take long on simulators, timing out the test. +// { dg-options "-D_GLIBCXX_DEBUG -DITERATIONS=5" { target simulator } } +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-timeout-factor 2.0 } + +// -*- C++ -*- + +// Copyright (C) 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. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// . + +/** + * @file trie_data_map_rand_debug.cc + * Contains a random-operation test for maps and sets, separated out. + */ + +#define PB_DS_REGRESSION +//#define PB_DS_REGRESSION_TRACE + +#include +#include +#include +#include + +#ifndef ITERATIONS +# define ITERATIONS 100 +#endif + +#ifndef KEYS +# define KEYS 200 +#endif + +// Debug version of the rand regression tests, based on trie_no_data_map. + +// 1 +// Simplify things by unrolling the typelist of the different +// container types into individual statements. +// +// Unroll the typelist represented by tree_types, from +// regression/common_type.hpp. This is just a compile-time list of 6 +// tree types, with different policies for the type of tree +// (pat_trie_tag) and for the node +// update (null_node_update, trie_order_statistics_node_update, +// trie_order_staticstics_node_update, trie_prefix_search_node_update) + +using namespace __gnu_pbds::test::detail; +using namespace __gnu_pbds; +typedef __gnu_pbds::test::basic_type basic_type; +typedef __gnu_cxx::throw_allocator_random allocator_type; +typedef __gnu_pbds::trie_string_access_traits + etraits_type; + +// pat_trie_tag +typedef trie + trie_type1; + +typedef trie + trie_type2; + +typedef trie + trie_type3; + + +// 2 +// Specialize container_rand_regression_test for specific container +// type and test function. + +#ifdef SPECIALIZE +// For testing one specific container type. +typedef trie_type1 test_type; + +void debug_break_here() { } + +namespace __gnu_pbds { + namespace test { + namespace detail { + + template<> + void + container_rand_regression_test::operator()() + { + + } + } + } +} +#endif + +int +main() +{ + // Set up the test object. + size_t sd = 1303948889; + rand_reg_test test(sd, ITERATIONS, KEYS, 0.2, .6, .2, .001, .25, true); + + // 1 + // Determine the problem container, function that fails. + test(trie_type1()); + test(trie_type2()); + test(trie_type3()); + +#ifdef SPECIALIZE + // 2 + // With specified problem container set test_type typedef + // appropriately above. Then, specialize operator()(), also + // above. Finally, run this below. + using namespace std; + test_type obj; + test(obj); +#endif + + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand_debug.cc new file mode 100644 index 0000000..b075e5b --- /dev/null +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand_debug.cc @@ -0,0 +1,131 @@ +// { dg-require-time "" } +// This can take long on simulators, timing out the test. +// { dg-options "-D_GLIBCXX_DEBUG -DITERATIONS=5" { target simulator } } +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-timeout-factor 2.0 } + +// -*- C++ -*- + +// Copyright (C) 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. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// . + +/** + * @file trie_data_map_rand_debug.cc + * Contains a random-operation test for maps and sets, separated out. + */ + +#define PB_DS_REGRESSION +//#define PB_DS_REGRESSION_TRACE + +#include +#include +#include +#include + +#ifndef ITERATIONS +# define ITERATIONS 100 +#endif + +#ifndef KEYS +# define KEYS 200 +#endif + +// Debug version of the rand regression tests, based on trie_no_data_map. + +// 1 +// Simplify things by unrolling the typelist of the different +// container types into individual statements. +// +// Unroll the typelist represented by tree_types, from +// regression/common_type.hpp. This is just a compile-time list of 6 +// tree types, with different policies for the type of tree +// (pat_trie_tag) and for the node +// update (null_node_update, trie_order_statistics_node_update, +// trie_order_staticstics_node_update, trie_prefix_search_node_update) + +using namespace __gnu_pbds::test::detail; +using namespace __gnu_pbds; +typedef __gnu_pbds::test::basic_type basic_type; +typedef __gnu_cxx::throw_allocator_random allocator_type; +typedef __gnu_pbds::trie_string_access_traits + etraits_type; + +// pat_trie_tag +typedef trie + trie_type1; + +typedef trie + trie_type2; + +typedef trie + trie_type3; + + +// 2 +// Specialize container_rand_regression_test for specific container +// type and test function. + +#ifdef SPECIALIZE +// For testing one specific container type. +typedef trie_type1 test_type; + +void debug_break_here() { } + +namespace __gnu_pbds { + namespace test { + namespace detail { + + template<> + void + container_rand_regression_test::operator()() + { + + } + } + } +} +#endif + +int +main() +{ + // Set up the test object. + size_t sd = 1303948889; + rand_reg_test test(sd, ITERATIONS, KEYS, 0.2, .6, .2, .001, .25, true); + + // 1 + // Determine the problem container, function that fails. + test(trie_type1()); + test(trie_type2()); + test(trie_type3()); + +#ifdef SPECIALIZE + // 2 + // With specified problem container set test_type typedef + // appropriately above. Then, specialize operator()(), also + // above. Finally, run this below. + using namespace std; + test_type obj; + test(obj); +#endif + + return 0; +} diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/hash_random_int_erase_mem_usage.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/hash_random_int_erase_mem_usage.cc index e1c7d9e..f80c77b 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/hash_random_int_erase_mem_usage.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/hash_random_int_erase_mem_usage.cc @@ -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 @@ -77,7 +77,7 @@ main(int argc, char* a_p_argv[]) erase_test tst(b, vn, vs, vm); typedef __gnu_test::tracker_allocator alloc_t; { - typedef hash_common_types, alloc_t>::performance_tl tl_t; + typedef hash_common_types, alloc_t>::performance_tl tl_t; tl_t tl; __gnu_cxx::typelist::apply(tst, tl); diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_pop_mem_usage.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_pop_mem_usage.cc index 8c0181e..50423db 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_pop_mem_usage.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_pop_mem_usage.cc @@ -60,9 +60,10 @@ main(int argc, char* a_p_argv[]) try { xml_test_performance_formatter fmt("Size", "Memory (bytes)"); - typedef __gnu_test::tracker_allocator callocator_type; - typedef __gnu_test::tracker_allocator sallocator_type; - typedef std::basic_string, callocator_type> string_t; + typedef __gnu_test::tracker_allocator allocator_type; + typedef std::char_traits traits_type; + typedef std::basic_string string_t; + typedef std::less cmp_type; typedef std::vector > vec_t; vec_t a_v(vm); @@ -72,18 +73,20 @@ main(int argc, char* a_p_argv[]) vec_t::const_iterator b = a_v.begin(); test_t tst(b, vn, vs, vm); { - typedef pq_common_types, callocator_type>::performance_tl pq_tl_t; + typedef pq_common_types::performance_tl pq_tl_t; pq_tl_t tl; __gnu_cxx::typelist::apply(tst, tl); } { - typedef native_priority_queue, sallocator_type> native_pq_t; + typedef native_priority_queue native_pq_t; tst(native_pq_t()); } { - typedef native_priority_queue, sallocator_type> native_pq_t; + typedef native_priority_queue native_pq_t; tst(native_pq_t()); } } diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_order_statistics_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_order_statistics_timing.cc index 9580668..eab8950 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_order_statistics_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_order_statistics_timing.cc @@ -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 @@ -61,7 +61,7 @@ main(int argc, char* a_p_argv[]) { typedef tree_order_statistics_test< true> test_t; test_t tst(vn, vs, vm); - typedef tree_common_types, __gnu_pbds::tree_order_statistics_node_update>::performance_tl tl_t; + typedef tree_common_types, __gnu_pbds::tree_order_statistics_node_update>::performance_tl tl_t; tl_t tl; __gnu_cxx::typelist::apply(tst, tl); } diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_split_join_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_split_join_timing.cc index c10fe01..a9423e2 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_split_join_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_split_join_timing.cc @@ -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 @@ -62,7 +62,7 @@ main(int argc, char* a_p_argv[]) typedef tree_split_join_test test_t; test_t tst(vn, vs, vm); - typedef tree_common_types::performance_tl tl_t; + typedef tree_common_types::performance_tl tl_t; tl_t tl; __gnu_cxx::typelist::apply(tst, tl); } diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/common_type.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/common_type.hpp index 562f418..c958122 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/common_type.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/common_type.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 @@ -49,15 +49,15 @@ namespace __gnu_pbds typename Data, class Hash_Fn = typename __gnu_pbds::detail::default_hash_fn::type, class Eq_Fn = std::equal_to, - class Allocator = std::allocator > > + typename _Alloc = std::allocator > > struct hash_common_types { private: - typedef typename Allocator::size_type size_type; + typedef typename _Alloc::size_type size_type; typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_< - Allocator, + _Alloc, 1, 8, 1, 2, false> @@ -65,7 +65,7 @@ namespace __gnu_pbds typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_< - Allocator, + _Alloc, 1, 8, 1, 2, true> @@ -73,7 +73,7 @@ namespace __gnu_pbds typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_< - Allocator, + _Alloc, 1, 8, 1, 1, false> @@ -81,37 +81,34 @@ namespace __gnu_pbds typedef __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_< - Allocator, + _Alloc, 1, 2, false> no_access_half_max_col_check_check_resize_trigger_policy; typedef __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_< - Allocator, + _Alloc, 1, 2, true> access_half_max_col_check_check_resize_trigger_policy; - typedef __gnu_pbds::test::linear_probe_fn_t_ lin_p_t; + typedef __gnu_pbds::test::linear_probe_fn_t_ lin_p_t; - typedef __gnu_pbds::test::quadratic_probe_fn_t_ quad_p_t; + typedef __gnu_pbds::test::quadratic_probe_fn_t_ quad_p_t; typedef typename __gnu_cxx::typelist::create4< __gnu_pbds::detail::false_type, - __gnu_pbds::test::direct_mask_range_hashing_t_< - Allocator>, + __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, no_access_half_load_check_resize_trigger_policy, - __gnu_pbds::test::hash_exponential_size_policy_t_< - Allocator> >::type + __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type performance_cc_policy0; typedef typename __gnu_cxx::typelist::create4< __gnu_pbds::detail::false_type, - __gnu_pbds::test::direct_mod_range_hashing_t_< - Allocator>, + __gnu_pbds::test::direct_mod_range_hashing_t_<_Alloc>, no_access_half_load_check_resize_trigger_policy, __gnu_pbds::test::hash_prime_size_policy_t_>::type performance_cc_policy1; @@ -119,18 +116,15 @@ namespace __gnu_pbds typedef typename __gnu_cxx::typelist::create4< __gnu_pbds::detail::false_type, - __gnu_pbds::test::direct_mask_range_hashing_t_< - Allocator>, + __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, no_access_one_load_check_resize_trigger_policy, - __gnu_pbds::test::hash_exponential_size_policy_t_< - Allocator> >::type + __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type performance_cc_policy2; typedef typename __gnu_cxx::typelist::create4< __gnu_pbds::detail::false_type, - __gnu_pbds::test::direct_mod_range_hashing_t_< - Allocator>, + __gnu_pbds::test::direct_mod_range_hashing_t_<_Alloc>, no_access_one_load_check_resize_trigger_policy, __gnu_pbds::test::hash_prime_size_policy_t_ >::type performance_cc_policy3; @@ -138,69 +132,57 @@ namespace __gnu_pbds typedef typename __gnu_cxx::typelist::create4< __gnu_pbds::detail::true_type, - __gnu_pbds::test::direct_mask_range_hashing_t_< - Allocator>, + __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, no_access_half_load_check_resize_trigger_policy, - __gnu_pbds::test::hash_exponential_size_policy_t_< - Allocator> >::type + __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type performance_cc_policy4; typedef typename __gnu_cxx::typelist::create4< __gnu_pbds::detail::false_type, - __gnu_pbds::test::direct_mask_range_hashing_t_< - Allocator>, + __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, no_access_half_max_col_check_check_resize_trigger_policy, - __gnu_pbds::test::hash_exponential_size_policy_t_< - Allocator> >::type + __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type performance_cc_policy5; typedef typename __gnu_cxx::typelist::create4< __gnu_pbds::detail::false_type, - __gnu_pbds::test::direct_mask_range_hashing_t_< - Allocator>, + __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, access_half_max_col_check_check_resize_trigger_policy, - __gnu_pbds::test::hash_exponential_size_policy_t_< - Allocator> >::type + __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type regression_cc_policy0; typedef typename __gnu_cxx::typelist::create4< __gnu_pbds::detail::false_type, - __gnu_pbds::test::direct_mask_range_hashing_t_< - Allocator>, + __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, access_half_load_check_resize_trigger_policy, - __gnu_pbds::test::hash_exponential_size_policy_t_< - Allocator> >::type + __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type regression_cc_policy1; typedef typename __gnu_cxx::typelist::create4< __gnu_pbds::detail::true_type, - __gnu_pbds::test::direct_mod_range_hashing_t_< - Allocator>, + __gnu_pbds::test::direct_mod_range_hashing_t_<_Alloc>, no_access_half_load_check_resize_trigger_policy, - __gnu_pbds::test::hash_prime_size_policy_t_ >::type + __gnu_pbds::test::hash_prime_size_policy_t_>::type regression_cc_policy2; typedef typename __gnu_cxx::typelist::create5< __gnu_pbds::detail::false_type, lin_p_t, - __gnu_pbds::test::direct_mask_range_hashing_t_< - Allocator>, + __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, no_access_half_load_check_resize_trigger_policy, - __gnu_pbds::test::hash_exponential_size_policy_t_< - Allocator> >::type + __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type performance_gp_policy0; typedef typename __gnu_cxx::typelist::create5< __gnu_pbds::detail::false_type, quad_p_t, - __gnu_pbds::test::direct_mod_range_hashing_t_< - Allocator>, + __gnu_pbds::test::direct_mod_range_hashing_t_<_Alloc>, no_access_half_load_check_resize_trigger_policy, __gnu_pbds::test::hash_prime_size_policy_t_ >::type performance_gp_policy1; @@ -209,8 +191,7 @@ namespace __gnu_pbds typename __gnu_cxx::typelist::create5< __gnu_pbds::detail::false_type, quad_p_t, - __gnu_pbds::test::direct_mod_range_hashing_t_< - Allocator>, + __gnu_pbds::test::direct_mod_range_hashing_t_<_Alloc>, access_half_load_check_resize_trigger_policy, __gnu_pbds::test::hash_prime_size_policy_t_>::type regression_gp_policy0; @@ -219,11 +200,9 @@ namespace __gnu_pbds typename __gnu_cxx::typelist::create5< __gnu_pbds::detail::true_type, lin_p_t, - __gnu_pbds::test::direct_mask_range_hashing_t_< - Allocator>, + __gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc>, access_half_load_check_resize_trigger_policy, - __gnu_pbds::test::hash_exponential_size_policy_t_< - Allocator> >::type + __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >::type regression_gp_policy1; typedef @@ -260,8 +239,7 @@ namespace __gnu_pbds { private: typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 0>::type + typename __gnu_cxx::typelist::at_index::type store_hash_indicator; enum @@ -269,19 +247,13 @@ namespace __gnu_pbds store_hash = store_hash_indicator::value }; - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 1>::type + typedef typename __gnu_cxx::typelist::at_index::type comb_hash_fn; - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 2>::type + typedef typename __gnu_cxx::typelist::at_index::type trigger_policy; - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 3>::type + typedef typename __gnu_cxx::typelist::at_index::type size_policy; public: @@ -292,12 +264,10 @@ namespace __gnu_pbds Hash_Fn, Eq_Fn, comb_hash_fn, - __gnu_pbds::hash_standard_resize_policy< - size_policy, - trigger_policy, - false>, + __gnu_pbds::hash_standard_resize_policy, store_hash, - Allocator> + _Alloc> type; }; @@ -306,8 +276,7 @@ namespace __gnu_pbds { private: typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 0>::type + typename __gnu_cxx::typelist::at_index::type store_hash_indicator; enum @@ -315,19 +284,13 @@ namespace __gnu_pbds store_hash = store_hash_indicator::value }; - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 1>::type + typedef typename __gnu_cxx::typelist::at_index::type comb_hash_fn; - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 2>::type + typedef typename __gnu_cxx::typelist::at_index::type trigger_policy; - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 3>::type + typedef typename __gnu_cxx::typelist::at_index::type size_policy; public: @@ -338,12 +301,10 @@ namespace __gnu_pbds Hash_Fn, Eq_Fn, comb_hash_fn, - __gnu_pbds::hash_standard_resize_policy< - size_policy, - trigger_policy, - true>, + __gnu_pbds::hash_standard_resize_policy, store_hash, - Allocator> + _Alloc> type; }; @@ -351,9 +312,7 @@ namespace __gnu_pbds struct no_access_generic_gp_hash_table_t { private: - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 0>::type + typedef typename __gnu_cxx::typelist::at_index::type store_hash_indicator; enum @@ -361,24 +320,16 @@ namespace __gnu_pbds store_hash = store_hash_indicator::value }; - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 1>::type + typedef typename __gnu_cxx::typelist::at_index::type probe_fn; - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 2>::type + typedef typename __gnu_cxx::typelist::at_index::type comb_probe_fn; - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 3>::type + typedef typename __gnu_cxx::typelist::at_index::type trigger_policy; - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 4>::type + typedef typename __gnu_cxx::typelist::at_index::type size_policy; public: @@ -390,12 +341,10 @@ namespace __gnu_pbds Eq_Fn, comb_probe_fn, probe_fn, - __gnu_pbds::hash_standard_resize_policy< - size_policy, - trigger_policy, - false>, + __gnu_pbds::hash_standard_resize_policy, store_hash, - Allocator> + _Alloc> type; }; @@ -403,9 +352,7 @@ namespace __gnu_pbds struct access_generic_gp_hash_table_t { private: - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 0>::type + typedef typename __gnu_cxx::typelist::at_index::type store_hash_indicator; enum @@ -413,24 +360,16 @@ namespace __gnu_pbds store_hash = store_hash_indicator::value }; - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 1>::type + typedef typename __gnu_cxx::typelist::at_index::type probe_fn; - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 2>::type + typedef typename __gnu_cxx::typelist::at_index::type comb_probe_fn; - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 3>::type + typedef typename __gnu_cxx::typelist::at_index::type trigger_policy; - typedef - typename __gnu_cxx::typelist::at_index< - Policy_Tl, 4>::type + typedef typename __gnu_cxx::typelist::at_index::type size_policy; public: @@ -442,12 +381,10 @@ namespace __gnu_pbds Eq_Fn, comb_probe_fn, probe_fn, - __gnu_pbds::hash_standard_resize_policy< - size_policy, - trigger_policy, - true>, + __gnu_pbds::hash_standard_resize_policy, store_hash, - Allocator> + _Alloc> type; }; @@ -512,19 +449,15 @@ namespace __gnu_pbds class Comb_Probe_Fn_TL, class Eq_Fn = std::equal_to, - class Allocator = - std::allocator< - std::pair< - const Key, - Data> > > + typename _Alloc = std::allocator > > struct ranged_hash_common_types { private: - typedef typename Allocator::size_type size_type; + typedef typename _Alloc::size_type size_type; typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_< - Allocator, + _Alloc, 1, 8, 1, 2, false> @@ -532,7 +465,7 @@ namespace __gnu_pbds typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_< - Allocator, + _Alloc, 1, 8, 1, 1, false> @@ -541,14 +474,14 @@ namespace __gnu_pbds typedef __gnu_pbds::hash_standard_resize_policy< __gnu_pbds::test::hash_exponential_size_policy_t_< - Allocator>, + _Alloc>, no_access_half_load_check_resize_trigger_policy> mask_half_resize_policy_t; typedef __gnu_pbds::hash_standard_resize_policy< __gnu_pbds::test::hash_exponential_size_policy_t_< - Allocator>, + _Alloc>, no_access_one_load_check_resize_trigger_policy> mask_one_resize_policy_t; @@ -567,18 +500,14 @@ namespace __gnu_pbds template struct half_resize_policy_selector; - template - struct half_resize_policy_selector< - __gnu_pbds::test::direct_mask_range_hashing_t_< - Allocator_> > + template + struct half_resize_policy_selector<__gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc_> > { typedef mask_half_resize_policy_t type; }; - template - struct half_resize_policy_selector< - __gnu_pbds::test::direct_mod_range_hashing_t_< - Allocator_> > + template + struct half_resize_policy_selector<__gnu_pbds::test::direct_mod_range_hashing_t_<_Alloc_> > { typedef mod_half_resize_policy_t type; }; @@ -586,18 +515,14 @@ namespace __gnu_pbds template struct one_resize_policy_selector; - template - struct one_resize_policy_selector< - __gnu_pbds::test::direct_mask_range_hashing_t_< - Allocator_> > + template + struct one_resize_policy_selector<__gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc_> > { typedef mask_one_resize_policy_t type; }; - template - struct one_resize_policy_selector< - __gnu_pbds::test::direct_mod_range_hashing_t_< - Allocator_> > + template + struct one_resize_policy_selector<__gnu_pbds::test::direct_mod_range_hashing_t_<_Alloc_> > { typedef mod_one_resize_policy_t type; }; @@ -609,13 +534,11 @@ namespace __gnu_pbds __gnu_pbds::cc_hash_table< Key, Data, - __gnu_pbds::null_hash_fn, + __gnu_pbds::null_type, Eq_Fn, Comb_Hash_Fn, - typename one_resize_policy_selector< - typename Comb_Hash_Fn::comb_fn>::type, - false, - Allocator> + typename one_resize_policy_selector::type, + false, _Alloc> type; }; @@ -632,14 +555,13 @@ namespace __gnu_pbds __gnu_pbds::gp_hash_table< Key, Data, - __gnu_pbds::null_hash_fn, + __gnu_pbds::null_type, Eq_Fn, Comb_Probe_Fn, - __gnu_pbds::null_probe_fn, - typename half_resize_policy_selector< - typename Comb_Probe_Fn::comb_fn>::type, + __gnu_pbds::null_type, + typename half_resize_policy_selector::type, false, - Allocator> + _Alloc> type; }; @@ -658,16 +580,15 @@ namespace __gnu_pbds }; template, - class Allocator = - std::allocator > + typename _Alloc = std::allocator > class lu_common_types { private: - typedef typename Allocator::size_type size_type; + typedef typename _Alloc::size_type size_type; - typedef __gnu_pbds::test::move_to_front_lu_policy_t_ mtf_u; + typedef __gnu_pbds::test::lu_move_to_front_policy_t_ mtf_u; - typedef __gnu_pbds::test::counter_lu_policy_t_ cnt_5_u; + typedef __gnu_pbds::test::lu_counter_policy_t_<_Alloc, 5> cnt_5_u; typedef typename __gnu_cxx::typelist::create1::type lu_policy0; @@ -687,20 +608,17 @@ namespace __gnu_pbds public: typedef - __gnu_pbds::list_update + __gnu_pbds::list_update type; }; typedef - typename __gnu_cxx::typelist::transform< - lu_policies, + typename __gnu_cxx::typelist::transform::type lu_types; typedef - typename __gnu_cxx::typelist::at_index< - lu_types, - 0>::type + typename __gnu_cxx::typelist::at_index::type min_lu_type; public: @@ -711,12 +629,12 @@ namespace __gnu_pbds }; template, - template - class Node_Update = __gnu_pbds::null_tree_node_update, - class Allocator = std::allocator > > + typename _Alloc_> + class Node_Update = __gnu_pbds::null_node_update, + typename _Alloc = std::allocator > > struct tree_common_types { private: @@ -727,7 +645,7 @@ namespace __gnu_pbds Cmp_Fn, __gnu_pbds::ov_tree_tag, Node_Update, - Allocator> + _Alloc> ov_tree_assoc_container_t; typedef @@ -737,7 +655,7 @@ namespace __gnu_pbds Cmp_Fn, __gnu_pbds::rb_tree_tag, Node_Update, - Allocator> + _Alloc> rb_tree_assoc_container_t; typedef @@ -747,7 +665,7 @@ namespace __gnu_pbds Cmp_Fn, __gnu_pbds::splay_tree_tag, Node_Update, - Allocator> + _Alloc> splay_tree_assoc_container_t; public: @@ -773,19 +691,19 @@ namespace __gnu_pbds template::type, + class _ATraits = + typename __gnu_pbds::detail::default_trie_access_traits::type, class Tag = __gnu_pbds::pat_trie_tag, - template - class Node_Update = __gnu_pbds::null_trie_node_update, - class Allocator = std::allocator > + template + class Node_Update = __gnu_pbds::null_node_update, + typename _Alloc = std::allocator > class trie_common_types { private: - typedef __gnu_pbds::trie type; + typedef __gnu_pbds::trie type; public: typedef typename __gnu_cxx::typelist::create1::type performance_tl; diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/ds_string_form.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/ds_string_form.hpp index 9ee5c4d..b765045 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/ds_string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/ds_string_form.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 @@ -139,7 +139,7 @@ namespace __gnu_pbds const std::string node_update_str = make_xml_tag("Node_Update", "value",(tree_supports_order_statistics::value ? - "tree_order_statistics_node_update" : "null_tree_node_update")); + "tree_order_statistics_node_update" : "null_node_update")); return make_xml_tag("type", "value", "tree", category_str + node_update_str); } @@ -239,7 +239,7 @@ namespace __gnu_pbds else if (trie_supports_prefix_search::value) s = "trie_prefix_search_node_update"; else - s = "null_trie_node_update"; + s = "null_node_update"; std::string node_s = make_xml_tag("Node_Update", "value", s); return make_xml_tag("type", "value", "trie", category_s + node_s); } diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/list_update_policy_string_form.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/list_update_policy_string_form.hpp index ed3747f..9f3e6bd 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/list_update_policy_string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/list_update_policy_string_form.hpp @@ -54,7 +54,7 @@ namespace __gnu_pbds struct lu_policy_string_form; template<> - struct lu_policy_string_form + struct lu_policy_string_form { static std::string name() @@ -64,12 +64,12 @@ namespace __gnu_pbds desc() { return make_xml_tag("Update_Policy", "value", - "move_to_front_lu_policy"); + "lu_move_to_front_policy"); } }; - template - struct lu_policy_string_form > + template + struct lu_policy_string_form > { static std::string name() @@ -82,7 +82,7 @@ namespace __gnu_pbds static std::string desc() { - return (make_xml_tag("Update_Policy", "value", "counter_lu_policy", + return (make_xml_tag("Update_Policy", "value", "lu_counter_policy", "Max_Count", Max_Count)); } }; diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/probe_fn_string_form.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/probe_fn_string_form.hpp index 15cbbfd..cb874d2 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/probe_fn_string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/probe_fn_string_form.hpp @@ -53,8 +53,8 @@ namespace __gnu_pbds template struct probe_fn_string_form; - template - struct probe_fn_string_form > + template + struct probe_fn_string_form > { static std::string name() @@ -65,8 +65,8 @@ namespace __gnu_pbds { return make_xml_tag("Probe_Fn", "value", "linear_probe_fn"); } }; - template - struct probe_fn_string_form > + template + struct probe_fn_string_form > { static std::string name() @@ -78,7 +78,7 @@ namespace __gnu_pbds }; template<> - struct probe_fn_string_form<__gnu_pbds::null_probe_fn> + struct probe_fn_string_form<__gnu_pbds::null_type> { static std::string name() @@ -86,7 +86,7 @@ namespace __gnu_pbds static std::string desc() - { return make_xml_tag("Probe_Fn", "value", "null_probe_fn"); } + { return make_xml_tag("Probe_Fn", "value", "null_type"); } }; } // namespace detail diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/size_policy_string_form.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/size_policy_string_form.hpp index d2b61fa..65655d7 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/size_policy_string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/size_policy_string_form.hpp @@ -55,9 +55,9 @@ namespace __gnu_pbds template struct size_policy_string_form; - template + template struct size_policy_string_form< - __gnu_pbds::test::hash_exponential_size_policy_t_ > + __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> > { static std::string name() diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/tree_supports_order_statistics.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/tree_supports_order_statistics.hpp index 80c1abe..a632279 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/tree_supports_order_statistics.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/tree_supports_order_statistics.hpp @@ -56,7 +56,7 @@ namespace __gnu_pbds value = __gnu_pbds::detail::is_same< typename Tree_Cntnr::node_update, __gnu_pbds::tree_order_statistics_node_update< - typename Tree_Cntnr::const_node_iterator, + typename Tree_Cntnr::node_const_iterator, typename Tree_Cntnr::node_iterator, typename Tree_Cntnr::cmp_fn, typename Tree_Cntnr::allocator_type> >::value diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_order_statistics.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_order_statistics.hpp index fc9cacc..925be58 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_order_statistics.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_order_statistics.hpp @@ -56,9 +56,9 @@ namespace __gnu_pbds value = __gnu_pbds::detail::is_same< typename Tree_Cntnr::node_update, __gnu_pbds::trie_order_statistics_node_update< - typename Tree_Cntnr::const_node_iterator, + typename Tree_Cntnr::node_const_iterator, typename Tree_Cntnr::node_iterator, - typename Tree_Cntnr::e_access_traits, + typename Tree_Cntnr::access_traits, typename Tree_Cntnr::allocator_type> >::value }; }; diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_prefix_search.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_prefix_search.hpp index 20c5210..b73335e 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_prefix_search.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_prefix_search.hpp @@ -56,9 +56,9 @@ namespace __gnu_pbds value = __gnu_pbds::detail::is_same< typename Tree_Cntnr::node_update, __gnu_pbds::trie_prefix_search_node_update< - typename Tree_Cntnr::const_node_iterator, + typename Tree_Cntnr::node_const_iterator, typename Tree_Cntnr::node_iterator, - typename Tree_Cntnr::e_access_traits, + typename Tree_Cntnr::access_traits, typename Tree_Cntnr::allocator_type> >::value }; }; diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/trigger_policy_string_form.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/trigger_policy_string_form.hpp index be4fe26..0d98fea 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/trigger_policy_string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/trigger_policy_string_form.hpp @@ -53,15 +53,15 @@ namespace __gnu_pbds template struct trigger_policy_string_form; - template struct trigger_policy_string_form< __gnu_pbds::test::hash_load_check_resize_trigger_t_< - Allocator, + _Alloc, Min_Load_Nom, Min_Load_Denom, Max_Load_Nom, @@ -95,13 +95,13 @@ namespace __gnu_pbds } }; - template struct trigger_policy_string_form< __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_< - Allocator, + _Alloc, Load_Nom, Load_Denom, External_Access> > diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/native_set.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/native_set.hpp index a2655fe..bcee0a8 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/native_set.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/native_set.hpp @@ -47,11 +47,11 @@ namespace __gnu_pbds namespace test { template, - class Allocator = std::allocator > + typename _Alloc = std::allocator > class native_set : public PB_DS_BASE_C_DEC { private: - typedef std::set::other> base_type; + typedef std::set::other> base_type; public: typedef native_tree_tag container_category; diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/string_form.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/string_form.hpp index d7825ac..35e7ddd 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/string_form.hpp @@ -109,11 +109,11 @@ namespace __gnu_pbds { return (""); } static std::string - name(__gnu_pbds::null_mapped_type) + name(__gnu_pbds::null_type) { return ("set"); } static std::string - desc(__gnu_pbds::null_mapped_type) + desc(__gnu_pbds::null_type) { return (""); } public: diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/template_policy.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/template_policy.hpp index 86db029..14d20dc 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/template_policy.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/template_policy.hpp @@ -46,33 +46,33 @@ namespace __gnu_pbds { namespace test { - template + template struct direct_mask_range_hashing_t_ - : public __gnu_pbds::direct_mask_range_hashing + : public __gnu_pbds::direct_mask_range_hashing { - typedef typename Allocator::size_type size_type; + typedef typename _Alloc::size_type size_type; typedef __gnu_pbds::direct_mask_range_hashing base_type; }; - template + template struct direct_mod_range_hashing_t_ - : public __gnu_pbds::direct_mod_range_hashing + : public __gnu_pbds::direct_mod_range_hashing { - typedef typename Allocator::size_type size_type; + typedef typename _Alloc::size_type size_type; typedef __gnu_pbds::direct_mod_range_hashing base_type; }; - template struct hash_load_check_resize_trigger_t_ : public __gnu_pbds::hash_load_check_resize_trigger + typename _Alloc::size_type> { - typedef typename Allocator::size_type size_type; + typedef typename _Alloc::size_type size_type; typedef __gnu_pbds::hash_load_check_resize_trigger base_type; inline @@ -87,15 +87,15 @@ namespace __gnu_pbds }; }; - template struct cc_hash_max_collision_check_resize_trigger_t_ : public __gnu_pbds::cc_hash_max_collision_check_resize_trigger + typename _Alloc::size_type> { - typedef typename Allocator::size_type size_type; + typedef typename _Alloc::size_type size_type; typedef __gnu_pbds::cc_hash_max_collision_check_resize_trigger base_type; inline @@ -113,30 +113,30 @@ namespace __gnu_pbds struct hash_prime_size_policy_t_ : public __gnu_pbds::hash_prime_size_policy { }; - template + template struct hash_exponential_size_policy_t_ - : public __gnu_pbds::hash_exponential_size_policy + : public __gnu_pbds::hash_exponential_size_policy { }; - template + template struct linear_probe_fn_t_ - : public __gnu_pbds::linear_probe_fn + : public __gnu_pbds::linear_probe_fn { }; - template + template struct quadratic_probe_fn_t_ - : public __gnu_pbds::quadratic_probe_fn + : public __gnu_pbds::quadratic_probe_fn { }; - template - struct counter_lu_policy_t_ - : public __gnu_pbds::counter_lu_policy + template + struct lu_counter_policy_t_ + : public __gnu_pbds::lu_counter_policy { - typedef __gnu_pbds::counter_lu_policy base_type; + typedef __gnu_pbds::lu_counter_policy base_type; }; - struct move_to_front_lu_policy_t_ - : public __gnu_pbds::move_to_front_lu_policy<> + struct lu_move_to_front_policy_t_ + : public __gnu_pbds::lu_move_to_front_policy<> { }; } // namespace test } // namespace __gnu_pbds diff --git a/libstdc++-v3/testsuite/util/common_type/priority_queue/common_type.hpp b/libstdc++-v3/testsuite/util/common_type/priority_queue/common_type.hpp index cc79b3e..b486c8c9 100644 --- a/libstdc++-v3/testsuite/util/common_type/priority_queue/common_type.hpp +++ b/libstdc++-v3/testsuite/util/common_type/priority_queue/common_type.hpp @@ -46,19 +46,19 @@ namespace __gnu_pbds namespace test { template, - class Allocator = std::allocator > + typename _Alloc = std::allocator > struct pq_common_types { private: - typedef __gnu_pbds::priority_queue pairing_heap_t; + typedef __gnu_pbds::priority_queue pairing_heap_t; - typedef __gnu_pbds::priority_queue binomial_heap_t; + typedef __gnu_pbds::priority_queue binomial_heap_t; - typedef __gnu_pbds::priority_queue rc_binomial_heap_t; + typedef __gnu_pbds::priority_queue rc_binomial_heap_t; - typedef __gnu_pbds::priority_queue binary_heap_t; + typedef __gnu_pbds::priority_queue binary_heap_t; - typedef __gnu_pbds::priority_queue thin_heap_t; + typedef __gnu_pbds::priority_queue thin_heap_t; typedef typename __gnu_cxx::typelist::create5::type all_tl; diff --git a/libstdc++-v3/testsuite/util/native_type/native_hash_map.hpp b/libstdc++-v3/testsuite/util/native_type/native_hash_map.hpp index 6fa3667..acfa584c 100644 --- a/libstdc++-v3/testsuite/util/native_type/native_hash_map.hpp +++ b/libstdc++-v3/testsuite/util/native_type/native_hash_map.hpp @@ -50,7 +50,7 @@ namespace __gnu_pbds { #define PB_DS_BASE_C_DEC \ std::tr1::__unordered_map >::other, Cache_Hash> + typename _Alloc::template rebind >::other, Cache_Hash> template::type, typename Eq_Fn = std::equal_to, typename Less_Fn = std::less, - typename Allocator = std::allocator, bool Cache_Hash = false + typename _Alloc = std::allocator, bool Cache_Hash = false > class native_hash_map : public PB_DS_BASE_C_DEC { diff --git a/libstdc++-v3/testsuite/util/native_type/native_hash_multimap.hpp b/libstdc++-v3/testsuite/util/native_type/native_hash_multimap.hpp index 8273edf..8008a0e 100644 --- a/libstdc++-v3/testsuite/util/native_type/native_hash_multimap.hpp +++ b/libstdc++-v3/testsuite/util/native_type/native_hash_multimap.hpp @@ -49,7 +49,7 @@ namespace __gnu_pbds namespace test { #define PB_DS_BASE_C_DEC \ - std::tr1::unordered_multimap + std::tr1::unordered_multimap template::type, class Eq_Fn = std::equal_to, class Less_Fn = std::less, - class Allocator = std::allocator > + typename _Alloc = std::allocator > class native_hash_multimap : public PB_DS_BASE_C_DEC { private: @@ -66,7 +66,7 @@ namespace __gnu_pbds public: typedef native_hash_tag container_category; - typedef Allocator allocator; + typedef _Alloc allocator; typedef typename base_type::iterator iterator; typedef typename base_type::const_iterator const_iterator; diff --git a/libstdc++-v3/testsuite/util/native_type/native_hash_set.hpp b/libstdc++-v3/testsuite/util/native_type/native_hash_set.hpp index d3f4596..dac0c11 100644 --- a/libstdc++-v3/testsuite/util/native_type/native_hash_set.hpp +++ b/libstdc++-v3/testsuite/util/native_type/native_hash_set.hpp @@ -50,14 +50,14 @@ namespace __gnu_pbds { #define PB_DS_BASE_C_DEC \ std::tr1::__unordered_set::other, Cache_Hash> + typename _Alloc::template rebind::other, Cache_Hash> template::type, typename Eq_Fn = std::equal_to, typename Less_Fn = std::less, - typename Allocator = std::allocator, bool Cache_Hash = false + typename _Alloc = std::allocator, bool Cache_Hash = false > class native_hash_set : public PB_DS_BASE_C_DEC { diff --git a/libstdc++-v3/testsuite/util/native_type/native_map.hpp b/libstdc++-v3/testsuite/util/native_type/native_map.hpp index 29170ca..0fae6b1 100644 --- a/libstdc++-v3/testsuite/util/native_type/native_map.hpp +++ b/libstdc++-v3/testsuite/util/native_type/native_map.hpp @@ -50,10 +50,10 @@ namespace __gnu_pbds { #define PB_DS_BASE_C_DEC \ std::map >::other > +typename _Alloc::template rebind >::other > template, - class Allocator = std::allocator > + typename _Alloc = std::allocator > class native_map : public PB_DS_BASE_C_DEC { private: diff --git a/libstdc++-v3/testsuite/util/native_type/native_multimap.hpp b/libstdc++-v3/testsuite/util/native_type/native_multimap.hpp index 4bda556..c29bfb6 100644 --- a/libstdc++-v3/testsuite/util/native_type/native_multimap.hpp +++ b/libstdc++-v3/testsuite/util/native_type/native_multimap.hpp @@ -48,10 +48,10 @@ namespace __gnu_pbds { #define PB_DS_BASE_C_DEC \ std::multimap >::other> + typename _Alloc::template rebind >::other> template, - class Allocator = std::allocator > + typename _Alloc = std::allocator > class native_multimap : public PB_DS_BASE_C_DEC { private: @@ -60,10 +60,10 @@ namespace __gnu_pbds public: typedef native_tree_tag container_category; - typedef Allocator allocator; + typedef _Alloc allocator; typedef - typename Allocator::template rebind< + typename _Alloc::template rebind< std::pair >::other::const_reference const_reference; diff --git a/libstdc++-v3/testsuite/util/native_type/native_priority_queue.hpp b/libstdc++-v3/testsuite/util/native_type/native_priority_queue.hpp index dad913f..b2c7941 100644 --- a/libstdc++-v3/testsuite/util/native_type/native_priority_queue.hpp +++ b/libstdc++-v3/testsuite/util/native_type/native_priority_queue.hpp @@ -51,21 +51,21 @@ namespace __gnu_pbds { namespace detail { - template + template struct base_seq { private: - typedef typename Allocator::template rebind value_rebind; + typedef typename _Alloc::template rebind value_rebind; public: typedef std::vector type; }; - template - struct base_seq + template + struct base_seq { private: - typedef typename Allocator::template rebind value_rebind; + typedef typename _Alloc::template rebind value_rebind; public: typedef std::deque type; @@ -76,20 +76,20 @@ namespace __gnu_pbds { }; #define PB_DS_CLASS_C_DEC \ - native_priority_queue + native_priority_queue #define PB_DS_BASE_C_DEC \ - std::priority_queue::type, Cmp_Fn> + std::priority_queue::type, Cmp_Fn> template, - typename Allocator = std::allocator > + typename _Alloc = std::allocator > class native_priority_queue : public PB_DS_BASE_C_DEC { private: typedef PB_DS_BASE_C_DEC base_type; - typedef typename Allocator::template rebind value_rebind; + typedef typename _Alloc::template rebind value_rebind; public: typedef Value_Type value_type; diff --git a/libstdc++-v3/testsuite/util/native_type/native_set.hpp b/libstdc++-v3/testsuite/util/native_type/native_set.hpp index c9f448b..c4909c7 100644 --- a/libstdc++-v3/testsuite/util/native_type/native_set.hpp +++ b/libstdc++-v3/testsuite/util/native_type/native_set.hpp @@ -48,10 +48,10 @@ namespace __gnu_pbds namespace test { #define PB_DS_BASE_C_DEC \ - std::set::other> + std::set::other> template, - class Allocator = std::allocator > + typename _Alloc = std::allocator > class native_set : public PB_DS_BASE_C_DEC { private: diff --git a/libstdc++-v3/testsuite/util/performance/assoc/multimap_common_type.hpp b/libstdc++-v3/testsuite/util/performance/assoc/multimap_common_type.hpp index e31abe1..b4b07ea 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/multimap_common_type.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/multimap_common_type.hpp @@ -53,35 +53,35 @@ namespace __gnu_pbds { return (static_cast(i)); } }; - template > + template > struct hash_set_tl_t { typedef typename __gnu_pbds::test::hash_common_types< Key, - __gnu_pbds::null_mapped_type, + __gnu_pbds::null_type, int_hash, std::equal_to, - Allocator>::performance_min_tl + _Alloc>::performance_min_tl type; }; - template > + template > struct lu_set_tl_t { typedef typename __gnu_pbds::test::lu_common_types< Key, - __gnu_pbds::null_mapped_type, + __gnu_pbds::null_type, std::equal_to< Key>, - Allocator>::performance_min_tl + _Alloc>::performance_min_tl type; }; template > + typename _Alloc = std::allocator > struct hash_mmap_tl_t { private: @@ -104,7 +104,7 @@ namespace __gnu_pbds hash_fn_t, std::equal_to< Key>, - Allocator>::performance_min_tl + _Alloc>::performance_min_tl type; }; @@ -119,7 +119,7 @@ namespace __gnu_pbds template > + typename _Alloc = std::allocator > struct tree_mmap_tl_t { private: @@ -132,8 +132,8 @@ namespace __gnu_pbds Cntnr_T, std::less< Key>, - __gnu_pbds::null_tree_node_update, - Allocator>::performance_min_tl + __gnu_pbds::null_node_update, + _Alloc>::performance_min_tl type; }; @@ -146,65 +146,65 @@ namespace __gnu_pbds type; }; - template + template struct hash_hash_mmap_tl_t { private: - typedef typename hash_set_tl_t::type sec_tl_t; + typedef typename hash_set_tl_t::type sec_tl_t; public: - typedef typename hash_mmap_tl_t::type type; + typedef typename hash_mmap_tl_t::type type; }; - template + template struct tree_hash_mmap_tl_t { private: - typedef typename hash_set_tl_t::type sec_tl_t; + typedef typename hash_set_tl_t::type sec_tl_t; public: - typedef typename tree_mmap_tl_t::type type; + typedef typename tree_mmap_tl_t::type type; }; - template + template struct tree_lu_mmap_tl_t { private: - typedef typename lu_set_tl_t::type sec_tl_t; + typedef typename lu_set_tl_t::type sec_tl_t; public: - typedef typename tree_mmap_tl_t::type type; + typedef typename tree_mmap_tl_t::type type; }; - template + template struct hash_lu_mmap_tl_t { private: - typedef typename lu_set_tl_t::type sec_tl_t; + typedef typename lu_set_tl_t::type sec_tl_t; public: - typedef typename hash_mmap_tl_t::type type; + typedef typename hash_mmap_tl_t::type type; }; } // namespace detail - template + template struct mmap_tl_t { private: typedef - typename detail::hash_hash_mmap_tl_t::type + typename detail::hash_hash_mmap_tl_t::type hh_mmap_tl_t; typedef - typename detail::hash_lu_mmap_tl_t::type + typename detail::hash_lu_mmap_tl_t::type hl_mmap_tl_t; typedef - typename detail::tree_hash_mmap_tl_t::type + typename detail::tree_hash_mmap_tl_t::type th_mmap_tl_t; typedef - typename detail::tree_lu_mmap_tl_t::type + typename detail::tree_lu_mmap_tl_t::type tl_mmap_tl_t; public: diff --git a/libstdc++-v3/testsuite/util/performance/assoc/timing/common_type.hpp b/libstdc++-v3/testsuite/util/performance/assoc/timing/common_type.hpp index a553afe..298443d 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/timing/common_type.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/timing/common_type.hpp @@ -48,7 +48,7 @@ namespace __gnu_pbds typedef __gnu_pbds::test::hash_common_types< int, - __gnu_pbds::null_mapped_type>::tl + __gnu_pbds::null_type>::tl hash_set_tl_t; template @@ -72,7 +72,7 @@ namespace __gnu_pbds typedef __gnu_pbds::test::tree_common_types< int, - __gnu_pbds::null_mapped_type>::tl + __gnu_pbds::null_type>::tl tree_set_tl_t; template diff --git a/libstdc++-v3/testsuite/util/performance/assoc/timing/multimap_find_test.hpp b/libstdc++-v3/testsuite/util/performance/assoc/timing/multimap_find_test.hpp index 7e3f95b..18d2c6b 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/timing/multimap_find_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/timing/multimap_find_test.hpp @@ -60,7 +60,7 @@ namespace __gnu_pbds operator()(std::size_t resolution) { size_t not_found_count = 0; - typedef typename Cntnr::const_point_iterator iterator_type; + typedef typename Cntnr::point_const_iterator iterator_type; for (std::size_t i = 0; i < resolution; ++i) { iterator_type end = m_r_container.end(); diff --git a/libstdc++-v3/testsuite/util/regression/common_type.hpp b/libstdc++-v3/testsuite/util/regression/common_type.hpp index 37705bc..bcfc3bc 100644 --- a/libstdc++-v3/testsuite/util/regression/common_type.hpp +++ b/libstdc++-v3/testsuite/util/regression/common_type.hpp @@ -1,6 +1,6 @@ // -*- C++ -*- -// Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2008, 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 @@ -64,13 +64,13 @@ namespace test } }; - typedef __gnu_pbds::string_trie_e_access_traits e_access_traits_t; + typedef __gnu_pbds::trie_string_access_traits access_traits_t; template struct tree_types { private: - typedef typename tree_common_types, __gnu_pbds::null_tree_node_update, alloc_type>::regression_tl no_order_statistics_tl_t; + typedef typename tree_common_types, __gnu_pbds::null_node_update, alloc_type>::regression_tl no_order_statistics_tl_t; typedef typename tree_common_types, __gnu_pbds::tree_order_statistics_node_update, alloc_type>::regression_tl order_statistics_tl_t; @@ -84,11 +84,11 @@ namespace test struct trie_types { private: - typedef typename trie_common_types::regression_tl no_updates_tl_t; + typedef typename trie_common_types::regression_tl no_updates_tl_t; - typedef typename trie_common_types::regression_tl order_statistics_tl_t; + typedef typename trie_common_types::regression_tl order_statistics_tl_t; - typedef typename trie_common_types::regression_tl prefix_search_tl_t; + typedef typename trie_common_types::regression_tl prefix_search_tl_t; public: typedef typename __gnu_cxx::typelist::append::type>::type tl_t; @@ -160,32 +160,27 @@ namespace test }; - namespace detail - { - - }; - typedef vector_adaptor vector_type; typedef __gnu_cxx::typelist::create1::type vector_tl_t; // Associative types. - typedef tree_types::tl_t tree_set_tl_t; - typedef tree_types::min_tl_t min_tree_set_tl_t; + typedef tree_types::tl_t tree_set_tl_t; + typedef tree_types::min_tl_t min_tree_set_tl_t; typedef tree_types::tl_t tree_map_tl_t; typedef tree_types::min_tl_t min_tree_map_tl_t; - typedef hash_types::tl_t hash_set_tl_t; - typedef hash_types::min_tl_t min_hash_set_tl_t; + typedef hash_types::tl_t hash_set_tl_t; + typedef hash_types::min_tl_t min_hash_set_tl_t; typedef hash_types::tl_t hash_map_tl_t; typedef hash_types::min_tl_t min_hash_map_tl_t; - typedef lu_types::tl_t lu_set_tl_t; - typedef lu_types::min_tl_t min_lu_set_tl_t; + typedef lu_types::tl_t lu_set_tl_t; + typedef lu_types::min_tl_t min_lu_set_tl_t; typedef lu_types::tl_t lu_map_tl_t; typedef lu_types::min_tl_t min_lu_map_tl_t; - typedef trie_types::tl_t trie_set_tl_t; - typedef trie_types::min_tl_t min_trie_set_tl_t; + typedef trie_types::tl_t trie_set_tl_t; + typedef trie_types::min_tl_t min_trie_set_tl_t; typedef trie_types::tl_t trie_map_tl_t; typedef trie_types::min_tl_t min_trie_map_tl_t; } // namespace test diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.h b/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.h index ca44332..48823bf 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.h +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.h @@ -75,7 +75,7 @@ namespace detail typedef typename cntnr::size_type size_type; typedef regression_test_traits test_traits; typedef typename test_traits::key_type key_type; - typedef typename test_traits::const_key_reference const_key_reference; + typedef typename test_traits::key_const_reference key_const_reference; typedef typename test_traits::value_type value_type; typedef typename test_traits::native_type native_type; typedef twister_rand_gen gen; diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.tcc b/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.tcc index 0f15866..7cc724a 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.tcc +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.tcc @@ -131,7 +131,7 @@ assignment_operator() try { p_c = new Cntnr(); - * p_c =* m_p_c; + *p_c = *m_p_c; std::swap(p_c, m_p_c); } catch(__gnu_cxx::forced_error&) @@ -379,12 +379,12 @@ it_constructor_imp(__gnu_pbds::pat_trie_tag) switch(get_next_sub_op(2)) { case 0: - p_c = new Cntnr(m_p_c->get_e_access_traits()); + p_c = new Cntnr(m_p_c->get_access_traits()); m_native_c.clear(); break; case 1: p_c = new Cntnr(m_p_c->begin(), m_p_c->end(), - m_p_c->get_e_access_traits()); + m_p_c->get_access_traits()); break; default: PB_DS_THROW_IF_FAILED(false, "", m_p_c, &m_native_c); @@ -450,7 +450,7 @@ basic_cmp_(const Cntnr& r_c, const native_type& r_native_c) m_alloc.set_probability(0); const key_type k = native_key; m_alloc.set_probability(1); - typename cntnr::const_point_iterator found_it = r_c.find(k); + typename cntnr::point_const_iterator found_it = r_c.find(k); PB_DS_THROW_IF_FAILED(found_it != r_c.end(), test_traits::native_val_to_string(*it), &r_c, &r_native_c); @@ -482,7 +482,7 @@ cmp_(const Cntnr& r_c, const native_type& r_native_c) prefix_search = test_traits::prefix_search, has_mapped = !__gnu_pbds::detail::is_same< typename Cntnr::mapped_type, - __gnu_pbds::null_mapped_type>::value + __gnu_pbds::null_type>::value }; order_preserving_cmp_imp(r_c, r_native_c, @@ -960,16 +960,16 @@ operator()() break; case 1: PB_DS_RUN_MTHD(copy_constructor) - break; + break; case 2: PB_DS_RUN_MTHD(it_constructor) - break; + break; case 3: PB_DS_RUN_MTHD(assignment_operator) - break; + break; case 4: PB_DS_RUN_MTHD(split_join) - break; + break; case 5: resize(); break; @@ -1072,8 +1072,8 @@ insert() m_alloc.set_probability(0); value_type v = test_traits::generate_value(m_g, m_m); m_alloc.set_probability(m_tp); - const_key_reference r_k = test_traits::extract_key(v); - typename cntnr::const_point_iterator found_it = m_p_c->find(r_k); + key_const_reference r_k = test_traits::extract_key(v); + typename cntnr::point_const_iterator found_it = m_p_c->find(r_k); const bool existed = (found_it != m_p_c->end()); const std::pair ins_ret = m_p_c->insert(v); @@ -1113,7 +1113,7 @@ subscript() enum { no_data = __gnu_pbds::detail::is_same< - typename Cntnr::const_key_reference, + typename Cntnr::key_const_reference, typename Cntnr::const_reference>::value }; @@ -1161,7 +1161,7 @@ subscript_imp(__gnu_pbds::detail::true_type) m_alloc.set_probability(0); value_type v = test_traits::generate_value(m_g, m_m); m_alloc.set_probability(m_tp); - (*m_p_c)[v] = __gnu_pbds::null_mapped_type(); + (*m_p_c)[v] = __gnu_pbds::null_type(); m_native_c.insert(test_traits::native_value(v)); } catch(__gnu_cxx::forced_error&) @@ -1431,9 +1431,9 @@ key_defs() { typedef typename Cntnr::key_type test_key_type; typedef typename Cntnr::key_reference test_key_reference; - typedef typename Cntnr::const_key_reference test_const_key_reference; + typedef typename Cntnr::key_const_reference test_key_const_reference; typedef typename Cntnr::key_pointer test_key_pointer; - typedef typename Cntnr::const_key_pointer test_const_key_pointer; + typedef typename Cntnr::key_const_pointer test_key_const_pointer; } PB_DS_CLASS_T_DEC @@ -1443,9 +1443,9 @@ mapped_defs() { typedef typename Cntnr::mapped_type test_mapped_type; typedef typename Cntnr::mapped_reference test_mapped_reference; - typedef typename Cntnr::const_mapped_reference test_const_mapped_reference; + typedef typename Cntnr::mapped_const_reference test_mapped_const_reference; typedef typename Cntnr::mapped_pointer test_mapped_pointer; - typedef typename Cntnr::const_mapped_pointer test_const_mapped_pointer; + typedef typename Cntnr::mapped_const_pointer test_mapped_const_pointer; } PB_DS_CLASS_T_DEC @@ -1490,7 +1490,7 @@ PB_DS_CLASS_C_DEC:: iterator_defs() { typedef typename Cntnr::point_iterator test_point_iterator; - typedef typename Cntnr::const_point_iterator const_test_point_iterator; + typedef typename Cntnr::point_const_iterator const_test_point_iterator; typedef typename Cntnr::iterator test_iterator; typedef typename Cntnr::const_iterator const_test_iterator; } @@ -1507,7 +1507,7 @@ PB_DS_CLASS_C_DEC:: node_iterator_defs(__gnu_pbds::detail::true_type) { typedef typename Cntnr::node_iterator test_node_iterator; - typedef typename Cntnr::const_node_iterator test_const_node_iterator; + typedef typename Cntnr::node_const_iterator test_node_const_iterator; } PB_DS_CLASS_T_DEC @@ -1571,7 +1571,7 @@ void PB_DS_CLASS_C_DEC:: policy_defs(__gnu_pbds::pat_trie_tag) { - typedef typename Cntnr::e_access_traits e_access_traits; + typedef typename Cntnr::access_traits access_traits; } @@ -1690,7 +1690,7 @@ void PB_DS_CLASS_C_DEC:: policy_access(__gnu_pbds::pat_trie_tag) { - typename Cntnr::e_access_traits& r_t = m_p_c->get_e_access_traits(); + typename Cntnr::access_traits& r_t = m_p_c->get_access_traits(); assert(&r_t); } @@ -1706,7 +1706,8 @@ split_join() split_join = container_traits::order_preserving }; - return (split_join_imp(__gnu_pbds::detail::integral_constant())); + typedef __gnu_pbds::detail::integral_constant __true_type; + return split_join_imp(__true_type()); } PB_DS_CLASS_T_DEC @@ -1788,7 +1789,7 @@ it_copy() PB_DS_THROW_IF_FAILED(const_it == it, "", m_p_c, &m_native_c); PB_DS_THROW_IF_FAILED(!(const_it != it), "", m_p_c, &m_native_c); - typename cntnr::const_point_iterator const_find_it(it); + typename cntnr::point_const_iterator const_find_it(it); PB_DS_THROW_IF_FAILED(const_find_it == it, "", m_p_c, &m_native_c); PB_DS_THROW_IF_FAILED(!(const_find_it != it), "", m_p_c, &m_native_c); @@ -1799,14 +1800,14 @@ it_copy() { typename cntnr::const_iterator const_it = m_p_c->end(); - typename cntnr::const_point_iterator const_find_it(const_it); + typename cntnr::point_const_iterator const_find_it(const_it); PB_DS_THROW_IF_FAILED(const_find_it == const_it, "", m_p_c, &m_native_c); PB_DS_THROW_IF_FAILED(!(const_find_it != const_it), "", m_p_c, &m_native_c); } { typename cntnr::point_iterator find_it = m_p_c->end(); - typename cntnr::const_point_iterator const_find_it(find_it); + typename cntnr::point_const_iterator const_find_it(find_it); PB_DS_THROW_IF_FAILED(find_it == const_find_it, "", m_p_c, &m_native_c); PB_DS_THROW_IF_FAILED(!(find_it != const_find_it), "", m_p_c, &m_native_c); } @@ -1824,7 +1825,7 @@ it_assign() PB_DS_THROW_IF_FAILED(const_it == it, "", m_p_c, &m_native_c); PB_DS_THROW_IF_FAILED(!(const_it != it), "", m_p_c, &m_native_c); - typename cntnr::const_point_iterator const_find_it; + typename cntnr::point_const_iterator const_find_it; const_find_it = it; PB_DS_THROW_IF_FAILED(const_find_it == it, "", m_p_c, &m_native_c); PB_DS_THROW_IF_FAILED(!(const_find_it != it), "", m_p_c, &m_native_c); @@ -1837,7 +1838,7 @@ it_assign() { typename cntnr::const_iterator const_it = m_p_c->end(); - typename cntnr::const_point_iterator const_find_it; + typename cntnr::point_const_iterator const_find_it; const_find_it = const_it; PB_DS_THROW_IF_FAILED(const_find_it == const_it, "", m_p_c, &m_native_c); PB_DS_THROW_IF_FAILED(!(const_find_it != const_it), "", m_p_c, &m_native_c); @@ -1845,7 +1846,7 @@ it_assign() { typename cntnr::point_iterator find_it = m_p_c->end(); - typename cntnr::const_point_iterator const_find_it; + typename cntnr::point_const_iterator const_find_it; const_find_it = find_it; PB_DS_THROW_IF_FAILED(find_it == const_find_it, "", m_p_c, &m_native_c); PB_DS_THROW_IF_FAILED(!(find_it != const_find_it), "", m_p_c, &m_native_c); @@ -1895,7 +1896,7 @@ rev_it_copy_imp(__gnu_pbds::detail::true_type) PB_DS_THROW_IF_FAILED(const_it == it, "", m_p_c, &m_native_c); PB_DS_THROW_IF_FAILED(!(const_it != it), "", m_p_c, &m_native_c); - typename cntnr::const_point_iterator const_find_it(it); + typename cntnr::point_const_iterator const_find_it(it); PB_DS_THROW_IF_FAILED(const_find_it == it, "", m_p_c, &m_native_c); PB_DS_THROW_IF_FAILED(!(const_find_it != it), "", m_p_c, &m_native_c); @@ -1923,7 +1924,7 @@ rev_it_assign_imp(__gnu_pbds::detail::true_type) PB_DS_THROW_IF_FAILED(const_it == it, "", m_p_c, &m_native_c); PB_DS_THROW_IF_FAILED(!(const_it != it), "", m_p_c, &m_native_c); - typename cntnr::const_point_iterator const_find_it; + typename cntnr::point_const_iterator const_find_it; const_find_it = it; PB_DS_THROW_IF_FAILED(const_find_it == it, "", m_p_c, &m_native_c); PB_DS_THROW_IF_FAILED(!(const_find_it != it), "", m_p_c, &m_native_c); diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp index 5f23049..936fbf5 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp @@ -1,6 +1,7 @@ // -*- C++ -*- -// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 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 @@ -62,7 +63,10 @@ namespace detail double ep, double cp, double mp, bool d) : m_sd(seed), m_n(n), m_m(m), m_tp(tp), m_ip(ip), m_ep(ep), m_cp(cp), m_mp(mp), m_disp(d) - { } + { + if (m_disp) + xml_test_rand_regression_formatter(seed, n, m, tp, ip, ep, cp, mp); + } template void @@ -107,27 +111,22 @@ namespace detail double ep = 0.2; double cp = 0.001; double mp = 0.25; - bool disp = false; // show progress + bool disp = true; // show progress try { detail::verify_params(sd, n, m, tp, ip, ep, cp, mp, disp); } - catch (__gnu_pbds::test::illegal_input_error&) + catch(__gnu_pbds::test::illegal_input_error&) { detail::usage(name); return -1; } - catch (...) + catch(...) { return -2; }; - // XXX RAII, constructor takes bool for display - xml_test_rand_regression_formatter* p_fmt = 0; - if (disp) - p_fmt = new xml_test_rand_regression_formatter(sd, n, m, tp, ip, ep, cp, mp); - try { detail::rand_reg_test tst(sd, n, m, tp, ip, ep, cp, mp, disp); @@ -136,13 +135,9 @@ namespace detail catch (...) { std::cerr << "Test failed with seed " << sd << std::endl; - if (disp) - delete p_fmt; throw; } - if (disp) - delete p_fmt; return 0; } @@ -152,8 +147,9 @@ namespace detail usage(const std::string& name) { using namespace std; - cerr << "usage: " << name << " ['t' | 'f']" << - endl << endl; + cerr << "usage: " << name + << " ['t' | 'f']" + << endl << endl; cerr << "This test performs basic regression tests on various associative containers." "For each container, it performs a sequence of operations. At each iteration, it does " diff --git a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/container_rand_regression_test.tcc b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/container_rand_regression_test.tcc index e929f35..19cc390 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/container_rand_regression_test.tcc +++ b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/container_rand_regression_test.tcc @@ -643,7 +643,7 @@ PB_DS_CLASS_C_DEC:: iterator_defs() { typedef typename Cntnr::point_iterator test_point_iterator; - typedef typename Cntnr::const_point_iterator const_test_point_iterator; + typedef typename Cntnr::point_const_iterator const_test_point_iterator; typedef typename Cntnr::iterator test_iterator; typedef typename Cntnr::const_iterator const_test_iterator; } @@ -744,14 +744,14 @@ it_copy() { typename cntnr::const_iterator const_it = m_p_c->end(); - typename cntnr::const_point_iterator const_find_it(const_it); + typename cntnr::point_const_iterator const_find_it(const_it); _GLIBCXX_THROW_IF(const_find_it != const_it, "", m_p_c, &m_native_c); _GLIBCXX_THROW_IF(!(const_find_it == const_it), "", m_p_c, &m_native_c); } { typename cntnr::iterator it = m_p_c->end(); - typename cntnr::const_point_iterator const_find_it1(it); + typename cntnr::point_const_iterator const_find_it1(it); _GLIBCXX_THROW_IF(const_find_it1 != it, "", m_p_c, &m_native_c); _GLIBCXX_THROW_IF(!(const_find_it1 == it), "", m_p_c, &m_native_c); @@ -760,7 +760,7 @@ it_copy() _GLIBCXX_THROW_IF(!(find_it1 == it), "", m_p_c, &m_native_c); typename cntnr::point_iterator find_it = m_p_c->end(); - typename cntnr::const_point_iterator const_find_it(find_it); + typename cntnr::point_const_iterator const_find_it(find_it); _GLIBCXX_THROW_IF(find_it != const_find_it, "", m_p_c, &m_native_c); _GLIBCXX_THROW_IF(!(find_it == const_find_it), "", m_p_c, &m_native_c); } @@ -780,7 +780,7 @@ it_assign() _GLIBCXX_THROW_IF(const_it != it, "", m_p_c, &m_native_c); _GLIBCXX_THROW_IF(!(const_it == it), "", m_p_c, &m_native_c); - typename cntnr::const_point_iterator const_find_it; + typename cntnr::point_const_iterator const_find_it; const_find_it = it; _GLIBCXX_THROW_IF(const_find_it != it, "", m_p_c, &m_native_c); _GLIBCXX_THROW_IF(!(const_find_it == it), "", m_p_c, &m_native_c); @@ -793,7 +793,7 @@ it_assign() { typename cntnr::const_iterator const_it = m_p_c->end(); - typename cntnr::const_point_iterator const_find_it; + typename cntnr::point_const_iterator const_find_it; const_find_it = const_it; _GLIBCXX_THROW_IF(const_find_it != const_it, "", m_p_c, &m_native_c); _GLIBCXX_THROW_IF(!(const_find_it == const_it), "", m_p_c, &m_native_c); @@ -801,7 +801,7 @@ it_assign() { typename cntnr::point_iterator find_it = m_p_c->end(); - typename cntnr::const_point_iterator const_find_it; + typename cntnr::point_const_iterator const_find_it; const_find_it = find_it; _GLIBCXX_THROW_IF(find_it != const_find_it, "", m_p_c, &m_native_c); _GLIBCXX_THROW_IF(!(find_it == const_find_it), "", m_p_c, &m_native_c); diff --git a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp index 37f8d51..227f60b 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp @@ -1,6 +1,7 @@ // -*- C++ -*- -// Copyright (C) 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2008, 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 @@ -60,7 +61,10 @@ namespace detail double dp, double ep, double cp, double mp, bool d) : m_sd(seed), m_n(n), m_m(m), m_tp(tp), m_ip(ip), m_dp(dp), m_ep(ep), m_cp(cp), m_mp(mp), m_disp(d) - { } + { + if (m_disp) + xml_test_rand_regression_formatter(seed, n, m, tp, ip, ep, cp, mp); + } template void @@ -100,14 +104,14 @@ namespace detail // Sane defaults. size_t n = iter; size_t m = keys; - size_t sd = 0; // 0 = time-determined arbitrary + size_t sd = twister_rand_gen::get_time_determined_seed(); double tp = 0.2; double ip = 0.6; double dp = 0.1; double ep = 0.2; double cp = 0.001; double mp = 1; - bool disp = false; // show progress + bool disp = true; // show progress try { @@ -123,13 +127,6 @@ namespace detail return -2; }; - xml_test_rand_regression_formatter* p_fmt = 0; - if (sd == 0) - sd = twister_rand_gen::get_time_determined_seed(); - if (disp) - p_fmt = new xml_test_rand_regression_formatter(sd, n, m, tp, ip, dp, - ep, cp, mp); - try { detail::rand_reg_test tst(sd, n, m, tp, ip, dp, ep, cp, mp, disp); @@ -138,13 +135,9 @@ namespace detail catch(...) { std::cerr << "Test failed with seed " << sd << std::endl; - if (disp) - delete p_fmt; - return -1; + throw; } - if (disp) - delete p_fmt; return 0; } diff --git a/libstdc++-v3/testsuite/util/regression/trait/assoc/native_type_trait.hpp b/libstdc++-v3/testsuite/util/regression/trait/assoc/native_type_trait.hpp index 38761a1..f8f5bae 100644 --- a/libstdc++-v3/testsuite/util/regression/trait/assoc/native_type_trait.hpp +++ b/libstdc++-v3/testsuite/util/regression/trait/assoc/native_type_trait.hpp @@ -47,58 +47,58 @@ namespace __gnu_pbds namespace detail { - template + template struct native_key_type; - template + template struct native_key_type< basic_type, - Allocator> + _Alloc> { typedef std::string type; static type - native_key(typename Allocator::template rebind< + native_key(typename _Alloc::template rebind< basic_type>::other::const_reference r_key) { return (std::string(r_key)); } }; - template + template struct native_key_type< std::pair< Hd, Tl>, - Allocator> + _Alloc> { - typedef typename native_key_type< Hd, Allocator>::type hd_type; + typedef typename native_key_type< Hd, _Alloc>::type hd_type; - typedef typename native_key_type< Tl, Allocator>::type tl_type; + typedef typename native_key_type< Tl, _Alloc>::type tl_type; typedef std::pair< hd_type, tl_type> type; static type - native_key(typename Allocator::template rebind< std::pair >::other::const_reference r_key) + native_key(typename _Alloc::template rebind< std::pair >::other::const_reference r_key) { return (std::make_pair( - native_key_type::native_key(r_key.first), - native_key_type::native_key(r_key.second))); + native_key_type::native_key(r_key.first), + native_key_type::native_key(r_key.second))); } }; template + typename _Alloc> struct native_type_traits_base; - template + template struct native_type_traits_base< Native_Key_Type, Key_Type, basic_type, - Allocator> + _Alloc> { public: typedef std::map< Native_Key_Type, std::string> type; @@ -111,20 +111,20 @@ namespace __gnu_pbds } static typename type::value_type - native_value(typename Allocator::template rebind< std::pair >::other::const_reference r_val) + native_value(typename _Alloc::template rebind< std::pair >::other::const_reference r_val) { return (std::make_pair( - native_key_type::native_key(r_val.first), + native_key_type::native_key(r_val.first), std::string(r_val.second))); } }; - template + template struct native_type_traits_base< Native_Key_Type, Key_Type, - __gnu_pbds::null_mapped_type, - Allocator> + __gnu_pbds::null_type, + _Alloc> { public: typedef std::set< Native_Key_Type> type; @@ -137,10 +137,10 @@ namespace __gnu_pbds } static typename type::value_type - native_value(typename Allocator::template rebind< + native_value(typename _Alloc::template rebind< Key_Type>::other::const_reference r_val) { - return (native_key_type::native_key( + return (native_key_type::native_key( r_val)); } }; @@ -148,16 +148,16 @@ namespace __gnu_pbds #define PB_DS_NATIVE_KEY_TYPE_C_DEC \ native_key_type< \ Key_Type, \ - Allocator> + _Alloc> #define PB_DS_BASE_C_DEC \ native_type_traits_base< \ typename PB_DS_NATIVE_KEY_TYPE_C_DEC::type, \ Key_Type, \ Data_Type, \ - Allocator> + _Alloc> - template + template struct native_type_traits : public PB_DS_BASE_C_DEC { typedef typename PB_DS_BASE_C_DEC::type type; @@ -165,7 +165,7 @@ namespace __gnu_pbds typedef typename type::key_type key_type; static typename PB_DS_NATIVE_KEY_TYPE_C_DEC::type - native_key(typename Allocator::template rebind< + native_key(typename _Alloc::template rebind< Key_Type>::other::const_reference r_key) { return (PB_DS_NATIVE_KEY_TYPE_C_DEC::native_key(r_key)); diff --git a/libstdc++-v3/testsuite/util/regression/trait/assoc/trait.hpp b/libstdc++-v3/testsuite/util/regression/trait/assoc/trait.hpp index a4a768e5..6074f38 100644 --- a/libstdc++-v3/testsuite/util/regression/trait/assoc/trait.hpp +++ b/libstdc++-v3/testsuite/util/regression/trait/assoc/trait.hpp @@ -101,7 +101,7 @@ namespace detail // Only associative containers. typedef typename Cntnr::key_type key_type; - typedef typename Cntnr::const_key_reference const_key_reference; + typedef typename Cntnr::key_const_reference key_const_reference; typedef typename native_type::key_type native_key_type; enum @@ -149,12 +149,12 @@ namespace detail generate_value(Gen& r_gen, size_t max) { return PB_DS_TYPE_TRAITS_C_DEC::generate_value(r_gen, max); } - static const_key_reference + static key_const_reference extract_key(const_reference r_val) { return type_traits_base::extract_key(r_val); } static native_key_type - native_key(const_key_reference r_key) + native_key(key_const_reference r_key) { return native_type_traits_base::native_key(r_key); } static native_value_type @@ -174,7 +174,7 @@ namespace detail { return to_string(r_val); } static std::string - key_to_string(const_key_reference r_key) + key_to_string(key_const_reference r_key) { return to_string(r_key); } static std::string @@ -182,7 +182,7 @@ namespace detail { return to_string(r_native_val); } static bool - prefix_match(const_key_reference r_key, const std::string& r_native_key) + prefix_match(key_const_reference r_key, const std::string& r_native_key) { const size_t len = std::min(r_key.length(), r_native_key.length()); const std::string substr = r_native_key.substr(0, len); diff --git a/libstdc++-v3/testsuite/util/regression/trait/assoc/type_trait.hpp b/libstdc++-v3/testsuite/util/regression/trait/assoc/type_trait.hpp index c7ce5f7..4c3f7ca 100644 --- a/libstdc++-v3/testsuite/util/regression/trait/assoc/type_trait.hpp +++ b/libstdc++-v3/testsuite/util/regression/trait/assoc/type_trait.hpp @@ -51,11 +51,11 @@ namespace __gnu_pbds { typedef Cntnr cntnr; typedef typename cntnr::key_type key_type; - typedef typename cntnr::const_key_reference const_key_reference; + typedef typename cntnr::key_const_reference key_const_reference; typedef typename cntnr::value_type value_type; typedef typename cntnr::const_reference const_reference; typedef typename cntnr::mapped_type mapped_type; - typedef typename cntnr::const_mapped_reference const_mapped_reference; + typedef typename cntnr::mapped_const_reference mapped_const_reference; template static key_type @@ -67,7 +67,7 @@ namespace __gnu_pbds generate_value(Gen& r_gen, size_t max) { return generate_value(r_gen, max, value_type()); } - static const_key_reference + static key_const_reference extract_key(const_reference r_val) { return extract_key_imp(r_val); } @@ -82,7 +82,7 @@ namespace __gnu_pbds template static value_type - generate_value(Gen& r_gen, size_t max, __gnu_pbds::null_mapped_type) + generate_value(Gen& r_gen, size_t max, __gnu_pbds::null_type) { return basic_type(r_gen, max); } template @@ -96,11 +96,11 @@ namespace __gnu_pbds std::pair) { return std::make_pair(basic_type(gen, max), basic_type(gen, max)); } - static const_key_reference + static key_const_reference extract_key_imp(basic_type_const_reference r_val) { return r_val; } - static const_key_reference + static key_const_reference extract_key_imp(pair_type_const_reference r_val) { return r_val.first; } }; diff --git a/libstdc++-v3/testsuite/util/testsuite_containers.h b/libstdc++-v3/testsuite/util/testsuite_containers.h index 24133cd..001c9c8 100644 --- a/libstdc++-v3/testsuite/util/testsuite_containers.h +++ b/libstdc++-v3/testsuite/util/testsuite_containers.h @@ -56,7 +56,7 @@ namespace __gnu_test template::is_allocator_aware::value> struct allocator_aware_types { - // Allocator-aware requirements (table 82) + // _Alloc-aware requirements (table 82) typedef _Tp test_type; typedef typename test_type::allocator_type allocator_type; }; -- cgit v1.1