]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/37144 (A bug in include/ext/pb_ds/detail/pat_trie_/constructors_destr...
authorBenjamin Kosnik <bkoz@redhat.com>
Tue, 24 May 2011 02:38:19 +0000 (02:38 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Tue, 24 May 2011 02:38:19 +0000 (02:38 +0000)
2011-05-23  Benjamin Kosnik  <bkoz@redhat.com>

PR libstdc++/37144
PR libstdc++/28457
Interface changes for ext/pb_ds.
PB_DS_BASE_C_DEC to unique PB_DS_*_BASE macros.
* include/ext/pb_ds/assoc_container.hpp (container_base): Remove.
(basic_hash_table, basic_branch, list_update): Derive from
container_base_dispatch.
* include/ext/pb_ds/list_update_policy.hpp (null_lu_metadata): Remove.
(move_to_front_lu_policy): To lu_move_to_front_policy.
(counter_lu_policy): To lu_counter_policy.
* include/ext/pb_ds/tree_policy.hpp (null_tree_node_update): Remove.
* include/ext/pb_ds/tag_and_trait.hpp (container_base_dispatch): Adjust
template parameters, declare here.
(null_mapped_type) Remove.
(null_type): Just use this for template tricks everywhere.
* include/ext/pb_ds/hash_policy.hpp (null_hash_fn, null_probe_fn):
Remove.
* include/ext/pb_ds/trie_policy.hpp (null_trie_node_update): Remove.
(string_trie_e_access_traits): To trie_string_access_traits.
* include/ext/pb_ds/priority_queue.hpp: Use container_base_dispatch.

File changes.
* include/Makefile.am (pb_headers): Removed and changed file names.
* include/Makefile.in: Regenerated.
* include/ext/pb_ds/detail/basic_types.hpp: Remove.
* include/ext/pb_ds/detail/bin_search_tree_/
  cond_dtor_entry_dealtor.hpp: Remove.
* include/ext/pb_ds/detail/bin_search_tree_/
  cond_key_dtor_entry_dealtor.hpp: Remove.
* include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp: Move..
* include/ext/pb_ds/detail/binary_heap_/
  point_const_iterator.hpp: ..here.
* include/ext/pb_ds/detail/basic_tree_policy: Move to...
* include/ext/pb_ds/detail/branch_policy: This.
* include/ext/pb_ds/detail/branch_policy/
  basic_tree_policy_base.hpp: Move...
* include/ext/pb_ds/detail/branch_policy/branch_policy.hpp: ...here.
* include/ext/pb_ds/detail/branch_policy/null_node_metadata.hpp: Add.
* include/ext/pb_ds/detail/branch_policy/traits.hpp: Add.
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
null_metadata.hpp: Remove.
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
const_point_iterator.hpp: Move...
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
point_const_iterator.hpp: ...here.
* include/ext/pb_ds/detail/list_update_policy/
counter_lu_metadata.hpp: Move..
* include/ext/pb_ds/detail/list_update_policy/
lu_counter_metadata.hpp: ...here.
* include/ext/pb_ds/detail/list_update_policy/
counter_lu_policy_imp.hpp: Remove.
* include/ext/pb_ds/detail/list_update_policy/
mtf_lu_policy_imp.hpp: Remove.
* include/ext/pb_ds/detail/trie_policy/
string_trie_e_access_traits_imp.hpp: Move...
* include/ext/pb_ds/detail/trie_policy/
sample_trie_access_traits.hpp: ...here.
* include/ext/pb_ds/detail/trie_policy/
sample_trie_e_access_traits.hpp: Move...
* include/ext/pb_ds/detail/trie_policy/
trie_string_access_traits_imp.hpp: ...here.
* include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp: Remove.
* include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp: Remove.
* include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp: Remove.
* include/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp: New, fold all
types found in the following files into pat_trie_base.
* include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp: Folded.
* include/ext/pb_ds/detail/pat_trie_/
  cond_dtor_entry_dealtor.hpp: Folded.
* include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp: Folded.
* include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp: Folded.
* include/ext/pb_ds/detail/pat_trie_/head.hpp: Folded.
* include/ext/pb_ds/detail/pat_trie_/leaf.hpp: Folded.
* include/ext/pb_ds/detail/pat_trie_/node_base.hpp: Folded.
* include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp: Folded.
* include/ext/pb_ds/detail/pat_trie_/internal_node.hpp: Folded.
* include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp: Folded.
* include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp: Folded.
* include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp: Move...
* include/ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp: ...here.
* include/ext/pb_ds/detail/unordered_iterator/
const_point_iterator.hpp: Move...
* include/ext/pb_ds/detail/unordered_iterator/
point_const_iterator.hpp: ...here.

Adjust for above changes.
* include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp: Same.
* include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp: Same.
* include/ext/pb_ds/detail/resize_policy/
  sample_resize_trigger.hpp: Same.
* include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binomial_heap_base_/
  binomial_heap_base_.hpp: Same.
* include/ext/pb_ds/detail/binomial_heap_base_/
  constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binomial_heap_base_/
  split_join_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/container_base_dispatch.hpp: Same. Adjust
  for template parameter ordering change.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  erase_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  constructor_destructor_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  insert_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  policy_access_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  resize_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  constructor_destructor_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  insert_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  entry_list_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  find_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  debug_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  constructor_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  cond_key_dtor_entry_dealtor.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  debug_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  erase_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  iterators_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  resize_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
  standard_policies.hpp: Same.
* include/ext/pb_ds/detail/tree_trace_base.hpp: Same.
* include/ext/pb_ds/detail/unordered_iterator/iterator.hpp: Same.
* include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp: Same.
* include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/
  constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/traits.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/
  policy_access_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/
  constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/traits.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/
  split_join_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/list_update_policy/
  sample_update_policy.hpp: Same.
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
  trace_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
  erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  erase_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  constructor_destructor_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  insert_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  policy_access_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  resize_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  constructor_destructor_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  insert_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  iterator_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  find_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  find_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  debug_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  constructor_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  debug_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  erase_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  resize_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
  standard_policies.hpp: Same.
* include/ext/pb_ds/detail/standard_policies.hpp: Same.
* include/ext/pb_ds/detail/types_traits.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/
  constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp: Same.
* include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp: Same.
* include/ext/pb_ds/detail/tree_policy/
  sample_tree_node_update.hpp: Same.
* include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp: Same.
* include/ext/pb_ds/detail/trie_policy/
  sample_trie_node_update.hpp: Same.
* include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp: Same.
* include/ext/pb_ds/detail/trie_policy/
  prefix_search_node_update_imp.hpp: Same.
* include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp: Same.
* include/ext/pb_ds/detail/cond_dealtor.hpp: Same.
* include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp: Same.
  Adjust for template parameter change, fold into
  container_base_dispatch.
* include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pairing_heap_/
  constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp: Same.
* include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binomial_heap_/
  constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp: Same.
* include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/type_utils.hpp: Same.
* include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp: Same.
* include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp: Same.
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
  policy_access_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
  left_child_next_sibling_heap_.hpp: Same.
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
  const_iterator.hpp: Same.
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
  insert_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
  constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
  debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
  node.hpp: Same.
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
  info_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/left_child_next_sibling_heap_/
  iterators_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp: Same.
* include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/thin_heap_/
  constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp: Same.
* include/ext/pb_ds/detail/ov_tree_map_/
  constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp: Same.
* include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/ov_tree_map_/traits.hpp: Same.
* include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/debug_map_base.hpp: Same.
* include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp: Same.
* include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp: Same.
* include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp: Same.
* include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp: Same.
* include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp: Same.
* include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp: Same.
* include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp: Same.
* include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/splay_tree_/
  constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/splay_tree_/node.hpp: Same.
* include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp: Same.
* include/ext/pb_ds/detail/splay_tree_/traits.hpp: Same.
* include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/list_update_map_/
  entry_metadata_base.hpp: Same.
* include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp: Same.
* include/ext/pb_ds/detail/list_update_map_/
  constructor_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/rc_binomial_heap_/
  rc_binomial_heap_.hpp: Same.
* include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/rc_binomial_heap_/
  constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp: Same.
* include/ext/pb_ds/detail/rc_binomial_heap_/
  split_join_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/rb_tree_map_/
  constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp: Same.
* include/ext/pb_ds/detail/rb_tree_map_/node.hpp: Same.
* include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/rb_tree_map_/traits.hpp: Same.

Documentation changes.
* include/ext/pb_ds/*: Add doxygen markup.
* doc/doxygen/user.cfg.in: Add details for extracting comments
from pb_ds.
* scripts/run_doxygen: Fixup __gnu_pb_ds::detail.
* scripts/make_graph.py: Move to svg output. Re-format generated tables.

* doc/Makefile.am (stamp-html-copy): New rule.
(stamp-html): Use it to copy non-generated files into html docs.
* doc/Makefile.in: Regenerated.

* doc/html/ext/pb_ds/sample_trie_e_access_traits.html: Move...
* doc/html/ext/pb_ds/trie_string_access_traits.html: ...here.
* doc/html/ext/pb_ds/string_trie_e_access_traits.html: Move..
* doc/html/ext/pb_ds/sample_trie_access_traits.html: ...here.

* doc/html/ext/pb_ds/tree_text_lor_find_timing_test_local.png,
hash_random_int_erase_mem_usage_test_local.png,
multimap_text_insert_mem_usage_test_small_s2p_hash_local.png,
tree_text_insert_timing_test_pat_trie_local.png ,
multimap_text_insert_mem_usage_test_small_s2p_tree_local.png ,
priority_queue_text_modify_down_timing_test_local.png,
gp_hash_random_int_subscript_timing_test_find_local.png,
text_find_timing_test_hash_local.png,
multimap_text_insert_timing_test_small_s2p_hash_local.png,
multimap_text_insert_timing_test_small_s2p_tree_local.png,
multimap_text_insert_mem_usage_test_large_s2p_hash_local.png,
multimap_text_insert_mem_usage_test_large_s2p_tree_local.png,
multimap_text_insert_timing_test_large_s2p_hash_local.png,
hash_zlob_random_int_find_timing_test_local.png,
multimap_text_insert_timing_test_large_s2p_tree_local.png,
binary_priority_queue_random_int_push_timing_test_local.png,
priority_queue_text_pop_mem_usage_test_local.png,
priority_queue_text_modify_down_timing_test_pairing_thin_local.png,
tree_split_join_timing_test_local.png,
multimap_text_find_timing_test_small_s2p_hash_local.png,
ccgp_hash_random_int_subscript_timing_test_insert_local.png,
priority_queue_random_int_push_pop_timing_test_local.png,
multimap_text_find_timing_test_small_s2p_tree_local.png,
gp_hash_random_int_subscript_timing_test_insert_local.png,
priority_queue_text_push_timing_test_local.png,
cc_hash_random_int_subscript_timing_test_find_local.png,
tree_text_insert_timing_test_vector_tree_local.png,
multimap_text_find_timing_test_large_s2p_hash_local.png,
pairing_priority_queue_text_push_timing_test_local.png,
tree_order_statistics_timing_test_local.png,
priority_queue_text_push_pop_timing_test_local.png,
text_find_timing_test_tree_like_local.png,
multimap_text_find_timing_test_large_s2p_tree_local.png,
priority_queue_text_modify_up_timing_test_pairing_thin_local.png,
cc_hash_random_int_subscript_timing_test_insert_local.png,
priority_queue_text_modify_up_timing_test_local.png,
random_int_find_find_timing_test_tree_local.png,
priority_queue_random_int_push_timing_test_local.png,
tree_text_insert_timing_test_node_tree_local.png,
pairing_priority_queue_text_push_pop_timing_test_local.png,
gp_hash_random_int_find_timing_test_local.png,
cc_hash_random_int_find_timing_test_local.png,
priority_queue_text_join_timing_test_local.png: Update local pngs.

Testsuite changes.
* testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc: New.
* testsuite/ext/pb_ds/regression/tree_data_map_rand_debug.cc: New.
* testsuite/ext/pb_ds/regression/priority_queue_rand_debug.cc: New.
* testsuite/ext/pb_ds/regression/trie_no_data_map_rand_debug.cc: New.
* testsuite/ext/pb_ds/regression/trie_data_map_rand_debug.cc: New.
* testsuite/ext/pb_ds/regression/list_update_no_data_map_rand_debug.cc:
New.
* testsuite/ext/pb_ds/regression/list_update_data_map_rand_debug.cc:
New.
* testsuite/ext/pb_ds/regression/hash_no_data_map_rand_debug.cc: New.
* testsuite/ext/pb_ds/regression/hash_data_map_rand_debug.cc: New.

* testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc: Fix typo.

* testsuite/ext/pb_ds/example/basic_set.cc: Update.
* testsuite/ext/pb_ds/example/ranged_hash.cc: Same.
* testsuite/ext/pb_ds/example/tree_order_statistics.cc: Same.
* testsuite/ext/pb_ds/example/trie_prefix_search.cc: Same.
* testsuite/ext/pb_ds/example/trie_dna.cc: Same.
* testsuite/ext/pb_ds/example/tree_intervals.cc: Same.
* testsuite/ext/pb_ds/example/basic_multimap.cc: Same.
* testsuite/performance/ext/pb_ds/hash_random_int_erase_mem_usage.cc:
  Same.
* testsuite/performance/ext/pb_ds/tree_split_join_timing.cc: Same.
* testsuite/performance/ext/pb_ds/tree_order_statistics_timing.cc: Same.
* testsuite/data/make_graph_test_infos.xml: Same.
* testsuite/util/regression/common_type.hpp: Same.
* testsuite/util/regression/trait/assoc/native_type_trait.hpp: Same.
* testsuite/util/regression/trait/assoc/trait.hpp: Same.
* testsuite/util/regression/trait/assoc/type_trait.hpp: Same.
* testsuite/util/regression/rand/priority_queue/
  rand_regression_test.hpp: Same.
* testsuite/util/regression/rand/priority_queue/
  container_rand_regression_test.tcc: Same.
* testsuite/util/regression/rand/assoc/rand_regression_test.hpp: Same.
* testsuite/util/regression/rand/assoc/container_rand_regression_test.h
* testsuite/util/regression/rand/assoc/
  container_rand_regression_test.tcc: Same.
* testsuite/util/native_type/native_priority_queue.hpp: Same.
* testsuite/util/native_type/native_multimap.hpp: Same.
* testsuite/util/native_type/native_hash_multimap.hpp: Same.
* testsuite/util/native_type/native_set.hpp: Same.
* testsuite/util/native_type/native_map.hpp: Same.
* testsuite/util/native_type/native_hash_set.hpp: Same.
* testsuite/util/native_type/native_hash_map.hpp: Same.
* testsuite/util/testsuite_containers.h
* testsuite/util/common_type/priority_queue/common_type.hpp: Same.
* testsuite/util/common_type/assoc/common_type.hpp: Same.
* testsuite/util/common_type/assoc/string_form.hpp: Same.
* testsuite/util/common_type/assoc/template_policy.hpp: Same.
* testsuite/util/common_type/assoc/detail/
  trigger_policy_string_form.hpp: Same.
* testsuite/util/common_type/assoc/detail/ds_string_form.hpp: Same.
* testsuite/util/common_type/assoc/detail/
  size_policy_string_form.hpp: Same.
* testsuite/util/common_type/assoc/detail/
  probe_fn_string_form.hpp: Same.
* testsuite/util/common_type/assoc/detail/
  tree_supports_order_statistics.hpp: Same.
* testsuite/util/common_type/assoc/detail/
  trie_supports_prefix_search.hpp: Same.
* testsuite/util/common_type/assoc/detail/
  list_update_policy_string_form.hpp: Same.
* testsuite/util/common_type/assoc/detail/
  trie_supports_order_statistics.hpp: Same.
* testsuite/util/common_type/assoc/native_set.hpp: Same.
* testsuite/util/performance/assoc/timing/common_type.hpp: Same.
* testsuite/util/performance/assoc/timing/multimap_find_test.hpp: Same.
* testsuite/util/performance/assoc/multimap_common_type.hpp: Same.

From-SVN: r174100

360 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/doc/Makefile.am
libstdc++-v3/doc/Makefile.in
libstdc++-v3/doc/doxygen/user.cfg.in
libstdc++-v3/doc/html/ext/pb_ds/binary_priority_queue_random_int_push_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/cc_hash_random_int_find_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/cc_hash_random_int_subscript_timing_test_find_local.png
libstdc++-v3/doc/html/ext/pb_ds/cc_hash_random_int_subscript_timing_test_insert_local.png
libstdc++-v3/doc/html/ext/pb_ds/ccgp_hash_random_int_subscript_timing_test_insert_local.png
libstdc++-v3/doc/html/ext/pb_ds/gp_hash_random_int_find_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/gp_hash_random_int_subscript_timing_test_find_local.png
libstdc++-v3/doc/html/ext/pb_ds/gp_hash_random_int_subscript_timing_test_insert_local.png
libstdc++-v3/doc/html/ext/pb_ds/hash_random_int_erase_mem_usage_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/hash_zlob_random_int_find_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_large_s2p_hash_local.png
libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_large_s2p_tree_local.png
libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_small_s2p_hash_local.png
libstdc++-v3/doc/html/ext/pb_ds/multimap_text_find_timing_test_small_s2p_tree_local.png
libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_large_s2p_hash_local.png
libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_large_s2p_tree_local.png
libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_small_s2p_hash_local.png
libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_mem_usage_test_small_s2p_tree_local.png
libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_large_s2p_hash_local.png
libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_large_s2p_tree_local.png
libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_small_s2p_hash_local.png
libstdc++-v3/doc/html/ext/pb_ds/multimap_text_insert_timing_test_small_s2p_tree_local.png
libstdc++-v3/doc/html/ext/pb_ds/pairing_priority_queue_text_push_pop_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/pairing_priority_queue_text_push_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/priority_queue_random_int_push_pop_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/priority_queue_random_int_push_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_join_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_down_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_down_timing_test_pairing_thin_local.png
libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_up_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_modify_up_timing_test_pairing_thin_local.png
libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_pop_mem_usage_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_push_pop_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/priority_queue_text_push_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/random_int_find_find_timing_test_tree_local.png
libstdc++-v3/doc/html/ext/pb_ds/sample_trie_access_traits.html [moved from libstdc++-v3/doc/html/ext/pb_ds/sample_trie_e_access_traits.html with 100% similarity]
libstdc++-v3/doc/html/ext/pb_ds/text_find_timing_test_hash_local.png
libstdc++-v3/doc/html/ext/pb_ds/text_find_timing_test_tree_like_local.png
libstdc++-v3/doc/html/ext/pb_ds/tree_order_statistics_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/tree_split_join_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/tree_text_insert_timing_test_node_tree_local.png
libstdc++-v3/doc/html/ext/pb_ds/tree_text_insert_timing_test_pat_trie_local.png
libstdc++-v3/doc/html/ext/pb_ds/tree_text_insert_timing_test_vector_tree_local.png
libstdc++-v3/doc/html/ext/pb_ds/tree_text_lor_find_timing_test_local.png
libstdc++-v3/doc/html/ext/pb_ds/trie_string_access_traits.html [moved from libstdc++-v3/doc/html/ext/pb_ds/string_trie_e_access_traits.html with 100% similarity]
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/ext/pb_ds/assoc_container.hpp
libstdc++-v3/include/ext/pb_ds/detail/basic_types.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp [moved from libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp with 80% similarity]
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/branch_policy/branch_policy.hpp [new file with mode: 0644]
libstdc++-v3/include/ext/pb_ds/detail/branch_policy/null_node_metadata.hpp [moved from libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp with 69% similarity]
libstdc++-v3/include/ext/pb_ds/detail/branch_policy/traits.hpp [moved from libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp with 51% similarity]
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/cond_dealtor.hpp
libstdc++-v3/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/container_base_dispatch.hpp
libstdc++-v3/include/ext/pb_ds/detail/debug_map_base.hpp
libstdc++-v3/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
libstdc++-v3/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp [moved from libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp with 82% similarity]
libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp [moved from libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp with 64% similarity]
libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp
libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/head.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/leaf.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp [new file with mode: 0644]
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp [moved from libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp with 50% similarity]
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/traits.hpp
libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp
libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/node.hpp
libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp
libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/traits.hpp
libstdc++-v3/include/ext/pb_ds/detail/standard_policies.hpp
libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
libstdc++-v3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
libstdc++-v3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
libstdc++-v3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
libstdc++-v3/include/ext/pb_ds/detail/tree_trace_base.hpp
libstdc++-v3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
libstdc++-v3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp [deleted file]
libstdc++-v3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
libstdc++-v3/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_access_traits.hpp [moved from libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp with 67% similarity]
libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp [moved from libstdc++-v3/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp with 88% similarity]
libstdc++-v3/include/ext/pb_ds/detail/type_utils.hpp
libstdc++-v3/include/ext/pb_ds/detail/types_traits.hpp
libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp [moved from libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp with 89% similarity]
libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
libstdc++-v3/include/ext/pb_ds/hash_policy.hpp
libstdc++-v3/include/ext/pb_ds/list_update_policy.hpp
libstdc++-v3/include/ext/pb_ds/priority_queue.hpp
libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp
libstdc++-v3/include/ext/pb_ds/tree_policy.hpp
libstdc++-v3/include/ext/pb_ds/trie_policy.hpp
libstdc++-v3/scripts/make_graph.py
libstdc++-v3/scripts/run_doxygen
libstdc++-v3/testsuite/data/make_graph_test_infos.xml
libstdc++-v3/testsuite/ext/pb_ds/example/basic_multimap.cc
libstdc++-v3/testsuite/ext/pb_ds/example/basic_priority_queue.cc
libstdc++-v3/testsuite/ext/pb_ds/example/basic_set.cc
libstdc++-v3/testsuite/ext/pb_ds/example/ranged_hash.cc
libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc
libstdc++-v3/testsuite/ext/pb_ds/example/tree_order_statistics.cc
libstdc++-v3/testsuite/ext/pb_ds/example/trie_dna.cc
libstdc++-v3/testsuite/ext/pb_ds/example/trie_prefix_search.cc
libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand_debug.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand_debug.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc
libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand_debug.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand_debug.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand_debug.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand_debug.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand_debug.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand_debug.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/ext/pb_ds/hash_random_int_erase_mem_usage.cc
libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_pop_mem_usage.cc
libstdc++-v3/testsuite/performance/ext/pb_ds/tree_order_statistics_timing.cc
libstdc++-v3/testsuite/performance/ext/pb_ds/tree_split_join_timing.cc
libstdc++-v3/testsuite/util/common_type/assoc/common_type.hpp
libstdc++-v3/testsuite/util/common_type/assoc/detail/ds_string_form.hpp
libstdc++-v3/testsuite/util/common_type/assoc/detail/list_update_policy_string_form.hpp
libstdc++-v3/testsuite/util/common_type/assoc/detail/probe_fn_string_form.hpp
libstdc++-v3/testsuite/util/common_type/assoc/detail/size_policy_string_form.hpp
libstdc++-v3/testsuite/util/common_type/assoc/detail/tree_supports_order_statistics.hpp
libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_order_statistics.hpp
libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_prefix_search.hpp
libstdc++-v3/testsuite/util/common_type/assoc/detail/trigger_policy_string_form.hpp
libstdc++-v3/testsuite/util/common_type/assoc/native_set.hpp
libstdc++-v3/testsuite/util/common_type/assoc/string_form.hpp
libstdc++-v3/testsuite/util/common_type/assoc/template_policy.hpp
libstdc++-v3/testsuite/util/common_type/priority_queue/common_type.hpp
libstdc++-v3/testsuite/util/native_type/native_hash_map.hpp
libstdc++-v3/testsuite/util/native_type/native_hash_multimap.hpp
libstdc++-v3/testsuite/util/native_type/native_hash_set.hpp
libstdc++-v3/testsuite/util/native_type/native_map.hpp
libstdc++-v3/testsuite/util/native_type/native_multimap.hpp
libstdc++-v3/testsuite/util/native_type/native_priority_queue.hpp
libstdc++-v3/testsuite/util/native_type/native_set.hpp
libstdc++-v3/testsuite/util/performance/assoc/multimap_common_type.hpp
libstdc++-v3/testsuite/util/performance/assoc/timing/common_type.hpp
libstdc++-v3/testsuite/util/performance/assoc/timing/multimap_find_test.hpp
libstdc++-v3/testsuite/util/regression/common_type.hpp
libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.h
libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.tcc
libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp
libstdc++-v3/testsuite/util/regression/rand/priority_queue/container_rand_regression_test.tcc
libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp
libstdc++-v3/testsuite/util/regression/trait/assoc/native_type_trait.hpp
libstdc++-v3/testsuite/util/regression/trait/assoc/trait.hpp
libstdc++-v3/testsuite/util/regression/trait/assoc/type_trait.hpp
libstdc++-v3/testsuite/util/testsuite_containers.h

index 76afc47d46fd1fd8fde26c0165276c087358ab1a..9c1cc0396e4dd21546a6136bafa3e161351e5838 100644 (file)
@@ -1,3 +1,512 @@
+2011-05-23  Benjamin Kosnik  <bkoz@redhat.com>
+
+       PR libstdc++/37144
+       PR libstdc++/28457
+       Interface changes for ext/pb_ds.
+       PB_DS_BASE_C_DEC to unique PB_DS_*_BASE macros.
+       * include/ext/pb_ds/assoc_container.hpp (container_base): Remove.
+       (basic_hash_table, basic_branch, list_update): Derive from
+       container_base_dispatch.
+       * include/ext/pb_ds/list_update_policy.hpp (null_lu_metadata): Remove.
+       (move_to_front_lu_policy): To lu_move_to_front_policy.
+       (counter_lu_policy): To lu_counter_policy.
+       * include/ext/pb_ds/tree_policy.hpp (null_tree_node_update): Remove.
+       * include/ext/pb_ds/tag_and_trait.hpp (container_base_dispatch): Adjust
+       template parameters, declare here.
+       (null_mapped_type) Remove.
+       (null_type): Just use this for template tricks everywhere.
+       * include/ext/pb_ds/hash_policy.hpp (null_hash_fn, null_probe_fn):
+       Remove.
+       * include/ext/pb_ds/trie_policy.hpp (null_trie_node_update): Remove.
+       (string_trie_e_access_traits): To trie_string_access_traits.
+       * include/ext/pb_ds/priority_queue.hpp: Use container_base_dispatch.
+
+       File changes.
+       * include/Makefile.am (pb_headers): Removed and changed file names.
+       * include/Makefile.in: Regenerated.
+       * include/ext/pb_ds/detail/basic_types.hpp: Remove.
+       * include/ext/pb_ds/detail/bin_search_tree_/
+         cond_dtor_entry_dealtor.hpp: Remove.
+       * include/ext/pb_ds/detail/bin_search_tree_/
+         cond_key_dtor_entry_dealtor.hpp: Remove.
+       * include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp: Move..
+       * include/ext/pb_ds/detail/binary_heap_/
+         point_const_iterator.hpp: ..here.
+       * include/ext/pb_ds/detail/basic_tree_policy: Move to...
+       * include/ext/pb_ds/detail/branch_policy: This.
+       * include/ext/pb_ds/detail/branch_policy/
+         basic_tree_policy_base.hpp: Move...
+       * include/ext/pb_ds/detail/branch_policy/branch_policy.hpp: ...here.
+       * include/ext/pb_ds/detail/branch_policy/null_node_metadata.hpp: Add.
+       * include/ext/pb_ds/detail/branch_policy/traits.hpp: Add.
+       * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+       null_metadata.hpp: Remove.
+       * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+       const_point_iterator.hpp: Move...
+       * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+       point_const_iterator.hpp: ...here.
+       * include/ext/pb_ds/detail/list_update_policy/
+       counter_lu_metadata.hpp: Move..
+       * include/ext/pb_ds/detail/list_update_policy/
+       lu_counter_metadata.hpp: ...here.
+       * include/ext/pb_ds/detail/list_update_policy/
+       counter_lu_policy_imp.hpp: Remove.
+       * include/ext/pb_ds/detail/list_update_policy/
+       mtf_lu_policy_imp.hpp: Remove.
+       * include/ext/pb_ds/detail/trie_policy/
+       string_trie_e_access_traits_imp.hpp: Move...
+       * include/ext/pb_ds/detail/trie_policy/
+       sample_trie_access_traits.hpp: ...here.
+       * include/ext/pb_ds/detail/trie_policy/
+       sample_trie_e_access_traits.hpp: Move...
+       * include/ext/pb_ds/detail/trie_policy/
+       trie_string_access_traits_imp.hpp: ...here.
+       * include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp: Remove.
+       * include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp: Remove.
+       * include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp: Remove.
+       * include/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp: New, fold all
+       types found in the following files into pat_trie_base.
+       * include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp: Folded.
+       * include/ext/pb_ds/detail/pat_trie_/
+         cond_dtor_entry_dealtor.hpp: Folded.
+       * include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp: Folded.
+       * include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp: Folded.
+       * include/ext/pb_ds/detail/pat_trie_/head.hpp: Folded.
+       * include/ext/pb_ds/detail/pat_trie_/leaf.hpp: Folded.
+       * include/ext/pb_ds/detail/pat_trie_/node_base.hpp: Folded.
+       * include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp: Folded.
+       * include/ext/pb_ds/detail/pat_trie_/internal_node.hpp: Folded.
+       * include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp: Folded.
+       * include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp: Folded.
+       * include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp: Move...
+       * include/ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp: ...here.
+       * include/ext/pb_ds/detail/unordered_iterator/
+       const_point_iterator.hpp: Move...
+       * include/ext/pb_ds/detail/unordered_iterator/
+       point_const_iterator.hpp: ...here.
+
+
+       Adjust for above changes.
+       * include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp: Same.
+       * include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp: Same.
+       * include/ext/pb_ds/detail/resize_policy/
+         sample_resize_trigger.hpp: Same.
+       * include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binomial_heap_base_/
+         binomial_heap_base_.hpp: Same.
+       * include/ext/pb_ds/detail/binomial_heap_base_/
+         constructors_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binomial_heap_base_/
+         split_join_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/container_base_dispatch.hpp: Same. Adjust
+         for template parameter ordering change.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         erase_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         constructor_destructor_no_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         insert_no_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         policy_access_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         resize_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         constructor_destructor_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         insert_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         entry_list_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         find_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         debug_no_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         constructor_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         cond_key_dtor_entry_dealtor.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         debug_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         erase_no_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         iterators_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         resize_no_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/cc_hash_table_map_/
+         standard_policies.hpp: Same.
+       * include/ext/pb_ds/detail/tree_trace_base.hpp: Same.
+       * include/ext/pb_ds/detail/unordered_iterator/iterator.hpp: Same.
+       * include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp: Same.
+       * include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp: Same.
+       * include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pat_trie_/
+         constructors_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp: Same.
+       * include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pat_trie_/traits.hpp: Same.
+       * include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/bin_search_tree_/
+         policy_access_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/bin_search_tree_/
+         constructors_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/bin_search_tree_/traits.hpp: Same.
+       * include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp: Same.
+       * include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp: Same.
+       * include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp: Same.
+       * include/ext/pb_ds/detail/bin_search_tree_/
+         split_join_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/list_update_policy/
+         sample_update_policy.hpp: Same.
+       * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+         trace_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+         erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         erase_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         constructor_destructor_no_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         insert_no_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         policy_access_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         resize_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         constructor_destructor_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         insert_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         iterator_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         find_no_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         find_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         debug_no_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         constructor_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         debug_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         erase_no_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         resize_no_store_hash_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/gp_hash_table_map_/
+         standard_policies.hpp: Same.
+       * include/ext/pb_ds/detail/standard_policies.hpp: Same.
+       * include/ext/pb_ds/detail/types_traits.hpp: Same.
+       * include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp: Same.
+       * include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp: Same.
+       * include/ext/pb_ds/detail/binary_heap_/
+         constructors_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp: Same.
+       * include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp: Same.
+       * include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp: Same.
+       * include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp: Same.
+       * include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp: Same.
+       * include/ext/pb_ds/detail/tree_policy/
+         sample_tree_node_update.hpp: Same.
+       * include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp: Same.
+       * include/ext/pb_ds/detail/trie_policy/
+         sample_trie_node_update.hpp: Same.
+       * include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp: Same.
+       * include/ext/pb_ds/detail/trie_policy/
+         prefix_search_node_update_imp.hpp: Same.
+       * include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp: Same.
+       * include/ext/pb_ds/detail/cond_dealtor.hpp: Same.
+       * include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp: Same.
+         Adjust for template parameter change, fold into
+         container_base_dispatch.
+       * include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pairing_heap_/
+         constructors_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp: Same.
+       * include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binomial_heap_/
+         constructors_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp: Same.
+       * include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/type_utils.hpp: Same.
+       * include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp: Same.
+       * include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp: Same.
+       * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+         policy_access_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+         left_child_next_sibling_heap_.hpp: Same.
+       * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+         const_iterator.hpp: Same.
+       * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+         insert_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+         constructors_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+         debug_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+         node.hpp: Same.
+       * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+         info_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
+         iterators_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp: Same.
+       * include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/thin_heap_/
+         constructors_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp: Same.
+       * include/ext/pb_ds/detail/ov_tree_map_/
+         constructors_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp: Same.
+       * include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/ov_tree_map_/traits.hpp: Same.
+       * include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/debug_map_base.hpp: Same.
+       * include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp: Same.
+       * include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp: Same.
+       * include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp: Same.
+       * include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp: Same.
+       * include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp: Same.
+       * include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp: Same.
+       * include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp: Same.
+       * include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/splay_tree_/
+         constructors_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/splay_tree_/node.hpp: Same.
+       * include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp: Same.
+       * include/ext/pb_ds/detail/splay_tree_/traits.hpp: Same.
+       * include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/list_update_map_/
+         entry_metadata_base.hpp: Same.
+       * include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp: Same.
+       * include/ext/pb_ds/detail/list_update_map_/
+         constructor_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/rc_binomial_heap_/
+         rc_binomial_heap_.hpp: Same.
+       * include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/rc_binomial_heap_/
+         constructors_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp: Same.
+       * include/ext/pb_ds/detail/rc_binomial_heap_/
+         split_join_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/rb_tree_map_/
+         constructors_destructor_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp: Same.
+       * include/ext/pb_ds/detail/rb_tree_map_/node.hpp: Same.
+       * include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp: Same.
+       * include/ext/pb_ds/detail/rb_tree_map_/traits.hpp: Same.
+
+
+       Documentation changes.
+       * include/ext/pb_ds/*: Add doxygen markup.
+       * doc/doxygen/user.cfg.in: Add details for extracting comments
+       from pb_ds.
+       * scripts/run_doxygen: Fixup __gnu_pb_ds::detail.
+       * scripts/make_graph.py: Move to svg output. Re-format generated tables.
+
+       * doc/Makefile.am (stamp-html-copy): New rule.
+       (stamp-html): Use it to copy non-generated files into html docs.
+       * doc/Makefile.in: Regenerated.
+
+       * doc/html/ext/pb_ds/sample_trie_e_access_traits.html: Move...
+       * doc/html/ext/pb_ds/trie_string_access_traits.html: ...here.
+       * doc/html/ext/pb_ds/string_trie_e_access_traits.html: Move..
+       * doc/html/ext/pb_ds/sample_trie_access_traits.html: ...here.
+
+       * doc/html/ext/pb_ds/tree_text_lor_find_timing_test_local.png,
+       hash_random_int_erase_mem_usage_test_local.png,
+       multimap_text_insert_mem_usage_test_small_s2p_hash_local.png,
+       tree_text_insert_timing_test_pat_trie_local.png ,
+       multimap_text_insert_mem_usage_test_small_s2p_tree_local.png ,
+       priority_queue_text_modify_down_timing_test_local.png,
+       gp_hash_random_int_subscript_timing_test_find_local.png,
+       text_find_timing_test_hash_local.png,
+       multimap_text_insert_timing_test_small_s2p_hash_local.png,
+       multimap_text_insert_timing_test_small_s2p_tree_local.png,
+       multimap_text_insert_mem_usage_test_large_s2p_hash_local.png,
+       multimap_text_insert_mem_usage_test_large_s2p_tree_local.png,
+       multimap_text_insert_timing_test_large_s2p_hash_local.png,
+       hash_zlob_random_int_find_timing_test_local.png,
+       multimap_text_insert_timing_test_large_s2p_tree_local.png,
+       binary_priority_queue_random_int_push_timing_test_local.png,
+       priority_queue_text_pop_mem_usage_test_local.png,
+       priority_queue_text_modify_down_timing_test_pairing_thin_local.png,
+       tree_split_join_timing_test_local.png,
+       multimap_text_find_timing_test_small_s2p_hash_local.png,
+       ccgp_hash_random_int_subscript_timing_test_insert_local.png,
+       priority_queue_random_int_push_pop_timing_test_local.png,
+       multimap_text_find_timing_test_small_s2p_tree_local.png,
+       gp_hash_random_int_subscript_timing_test_insert_local.png,
+       priority_queue_text_push_timing_test_local.png,
+       cc_hash_random_int_subscript_timing_test_find_local.png,
+       tree_text_insert_timing_test_vector_tree_local.png,
+       multimap_text_find_timing_test_large_s2p_hash_local.png,
+       pairing_priority_queue_text_push_timing_test_local.png,
+       tree_order_statistics_timing_test_local.png,
+       priority_queue_text_push_pop_timing_test_local.png,
+       text_find_timing_test_tree_like_local.png,
+       multimap_text_find_timing_test_large_s2p_tree_local.png,
+       priority_queue_text_modify_up_timing_test_pairing_thin_local.png,
+       cc_hash_random_int_subscript_timing_test_insert_local.png,
+       priority_queue_text_modify_up_timing_test_local.png,
+       random_int_find_find_timing_test_tree_local.png,
+       priority_queue_random_int_push_timing_test_local.png,
+       tree_text_insert_timing_test_node_tree_local.png,
+       pairing_priority_queue_text_push_pop_timing_test_local.png,
+       gp_hash_random_int_find_timing_test_local.png,
+       cc_hash_random_int_find_timing_test_local.png,
+       priority_queue_text_join_timing_test_local.png: Update local pngs.
+
+
+       Testsuite changes.
+       * testsuite/ext/pb_ds/regression/tree_no_data_map_rand_debug.cc: New.
+       * testsuite/ext/pb_ds/regression/tree_data_map_rand_debug.cc: New.
+       * testsuite/ext/pb_ds/regression/priority_queue_rand_debug.cc: New.
+       * testsuite/ext/pb_ds/regression/trie_no_data_map_rand_debug.cc: New.
+       * testsuite/ext/pb_ds/regression/trie_data_map_rand_debug.cc: New.
+       * testsuite/ext/pb_ds/regression/list_update_no_data_map_rand_debug.cc:
+       New.
+       * testsuite/ext/pb_ds/regression/list_update_data_map_rand_debug.cc:
+       New.
+       * testsuite/ext/pb_ds/regression/hash_no_data_map_rand_debug.cc: New.
+       * testsuite/ext/pb_ds/regression/hash_data_map_rand_debug.cc: New.
+
+       * testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc: Fix typo.
+
+       * testsuite/ext/pb_ds/example/basic_set.cc: Update.
+       * testsuite/ext/pb_ds/example/ranged_hash.cc: Same.
+       * testsuite/ext/pb_ds/example/tree_order_statistics.cc: Same.
+       * testsuite/ext/pb_ds/example/trie_prefix_search.cc: Same.
+       * testsuite/ext/pb_ds/example/trie_dna.cc: Same.
+       * testsuite/ext/pb_ds/example/tree_intervals.cc: Same.
+       * testsuite/ext/pb_ds/example/basic_multimap.cc: Same.
+       * testsuite/performance/ext/pb_ds/hash_random_int_erase_mem_usage.cc:
+         Same.
+       * testsuite/performance/ext/pb_ds/tree_split_join_timing.cc: Same.
+       * testsuite/performance/ext/pb_ds/tree_order_statistics_timing.cc: Same.
+       * testsuite/data/make_graph_test_infos.xml: Same.
+       * testsuite/util/regression/common_type.hpp: Same.
+       * testsuite/util/regression/trait/assoc/native_type_trait.hpp: Same.
+       * testsuite/util/regression/trait/assoc/trait.hpp: Same.
+       * testsuite/util/regression/trait/assoc/type_trait.hpp: Same.
+       * testsuite/util/regression/rand/priority_queue/
+         rand_regression_test.hpp: Same.
+       * testsuite/util/regression/rand/priority_queue/
+         container_rand_regression_test.tcc: Same.
+       * testsuite/util/regression/rand/assoc/rand_regression_test.hpp: Same.
+       * testsuite/util/regression/rand/assoc/container_rand_regression_test.h
+       * testsuite/util/regression/rand/assoc/
+         container_rand_regression_test.tcc: Same.
+       * testsuite/util/native_type/native_priority_queue.hpp: Same.
+       * testsuite/util/native_type/native_multimap.hpp: Same.
+       * testsuite/util/native_type/native_hash_multimap.hpp: Same.
+       * testsuite/util/native_type/native_set.hpp: Same.
+       * testsuite/util/native_type/native_map.hpp: Same.
+       * testsuite/util/native_type/native_hash_set.hpp: Same.
+       * testsuite/util/native_type/native_hash_map.hpp: Same.
+       * testsuite/util/testsuite_containers.h
+       * testsuite/util/common_type/priority_queue/common_type.hpp: Same.
+       * testsuite/util/common_type/assoc/common_type.hpp: Same.
+       * testsuite/util/common_type/assoc/string_form.hpp: Same.
+       * testsuite/util/common_type/assoc/template_policy.hpp: Same.
+       * testsuite/util/common_type/assoc/detail/
+         trigger_policy_string_form.hpp: Same.
+       * testsuite/util/common_type/assoc/detail/ds_string_form.hpp: Same.
+       * testsuite/util/common_type/assoc/detail/
+         size_policy_string_form.hpp: Same.
+       * testsuite/util/common_type/assoc/detail/
+         probe_fn_string_form.hpp: Same.
+       * testsuite/util/common_type/assoc/detail/
+         tree_supports_order_statistics.hpp: Same.
+       * testsuite/util/common_type/assoc/detail/
+         trie_supports_prefix_search.hpp: Same.
+       * testsuite/util/common_type/assoc/detail/
+         list_update_policy_string_form.hpp: Same.
+       * testsuite/util/common_type/assoc/detail/
+         trie_supports_order_statistics.hpp: Same.
+       * testsuite/util/common_type/assoc/native_set.hpp: Same.
+       * testsuite/util/performance/assoc/timing/common_type.hpp: Same.
+       * testsuite/util/performance/assoc/timing/multimap_find_test.hpp: Same.
+       * testsuite/util/performance/assoc/multimap_common_type.hpp: Same.
+
 2011-05-23  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * include/bits/streambuf_iterator.h: Use noexcept per the FDIS.
index b564f1cff41fbc06049aa8db58a43d72c73d8b8a..7e75cc71d21a9ea00c94765016de738737b04a8f 100644 (file)
@@ -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
index e17773370d1091e42bc7b8d89bc936c6dd368b17..8247b60a91aa2e2250dccfb96f622717c7e377f3 100644 (file)
@@ -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
 
index 920a4cd4acf6c2a4a8aa84791df02f3ad9a85cb9..6332dc199090cc68e14f1b10af3774c864f780f3 100644 (file)
@@ -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
index 76e02f134f01c94919c0abf6d8912bd380b6e01e..c69cf1e7641a7fe8a51bc8f073daf582026bbb21 100644 (file)
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
index 4f578c65b1ea26bb94ad1a75c4e30d9a054ef87e..40404c87518e00b14dc433de6c1c06a489a7321e 100644 (file)
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
index ca4db96f457f3d6db6712a03f84434af3ad3e584..bb5f30b68b9749ab61540d9c1ec31e66f610b7f4 100644 (file)
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
index 48fcf76c048c88b3e69f9021057c2391b237ac79..8dc7735c113589440027c3d3b03c4beea1087518 100644 (file)
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
index 2449e1de324c4d44bbc4f2d10433d3ab840c69a9..2b8c0e76d5f2453ab0e4e5cd97c0cb34103587ed 100644 (file)
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
index 1b31b7f27ca70c8909918fe056b3a64af5ece172..299737dd6fc6f3be1527d8033f80164be169d54e 100644 (file)
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
index c693ed3869b7047bf872cc6d84dc02a819e6e0c0..7e4d7fadc62a31bbcf230a4f074cc3d3b056cff5 100644 (file)
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
index 9fa08a0c2c307a32fad055befe104cf103fa1984..587ff1d145c8f6f32cefa6a2909b6287cfb8733b 100644 (file)
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
index dbd3ee9d3c0aa66fd5bfa7454a1737742f331420..66bb0eb46e2804f1e6343ac9b149b027546f6c04 100644 (file)
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
index 0be2f00fa63e49b970f46ac8a2c4e0e99cb917b9..81848ba8b2e3d445667e8fd3f9b75a37d0d978a1 100644 (file)
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
index 32a61cac9bdedb9421c0e3dffc6ce7a9064e05b2..121af9e45a1b5e6946ab8bd8079e6d3f3aa170bf 100644 (file)
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
index 10b3980edab6b26b2ef76e829a2abb8bb2d4f237..3ac90d56c860aa3999b2b74590d5fe20fc48d4c1 100644 (file)
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
index a8fa261177bce2458a317d801c38283704538f5c..4fc3d594afc943b6bcb20b5e37602781a3166b20 100644 (file)
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
index b3d10612f79eaf952b68426306839bf0938898e3..123c3a648b80bd5e0376a54cb41aa87be12c2b00 100644 (file)
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
index 8af7100c6e7bfb4fbfad2e6b95d80a23ced133c6..73a35cef612f6a565f8cd4624aa2faed6123fa87 100644 (file)
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
index 63c0c8db797745c600d793199862a9fb5c3cfc9b..fce364cb318d8814b72e0c6cb42c0fa4e9e58d2f 100644 (file)
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
index 589dccdefa9641f25d45258991b87ef802e9ee2a..df0becc112c9964855b1a8ae32e95fb00ac0e970 100644 (file)
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
index d7322f287a83954beeb0a610e17499585f6a53bb..9bacb35ce545c0915825c622326ac994b0cf52ef 100644 (file)
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
index 5f89460087a781c4bfdaab5e0a0d43cf3e3d4497..de6ee23391e117e95b524d366c56f36990af89bf 100644 (file)
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
index 2b496b48d780558750b1667e79979d089ea52cb2..307ca2db18763402e240492698308a7dc8bca8a2 100644 (file)
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
index 4af78faa524c40ec973bbbd2eac89943e90eb490..4174fabe923d64918101af1793e40e4332408f50 100644 (file)
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
index 40b5b2c43272e937b0c45d8c204c5dffc8084aeb..c5f4e57e6d7c3e1f238c27c471c71fb59d124420 100644 (file)
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
index 97ca4e9daad5f4c2f39b95cc741017f49669228c..81f7a5900a023384ccbc4a4c81cc44bcfde231f9 100644 (file)
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
index cedcb4cf4b22dcd3a76a6a27bfa3f51bdbe7ca88..472d8691f2e7b69512e89d9c2daa5b138e0117aa 100644 (file)
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
index 51f8211f1d41e26b59dc864cc0706528eb1fda69..b8cc15330abeaabdad1f3a138bb0b3b7d72be962 100644 (file)
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
index dead185fa4fea098b06189e39eaa1c9175951e9b..51fa718d279e43fcae7f19c619ae2d7484a00471 100644 (file)
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
index 1701b4d8a61ec2289946cc3135f3d1ed14d814e2..67318f04896a176ea21675a4b08d6b8f0728209f 100644 (file)
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
index 2fa9c7988048db2510d0a98956f36837c2a9fde3..d8d3b7a7ada1cbc73cfe83b4460d8a63d40e768b 100644 (file)
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
index 977d167186c5f1aa68908e31f4aee1b2c53af47a..23ac5e73ec1c05753d5f6628efdaa8271f52f296 100644 (file)
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
index 31575b452d385ab969bb5adf0526f93438c3ce3b..dc48e39df5d8b7dfc778f965a0c1afd5a817a331 100644 (file)
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
index b878dde665c9bc8e5fddac3358bc10231ce03db7..9a73934c7731c4fecfd06601b4db1451f7f230ee 100644 (file)
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
index c1413fc93d6a18ea72d0b3a10f0a6e03614f0d0f..d1966e33d98b017d60a9e69bf8d7111697046aae 100644 (file)
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
index a7c5f8987aee65d16149c328ed0f80f32c0c52bb..fd52d5a16c5f1a2ca83f4560ee7c8bfa7ad72f63 100644 (file)
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
index da7297bffa9cc9ab60cbb60c0310cf457410c012..18cca76c2944f349116169318174bf14e71260a1 100644 (file)
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
index 83105202a4835efb176b993ef0c430d8b8f09c2a..dd7c184dd435a19272e88fad490ddb76c8999d57 100644 (file)
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
index d85980f30fb4947574f7cf64dceb6d816e44d6e7..5364778241dff27501093cfa740c6dea79f2db92 100644 (file)
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
index b7fdc4746442734c377fbc7740146fbdd61708d9..8ec5cfbce7a833e2d3ea738697636e084c2bb9d1 100644 (file)
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
index 2b921743f7c2c05b8f40ff4df168cde83ae4309f..9f46319f8081010d6b1bc88819ed44ed937c956a 100644 (file)
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
index 131d24a1a12f764adfc60fd040286f37b0af29e3..fe5ba81c49e29aeffab63609d77ff33547e36dcd 100644 (file)
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
index bb100084b3fc7feb4ed638f60e6ff5dffe048d29..c98488c041a8fcb2c7a7f5d2adb37cd533a7e05f 100644 (file)
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
index 228de144222a65b8dcbae8bfacd189f3ce2c8bee..eff7eefb09d89c0099eabda19010d4832f37b291 100644 (file)
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
index cecb8a10750c9c499c9b56a76874f0a8619810cd..f67156d452ee6e0f7cb39df697dcd288533ba525 100644 (file)
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
index 26f71510ff0ce46890171c6b9163ff74f3da79ef..960803b05f5ae58fcc6f52291ae337558bc7f94a 100644 (file)
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
index 27aff0d2ddd627f786feda8d023f0cf130455f0c..73b858993d06b6a8ca14a5303d839676655ca9db 100644 (file)
@@ -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
 
index e7f7951d42767c6577a32bca4d949cafe4da8cd2..aa90813309236850f68f62ae2454c15913d2dd9d 100644 (file)
@@ -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
 
index 12a3fc501c91c774b76a1ee84c2fdfecd0ded22b..d366f431ccf7b1ef48b0873b6f8eb03eee73bde4 100644 (file)
@@ -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
 #include <ext/pb_ds/tag_and_trait.hpp>
 #include <ext/pb_ds/detail/standard_policies.hpp>
 #include <ext/pb_ds/detail/container_base_dispatch.hpp>
-#include <ext/pb_ds/detail/basic_tree_policy/traits.hpp>
+#include <ext/pb_ds/detail/branch_policy/traits.hpp>
 
 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<Key, Mapped, Tag, Policy_Tl, Allocator>::type
-
-  /// An abstract basic associative container.
-  template<typename Key, 
-          typename Mapped, 
-          typename Tag, 
-          typename Policy_Tl, 
-          typename Allocator>
-  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<Key>::other::value_type key_type;
-    typedef typename allocator_type::template rebind<key_type>::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<mapped_type>::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<value_type>::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 <ext/pb_ds/detail/constructors_destructor_fn_imps.hpp>
-#undef PB_DS_CLASS_NAME
-  };
-
-#undef PB_DS_BASE_C_DEC
 
-
-#define PB_DS_BASE_C_DEC \
-  container_base<Key, Mapped, Tag, typename __gnu_cxx::typelist::append< \
-  typename __gnu_cxx::typelist::create4<Hash_Fn, Eq_Fn, Resize_Policy, detail::integral_constant<int, Store_Hash> >::type, Policy_TL>::type, Allocator>
+#define PB_DS_HASH_BASE \
+  detail::container_base_dispatch<Key, Mapped, _Alloc, Tag, \
+    typename __gnu_cxx::typelist::append< \
+    typename __gnu_cxx::typelist::create4<Hash_Fn, Eq_Fn, Resize_Policy, \
+    detail::integral_constant<int, Store_Hash> >::type, Policy_Tl>::type>::type
 
   /// An abstract basic hash-based associative container.
   template<typename Key,
@@ -139,12 +69,12 @@ namespace __gnu_pbds
           typename Resize_Policy,
           bool Store_Hash,
           typename Tag,
-          typename Policy_TL,
-          typename Allocator>
-  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<Key, Mapped,        Hash_Fn, Eq_Fn, Resize_Policy, Store_Hash, \
                   cc_hash_tag, \
-         typename __gnu_cxx::typelist::create1<Comb_Hash_Fn>::type, Allocator>
+         typename __gnu_cxx::typelist::create1<Comb_Hash_Fn>::type, _Alloc>
 
   /// A concrete collision-chaining hash-based associative container.
   template<typename Key,
@@ -176,24 +106,25 @@ namespace __gnu_pbds
           typename Comb_Hash_Fn = detail::default_comb_hash_fn::type,
           typename Resize_Policy = typename detail::default_resize_policy<Comb_Hash_Fn>::type,
           bool Store_Hash = detail::default_store_hash,
-          typename Allocator = std::allocator<char> >
-  class cc_hash_table :  public PB_DS_BASE_C_DEC
+          typename _Alloc = std::allocator<char> >
+  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<typename It>
-    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<Key, Mapped,        Hash_Fn, Eq_Fn, Resize_Policy, Store_Hash, \
                   gp_hash_tag, \
-                  typename __gnu_cxx::typelist::create2<Comb_Probe_Fn, Probe_Fn>::type, Allocator>
+  typename __gnu_cxx::typelist::create2<Comb_Probe_Fn, Probe_Fn>::type, _Alloc>
 
   /// A concrete general-probing hash-based associative container.
   template<typename Key,
@@ -314,18 +245,19 @@ namespace __gnu_pbds
           typename Probe_Fn = typename detail::default_probe_fn<Comb_Probe_Fn>::type,
           typename Resize_Policy = typename detail::default_resize_policy<Comb_Probe_Fn>::type,
           bool Store_Hash = detail::default_store_hash,
-          typename Allocator = std::allocator<char> >
-  class gp_hash_table : public PB_DS_BASE_C_DEC
+          typename _Alloc = std::allocator<char> >
+  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<typename It>
-    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<typename It>
-    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<typename It>
-    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<Key, Mapped, Tag, Policy_Tl, Allocator>
+#define PB_DS_BRANCH_BASE \
+  detail::container_base_dispatch<Key, Mapped, _Alloc, Tag, Policy_Tl>::type
 
   /// An abstract basic tree-like (tree, trie) associative container.
-  template<typename Key, typename Mapped, typename Tag, 
-          typename Node_Update, typename Policy_Tl, typename Allocator>
-  class basic_tree : public PB_DS_BASE_C_DEC
+  template<typename Key, typename Mapped, typename Tag,
+          typename Node_Update, typename Policy_Tl, typename _Alloc>
+  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 <ext/pb_ds/detail/constructors_destructor_fn_imps.hpp>
 #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<Key, Mapped,Cmp_Fn,Node_Update,Tag, Allocator>
+#define PB_DS_TREE_NODE_AND_IT_TRAITS \
+  detail::tree_traits<Key, Mapped,Cmp_Fn,Node_Update,Tag,_Alloc>
 
-#define PB_DS_BASE_C_DEC \
-  basic_tree<Key,Mapped,Tag,typename PB_DS_TREE_NODE_AND_IT_TRAITS_C_DEC::node_update, \
-            typename __gnu_cxx::typelist::create2<Cmp_Fn, PB_DS_TREE_NODE_AND_IT_TRAITS_C_DEC >::type, Allocator>
+#define PB_DS_TREE_BASE \
+  basic_branch<Key,Mapped, Tag, \
+              typename PB_DS_TREE_NODE_AND_IT_TRAITS::node_update, \
+              typename __gnu_cxx::typelist::create2<Cmp_Fn, \
+              PB_DS_TREE_NODE_AND_IT_TRAITS>::type, _Alloc>
 
-  /// A concrete basic tree-based associative container.
+  /// A basic tree-based associative container.
   template<typename Key, typename Mapped, typename Cmp_Fn = std::less<Key>,
           typename Tag = rb_tree_tag,
-          template<typename Const_Node_Iterator, typename Node_Iterator, typename Cmp_Fn_, typename Allocator_>
-  class Node_Update = __gnu_pbds::null_tree_node_update,
-          typename Allocator = std::allocator<char> >
-  class tree : public PB_DS_BASE_C_DEC
+          template<typename Node_CItr, typename Node_Itr,
+                   typename Cmp_Fn_, typename _Alloc_>
+          class Node_Update = null_node_update,
+          typename _Alloc = std::allocator<char> >
+  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<Key,Mapped,E_Access_Traits,Node_Update,Tag,Allocator>
+#define PB_DS_TRIE_NODE_AND_IT_TRAITS \
+  detail::trie_traits<Key,Mapped,_ATraits,Node_Update,Tag,_Alloc>
 
-#define PB_DS_BASE_C_DEC \
-  basic_tree<Key,Mapped,Tag, typename PB_DS_TRIE_NODE_AND_ITS_TRAITS::node_update, \
-            typename __gnu_cxx::typelist::create2<E_Access_Traits, PB_DS_TRIE_NODE_AND_ITS_TRAITS >::type, Allocator>
+#define PB_DS_TRIE_BASE \
+  basic_branch<Key,Mapped,Tag, \
+              typename PB_DS_TRIE_NODE_AND_IT_TRAITS::node_update, \
+              typename __gnu_cxx::typelist::create2<_ATraits, \
+              PB_DS_TRIE_NODE_AND_IT_TRAITS >::type, _Alloc>
 
-  /// A concrete basic trie-based associative container.
+  /// A basic trie-based associative container.
   template<typename Key,
           typename Mapped,
-          typename E_Access_Traits = typename detail::default_trie_e_access_traits<Key>::type,
+          typename _ATraits = \
+                   typename detail::default_trie_access_traits<Key>::type,
           typename Tag = pat_trie_tag,
-          template<typename Const_Node_Iterator,
-                   typename Node_Iterator,
-                   typename E_Access_Traits_,
-                   typename Allocator_>
-  class Node_Update = null_trie_node_update,
-          typename Allocator = std::allocator<char> >
-  class trie : public PB_DS_BASE_C_DEC
+          template<typename Node_CItr,
+                   typename Node_Itr,
+                   typename _ATraits_,
+                   typename _Alloc_>
+          class Node_Update = null_node_update,
+          typename _Alloc = std::allocator<char> >
+  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<typename It>
-    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<Key, Mapped, list_update_tag, \
-                typename __gnu_cxx::typelist::create2<Eq_Fn, Update_Policy>::type, Allocator>
+#define PB_DS_LU_BASE \
+  detail::container_base_dispatch<Key, Mapped, _Alloc, list_update_tag,        \
+    typename __gnu_cxx::typelist::create2<Eq_Fn, Update_Policy>::type>::type
 
   /// A list-update based associative container.
   template<typename Key,
           typename Mapped,
           class Eq_Fn = typename detail::default_eq_fn<Key>::type,
           class Update_Policy = detail::default_update_policy::type,
-          class Allocator = std::allocator<char> >
-  class list_update : public PB_DS_BASE_C_DEC
+          class _Alloc = std::allocator<char> >
+  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 (file)
index aac1397..0000000
+++ /dev/null
@@ -1,211 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file basic_types.hpp
- * Contains basic types used by containers.
- */
-
-#ifndef PB_DS_BASIC_TYPES_HPP
-#define PB_DS_BASIC_TYPES_HPP
-
-#include <algorithm>
-#include <utility>
-#include <ext/pb_ds/tag_and_trait.hpp>
-#include <ext/pb_ds/detail/type_utils.hpp>
-
-namespace __gnu_pbds
-{
-  namespace detail
-  {
-    template<typename Key, typename Mapped, typename Allocator, bool Store_Hash>
-    struct value_type_base;
-
-    /**
-     * Specialization of value_type_base for the case where the hash value
-     * is not stored alongside each value.
-     **/
-    template<typename Key, typename Mapped, typename Allocator>
-    struct value_type_base<Key, Mapped, Allocator, false>
-    {
-      typedef typename Allocator::template rebind<Mapped>::other mapped_type_allocator;
-      typedef typename mapped_type_allocator::value_type mapped_type;
-      typedef typename mapped_type_allocator::pointer mapped_pointer;
-      typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
-      typedef typename mapped_type_allocator::reference mapped_reference;
-      typedef typename mapped_type_allocator::const_reference const_mapped_reference;
-
-      typedef typename Allocator::template rebind<std::pair<const Key, Mapped> >::other value_type_allocator;
-      typedef typename value_type_allocator::value_type value_type;
-      typedef typename value_type_allocator::pointer pointer;
-      typedef typename value_type_allocator::const_pointer const_pointer;
-      typedef typename value_type_allocator::reference reference;
-      typedef typename value_type_allocator::const_reference const_reference;
-
-      struct stored_value_type
-      {
-       value_type m_value;
-      };
-    };
-
-    /**
-     * Specialization of value_type_base for the case where the hash value
-     * is stored alongside each value.
-     **/
-    template<typename Key, typename Mapped, typename Allocator>
-    struct value_type_base<Key, Mapped, Allocator, true>
-    {
-      typedef typename Allocator::template rebind<Mapped>::other mapped_type_allocator;
-      typedef typename mapped_type_allocator::value_type mapped_type;
-      typedef typename mapped_type_allocator::pointer mapped_pointer;
-      typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
-      typedef typename mapped_type_allocator::reference mapped_reference;
-      typedef typename mapped_type_allocator::const_reference const_mapped_reference;
-
-      typedef typename Allocator::template rebind<std::pair<const Key, Mapped> >::other value_type_allocator;
-      typedef typename value_type_allocator::value_type value_type;
-      typedef typename value_type_allocator::pointer pointer;
-      typedef typename value_type_allocator::const_pointer const_pointer;
-      typedef typename value_type_allocator::reference reference;
-      typedef typename value_type_allocator::const_reference const_reference;
-
-      struct stored_value_type
-      {
-       value_type m_value;
-       typename Allocator::size_type m_hash;
-      };
-    };
-
-#define PB_DS_CLASS_T_DEC \
-    template<typename Key, typename Allocator>
-
-#define PB_DS_CLASS_C_DEC \
-    value_type_base<Key, null_mapped_type, Allocator, false>
-
-    /**
-     * Specialization of value_type_base for the case where the hash value
-     * is not stored alongside each value.
-     **/
-    template<typename Key, typename Allocator>
-    struct value_type_base<Key, null_mapped_type, Allocator, false>
-    {
-      typedef typename Allocator::template rebind<null_mapped_type>::other mapped_type_allocator;
-      typedef typename mapped_type_allocator::value_type mapped_type;
-      typedef typename mapped_type_allocator::pointer mapped_pointer;
-      typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
-      typedef typename mapped_type_allocator::reference mapped_reference;
-      typedef typename mapped_type_allocator::const_reference const_mapped_reference;
-
-      typedef Key value_type;
-
-      typedef typename Allocator::template rebind<value_type>::other value_type_allocator;
-      typedef typename value_type_allocator::pointer pointer;
-      typedef typename value_type_allocator::const_pointer const_pointer;
-      typedef typename value_type_allocator::reference reference;
-      typedef typename value_type_allocator::const_reference const_reference;
-
-      struct stored_value_type
-      {
-       value_type m_value;
-      };
-
-      static null_mapped_type s_null_mapped;
-    };
-
-    PB_DS_CLASS_T_DEC
-    null_mapped_type PB_DS_CLASS_C_DEC::s_null_mapped;
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
-#define PB_DS_CLASS_T_DEC \
-    template<typename Key, typename Allocator>
-
-#define PB_DS_CLASS_C_DEC \
-    value_type_base<Key, null_mapped_type, Allocator, true>
-
-    /**
-     * Specialization of value_type_base for the case where the hash value
-     * is stored alongside each value.
-     **/
-    template<typename Key, typename Allocator>
-    struct value_type_base<Key, null_mapped_type, Allocator, true>
-    {
-      typedef typename Allocator::template rebind<null_mapped_type>::other mapped_type_allocator;
-      typedef typename mapped_type_allocator::value_type mapped_type;
-      typedef typename mapped_type_allocator::pointer mapped_pointer;
-      typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
-      typedef typename mapped_type_allocator::reference mapped_reference;
-      typedef typename mapped_type_allocator::const_reference const_mapped_reference;
-
-      typedef Key value_type;
-
-      typedef typename Allocator::template rebind<value_type>::other value_type_allocator;
-      typedef typename value_type_allocator::pointer pointer;
-      typedef typename value_type_allocator::const_pointer const_pointer;
-      typedef typename value_type_allocator::reference reference;
-      typedef typename value_type_allocator::const_reference const_reference;
-
-      struct stored_value_type
-      {
-       value_type m_value;
-       typename Allocator::size_type m_hash;
-      };
-
-      static null_mapped_type s_null_mapped;
-    };
-
-    PB_DS_CLASS_T_DEC
-    null_mapped_type PB_DS_CLASS_C_DEC::s_null_mapped;
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
-    template<typename Key, typename Mapped>
-    struct no_throw_copies
-    {
-      typedef integral_constant<int, is_simple<Key>::value && is_simple<Mapped>::value> indicator;
-    };
-
-    template<typename Key>
-    struct no_throw_copies<Key, null_mapped_type>
-    {
-      typedef integral_constant<int, is_simple<Key>::value> indicator;
-    };
-  } // namespace detail
-} // namespace __gnu_pbds
-
-#endif 
-
index a73414a0fcc59cce9d6c79d2ece6dacdb1abbe1b..a875e300d4d3984951d3a1b6480efe15f622618b 100644 (file)
 // warranty.
 
 /**
- * @file bin_search_tree_.hpp
- * Contains an implementation class for bin_search_tree_.
- */
-/*
- * This implementation uses an idea from the SGI STL (using a @a header node
- *    which is needed for efficient iteration).
+ *  @file bin_search_tree_/bin_search_tree_.hpp
+ *  Contains an implementation class for binary search tree.
  */
 
 #include <ext/pb_ds/exception.hpp>
+#include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
 #include <ext/pb_ds/detail/types_traits.hpp>
-#include <ext/pb_ds/detail/debug_map_base.hpp>
-#include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/detail/cond_dealtor.hpp>
 #include <ext/pb_ds/detail/type_utils.hpp>
 #include <ext/pb_ds/detail/tree_trace_base.hpp>
+#ifdef _GLIBCXX_DEBUG
+#include <ext/pb_ds/detail/debug_map_base.hpp>
+#endif
 #include <utility>
 #include <functional>
 #include <debug/debug.h>
@@ -58,201 +56,129 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-
-#define PB_DS_CLASS_T_DEC                                              \
-    template<typename Key, typename Mapped, class Cmp_Fn,              \
-            class Node_And_It_Traits, class Allocator>
-
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CLASS_NAME                       \
-    bin_search_tree_data_
-#endif 
+#define PB_DS_BIN_TREE_NAME bin_search_tree_map
+#endif
 
 #ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_CLASS_NAME                       \
-    bin_search_tree_no_data_
-#endif 
-
-#define PB_DS_CLASS_C_DEC                                              \
-    PB_DS_CLASS_NAME<                                                  \
-                                               Key,                    \
-                                               Mapped,                 \
-                                               Cmp_Fn,                 \
-                                               Node_And_It_Traits,     \
-                                               Allocator>
-
-#define PB_DS_TYPES_TRAITS_C_DEC                               \
-    types_traits<                              \
-                                               Key,            \
-                                               Mapped,         \
-                                               Allocator,      \
-                                               false>
+#define PB_DS_BIN_TREE_NAME bin_search_tree_set
+#endif
 
-#ifdef _GLIBCXX_DEBUG
-#define PB_DS_DEBUG_MAP_BASE_C_DEC                                     \
-    debug_map_base<Key,        eq_by_less<Key, Cmp_Fn>, \
-             typename Allocator::template rebind<Key>::other::const_reference>
-#endif 
+#define PB_DS_CLASS_T_DEC \
+    template<typename Key, typename Mapped, typename Cmp_Fn, \
+            typename Node_And_It_Traits, typename _Alloc>
 
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#define PB_DS_EP2VP(X)& ((X)->m_value)
-#endif 
+#define PB_DS_CLASS_C_DEC \
+    PB_DS_BIN_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
 
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped_Data()
-#define PB_DS_EP2VP(X)& ((X)->m_value.first)
-#endif 
+#define PB_DS_BIN_TREE_TRAITS_BASE \
+    types_traits<Key, Mapped, _Alloc, false>
+
+#ifdef _GLIBCXX_DEBUG
+#define PB_DS_DEBUG_MAP_BASE_C_DEC  \
+    debug_map_base<Key,        eq_by_less<Key, Cmp_Fn>, \
+             typename _Alloc::template rebind<Key>::other::const_reference>
+#endif
 
 #ifdef PB_DS_TREE_TRACE
-#define PB_DS_TREE_TRACE_BASE_C_DEC                                    \
-    tree_trace_base<                                                   \
-                                                                       typename Node_And_It_Traits::const_node_iterator, \
-                                                                       typename Node_And_It_Traits::node_iterator, \
-                                                                       Cmp_Fn, \
-                                                                       true, \
-                                                                       Allocator>
-#endif 
-
-    /**
-     * class description = "8i|\|4ree $34rc|-| 7r33 74813.">
-     **/
-    template<typename Key,
-            typename Mapped,
-            class Cmp_Fn,
-            class Node_And_It_Traits,
-            class Allocator>
-    class PB_DS_CLASS_NAME :
+#define PB_DS_TREE_TRACE_BASE_C_DEC \
+    tree_trace_base<typename Node_And_It_Traits::node_const_iterator, \
+                   typename Node_And_It_Traits::node_iterator,       \
+                   Cmp_Fn, true, _Alloc>
+#endif
+
+
+    /*
+     *  @brief Binary search tree (BST).
+     *
+     *  This implementation uses an idea from the SGI STL (using a @a
+     *  header node which is needed for efficient iteration).
+     */
+    template<typename Key, typename Mapped, typename Cmp_Fn,
+            typename Node_And_It_Traits, typename _Alloc>
+    class PB_DS_BIN_TREE_NAME :
 #ifdef _GLIBCXX_DEBUG
       public PB_DS_DEBUG_MAP_BASE_C_DEC,
-#endif 
+#endif
 #ifdef PB_DS_TREE_TRACE
       public PB_DS_TREE_TRACE_BASE_C_DEC,
-#endif 
+#endif
       public Cmp_Fn,
-      public PB_DS_TYPES_TRAITS_C_DEC,
+      public PB_DS_BIN_TREE_TRAITS_BASE,
       public Node_And_It_Traits::node_update
     {
+      typedef Node_And_It_Traits                       traits_type;
 
     protected:
+      typedef PB_DS_BIN_TREE_TRAITS_BASE               traits_base;
+
       typedef
-      typename Allocator::template rebind<
-      typename Node_And_It_Traits::node>::other
+      typename _Alloc::template rebind<typename traits_type::node>::other
       node_allocator;
 
-      typedef typename node_allocator::value_type node;
-
-      typedef typename node_allocator::pointer node_pointer;
+      typedef typename node_allocator::value_type      node;
+      typedef typename node_allocator::pointer                 node_pointer;
 
-      typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
-
-      typedef
-      typename Node_And_It_Traits::null_node_update_pointer
+      typedef typename traits_type::null_node_update_pointer
       null_node_update_pointer;
 
     private:
-      typedef cond_dealtor< node, Allocator> cond_dealtor_t;
+      typedef cond_dealtor<node, _Alloc>               cond_dealtor_t;
 
 #ifdef _GLIBCXX_DEBUG
-      typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
-#endif 
+      typedef PB_DS_DEBUG_MAP_BASE_C_DEC               debug_base;
+#endif
 
     public:
-
-      typedef typename Allocator::size_type size_type;
-
-      typedef typename Allocator::difference_type difference_type;
-
-      typedef typename PB_DS_TYPES_TRAITS_C_DEC::key_type key_type;
-
-      typedef typename PB_DS_TYPES_TRAITS_C_DEC::key_pointer key_pointer;
-
-      typedef
-      typename PB_DS_TYPES_TRAITS_C_DEC::const_key_pointer
-      const_key_pointer;
-
-      typedef typename PB_DS_TYPES_TRAITS_C_DEC::key_reference key_reference;
-
-      typedef
-      typename PB_DS_TYPES_TRAITS_C_DEC::const_key_reference
-      const_key_reference;
+      typedef typename _Alloc::size_type               size_type;
+      typedef typename _Alloc::difference_type         difference_type;
+      typedef typename traits_base::key_type           key_type;
+      typedef typename traits_base::key_pointer        key_pointer;
+      typedef typename traits_base::key_const_pointer  key_const_pointer;
+      typedef typename traits_base::key_reference      key_reference;
+      typedef typename traits_base::key_const_reference key_const_reference;
 
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-      typedef typename PB_DS_TYPES_TRAITS_C_DEC::mapped_type mapped_type;
-
-      typedef
-      typename PB_DS_TYPES_TRAITS_C_DEC::mapped_pointer
-      mapped_pointer;
+      typedef typename traits_base::mapped_type        mapped_type;
+      typedef typename traits_base::mapped_pointer     mapped_pointer;
+      typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
+      typedef typename traits_base::mapped_reference   mapped_reference;
+      typedef typename traits_base::mapped_const_reference mapped_const_reference;
+#endif
 
-      typedef
-      typename PB_DS_TYPES_TRAITS_C_DEC::const_mapped_pointer
-      const_mapped_pointer;
-
-      typedef
-      typename PB_DS_TYPES_TRAITS_C_DEC::mapped_reference
-      mapped_reference;
-
-      typedef
-      typename PB_DS_TYPES_TRAITS_C_DEC::const_mapped_reference
-      const_mapped_reference;
-#endif 
-
-      typedef typename PB_DS_TYPES_TRAITS_C_DEC::value_type value_type;
-
-      typedef typename PB_DS_TYPES_TRAITS_C_DEC::pointer pointer;
-
-      typedef typename PB_DS_TYPES_TRAITS_C_DEC::const_pointer const_pointer;
-
-      typedef typename PB_DS_TYPES_TRAITS_C_DEC::reference reference;
-
-      typedef
-      typename PB_DS_TYPES_TRAITS_C_DEC::const_reference
-      const_reference;
-
-      typedef
-      typename Node_And_It_Traits::const_point_iterator
-      const_point_iterator;
-
-      typedef const_point_iterator const_iterator;
-
-      typedef typename Node_And_It_Traits::point_iterator point_iterator;
+      typedef typename traits_base::value_type                 value_type;
+      typedef typename traits_base::pointer            pointer;
+      typedef typename traits_base::const_pointer      const_pointer;
+      typedef typename traits_base::reference          reference;
+      typedef typename traits_base::const_reference    const_reference;
+      typedef typename traits_type::point_const_iterator point_const_iterator;
 
-      typedef point_iterator iterator;
+      typedef point_const_iterator                     const_iterator;
+      typedef typename traits_type::point_iterator     point_iterator;
+      typedef point_iterator                           iterator;
 
-      typedef
-      typename Node_And_It_Traits::const_reverse_iterator
-      const_reverse_iterator;
-
-      typedef typename Node_And_It_Traits::reverse_iterator reverse_iterator;
-
-      typedef
-      typename Node_And_It_Traits::const_node_iterator
-      const_node_iterator;
+      typedef typename traits_type::const_reverse_iterator const_reverse_iterator;
 
-      typedef typename Node_And_It_Traits::node_iterator node_iterator;
+      typedef typename traits_type::reverse_iterator   reverse_iterator;
+      typedef typename traits_type::node_const_iterator node_const_iterator;
+      typedef typename traits_type::node_iterator      node_iterator;
+      typedef typename traits_type::node_update        node_update;
 
-      typedef Cmp_Fn cmp_fn;
-
-      typedef Allocator allocator_type;
-
-      typedef typename Node_And_It_Traits::node_update node_update;
-
-    public:
+      typedef Cmp_Fn                                   cmp_fn;
+      typedef _Alloc                                   allocator_type;
 
-      PB_DS_CLASS_NAME();
+      PB_DS_BIN_TREE_NAME();
 
-      PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn);
+      PB_DS_BIN_TREE_NAME(const Cmp_Fn&);
 
-      PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_update);
+      PB_DS_BIN_TREE_NAME(const Cmp_Fn&, const node_update&);
 
-      PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other);
+      PB_DS_BIN_TREE_NAME(const PB_DS_CLASS_C_DEC&);
 
       void
-      swap(PB_DS_CLASS_C_DEC& other);
+      swap(PB_DS_CLASS_C_DEC&);
 
-      ~PB_DS_CLASS_NAME();
+      ~PB_DS_BIN_TREE_NAME();
 
       inline bool
       empty() const;
@@ -263,29 +189,29 @@ namespace __gnu_pbds
       inline size_type
       max_size() const;
 
-      Cmp_Fn& 
+      Cmp_Fn&
       get_cmp_fn();
 
-      const Cmp_Fn& 
+      const Cmp_Fn&
       get_cmp_fn() const;
 
       inline point_iterator
-      lower_bound(const_key_reference r_key);
+      lower_bound(key_const_reference);
 
-      inline const_point_iterator
-      lower_bound(const_key_reference r_key) const;
+      inline point_const_iterator
+      lower_bound(key_const_reference) const;
 
       inline point_iterator
-      upper_bound(const_key_reference r_key);
+      upper_bound(key_const_reference);
 
-      inline const_point_iterator
-      upper_bound(const_key_reference r_key) const;
+      inline point_const_iterator
+      upper_bound(key_const_reference) const;
 
       inline point_iterator
-      find(const_key_reference r_key);
+      find(key_const_reference);
 
-      inline const_point_iterator
-      find(const_key_reference r_key) const;
+      inline point_const_iterator
+      find(key_const_reference) const;
 
       inline iterator
       begin();
@@ -311,13 +237,13 @@ namespace __gnu_pbds
       inline const_reverse_iterator
       rend() const;
 
-      inline const_node_iterator
+      inline node_const_iterator
       node_begin() const;
 
       inline node_iterator
       node_begin();
 
-      inline const_node_iterator
+      inline node_const_iterator
       node_end() const;
 
       inline node_iterator
@@ -327,148 +253,139 @@ namespace __gnu_pbds
       clear();
 
     protected:
-
       void
-      value_swap(PB_DS_CLASS_C_DEC& other);
+      value_swap(PB_DS_CLASS_C_DEC&);
 
       void
       initialize_min_max();
 
       inline iterator
-      insert_imp_empty(const_reference r_value);
+      insert_imp_empty(const_reference);
 
       inline iterator
-      insert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd);
+      insert_leaf_new(const_reference, node_pointer, bool);
 
       inline node_pointer
-      get_new_node_for_leaf_insert(const_reference r_val, false_type);
+      get_new_node_for_leaf_insert(const_reference, false_type);
 
       inline node_pointer
-      get_new_node_for_leaf_insert(const_reference r_val, true_type);
+      get_new_node_for_leaf_insert(const_reference, true_type);
 
       inline void
-      actual_erase_node(node_pointer p_nd);
+      actual_erase_node(node_pointer);
 
       inline std::pair<node_pointer, bool>
-      erase(node_pointer p_nd);
+      erase(node_pointer);
 
       inline void
-      update_min_max_for_erased_node(node_pointer p_nd);
+      update_min_max_for_erased_node(node_pointer);
 
       static void
-      clear_imp(node_pointer p_nd);
+      clear_imp(node_pointer);
 
-      inline std::pair<
-       point_iterator,
-       bool>
-      insert_leaf(const_reference r_value);
+      inline std::pair<point_iterator, bool>
+      insert_leaf(const_reference);
 
       inline void
-      rotate_left(node_pointer p_x);
+      rotate_left(node_pointer);
 
       inline void
-      rotate_right(node_pointer p_y);
+      rotate_right(node_pointer);
 
       inline void
-      rotate_parent(node_pointer p_nd);
+      rotate_parent(node_pointer);
 
       inline void
-      apply_update(node_pointer p_nd, null_node_update_pointer);
+      apply_update(node_pointer, null_node_update_pointer);
 
       template<typename Node_Update_>
-      inline void
-      apply_update(node_pointer p_nd, Node_Update_* p_update);
+       inline void
+       apply_update(node_pointer, Node_Update_*);
 
       inline void
-      update_to_top(node_pointer p_nd, null_node_update_pointer);
+      update_to_top(node_pointer, null_node_update_pointer);
 
       template<typename Node_Update_>
-      inline void
-      update_to_top(node_pointer p_nd, Node_Update_* p_update);
+       inline void
+       update_to_top(node_pointer, Node_Update_*);
 
       bool
-      join_prep(PB_DS_CLASS_C_DEC& other);
+      join_prep(PB_DS_CLASS_C_DEC&);
 
       void
-      join_finish(PB_DS_CLASS_C_DEC& other);
+      join_finish(PB_DS_CLASS_C_DEC&);
 
       bool
-      split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other);
+      split_prep(key_const_reference, PB_DS_CLASS_C_DEC&);
 
       void
-      split_finish(PB_DS_CLASS_C_DEC& other);
+      split_finish(PB_DS_CLASS_C_DEC&);
 
       size_type
-      recursive_count(node_pointer p_nd) const;
+      recursive_count(node_pointer) const;
 
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_valid(const char* file, int line) const;
+      assert_valid(const char*, int) const;
 
       void
-      structure_only_assert_valid(const char* file, int line) const;
+      structure_only_assert_valid(const char*, int) const;
 
       void
-      assert_node_consistent(const node_pointer p_nd,
-                            const char* file, int line) const;
-#endif 
+      assert_node_consistent(const node_pointer, const char*, int) const;
+#endif
 
     private:
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_iterators(const char* file, int line) const;
+      assert_iterators(const char*, int) const;
 
       void
-      assert_consistent_with_debug_base(const char* file, int line) const;
+      assert_consistent_with_debug_base(const char*, int) const;
 
       void
-      assert_node_consistent_with_left(const node_pointer p_nd,
-                                      const char* file, int line) const;
+      assert_node_consistent_with_left(const node_pointer,
+                                      const char*, int) const;
 
       void
-      assert_node_consistent_with_right(const node_pointer p_nd,
-                                       const char* file, int line) const;
+      assert_node_consistent_with_right(const node_pointer,
+                                       const char*, int) const;
 
       void
-      assert_consistent_with_debug_base(const node_pointer p_nd,
-                                       const char* file, int line) const;
+      assert_consistent_with_debug_base(const node_pointer,
+                                       const char*, int) const;
 
       void
-      assert_min(const char* file, int line) const;
+      assert_min(const char*, int) const;
 
       void
-      assert_min_imp(const node_pointer p_nd,
-                    const char* file, int line) const;
+      assert_min_imp(const node_pointer, const char*, int) const;
 
       void
-      assert_max(const char* file, int line) const;
+      assert_max(const char*, int) const;
 
       void
-      assert_max_imp(const node_pointer p_nd,
-                    const char* file, int line) const;
+      assert_max_imp(const node_pointer, const char*, int) const;
 
       void
-      assert_size(const char* file, int line) const;
+      assert_size(const char*, int) const;
 
-      typedef std::pair< const_pointer, const_pointer> node_consistent_t;
+      typedef std::pair<const_pointer, const_pointer> node_consistent_t;
 
       node_consistent_t
-      assert_node_consistent_(const node_pointer p_nd,
-                             const char* file, int line) const;
-#endif 
+      assert_node_consistent_(const node_pointer, const char*, int) const;
+#endif
 
       void
       initialize();
 
       node_pointer
-      recursive_copy_node(const node_pointer p_nd);
+      recursive_copy_node(const node_pointer);
 
     protected:
-      node_pointer m_p_head;
-
-      size_type m_size;
-
-      static node_allocator s_node_allocator;
+      node_pointer             m_p_head;
+      size_type                m_size;
+      static node_allocator    s_node_allocator;
     };
 
 #define PB_DS_STRUCT_ONLY_ASSERT_VALID(X)                              \
@@ -492,17 +409,12 @@ namespace __gnu_pbds
 #undef PB_DS_STRUCT_ONLY_ASSERT_VALID
 #undef PB_DS_CLASS_C_DEC
 #undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_NAME
-#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_BIN_TREE_NAME
+#undef PB_DS_BIN_TREE_TRAITS_BASE
 #undef PB_DS_DEBUG_MAP_BASE_C_DEC
 
 #ifdef PB_DS_TREE_TRACE
 #undef PB_DS_TREE_TRACE_BASE_C_DEC
-#endif 
-
-#undef PB_DS_V2F
-#undef PB_DS_EP2VP
-#undef PB_DS_V2S
-
+#endif
   } // namespace detail
 } // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
deleted file mode 100644 (file)
index 370574c..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file cond_dtor_entry_dealtor.hpp
- * Contains a binary tree container conditional deallocator
- */
-
-class bin_search_tree_cond_dtor_entry_dealtor_
-{
-public:
-  inline
-  bin_search_tree_cond_dtor_entry_dealtor_(node_pointer p_nd) : m_p_nd(p_nd),
-                                                               m_no_action_dtor(false)
-  { }
-
-  inline void
-  set_no_action_dtor()
-  {
-    m_no_action_dtor = true;
-  }
-
-  inline
-  ~bin_search_tree_cond_dtor_entry_dealtor_()
-  {
-    if (m_no_action_dtor)
-      return;
-
-    typename Allocator::template rebind<Node>::other().
-      deallocate(m_p_nd, 1);
-  }
-
-protected:
-  node_pointer m_p_nd;
-
-  bool m_no_action_dtor;
-};
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp b/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
deleted file mode 100644 (file)
index 612eceb..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file cond_key_dtor_entry_dealtor.hpp
- * Contains a binary tree container conditional deallocator
- */
-
-class bin_seach_tree_cond_key_dtor_entry_dealtor_
-{
-public:
-  inline
-  bin_seach_tree_cond_key_dtor_entry_dealtor_(node_pointer p_nd) : m_p_nd(p_nd),
-                                                                  m_no_action_dtor(false),
-                                                                  m_key_destruct(false)
-  { }
-
-  inline void
-  set_no_action_dtor()
-  {
-    m_no_action_dtor = true;
-  }
-
-  inline void
-  set_key_destruct()
-  {
-    m_key_destruct = true;
-  }
-
-  inline
-  ~bin_seach_tree_cond_key_dtor_entry_dealtor_()
-  {
-    if (m_no_action_dtor)
-      return;
-
-    if (m_key_destruct)
-      m_p_nd->m_value.first.~Key();
-
-    bin_tree_base::s_alloc.deallocate(m_p_nd, 1);
-  }
-
-protected:
-  node_pointer m_p_nd;
-
-  bool m_no_action_dtor;
-
-  bool m_key_destruct;
-};
-
index d7b5985cc6d97014cdd38282804461cae44279f5..2815b4274a9f069a093563a547283d26864e5ffb 100644 (file)
@@ -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);
index 86d5c2e87f7a91cddb03ade1dbd510a3cb3e8dbc..1f77e31cf39734c4028081d723a33010ddc2db37 100644 (file)
@@ -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
index 60a54903458f710a616eed0d56fb656a95237c54..1d1b17040d081bb58d6c0036a1479b5ba8d3597b 100644 (file)
@@ -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);
 }
-
index 6b50dc8c594d16b64bcfb58987d882c2e15406cb..03b7fe89416157e8bd3ebecdb64fcffae5e924b8 100644 (file)
 // 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);
 }
-
index b3e46112fb6acc64d9b0d4323c7a8ff4d30a8d58..54cd52e04ba863081cb45ecd27207ec408da16ab 100644 (file)
@@ -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_.
  */
 
index eb0f76d0ea26f8dd013e21e2cd560adeb6cb6ec0..5a9a03e867e862c12f40baec5e20a4ab50879a91 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file insert_fn_imps.hpp
+ * @file bin_search_tree_/insert_fn_imps.hpp
  * Contains an implementation class for bin_search_tree_.
  */
 
@@ -101,38 +101,30 @@ insert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd)
   if (left_nd)
     {
       _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == 0);
-      _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(
-                                         PB_DS_V2F(r_value),
-                                         PB_DS_V2F(p_nd->m_value)));
+      _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(r_value),
+                                              PB_DS_V2F(p_nd->m_value)));
 
       p_nd->m_p_left = p_new_nd;
-
       if (m_p_head->m_p_left == p_nd)
        m_p_head->m_p_left = p_new_nd;
     }
   else
     {
       _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_right == 0);
-      _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(
-                                         PB_DS_V2F(p_nd->m_value),
-                                         PB_DS_V2F(r_value)));
+      _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),
+                                              PB_DS_V2F(r_value)));
 
       p_nd->m_p_right = p_new_nd;
-
       if (m_p_head->m_p_right == p_nd)
        m_p_head->m_p_right = p_new_nd;
     }
 
   p_new_nd->m_p_parent = p_nd;
-
   p_new_nd->m_p_left = p_new_nd->m_p_right = 0;
-
   PB_DS_ASSERT_NODE_CONSISTENT(p_nd)
 
   update_to_top(p_new_nd, (node_update* )this);
-
   _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_value));)
-
   return iterator(p_new_nd);
 }
 
@@ -148,13 +140,10 @@ insert_imp_empty(const_reference r_value)
     m_p_head->m_p_parent = p_new_node;
 
   p_new_node->m_p_parent = m_p_head;
-
   p_new_node->m_p_left = p_new_node->m_p_right = 0;
-
   _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_value));)
 
   update_to_top(m_p_head->m_p_parent, (node_update*)this);
-
   return iterator(p_new_node);
 }
 
@@ -164,18 +153,14 @@ PB_DS_CLASS_C_DEC::
 get_new_node_for_leaf_insert(const_reference r_val, false_type)
 {
   node_pointer p_new_nd = s_node_allocator.allocate(1);
-
   cond_dealtor_t cond(p_new_nd);
 
   new (const_cast<void* >(static_cast<const void* >(&p_new_nd->m_value)))
     typename node::value_type(r_val);
 
   cond.set_no_action();
-
   p_new_nd->m_p_left = p_new_nd->m_p_right = 0;
-
   ++m_size;
-
   return p_new_nd;
 }
 
@@ -190,9 +175,6 @@ get_new_node_for_leaf_insert(const_reference r_val, true_type)
     typename node::value_type(r_val);
 
   p_new_nd->m_p_left = p_new_nd->m_p_right = 0;
-
   ++m_size;
-
   return p_new_nd;
 }
-
index e5f6a4d7361c2cfb89d293711a5d569a60e0e7e1..8076084aefd5dc08c50031dbf6c0e2e00d59b0d5 100644 (file)
@@ -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
index b4ea45376a8de03ac445b8177e528af25284cf90..d64bdf75d9c24a22165f20925b8098d8f092b5d1 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file node_iterators.hpp
+ * @file bin_search_tree_/node_iterators.hpp
  * Contains an implementation class for bin_search_tree_.
  */
 
@@ -47,31 +47,27 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-
 #define PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC                     \
     bin_search_tree_const_node_it_<                                    \
                                                        Node,           \
                                                        Const_Iterator, \
                                                        Iterator,       \
-                                                       Allocator>
+                                                       _Alloc>
 
-    // Const node iterator.
+    /// Const node iterator.
     template<typename Node,
             class Const_Iterator,
             class Iterator,
-            class Allocator>
+            typename _Alloc>
     class bin_search_tree_const_node_it_
     {
-    private:
-
     private:
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
       Node>::other::pointer
       node_pointer;
 
     public:
-
       // Category.
       typedef trivial_iterator_tag iterator_category;
 
@@ -92,11 +88,9 @@ namespace __gnu_pbds
 
       // Const metadata reference type.
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        metadata_type>::other::const_reference
-      const_metadata_reference;
-
-    public:
+      metadata_const_reference;
 
       // Default constructor.
       /*
@@ -105,7 +99,8 @@ namespace __gnu_pbds
       */
 
       inline
-      bin_search_tree_const_node_it_(const node_pointer p_nd = 0) : m_p_nd(const_cast<node_pointer>(p_nd))
+      bin_search_tree_const_node_it_(const node_pointer p_nd = 0) 
+      : m_p_nd(const_cast<node_pointer>(p_nd))
       { }
 
       // Access.
@@ -116,7 +111,7 @@ namespace __gnu_pbds
       }
 
       // Metadata access.
-      inline const_metadata_reference
+      inline metadata_const_reference
       get_metadata() const
       {
        return (m_p_nd->get_metadata());
@@ -150,7 +145,6 @@ namespace __gnu_pbds
        return (m_p_nd != other.m_p_nd);
       }
 
-    public:
       node_pointer m_p_nd;
     };
 
@@ -159,26 +153,23 @@ namespace __gnu_pbds
                                                Node,           \
                                                Const_Iterator, \
                                                Iterator,       \
-                                               Allocator>
+                                               _Alloc>
 
-    // Node iterator.
+    /// Node iterator.
     template<typename Node,
             class Const_Iterator,
             class Iterator,
-            class Allocator>
-    class bin_search_tree_node_it_ : 
-      public PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
-
+            typename _Alloc>
+    class bin_search_tree_node_it_ 
+    : public PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
     {
-
     private:
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
       Node>::other::pointer
       node_pointer;
 
     public:
-
       // __Iterator's value type.
       typedef Iterator value_type;
 
@@ -188,8 +179,6 @@ namespace __gnu_pbds
       // __Iterator's __const reference type.
       typedef Iterator const_reference;
 
-    public:
-
       // Default constructor.
       /*
        inline
@@ -197,8 +186,8 @@ namespace __gnu_pbds
       */
 
       inline
-      bin_search_tree_node_it_(const node_pointer p_nd = 0) : PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(
-                                                                                                           const_cast<node_pointer>(p_nd))
+      bin_search_tree_node_it_(const node_pointer p_nd = 0) 
+      : PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(const_cast<node_pointer>(p_nd))
       { }
 
       // Access.
@@ -227,7 +216,6 @@ namespace __gnu_pbds
     };
 
 #undef PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
-
 #undef PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC
 
   } // namespace detail
index 959df68a168bcb8cc3de0b5a4c83ae060db51882..d99924878c301d390d110a39ce792ba8e9bc6cbc 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file point_iterators.hpp
+ * @file bin_search_tree_/point_iterators.hpp
  * Contains an implementation class for bin_search_tree_.
  */
 
@@ -58,7 +58,7 @@ namespace __gnu_pbds
                                                Reference,              \
                                                Const_Reference,        \
                                                Is_Forward_Iterator,    \
-                                               Allocator>
+                                               _Alloc>
 
 #define PB_DS_TREE_CONST_ODIR_IT_C_DEC                                 \
     bin_search_tree_const_it_<                                         \
@@ -69,7 +69,7 @@ namespace __gnu_pbds
                                                Reference,              \
                                                Const_Reference,        \
                                                !Is_Forward_Iterator,   \
-                                               Allocator>
+                                               _Alloc>
 
 #define PB_DS_TREE_IT_C_DEC                                            \
     bin_search_tree_it_<                                               \
@@ -80,7 +80,7 @@ namespace __gnu_pbds
                                                Reference,              \
                                                Const_Reference,        \
                                                Is_Forward_Iterator,    \
-                                               Allocator>
+                                               _Alloc>
 
 #define PB_DS_TREE_ODIR_IT_C_DEC                                       \
     bin_search_tree_it_<                                               \
@@ -91,9 +91,9 @@ namespace __gnu_pbds
                                                        Reference,      \
                                                        Const_Reference, \
                                                        !Is_Forward_Iterator, \
-                                                       Allocator>
+                                                       _Alloc>
 
-    // Const iterator.
+    /// Const iterator.
     template<typename Node_Pointer,
             typename Value_Type,
             typename Pointer,
@@ -101,27 +101,17 @@ namespace __gnu_pbds
             typename Reference,
             typename Const_Reference,
             bool Is_Forward_Iterator,
-            class Allocator>
+            typename _Alloc>
     class bin_search_tree_const_it_
     {
-
-    public:
-
-      typedef std::bidirectional_iterator_tag iterator_category;
-
-      typedef typename Allocator::difference_type difference_type;
-
-      typedef Value_Type value_type;
-
-      typedef Pointer pointer;
-
-      typedef Const_Pointer const_pointer;
-
-      typedef Reference reference;
-
-      typedef Const_Reference const_reference;
-
     public:
+      typedef std::bidirectional_iterator_tag          iterator_category;
+      typedef typename _Alloc::difference_type         difference_type;
+      typedef Value_Type                               value_type;
+      typedef Pointer                                  pointer;
+      typedef Const_Pointer                            const_pointer;
+      typedef Reference                                reference;
+      typedef Const_Reference                          const_reference;
 
       inline
       bin_search_tree_const_it_(const Node_Pointer p_nd = 0) 
@@ -280,7 +270,7 @@ namespace __gnu_pbds
       Node_Pointer m_p_nd;
     };
 
-    // Iterator.
+    /// Iterator.
     template<typename Node_Pointer,
             typename Value_Type,
             typename Pointer,
@@ -288,14 +278,10 @@ namespace __gnu_pbds
             typename Reference,
             typename Const_Reference,
             bool Is_Forward_Iterator,
-            class Allocator>
-    class bin_search_tree_it_ : 
-      public PB_DS_TREE_CONST_IT_C_DEC
-
+            typename _Alloc>
+    class bin_search_tree_it_ : public PB_DS_TREE_CONST_IT_C_DEC
     {
-
     public:
-
       inline
       bin_search_tree_it_(const Node_Pointer p_nd = 0) 
       : PB_DS_TREE_CONST_IT_C_DEC((Node_Pointer)p_nd)
index 63f307d39d9a06b313d4eaf0d508c29b32aeb224..5b71c407f7f108b9c867368535bf2e30d54cf397 100644 (file)
@@ -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); }
 
index bcf3ce6321f4e256c9717c642b2380f08c60fc0e..cfcccadb18236ef0c042b6cd7c5c74d5831c35a2 100644 (file)
@@ -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);
 }
-
index c2090a1784201462966e930bddcc72b27b3be251..63c757cc1364c9e66a83850aae8a089a0b61df4a 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file rotate_fn_imps.hpp
+ * @file bin_search_tree_/rotate_fn_imps.hpp
  * Contains imps for rotating nodes.
  */
 
@@ -130,7 +130,7 @@ PB_DS_CLASS_C_DEC::
 apply_update(node_pointer p_nd, Node_Update_*  /*p_update*/)
 {
   node_update::operator()(node_iterator(p_nd),
-                         const_node_iterator(static_cast<node_pointer>(0)));
+                         node_const_iterator(static_cast<node_pointer>(0)));
 }
 
 PB_DS_CLASS_T_DEC
index 00fbdf4261262106703e686ec6333ee5906a17fe..be2fd344ccf7d6c82627345af6f45225a6b5e574 100644 (file)
@@ -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)
index 58c30c3fe52161d93ce59de8efda2c82c2f49dff..3066c381f42ba86ca4d66e854942c886aa14fc99 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file traits.hpp
+ * @file bin_search_tree_/traits.hpp
  * Contains an implementation for bin_search_tree_.
  */
 
@@ -48,34 +48,28 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-
+    /// Binary search tree traits, primary template.
     template<typename Key,
             typename Mapped,
             class Cmp_Fn,
-            template<typename Const_Node_Iterator,
-                     class Node_Iterator,
+            template<typename Node_CItr,
+                     class Node_Itr,
                      class Cmp_Fn,
-                     class Allocator>
+                     typename _Alloc>
     class Node_Update,
             class Node,
-            class Allocator>
+            typename _Alloc>
     struct bin_search_tree_traits
     {
     private:
-      typedef
-      types_traits<
-      Key,
-      Mapped,
-      Allocator,
-      false>
-      type_traits;
+      typedef types_traits<Key, Mapped, _Alloc, false> type_traits;
 
     public:
       typedef Node node;
 
       typedef
       bin_search_tree_const_it_<
-       typename Allocator::template rebind<
+       typename _Alloc::template rebind<
        node>::other::pointer,
        typename type_traits::value_type,
        typename type_traits::pointer,
@@ -83,12 +77,12 @@ namespace __gnu_pbds
        typename type_traits::reference,
        typename type_traits::const_reference,
        true,
-       Allocator>
-      const_point_iterator;
+       _Alloc>
+      point_const_iterator;
 
       typedef
       bin_search_tree_it_<
-       typename Allocator::template rebind<
+       typename _Alloc::template rebind<
        node>::other::pointer,
        typename type_traits::value_type,
        typename type_traits::pointer,
@@ -96,12 +90,12 @@ namespace __gnu_pbds
        typename type_traits::reference,
        typename type_traits::const_reference,
        true,
-       Allocator>
+       _Alloc>
       point_iterator;
 
       typedef
       bin_search_tree_const_it_<
-       typename Allocator::template rebind<
+       typename _Alloc::template rebind<
        node>::other::pointer,
        typename type_traits::value_type,
        typename type_traits::pointer,
@@ -109,12 +103,12 @@ namespace __gnu_pbds
        typename type_traits::reference,
        typename type_traits::const_reference,
        false,
-       Allocator>
+       _Alloc>
       const_reverse_iterator;
 
       typedef
       bin_search_tree_it_<
-       typename Allocator::template rebind<
+       typename _Alloc::template rebind<
        node>::other::pointer,
        typename type_traits::value_type,
        typename type_traits::pointer,
@@ -122,74 +116,69 @@ namespace __gnu_pbds
        typename type_traits::reference,
        typename type_traits::const_reference,
        false,
-       Allocator>
+       _Alloc>
       reverse_iterator;
 
       typedef
       bin_search_tree_const_node_it_<
        Node,
-       const_point_iterator,
+       point_const_iterator,
        point_iterator,
-       Allocator>
-      const_node_iterator;
+       _Alloc>
+      node_const_iterator;
 
       typedef
       bin_search_tree_node_it_<
        Node,
-       const_point_iterator,
+       point_const_iterator,
        point_iterator,
-       Allocator>
+       _Alloc>
       node_iterator;
 
       typedef
       Node_Update<
-       const_node_iterator,
+       node_const_iterator,
        node_iterator,
        Cmp_Fn,
-       Allocator>
+       _Alloc>
       node_update;
 
       typedef
-      __gnu_pbds::null_tree_node_update<
-       const_node_iterator,
+      __gnu_pbds::null_node_update<
+       node_const_iterator,
        node_iterator,
        Cmp_Fn,
-       Allocator>* 
+       _Alloc>* 
       null_node_update_pointer;
     };
 
+    /// Specialization.
     template<typename Key,
             class Cmp_Fn,
-            template<typename Const_Node_Iterator,
-                     class Node_Iterator,
+            template<typename Node_CItr,
+                     class Node_Itr,
                      class Cmp_Fn,
-                     class Allocator>
+                     typename _Alloc>
     class Node_Update,
             class Node,
-            class Allocator>
+            typename _Alloc>
     struct bin_search_tree_traits<
       Key,
-      null_mapped_type,
+      null_type,
       Cmp_Fn,
       Node_Update,
       Node,
-      Allocator>
+      _Alloc>
     {
     private:
-      typedef
-      types_traits<
-      Key,
-      null_mapped_type,
-      Allocator,
-      false>
-      type_traits;
+      typedef types_traits<Key, null_type, _Alloc, false> type_traits;
 
     public:
       typedef Node node;
 
       typedef
       bin_search_tree_const_it_<
-       typename Allocator::template rebind<
+       typename _Alloc::template rebind<
        node>::other::pointer,
        typename type_traits::value_type,
        typename type_traits::pointer,
@@ -197,14 +186,14 @@ namespace __gnu_pbds
        typename type_traits::reference,
        typename type_traits::const_reference,
        true,
-       Allocator>
-      const_point_iterator;
+       _Alloc>
+      point_const_iterator;
 
-      typedef const_point_iterator point_iterator;
+      typedef point_const_iterator point_iterator;
 
       typedef
       bin_search_tree_const_it_<
-       typename Allocator::template rebind<
+       typename _Alloc::template rebind<
        node>::other::pointer,
        typename type_traits::value_type,
        typename type_traits::pointer,
@@ -212,7 +201,7 @@ namespace __gnu_pbds
        typename type_traits::reference,
        typename type_traits::const_reference,
        false,
-       Allocator>
+       _Alloc>
       const_reverse_iterator;
 
       typedef const_reverse_iterator reverse_iterator;
@@ -220,27 +209,23 @@ namespace __gnu_pbds
       typedef
       bin_search_tree_const_node_it_<
        Node,
-       const_point_iterator,
+       point_const_iterator,
        point_iterator,
-       Allocator>
-      const_node_iterator;
+       _Alloc>
+      node_const_iterator;
 
-      typedef const_node_iterator node_iterator;
+      typedef node_const_iterator node_iterator;
 
       typedef
-      Node_Update<
-       const_node_iterator,
-       node_iterator,
-       Cmp_Fn,
-       Allocator>
+      Node_Update<node_const_iterator, node_iterator, Cmp_Fn, _Alloc>
       node_update;
 
       typedef
-      __gnu_pbds::null_tree_node_update<
-       const_node_iterator,
+      __gnu_pbds::null_node_update<
+       node_const_iterator,
        node_iterator,
        Cmp_Fn,
-       Allocator>* 
+       _Alloc>* 
       null_node_update_pointer;
     };
 
index 4d65d2b6826c5662d9075a3ac481484ef7e49353..ee408e8ea0294484284a1c3ac8e45188aa5ccf32 100644 (file)
 // warranty.
 
 /**
- * @file binary_heap_.hpp
+ * @file binary_heap_/binary_heap_.hpp
  * Contains an implementation class for a binary heap.
  */
 
 #ifndef PB_DS_BINARY_HEAP_HPP
 #define PB_DS_BINARY_HEAP_HPP
 
-/*
- * Based on CLRS.
- */
-
 #include <queue>
 #include <algorithm>
 #include <ext/pb_ds/detail/cond_dealtor.hpp>
@@ -53,7 +49,7 @@
 #include <ext/pb_ds/detail/binary_heap_/entry_cmp.hpp>
 #include <ext/pb_ds/detail/binary_heap_/entry_pred.hpp>
 #include <ext/pb_ds/detail/binary_heap_/resize_policy.hpp>
-#include <ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp>
 #include <ext/pb_ds/detail/binary_heap_/const_iterator.hpp>
 #ifdef PB_DS_BINARY_HEAP_TRACE_
 #include <iostream>
@@ -66,126 +62,85 @@ namespace __gnu_pbds
   namespace detail
   {
 #define PB_DS_CLASS_T_DEC \
-    template<typename Value_Type, class Cmp_Fn, class Allocator>
+    template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
 
 #define PB_DS_CLASS_C_DEC \
-    binary_heap_<Value_Type, Cmp_Fn, Allocator>
+    binary_heap<Value_Type, Cmp_Fn, _Alloc>
 
 #define PB_DS_ENTRY_CMP_DEC \
-    entry_cmp<Value_Type, Cmp_Fn, is_simple<Value_Type>::value, Allocator>::type
+    entry_cmp<Value_Type, Cmp_Fn, _Alloc, is_simple<Value_Type>::value>::type
 
 #define PB_DS_RESIZE_POLICY_DEC        \
-    __gnu_pbds::detail::resize_policy<typename Allocator::size_type>
+    __gnu_pbds::detail::resize_policy<typename _Alloc::size_type>
 
     /**
-     * class description = "Base class for some types of h3ap$">
-     **/
-    template<typename Value_Type, class Cmp_Fn, class Allocator>
-    class binary_heap_ : public PB_DS_ENTRY_CMP_DEC,
-                        public PB_DS_RESIZE_POLICY_DEC
+     *  @brief Binary heaps composed of resize and compare policies.
+     *
+     *  Based on CLRS.
+     */
+    template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
+    class binary_heap
+    : public PB_DS_ENTRY_CMP_DEC, public PB_DS_RESIZE_POLICY_DEC
     {
+    public:
+      typedef Value_Type                               value_type;
+      typedef Cmp_Fn                                   cmp_fn;
+      typedef _Alloc                                   allocator_type;
+      typedef typename _Alloc::size_type               size_type;
+      typedef typename _Alloc::difference_type                 difference_type;
+      typedef typename PB_DS_ENTRY_CMP_DEC             entry_cmp;
+      typedef PB_DS_RESIZE_POLICY_DEC                  resize_policy;
+      typedef cond_dealtor<value_type, _Alloc>                 cond_dealtor_t;
 
     private:
       enum
        {
-         simple_value = is_simple<Value_Type>::value
+         simple_value = is_simple<value_type>::value
        };
 
-      typedef integral_constant<int, simple_value> no_throw_copies_t;
-
-      typedef
-      typename Allocator::template rebind<
-       Value_Type>::other
-      value_allocator;
-
-      typedef
-      typename __conditional_type<
-       simple_value,
-       Value_Type,
-       typename value_allocator::pointer>::__type
-      entry;
+      typedef integral_constant<int, simple_value>     no_throw_copies_t;
 
-      typedef
-      typename Allocator::template rebind<
-       entry>::other
-      entry_allocator;
-
-      typedef typename entry_allocator::pointer entry_pointer;
-
-      typedef typename PB_DS_ENTRY_CMP_DEC entry_cmp;
-
-      typedef PB_DS_RESIZE_POLICY_DEC resize_policy;
-
-      typedef
-      cond_dealtor<
-       Value_Type,
-       Allocator>
-      cond_dealtor_t;
+      typedef typename _Alloc::template rebind<value_type>     __rebind_v;
+      typedef typename __rebind_v::other               value_allocator;
 
     public:
+      typedef typename value_allocator::pointer                pointer;
+      typedef typename value_allocator::const_pointer  const_pointer;
+      typedef typename value_allocator::reference      reference;
+      typedef typename value_allocator::const_reference        const_reference;
 
-      typedef typename Allocator::size_type size_type;
-
-      typedef typename Allocator::difference_type difference_type;
+      typedef typename __conditional_type<simple_value,
+                                         value_type, pointer>::__type
+                                                       entry;
 
-      typedef Value_Type value_type;
+      typedef typename _Alloc::template rebind<entry>::other
+                                                       entry_allocator;
 
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::pointer
-      pointer;
+      typedef typename entry_allocator::pointer        entry_pointer;
 
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::const_pointer
-      const_pointer;
+      typedef binary_heap_point_const_iterator_<value_type, entry,
+                                               simple_value, _Alloc>
+                                                       point_const_iterator;
 
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::reference
-      reference;
+      typedef point_const_iterator                     point_iterator;
 
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::const_reference
-      const_reference;
+      typedef binary_heap_const_iterator_<value_type, entry,
+                                         simple_value, _Alloc>
+                                                       const_iterator;
 
-      typedef
-      binary_heap_const_point_iterator_<
-       value_type,
-       entry,
-       simple_value,
-       Allocator>
-      const_point_iterator;
+      typedef const_iterator                           iterator;
 
-      typedef const_point_iterator point_iterator;
 
-      typedef
-      binary_heap_const_iterator_<
-       value_type,
-       entry,
-       simple_value,
-       Allocator>
-      const_iterator;
+      binary_heap();
 
-      typedef const_iterator iterator;
+      binary_heap(const cmp_fn&);
 
-      typedef Cmp_Fn cmp_fn;
-
-      typedef Allocator allocator_type;
-
-    public:
-
-      binary_heap_();
-
-      binary_heap_(const Cmp_Fn& r_cmp_fn);
-
-      binary_heap_(const PB_DS_CLASS_C_DEC& other);
+      binary_heap(const binary_heap&);
 
       void
-      swap(PB_DS_CLASS_C_DEC& other);
+      swap(binary_heap&);
 
-      ~binary_heap_();
+      ~binary_heap();
 
       inline bool
       empty() const;
@@ -196,17 +151,17 @@ namespace __gnu_pbds
       inline size_type
       max_size() const;
 
-      Cmp_Fn& 
+      Cmp_Fn&
       get_cmp_fn();
 
-      const Cmp_Fn& 
+      const Cmp_Fn&
       get_cmp_fn() const;
 
       inline point_iterator
-      push(const_reference r_val);
+      push(const_reference);
 
       void
-      modify(point_iterator it, const_reference r_new_val);
+      modify(point_iterator, const_reference);
 
       inline const_reference
       top() const;
@@ -215,17 +170,17 @@ namespace __gnu_pbds
       pop();
 
       inline void
-      erase(point_iterator it);
+      erase(point_iterator);
 
       template<typename Pred>
-      typename PB_DS_CLASS_C_DEC::size_type
-      erase_if(Pred pred);
+       size_type
+       erase_if(Pred);
 
-      inline static void
-      erase_at(entry_pointer a_entries, size_type size, false_type);
+      inline void
+      erase_at(entry_pointer, size_type, false_type);
 
-      inline static void
-      erase_at(entry_pointer a_entries, size_type size, true_type);
+      inline void
+      erase_at(entry_pointer, size_type, true_type);
 
       inline iterator
       begin();
@@ -243,48 +198,43 @@ namespace __gnu_pbds
       clear();
 
       template<typename Pred>
-      void
-      split(Pred pred, PB_DS_CLASS_C_DEC& other);
+       void
+       split(Pred, binary_heap&);
 
       void
-      join(PB_DS_CLASS_C_DEC& other);
+      join(binary_heap&);
 
 #ifdef PB_DS_BINARY_HEAP_TRACE_
       void
       trace() const;
-#endif 
+#endif
 
     protected:
-
       template<typename It>
-      void
-      copy_from_range(It first_it, It last_it);
+       void
+       copy_from_range(It, It);
 
     private:
-
       void
-      value_swap(PB_DS_CLASS_C_DEC& other);
-
-      inline void
-      insert_value(const_reference r_val, false_type);
+      value_swap(binary_heap&);
 
       inline void
-      insert_value(value_type val, true_type);
+      insert_value(const_reference, false_type);
 
       inline void
-      insert_entry(entry e);
+      insert_value(value_type, true_type);
 
       inline void
       resize_for_insert_if_needed();
 
       inline void
-      swap_value_imp(entry_pointer p_e, value_type new_val, true_type);
+      swap_value_imp(entry_pointer, value_type, true_type);
 
       inline void
-      swap_value_imp(entry_pointer p_e, const_reference r_new_val, false_type);
+      swap_value_imp(entry_pointer, const_reference, false_type);
 
       void
-      fix(entry_pointer p_e);
+      fix(entry_pointer);
 
       inline const_reference
       top_imp(true_type) const;
@@ -293,48 +243,91 @@ namespace __gnu_pbds
       top_imp(false_type) const;
 
       inline static size_type
-      left_child(size_type i);
+      left_child(size_type);
 
       inline static size_type
-      right_child(size_type i);
+      right_child(size_type);
 
       inline static size_type
-      parent(size_type i);
+      parent(size_type);
 
       inline void
       resize_for_erase_if_needed();
 
       template<typename Pred>
       size_type
-      partition(Pred pred);
+      partition(Pred);
 
-#ifdef _GLIBCXX_DEBUG
       void
-      assert_valid(const char* file, int line) const;
-#endif 
+      make_heap()
+      {
+       const entry_cmp& m_cmp = static_cast<entry_cmp&>(*this);
+       entry_pointer end = m_a_entries + m_size;
+       std::make_heap(m_a_entries, end, m_cmp);
+       _GLIBCXX_DEBUG_ASSERT(is_heap());
+      }
 
-#ifdef PB_DS_BINARY_HEAP_TRACE_
       void
-      trace_entry(const entry& r_e, false_type) const;
+      push_heap()
+      {
+       if (!is_heap())
+         make_heap();
+       else
+         {
+           const entry_cmp& m_cmp = static_cast<entry_cmp&>(*this);
+           entry_pointer end = m_a_entries + m_size;
+           std::push_heap(m_a_entries, end, m_cmp);
+         }
+      }
 
       void
-      trace_entry(const entry& r_e, true_type) const;
-#endif 
+      pop_heap()
+      {
+       const entry_cmp& m_cmp = static_cast<entry_cmp&>(*this);
+       entry_pointer end = m_a_entries + m_size;
+       std::pop_heap(m_a_entries, end, m_cmp);
+      }
+
+      bool
+      is_heap()
+      {
+       const entry_cmp& m_cmp = static_cast<entry_cmp&>(*this);
+       entry_pointer end = m_a_entries + m_size;
+       bool p = std::__is_heap(m_a_entries, end, m_cmp);
+       return p;
+      }
 
-    private:
-      static entry_allocator s_entry_allocator;
-
-      static value_allocator s_value_allocator;
+#ifdef _GLIBCXX_DEBUG
+      void
+      assert_valid(const char*, int) const;
+#endif
 
-      static no_throw_copies_t s_no_throw_copies_ind;
+#ifdef PB_DS_BINARY_HEAP_TRACE_
+      void
+      trace_entry(const entry&, false_type) const;
 
-      size_type m_size;
+      void
+      trace_entry(const entry&, true_type) const;
+#endif
 
-      size_type m_actual_size;
+      static entry_allocator   s_entry_allocator;
+      static value_allocator   s_value_allocator;
+      static no_throw_copies_t         s_no_throw_copies_ind;
 
-      entry_pointer m_a_entries;
+      size_type                m_size;
+      size_type                m_actual_size;
+      entry_pointer            m_a_entries;
     };
 
+#define PB_DS_ASSERT_VALID(X) \
+  _GLIBCXX_DEBUG_ONLY(X.assert_valid(__FILE__, __LINE__);)
+
+#define PB_DS_DEBUG_VERIFY(_Cond)                                      \
+  _GLIBCXX_DEBUG_VERIFY_AT(_Cond,                                      \
+                          _M_message(#_Cond" assertion from %1;:%2;")  \
+                          ._M_string(__FILE__)._M_integer(__LINE__)    \
+                          ,__file,__line)
+
 #include <ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp>
 #include <ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp>
 #include <ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp>
@@ -354,4 +347,4 @@ namespace __gnu_pbds
   } // namespace detail
 } // namespace __gnu_pbds
 
-#endif 
+#endif
index aa86f5ea4f58b19a54df4ddb0772675f6ef4e193..a6ac261b9ba2de7538f896765022518a5fdb1633 100644 (file)
@@ -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.
  */
 #ifndef PB_DS_BINARY_HEAP_CONST_ITERATOR_HPP
 #define PB_DS_BINARY_HEAP_CONST_ITERATOR_HPP
 
-#include <ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp>
 #include <debug/debug.h>
 
 namespace __gnu_pbds
 {
   namespace detail
   {
+#define PB_DS_BIN_HEAP_CIT_BASE \
+    binary_heap_point_const_iterator_<Value_Type, Entry, Simple, _Alloc>
 
-#define PB_DS_CLASS_C_DEC \
-    binary_heap_const_iterator_<Value_Type, Entry, Simple, Allocator>
-
-#define PB_DS_BASE_C_DEC \
-    binary_heap_const_point_iterator_<Value_Type, Entry, Simple, Allocator>
-
-    // Const point-type iterator.
+    /// Const point-type iterator.
     template<typename Value_Type,
             typename Entry,
             bool Simple,
-            class Allocator>
-    class binary_heap_const_iterator_ : public PB_DS_BASE_C_DEC
+            typename _Alloc>
+    class binary_heap_const_iterator_ : public PB_DS_BIN_HEAP_CIT_BASE
     {
-
     private:
-      typedef typename PB_DS_BASE_C_DEC::entry_pointer entry_pointer;
-
-      typedef PB_DS_BASE_C_DEC base_type;
+      typedef PB_DS_BIN_HEAP_CIT_BASE                  base_type;
+      typedef typename base_type::entry_pointer        entry_pointer;
 
     public:
-
       // Category.
-      typedef std::forward_iterator_tag iterator_category;
+      typedef std::forward_iterator_tag                iterator_category;
 
       // Difference type.
-      typedef typename Allocator::difference_type difference_type;
+      typedef typename _Alloc::difference_type                 difference_type;
 
       // Iterator's value type.
-      typedef typename base_type::value_type value_type;
+      typedef typename base_type::value_type           value_type;
 
       // Iterator's pointer type.
-      typedef typename base_type::pointer pointer;
+      typedef typename base_type::pointer              pointer;
 
       // Iterator's const pointer type.
-      typedef typename base_type::const_pointer const_pointer;
+      typedef typename base_type::const_pointer        const_pointer;
 
       // Iterator's reference type.
-      typedef typename base_type::reference reference;
+      typedef typename base_type::reference            reference;
 
       // Iterator's const reference type.
-      typedef typename base_type::const_reference const_reference;
-
-    public:
+      typedef typename base_type::const_reference      const_reference;
 
       inline
       binary_heap_const_iterator_(entry_pointer p_e) : base_type(p_e)
@@ -105,24 +96,21 @@ namespace __gnu_pbds
 
       // Copy constructor.
       inline
-      binary_heap_const_iterator_(const PB_DS_CLASS_C_DEC& other) : base_type(other)
+      binary_heap_const_iterator_(const binary_heap_const_iterator_& other) 
+      : base_type(other)
       { }
 
       // Compares content to a different iterator object.
       inline bool
-      operator==(const PB_DS_CLASS_C_DEC& other) const
-      {
-       return base_type::m_p_e == other.m_p_e;
-      }
+      operator==(const binary_heap_const_iterator_& other) const
+      { return base_type::m_p_e == other.m_p_e; }
 
       // Compares content (negatively) to a different iterator object.
       inline bool
-      operator!=(const PB_DS_CLASS_C_DEC& other) const
-      {
-       return base_type::m_p_e != other.m_p_e;
-      }
+      operator!=(const binary_heap_const_iterator_& other) const
+      { return base_type::m_p_e != other.m_p_e; }
 
-      inline PB_DS_CLASS_C_DEC
+      inline binary_heap_const_iterator_
       operator++()
       {
        _GLIBCXX_DEBUG_ASSERT(base_type::m_p_e != 0);
@@ -130,10 +118,10 @@ namespace __gnu_pbds
        return *this;
       }
 
-      inline PB_DS_CLASS_C_DEC
+      inline binary_heap_const_iterator_
       operator++(int)
       {
-       PB_DS_CLASS_C_DEC ret_it(base_type::m_p_e);
+       binary_heap_const_iterator_ ret_it(base_type::m_p_e);
        operator++();
        return ret_it;
       }
@@ -144,8 +132,7 @@ namespace __gnu_pbds
       { ++base_type::m_p_e; }
     };
 
-#undef PB_DS_CLASS_C_DEC
-#undef PB_DS_BASE_C_DEC
+#undef PB_DS_BIN_HEAP_CIT_BASE
   } // namespace detail
 } // namespace __gnu_pbds
 
index bdaa7ff78064112f92fa64f45a3a26677b97162b..9602385fbb169ffea1abb8b2e68037db9a0df2bd 100644 (file)
@@ -35,7 +35,7 @@
 // warranty.
 
 /**
- * @file constructors_destructor_fn_imps.hpp
+ * @file binary_heap_/constructors_destructor_fn_imps.hpp
  * Contains an implementation class for binary_heap_.
  */
 
@@ -62,55 +62,37 @@ copy_from_range(It first_it, It last_it)
       insert_value(*first_it, s_no_throw_copies_ind);
       ++first_it;
     }
-
-  std::make_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));
-
-  PB_DS_ASSERT_VALID((*this))
+  make_heap();
+ PB_DS_ASSERT_VALID((*this))
 }
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-binary_heap_() :
-  m_size(0),
-  m_actual_size(resize_policy::min_size),
+binary_heap()
+: m_size(0), m_actual_size(resize_policy::min_size),
   m_a_entries(s_entry_allocator.allocate(m_actual_size))
-{
-  PB_DS_ASSERT_VALID((*this))
-}
+{ PB_DS_ASSERT_VALID((*this)) }
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-binary_heap_(const Cmp_Fn& r_cmp_fn) :
-  entry_cmp(r_cmp_fn),
-  m_size(0),
-  m_actual_size(resize_policy::min_size),
+binary_heap(const Cmp_Fn& r_cmp_fn)
+: entry_cmp(r_cmp_fn), m_size(0), m_actual_size(resize_policy::min_size),
   m_a_entries(s_entry_allocator.allocate(m_actual_size))
-{
-  PB_DS_ASSERT_VALID((*this))
-}
+{ PB_DS_ASSERT_VALID((*this)) }
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-binary_heap_(const PB_DS_CLASS_C_DEC& other) :
-  entry_cmp(other),
-  resize_policy(other),
-  m_size(0),
+binary_heap(const PB_DS_CLASS_C_DEC& other)
+: entry_cmp(other), resize_policy(other), m_size(0),
   m_actual_size(other.m_actual_size),
   m_a_entries(s_entry_allocator.allocate(m_actual_size))
 {
   PB_DS_ASSERT_VALID(other)
   _GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries);
 
-  const_iterator first_it = other.begin();
-  const_iterator last_it = other.end();
-
   __try
     {
-      while (first_it != last_it)
-        {
-         insert_value(*first_it, s_no_throw_copies_ind);
-         ++first_it;
-        }
+      copy_from_range(other.begin(), other.end());
     }
   __catch(...)
     {
@@ -131,9 +113,8 @@ swap(PB_DS_CLASS_C_DEC& other)
   PB_DS_ASSERT_VALID((*this))
   PB_DS_ASSERT_VALID(other)
   _GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries);
-
   value_swap(other);
-  std::swap((entry_cmp& )(*this), (entry_cmp& )other);
+  std::swap((entry_cmp&)(*this), (entry_cmp&)other);
   PB_DS_ASSERT_VALID((*this))
   PB_DS_ASSERT_VALID(other)
 }
@@ -151,10 +132,9 @@ value_swap(PB_DS_CLASS_C_DEC& other)
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-~binary_heap_()
+~binary_heap()
 {
   for (size_type i = 0; i < m_size; ++i)
     erase_at(m_a_entries, i, s_no_throw_copies_ind);
   s_entry_allocator.deallocate(m_a_entries, m_actual_size);
 }
-
index a2c6f307f178dab697e4502f9e73f26fa57e5565..b1b0f5ba1b996dc1fd4c189487e113fb23ef62b5 100644 (file)
@@ -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
index b0a9b5b0d9267cb7bc8b9896382a8a16e5228343..42e799fc8bd91d6f1c067dbb7788402d1f9f4976 100644 (file)
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the terms
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file entry_cmp.hpp
+ * @file binary_heap_/entry_cmp.hpp
  * Contains an implementation class for a binary_heap.
  */
 
@@ -45,48 +45,40 @@ namespace __gnu_pbds
 {
   namespace detail
   {
+    /// Entry compare, primary template.
+    template<typename _VTp, typename Cmp_Fn, typename _Alloc, bool No_Throw>
+      struct entry_cmp;
 
-    template<typename Value_Type,
-            class Cmp_Fn,
-            bool No_Throw,
-            class Allocator>
-    struct entry_cmp
-    {
-      typedef Cmp_Fn type;
-    };
-
-    template<typename Value_Type, class Cmp_Fn, class Allocator>
-    struct entry_cmp<
-      Value_Type,
-      Cmp_Fn,
-      false,
-      Allocator>
-    {
-    public:
-      typedef
-      typename Allocator::template rebind<
-      Value_Type>::other::const_pointer
-      entry;
-
-      struct type : public Cmp_Fn
+    /// Specialization, true.
+    template<typename _VTp, typename Cmp_Fn, typename _Alloc>
+      struct entry_cmp<_VTp, Cmp_Fn, _Alloc, true>
       {
-      public:
-       inline
-       type()
-       { }
+       /// Compare.
+       typedef Cmp_Fn                                          type;
+      };
+
+    /// Specialization, false.
+    template<typename _VTp, typename Cmp_Fn, typename _Alloc>
+      struct entry_cmp<_VTp, Cmp_Fn, _Alloc, false>
+      {
+      private:
+       typedef typename _Alloc::template rebind<_VTp>          __rebind_v;
 
-       inline
-       type(const Cmp_Fn& other) : Cmp_Fn(other)
-       { }
+      public:
+       typedef typename __rebind_v::other::const_pointer       entry;
 
-       inline bool
-       operator()(entry p_lhs,  entry p_rhs) const
+       /// Compare plus entry.
+       struct type : public Cmp_Fn
        {
-         return Cmp_Fn::operator()(*p_lhs, * p_rhs);
-       }
-      };
-    };
+         type() { }
 
+         type(const Cmp_Fn& other) : Cmp_Fn(other) { }
+
+         bool
+         operator()(entry lhs, entry rhs) const
+         { return Cmp_Fn::operator()(*lhs, *rhs); }
+       };
+      };
   } // namespace detail
 } // namespace __gnu_pbds
 
index 185529e15e33954087bf227d9a1dcf9b694d8c72..001876ef1f05f95d0cfbcc22086b9792c05775e0 100644 (file)
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the terms
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file entry_pred.hpp
+ * @file binary_heap_/entry_pred.hpp
  * Contains an implementation class for a binary_heap.
  */
 
@@ -45,48 +45,40 @@ namespace __gnu_pbds
 {
   namespace detail
   {
+    /// Entry predicate primary class template.
+    template<typename _VTp, typename Pred, typename _Alloc, bool No_Throw>
+      struct entry_pred;
 
-    template<typename Value_Type,
-            class Pred,
-            bool No_Throw,
-            class Allocator>
-    struct entry_pred
-    {
-      typedef Pred type;
-    };
-
-    template<typename Value_Type, class Pred, class Allocator>
-    struct entry_pred<
-      Value_Type,
-      Pred,
-      false,
-      Allocator>
-    {
-    public:
-      typedef
-      typename Allocator::template rebind<
-      Value_Type>::other::const_pointer
-      entry;
-
-      struct type : public Pred
+    /// Specialization, true.
+    template<typename _VTp, typename Pred, typename _Alloc>
+      struct entry_pred<_VTp, Pred, _Alloc, true>
       {
-      public:
-       inline
-       type()
-       { }
+       typedef Pred                                            type;
+      };
+
+    /// Specialization, false.
+    template<typename _VTp, typename Pred, typename _Alloc>
+      struct entry_pred<_VTp, Pred, _Alloc, false>
+      {
+      private:
+       typedef typename _Alloc::template rebind<_VTp>          __rebind_v;
 
-       inline
-       type(const Pred& other) : Pred(other)
-       { }
+      public:
+       typedef typename __rebind_v::other::const_pointer       entry;
 
-       inline bool
-       operator()(entry p_v) const
+       struct type : public Pred
        {
-         return Pred::operator()(*p_v);
-       }
-      };
-    };
+         inline
+         type() { }
 
+         inline
+         type(const Pred& other) : Pred(other) { }
+
+         inline bool
+         operator()(entry p_v) const
+         { return Pred::operator()(*p_v); }
+       };
+      };
   } // namespace detail
 } // namespace __gnu_pbds
 
index 2b6c9b79849eec32fa249bad781b3d4c9d813add..f204d81f603998e1e333a447269dcc7600c12884 100644 (file)
@@ -35,7 +35,7 @@
 // warranty.
 
 /**
- * @file erase_fn_imps.hpp
+ * @file binary_heap_/erase_fn_imps.hpp
  * Contains an implementation class for a binary_heap.
  */
 
@@ -49,23 +49,17 @@ clear()
 
   __try
     {
-      const size_type actual_size = resize_policy::get_new_size_for_arbitrary(0);
-
-      entry_pointer a_entries = s_entry_allocator.allocate(actual_size);
-
-      resize_policy::notify_arbitrary(actual_size);
-
+      const size_type new_size = resize_policy::get_new_size_for_arbitrary(0);
+      entry_pointer new_entries = s_entry_allocator.allocate(new_size);
+      resize_policy::notify_arbitrary(new_size);
       s_entry_allocator.deallocate(m_a_entries, m_actual_size);
-
-      m_actual_size = actual_size;
-
-      m_a_entries = a_entries;
+      m_actual_size = new_size;
+      m_a_entries = new_entries;
     }
   __catch(...)
     { }
 
   m_size = 0;
-
   PB_DS_ASSERT_VALID((*this))
 }
 
@@ -92,13 +86,9 @@ pop()
   PB_DS_ASSERT_VALID((*this))
   _GLIBCXX_DEBUG_ASSERT(!empty());
 
-  erase_at(m_a_entries, 0, s_no_throw_copies_ind);
-
-  std::pop_heap(m_a_entries, m_a_entries + m_size,
-               static_cast<entry_cmp& >(*this));
-
+  pop_heap();
+  erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind);
   resize_for_erase_if_needed();
-
   _GLIBCXX_DEBUG_ASSERT(m_size > 0);
   --m_size;
 
@@ -113,43 +103,32 @@ erase_if(Pred pred)
 {
   PB_DS_ASSERT_VALID((*this))
 
-  typedef typename entry_pred<value_type, Pred, simple_value, Allocator>::type
+  typedef typename entry_pred<value_type, Pred, _Alloc, simple_value>::type
     pred_t;
 
   const size_type left = partition(pred_t(pred));
-
   _GLIBCXX_DEBUG_ASSERT(m_size >= left);
-
   const size_type ersd = m_size - left;
-
   for (size_type i = left; i < m_size; ++i)
     erase_at(m_a_entries, i, s_no_throw_copies_ind);
 
   __try
     {
-      const size_type actual_size =
+      const size_type new_size =
        resize_policy::get_new_size_for_arbitrary(left);
 
-      entry_pointer a_entries = s_entry_allocator.allocate(actual_size);
-
-      std::copy(m_a_entries, m_a_entries + left, a_entries);
-
+      entry_pointer new_entries = s_entry_allocator.allocate(new_size);
+      std::copy(m_a_entries, m_a_entries + left, new_entries);
       s_entry_allocator.deallocate(m_a_entries, m_actual_size);
-
-      m_actual_size = actual_size;
-
+      m_actual_size = new_size;
       resize_policy::notify_arbitrary(m_actual_size);
     }
   __catch(...)
     { };
 
   m_size = left;
-
-  std::make_heap(m_a_entries, m_a_entries + m_size,
-                static_cast<entry_cmp& >(*this));
-
+  make_heap();
   PB_DS_ASSERT_VALID((*this))
-
   return ersd;
 }
 
@@ -162,16 +141,12 @@ erase(point_iterator it)
   _GLIBCXX_DEBUG_ASSERT(!empty());
 
   const size_type fix_pos = it.m_p_e - m_a_entries;
-
   std::swap(*it.m_p_e, m_a_entries[m_size - 1]);
-
   erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind);
-
   resize_for_erase_if_needed();
 
   _GLIBCXX_DEBUG_ASSERT(m_size > 0);
   --m_size;
-
   _GLIBCXX_DEBUG_ASSERT(fix_pos <= m_size);
 
   if (fix_pos != m_size)
@@ -190,21 +165,15 @@ resize_for_erase_if_needed()
 
   __try
     {
-      const size_type new_actual_size =
-       resize_policy::get_new_size_for_shrink();
-
-      entry_pointer a_new_entries = s_entry_allocator.allocate(new_actual_size);
-
+      const size_type new_size = resize_policy::get_new_size_for_shrink();
+      entry_pointer new_entries = s_entry_allocator.allocate(new_size);
       resize_policy::notify_shrink_resize();
 
       _GLIBCXX_DEBUG_ASSERT(m_size > 0);
-      std::copy(m_a_entries, m_a_entries + m_size - 1, a_new_entries);
-
+      std::copy(m_a_entries, m_a_entries + m_size - 1, new_entries);
       s_entry_allocator.deallocate(m_a_entries, m_actual_size);
-
-      m_actual_size = new_actual_size;
-
-      m_a_entries = a_new_entries;
+      m_actual_size = new_size;
+      m_a_entries = new_entries;
     }
   __catch(...)
     { }
@@ -230,9 +199,7 @@ partition(Pred pred)
       else
        {
          _GLIBCXX_DEBUG_ASSERT(left < right);
-
          std::swap(m_a_entries[left], m_a_entries[right]);
-
          ++left;
          --right;
        }
index 116e9bcddaac7921472bb56afd372e1a83e7c9d3..c445dc0c31f4968ce4ece860b6c4c29181204367 100644 (file)
@@ -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; }
index d29279318fcc320b8935938eb0a773d00ed439de..ae36d3181a11bfda1f57689931961fe690001b2b 100644 (file)
@@ -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(); }
 
index c6c41e572645d8d1e8ba0d3adb6f23ade3b83475..1e1ed969e723dbf1e32bc0623d552998cb3ab8be 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file insert_fn_imps.hpp
+ * @file binary_heap_/insert_fn_imps.hpp
  * Contains an implementation class for a binary_heap.
  */
 
@@ -45,8 +45,7 @@ push(const_reference r_val)
 {
   PB_DS_ASSERT_VALID((*this))
   insert_value(r_val, s_no_throw_copies_ind);
-  std::push_heap(m_a_entries, m_a_entries + m_size, 
-                static_cast<entry_cmp&>(*this));
+  push_heap();
   PB_DS_ASSERT_VALID((*this))
   return point_iterator(m_a_entries);
 }
@@ -57,7 +56,6 @@ PB_DS_CLASS_C_DEC::
 insert_value(value_type val, true_type)
 {
   resize_for_insert_if_needed();
-
   m_a_entries[m_size++] = val;
 }
 
@@ -74,15 +72,6 @@ insert_value(const_reference r_val, false_type)
   m_a_entries[m_size++] = p_new;
 }
 
-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::
@@ -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
index db0a64ea899942c1fedee4c279f2f7cf560e72fa..daaf2e4a7f89e113b28a3fd1855962c08d80326e 100644 (file)
@@ -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); }
 
similarity index 80%
rename from libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
rename to libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp
index 3d75e86d45a7e3759cc2785d6d1ab7e042ed9735..873626073878368362ee47b6ba41a68cb0efe8a6 100644 (file)
@@ -34,9 +34,9 @@
 // warranty.
 
 /**
- * @file const_point_iterator.hpp
+ * @file binary_heap_/point_const_iterator.hpp
  * Contains an iterator class returned by the table's const find and insert
- *     methods.
+ * methods.
  */
 
 #ifndef PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP
@@ -51,11 +51,11 @@ namespace __gnu_pbds
   {
     // Const point-type iterator.
     template<typename Value_Type, typename Entry, bool Simple, 
-            typename Allocator>
-    class binary_heap_const_point_iterator_
+            typename _Alloc>
+    class binary_heap_point_const_iterator_
     {
     protected:
-      typedef typename Allocator::template rebind<Entry>::other::pointer entry_pointer;
+      typedef typename _Alloc::template rebind<Entry>::other::pointer entry_pointer;
 
     public:
       // Category.
@@ -68,35 +68,35 @@ namespace __gnu_pbds
       typedef Value_Type value_type;
 
       // Iterator's pointer type.
-      typedef typename Allocator::template rebind<value_type>::other::pointer
+      typedef typename _Alloc::template rebind<value_type>::other::pointer
       pointer;
 
       // Iterator's const pointer type.
       typedef
-      typename Allocator::template rebind<value_type>::other::const_pointer
+      typename _Alloc::template rebind<value_type>::other::const_pointer
       const_pointer;
 
       // Iterator's reference type.
       typedef
-      typename Allocator::template rebind<value_type>::other::reference
+      typename _Alloc::template rebind<value_type>::other::reference
       reference;
 
       // Iterator's const reference type.
       typedef
-      typename Allocator::template rebind<value_type>::other::const_reference
+      typename _Alloc::template rebind<value_type>::other::const_reference
       const_reference;
 
       inline
-      binary_heap_const_point_iterator_(entry_pointer p_e) : m_p_e(p_e)
+      binary_heap_point_const_iterator_(entry_pointer p_e) : m_p_e(p_e)
       { }
 
       // Default constructor.
       inline
-      binary_heap_const_point_iterator_() : m_p_e(0) { }
+      binary_heap_point_const_iterator_() : m_p_e(0) { }
 
       // Copy constructor.
       inline
-      binary_heap_const_point_iterator_(const binary_heap_const_point_iterator_& other)
+      binary_heap_point_const_iterator_(const binary_heap_point_const_iterator_& other)
       : m_p_e(other.m_p_e)
       { }
 
@@ -118,12 +118,12 @@ namespace __gnu_pbds
 
       // Compares content to a different iterator object.
       inline bool
-      operator==(const binary_heap_const_point_iterator_& other) const
+      operator==(const binary_heap_point_const_iterator_& other) const
       { return m_p_e == other.m_p_e; }
 
       // Compares content (negatively) to a different iterator object.
       inline bool
-      operator!=(const binary_heap_const_point_iterator_& other) const
+      operator!=(const binary_heap_point_const_iterator_& other) const
       { return m_p_e != other.m_p_e; }
 
     private:
index 11a7b89158ab255cb3ca2fd1ddeb3f73502bd77f..f3782221b495db4795a08df42d75b3772da0857a 100644 (file)
@@ -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.
  */
 
index c5893872e5c54697722138c8b121fd0b5eb49cb8..e3d74bffd69898c6cbf1615914f4dff8f4cc36eb 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file resize_policy.hpp
+ * @file binary_heap_/resize_policy.hpp
  * Contains an implementation class for a binary_heap.
  */
 
@@ -47,40 +47,49 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-
-#define PB_DS_CLASS_T_DEC template<typename Size_Type>
-
-#define PB_DS_CLASS_C_DEC resize_policy<Size_Type>
-
-    template<typename Size_Type>
+    /// Resize policy for binary heap.
+    template<typename _Tp>
     class resize_policy
     {
-    public:
-      typedef Size_Type size_type;
-
+    private:
       enum
        {
-         min_size = 16
+         ratio = 8,
+         factor = 2
        };
 
+      // Next shrink size.
+      _Tp              m_shrink_size;
+
+      // Next grow size.
+      _Tp              m_grow_size;
+
     public:
-      inline
-      resize_policy();
+      typedef _Tp      size_type;
+
+      static const _Tp min_size = 16;
+
+      resize_policy() : m_shrink_size(0), m_grow_size(min_size)
+      { PB_DS_ASSERT_VALID((*this)) }
+
+      resize_policy(const resize_policy& other)
+      : m_shrink_size(other.m_shrink_size), m_grow_size(other.m_grow_size)
+      { PB_DS_ASSERT_VALID((*this)) }
 
       inline void
-      swap(PB_DS_CLASS_C_DEC& other);
+      swap(resize_policy<_Tp>&);
 
       inline bool
-      resize_needed_for_grow(size_type size) const;
+      resize_needed_for_grow(size_type) const;
 
       inline bool
-      resize_needed_for_shrink(size_type size) const;
+      resize_needed_for_shrink(size_type) const;
 
       inline bool
-      grow_needed(size_type size) const;
+      grow_needed(size_type) const;
 
       inline bool
-      shrink_needed(size_type size) const;
+      shrink_needed(size_type) const;
 
       inline size_type
       get_new_size_for_grow() const;
@@ -88,8 +97,8 @@ namespace __gnu_pbds
       inline size_type
       get_new_size_for_shrink() const;
 
-      size_type
-      get_new_size_for_arbitrary(size_type size) const;
+      inline size_type
+      get_new_size_for_arbitrary(size_type) const;
 
       inline void
       notify_grow_resize();
@@ -98,83 +107,67 @@ namespace __gnu_pbds
       notify_shrink_resize();
 
       void
-      notify_arbitrary(size_type actual_size);
+      notify_arbitrary(size_type);
 
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_valid(const char* file, int line) const;
-#endif 
+      assert_valid(const char*, int) const;
+#endif
 
 #ifdef PB_DS_BINARY_HEAP_TRACE_
       void
       trace() const;
-#endif 
-
-    private:
-      enum
-       {
-         ratio = 8,
-         factor = 2
-       };
-
-    private:
-      size_type m_next_shrink_size;
-      size_type m_next_grow_size;
+#endif
     };
 
-    PB_DS_CLASS_T_DEC
-    inline
-    PB_DS_CLASS_C_DEC::
-    resize_policy() :
-      m_next_shrink_size(0),
-      m_next_grow_size(min_size)
-    { PB_DS_ASSERT_VALID((*this)) }
+    template<typename _Tp>
+      const _Tp resize_policy<_Tp>::min_size;
 
-    PB_DS_CLASS_T_DEC
+    template<typename _Tp>
     inline void
-    PB_DS_CLASS_C_DEC::
-    swap(PB_DS_CLASS_C_DEC& other)
+    resize_policy<_Tp>::
+    swap(resize_policy<_Tp>& other)
     {
-      std::swap(m_next_shrink_size, other.m_next_shrink_size);
-      std::swap(m_next_grow_size, other.m_next_grow_size);
+      std::swap(m_shrink_size, other.m_shrink_size);
+      std::swap(m_grow_size, other.m_grow_size);
     }
 
-    PB_DS_CLASS_T_DEC
+    template<typename _Tp>
     inline bool
-    PB_DS_CLASS_C_DEC::
+    resize_policy<_Tp>::
     resize_needed_for_grow(size_type size) const
     {
-      _GLIBCXX_DEBUG_ASSERT(size <= m_next_grow_size);
-      return size == m_next_grow_size;
+      _GLIBCXX_DEBUG_ASSERT(size <= m_grow_size);
+      return size == m_grow_size;
     }
 
-    PB_DS_CLASS_T_DEC
+    template<typename _Tp>
     inline bool
-    PB_DS_CLASS_C_DEC::
+    resize_policy<_Tp>::
     resize_needed_for_shrink(size_type size) const
     {
-      _GLIBCXX_DEBUG_ASSERT(size <= m_next_grow_size);
-      return size == m_next_shrink_size;
+      _GLIBCXX_DEBUG_ASSERT(size <= m_grow_size);
+      return size == m_shrink_size;
     }
 
-    PB_DS_CLASS_T_DEC
-    inline typename PB_DS_CLASS_C_DEC::size_type
-    PB_DS_CLASS_C_DEC::
+    template<typename _Tp>
+    inline typename resize_policy<_Tp>::size_type
+    resize_policy<_Tp>::
     get_new_size_for_grow() const
-    { return m_next_grow_size*  factor; }
+    { return m_grow_size * factor; }
 
-    PB_DS_CLASS_T_DEC
-    inline typename PB_DS_CLASS_C_DEC::size_type
-    PB_DS_CLASS_C_DEC::
+    template<typename _Tp>
+    inline typename resize_policy<_Tp>::size_type
+    resize_policy<_Tp>::
     get_new_size_for_shrink() const
     {
-      const size_type half_size = m_next_grow_size / factor;
-      return std::max(static_cast<size_type>(min_size), half_size);
+      const size_type half_size = m_grow_size / factor;
+      return std::max(min_size, half_size);
     }
 
-    PB_DS_CLASS_T_DEC
-    inline typename PB_DS_CLASS_C_DEC::size_type
-    PB_DS_CLASS_C_DEC::
+    template<typename _Tp>
+    inline typename resize_policy<_Tp>::size_type
+    resize_policy<_Tp>::
     get_new_size_for_arbitrary(size_type size) const
     {
       size_type ret = min_size;
@@ -183,71 +176,65 @@ namespace __gnu_pbds
       return ret;
     }
 
-    PB_DS_CLASS_T_DEC
+    template<typename _Tp>
     inline void
-    PB_DS_CLASS_C_DEC::
+    resize_policy<_Tp>::
     notify_grow_resize()
     {
       PB_DS_ASSERT_VALID((*this))
-      _GLIBCXX_DEBUG_ASSERT(m_next_grow_size >= min_size);
-      m_next_grow_size *= factor;
-      m_next_shrink_size = m_next_grow_size / ratio;
+      _GLIBCXX_DEBUG_ASSERT(m_grow_size >= min_size);
+      m_grow_size *= factor;
+      m_shrink_size = m_grow_size / ratio;
       PB_DS_ASSERT_VALID((*this))
     }
 
-    PB_DS_CLASS_T_DEC
+    template<typename _Tp>
     inline void
-    PB_DS_CLASS_C_DEC::
+    resize_policy<_Tp>::
     notify_shrink_resize()
     {
       PB_DS_ASSERT_VALID((*this))
-      m_next_shrink_size /= factor;
-      if (m_next_shrink_size == 1)
-       m_next_shrink_size = 0;
-
-      m_next_grow_size =
-       std::max(m_next_grow_size / factor, static_cast<size_type>(min_size));
+      m_shrink_size /= factor;
+      if (m_shrink_size == 1)
+       m_shrink_size = 0;
+      m_grow_size = std::max(m_grow_size / factor, min_size);
       PB_DS_ASSERT_VALID((*this))
     }
 
-    PB_DS_CLASS_T_DEC
+    template<typename _Tp>
     inline void
-    PB_DS_CLASS_C_DEC::
+    resize_policy<_Tp>::
     notify_arbitrary(size_type actual_size)
     {
-      m_next_grow_size = actual_size;
-      m_next_shrink_size = m_next_grow_size / ratio;
+      m_grow_size = actual_size;
+      m_shrink_size = m_grow_size / ratio;
       PB_DS_ASSERT_VALID((*this))
     }
 
 #ifdef _GLIBCXX_DEBUG
-    PB_DS_CLASS_T_DEC
+    template<typename _Tp>
     void
-    PB_DS_CLASS_C_DEC::
+    resize_policy<_Tp>::
     assert_valid(const char* __file, int __line) const
     {
-      PB_DS_DEBUG_VERIFY(m_next_shrink_size == 0 ||
-                      m_next_shrink_size*  ratio == m_next_grow_size);
-
-      PB_DS_DEBUG_VERIFY(m_next_grow_size >= min_size);
+      PB_DS_DEBUG_VERIFY(m_shrink_size == 0
+                        || m_shrink_size * ratio == m_grow_size);
+      PB_DS_DEBUG_VERIFY(m_grow_size >= min_size);
     }
-#endif 
+#endif
 
 #ifdef PB_DS_BINARY_HEAP_TRACE_
-    PB_DS_CLASS_T_DEC
+    template<typename _Tp>
     void
-    PB_DS_CLASS_C_DEC::
+    resize_policy<_Tp>::
     trace() const
     {
-      std::cerr << "shrink = " << m_next_shrink_size <<
-       " grow = " << m_next_grow_size << std::endl;
+      std::cerr << "shrink = " << m_shrink_size
+               << " grow = " << m_grow_size << std::endl;
     }
-#endif 
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
+#endif
 
 } // namespace detail
 } // namespace __gnu_pbds
 
-#endif 
+#endif
index 675b4ec40dbd9af8660624c260c2688388efe0f5..0d09b535730e0f7cdfa27c636b708df4a7650ae3 100644 (file)
@@ -35,7 +35,7 @@
 // warranty.
 
 /**
- * @file split_join_fn_imps.hpp
+ * @file binary_heap_/split_join_fn_imps.hpp
  * Contains an implementation class for a binary_heap.
  */
 
@@ -48,40 +48,30 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
   PB_DS_ASSERT_VALID((*this))
 
   typedef
-    typename entry_pred<
-    value_type,
-    Pred,
-    simple_value,
-    Allocator>::type
+    typename entry_pred<value_type, Pred, _Alloc, simple_value>::type
     pred_t;
 
   const size_type left = partition(pred_t(pred));
-
   _GLIBCXX_DEBUG_ASSERT(m_size >= left);
 
   const size_type ersd = m_size - left;
-
   _GLIBCXX_DEBUG_ASSERT(m_size >= ersd);
 
-  const size_type actual_size =
-    resize_policy::get_new_size_for_arbitrary(left);
-
-  const size_type other_actual_size =
-    other.get_new_size_for_arbitrary(ersd);
+  const size_type new_size = resize_policy::get_new_size_for_arbitrary(left);
+  const size_type other_actual_size = other.get_new_size_for_arbitrary(ersd);
 
   entry_pointer a_entries = 0;
   entry_pointer a_other_entries = 0;
 
   __try
     {
-      a_entries = s_entry_allocator.allocate(actual_size);
-
+      a_entries = s_entry_allocator.allocate(new_size);
       a_other_entries = s_entry_allocator.allocate(other_actual_size);
     }
   __catch(...)
     {
       if (a_entries != 0)
-       s_entry_allocator.deallocate(a_entries, actual_size);
+       s_entry_allocator.deallocate(a_entries, new_size);
 
       if (a_other_entries != 0)
        s_entry_allocator.deallocate(a_other_entries, other_actual_size);
@@ -92,14 +82,14 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
   for (size_type i = 0; i < other.m_size; ++i)
     erase_at(other.m_a_entries, i, s_no_throw_copies_ind);
 
-  _GLIBCXX_DEBUG_ASSERT(actual_size >= left);
+  _GLIBCXX_DEBUG_ASSERT(new_size >= left);
   std::copy(m_a_entries, m_a_entries + left, a_entries);
   std::copy(m_a_entries + left, m_a_entries + m_size, a_other_entries);
 
   s_entry_allocator.deallocate(m_a_entries, m_actual_size);
   s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);
 
-  m_actual_size = actual_size;
+  m_actual_size = new_size;
   other.m_actual_size = other_actual_size;
 
   m_size = left;
@@ -108,8 +98,8 @@ split(Pred pred, PB_DS_CLASS_C_DEC& other)
   m_a_entries = a_entries;
   other.m_a_entries = a_other_entries;
 
-  std::make_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));
-  std::make_heap(other.m_a_entries, other.m_a_entries + other.m_size, static_cast<entry_cmp& >(other));
+  make_heap();
+  other.make_heap();
 
   resize_policy::notify_arbitrary(m_actual_size);
   other.notify_arbitrary(other.m_actual_size);
@@ -127,20 +117,20 @@ join(PB_DS_CLASS_C_DEC& other)
   PB_DS_ASSERT_VALID(other)
 
   const size_type len = m_size + other.m_size;
-  const size_type actual_size = resize_policy::get_new_size_for_arbitrary(len);
+  const size_type new_size = resize_policy::get_new_size_for_arbitrary(len);
 
   entry_pointer a_entries = 0;
   entry_pointer a_other_entries = 0;
 
   __try
     {
-      a_entries = s_entry_allocator.allocate(actual_size);
+      a_entries = s_entry_allocator.allocate(new_size);
       a_other_entries = s_entry_allocator.allocate(resize_policy::min_size);
     }
   __catch(...)
     {
       if (a_entries != 0)
-       s_entry_allocator.deallocate(a_entries, actual_size);
+       s_entry_allocator.deallocate(a_entries, new_size);
 
       if (a_other_entries != 0)
        s_entry_allocator.deallocate(a_other_entries, resize_policy::min_size);
@@ -149,25 +139,23 @@ join(PB_DS_CLASS_C_DEC& other)
     }
 
   std::copy(m_a_entries, m_a_entries + m_size, a_entries);
-  std::copy(other.m_a_entries, other.m_a_entries + other.m_size, a_entries + m_size);
+  std::copy(other.m_a_entries, other.m_a_entries + other.m_size,
+           a_entries + m_size);
 
   s_entry_allocator.deallocate(m_a_entries, m_actual_size);
   m_a_entries = a_entries;
   m_size = len;
-  m_actual_size = actual_size;
-
-  resize_policy::notify_arbitrary(actual_size);
-
-  std::make_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));
+  m_actual_size = new_size;
+  resize_policy::notify_arbitrary(new_size);
+  make_heap();
 
   s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);
   other.m_a_entries = a_other_entries;
   other.m_size = 0;
   other.m_actual_size = resize_policy::min_size;
-
   other.notify_arbitrary(resize_policy::min_size);
-
+  other.make_heap();
+  
   PB_DS_ASSERT_VALID((*this))
   PB_DS_ASSERT_VALID(other)
 }
-
index 36bd66f755371fe1a19e27b66050a4cffd89f22d..2704ec65c1b9b010d5098dc740f8251e13dcc7f2 100644 (file)
@@ -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.
  */
 
index a6d6098fd37c7e1ee45a9146589dff6da85f6b33..d8704f65c41b83d6aa92e940111c6004f2ac94fa 100644 (file)
@@ -53,64 +53,56 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-
 #define PB_DS_CLASS_T_DEC \
-    template<typename Value_Type, class Cmp_Fn, class Allocator>
+    template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
 
 #define PB_DS_CLASS_C_DEC \
-    binomial_heap_<Value_Type, Cmp_Fn, Allocator>
-
-#define PB_DS_BASE_C_DEC \
-    binomial_heap_base_<Value_Type, Cmp_Fn, Allocator>
+    binomial_heap<Value_Type, Cmp_Fn, _Alloc>
 
-    /**
-     * class description = "8y|\|0|\/|i41 h34p 74813">
-     **/
-    template<typename Value_Type, class Cmp_Fn, class Allocator>
-    class binomial_heap_ : public PB_DS_BASE_C_DEC
+    /// Binomial heap.
+    template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
+    class binomial_heap
+    : public binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>
     {
     private:
-      typedef PB_DS_BASE_C_DEC base_type;
-      typedef typename base_type::node_pointer node_pointer;
-      typedef typename base_type::const_node_pointer const_node_pointer;
+      typedef binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>   base_type;
+      typedef typename base_type::node_pointer                 node_pointer;
+      typedef typename base_type::node_const_pointer   node_const_pointer;
 
     public:
-      typedef Value_Type value_type;
-      typedef typename Allocator::size_type size_type;
-      typedef typename Allocator::difference_type difference_type;
-      typedef typename base_type::pointer pointer;
-      typedef typename base_type::const_pointer const_pointer;
-      typedef typename base_type::reference reference;
-      typedef typename base_type::const_reference const_reference;
-      typedef typename base_type::const_point_iterator const_point_iterator;
-      typedef typename base_type::point_iterator point_iterator;
-      typedef typename base_type::const_iterator const_iterator;
-      typedef typename base_type::iterator iterator;
-      typedef typename base_type::cmp_fn cmp_fn;
-      typedef typename base_type::allocator_type allocator_type;
+      typedef Value_Type                               value_type;
+      typedef typename _Alloc::size_type               size_type;
+      typedef typename _Alloc::difference_type                 difference_type;
+      typedef typename base_type::pointer              pointer;
+      typedef typename base_type::const_pointer        const_pointer;
+      typedef typename base_type::reference            reference;
+      typedef typename base_type::const_reference      const_reference;
+      typedef typename base_type::point_const_iterator         point_const_iterator;
+      typedef typename base_type::point_iterator       point_iterator;
+      typedef typename base_type::const_iterator       const_iterator;
+      typedef typename base_type::iterator             iterator;
+      typedef typename base_type::cmp_fn               cmp_fn;
+      typedef typename base_type::allocator_type       allocator_type;
 
-      binomial_heap_();
+      binomial_heap();
 
-      binomial_heap_(const Cmp_Fn& r_cmp_fn);
+      binomial_heap(const Cmp_Fn&);
 
-      binomial_heap_(const PB_DS_CLASS_C_DEC& other);
+      binomial_heap(const binomial_heap&);
 
-      ~binomial_heap_();
+      ~binomial_heap();
 
     protected:
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_valid(const char* file, int line) const;
-#endif 
+      assert_valid(const char*, int) const;
+#endif
     };
 
 #include <ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp>
 #include <ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp>
 
 #undef PB_DS_CLASS_C_DEC
-
 #undef PB_DS_CLASS_T_DEC
-
-#undef PB_DS_BASE_C_DEC
   } // namespace detail
 } // namespace __gnu_pbds
index ebe1f2e9ea8102be6c02f24de22653a09d810672..ee8d89c9dfb32005f9a5ff5a2fd0b06df815c85e 100644 (file)
 // 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() { }
index 80c0b048632e2aad693f2cc393e70c79620aefcc..12949aedb2b324ba0bde94bbdff6f58b649e8a7f 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file debug_fn_imps.hpp
+ * @file detail/binomial_heap_/debug_fn_imps.hpp
  * Contains an implementation for binomial_heap_.
  */
 
index b2add18e7a0475142ac1c72ea62964020f0658af..9d260d0e17e333aaa60b516dc60b9e5cec4ddde0 100644 (file)
@@ -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.
  */
 
 #include <ext/pb_ds/detail/cond_dealtor.hpp>
 #include <ext/pb_ds/detail/type_utils.hpp>
 #include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>
-#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>
 
 namespace __gnu_pbds
 {
   namespace detail
   {
-
 #define PB_DS_CLASS_T_DEC \
-    template<typename Value_Type, class Cmp_Fn, class Allocator>
+    template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
 
 #define PB_DS_CLASS_C_DEC \
-    binomial_heap_base_<Value_Type, Cmp_Fn, Allocator>
+    binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>
 
 #ifdef _GLIBCXX_DEBUG
-#define PB_DS_BASE_C_DEC \
-    left_child_next_sibling_heap_<Value_Type, Cmp_Fn, \
-                                 typename Allocator::size_type, \
-                                 Allocator, false>
-#else 
-#define PB_DS_BASE_C_DEC \
-    left_child_next_sibling_heap_<Value_Type, Cmp_Fn,  \
-                               typename Allocator::size_type, Allocator>
-#endif 
-
-    /**
-     * class description = "8y|\|0|\/|i41 h34p 74813">
-     **/
-    template<typename Value_Type, class Cmp_Fn, class Allocator>
-    class binomial_heap_base_ : public PB_DS_BASE_C_DEC
-    {
+#define PB_DS_B_HEAP_BASE \
+  left_child_next_sibling_heap<Value_Type, Cmp_Fn, \
+                               typename _Alloc::size_type,  _Alloc, false>
+#else
+#define PB_DS_B_HEAP_BASE \
+  left_child_next_sibling_heap<Value_Type, Cmp_Fn, \
+                               typename _Alloc::size_type, _Alloc>
+#endif
 
+    /// Base class for binomial heap.
+    template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
+    class binomial_heap_base
+    : public PB_DS_B_HEAP_BASE
+    {
     private:
-      typedef PB_DS_BASE_C_DEC base_type;
+      typedef typename _Alloc::template rebind<Value_Type>::other __rebind_v;
+      typedef PB_DS_B_HEAP_BASE                                base_type;
 
     protected:
-      typedef typename base_type::node node;
-
-      typedef typename base_type::node_pointer node_pointer;
-
-      typedef typename base_type::const_node_pointer const_node_pointer;
+      typedef typename base_type::node                         node;
+      typedef typename base_type::node_pointer                 node_pointer;
+      typedef typename base_type::node_const_pointer   node_const_pointer;
 
     public:
-
-      typedef typename Allocator::size_type size_type;
-
-      typedef typename Allocator::difference_type difference_type;
-
-      typedef Value_Type value_type;
-
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::pointer
-      pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::const_pointer
-      const_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::reference
-      reference;
-
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::const_reference
-      const_reference;
-
-      typedef
-      typename PB_DS_BASE_C_DEC::const_point_iterator
-      const_point_iterator;
-
-      typedef typename PB_DS_BASE_C_DEC::point_iterator point_iterator;
-
-      typedef typename PB_DS_BASE_C_DEC::const_iterator const_iterator;
-
-      typedef typename PB_DS_BASE_C_DEC::iterator iterator;
-
-      typedef Cmp_Fn cmp_fn;
-
-      typedef Allocator allocator_type;
+      typedef Value_Type                               value_type;
+      typedef Cmp_Fn                                   cmp_fn;
+      typedef _Alloc                                   allocator_type;
+      typedef typename _Alloc::size_type               size_type;
+      typedef typename _Alloc::difference_type                 difference_type;
+
+      typedef typename __rebind_v::pointer             pointer;
+      typedef typename __rebind_v::const_pointer       const_pointer;
+      typedef typename __rebind_v::reference           reference;
+      typedef typename __rebind_v::const_reference     const_reference;
+
+      typedef typename base_type::point_const_iterator         point_const_iterator;
+      typedef typename base_type::point_iterator       point_iterator;
+      typedef typename base_type::const_iterator       const_iterator;
+      typedef typename base_type::iterator             iterator;
 
     public:
 
       inline point_iterator
-      push(const_reference r_val);
+      push(const_reference);
 
       void
-      modify(point_iterator it, const_reference r_new_val);
+      modify(point_iterator, const_reference);
 
       inline const_reference
       top() const;
@@ -149,72 +118,72 @@ namespace __gnu_pbds
       pop();
 
       void
-      erase(point_iterator it);
+      erase(point_iterator);
 
       inline void
       clear();
 
       template<typename Pred>
       size_type
-      erase_if(Pred pred);
+      erase_if(Pred);
 
       template<typename Pred>
       void
-      split(Pred pred, PB_DS_CLASS_C_DEC& other);
+      split(Pred, PB_DS_CLASS_C_DEC&);
 
       void
-      join(PB_DS_CLASS_C_DEC& other);
+      join(PB_DS_CLASS_C_DEC&);
 
     protected:
 
-      binomial_heap_base_();
+      binomial_heap_base();
 
-      binomial_heap_base_(const Cmp_Fn& r_cmp_fn);
+      binomial_heap_base(const Cmp_Fn&);
 
-      binomial_heap_base_(const PB_DS_CLASS_C_DEC& other);
+      binomial_heap_base(const PB_DS_CLASS_C_DEC&);
 
       void
-      swap(PB_DS_CLASS_C_DEC& other);
+      swap(PB_DS_CLASS_C_DEC&);
 
-      ~binomial_heap_base_();
+      ~binomial_heap_base();
 
       template<typename It>
       void
-      copy_from_range(It first_it, It last_it);
+      copy_from_range(It, It);
 
       inline void
       find_max();
 
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_valid(bool strictly_binomial, const char* file, int line) const;
+      assert_valid(bool, const char*, int) const;
 
       void
-      assert_max(const char* file, int line) const;
-#endif 
+      assert_max(const char*, int) const;
+#endif
 
     private:
 
       inline node_pointer
-      fix(node_pointer p_nd) const;
+      fix(node_pointer) const;
 
       inline void
-      insert_node(node_pointer p_nd);
+      insert_node(node_pointer);
 
       inline void
-      remove_parentless_node(node_pointer p_nd);
+      remove_parentless_node(node_pointer);
 
       inline node_pointer
-      join(node_pointer p_lhs, node_pointer p_rhs) const;
+      join(node_pointer, node_pointer) const;
 
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_node_consistent(const_node_pointer, bool, bool,
+      assert_node_consistent(node_const_pointer, bool, bool,
                             const char*, int) const;
 #endif
 
     protected:
-      node_pointer m_p_max;
+      node_pointer     m_p_max;
     };
 
 #define PB_DS_ASSERT_VALID_COND(X, _StrictlyBinomial)                  \
@@ -235,10 +204,8 @@ namespace __gnu_pbds
 #undef PB_DS_ASSERT_VALID_COND
 #undef PB_DS_CLASS_C_DEC
 #undef PB_DS_CLASS_T_DEC
-#undef PB_DS_BASE_C_DEC
-
-
+#undef PB_DS_B_HEAP_BASE
   } // namespace detail
 } // namespace __gnu_pbds
 
-#endif 
+#endif
index fa86c230cd2da1a11f8827b8e856e95b6eb4fb2a..ef9d0e3b30043d3afa33f9f6d5edd3905d649992 100644 (file)
@@ -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()
 { }
-
index 6f2aa2a798376140e3a8662df5d558a2b5c43a50..137ec4b0c6ece35209ab64919f3e90a5d5cce713 100644 (file)
@@ -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);
index e7a2dc4f6fdc46b8343a16cfac6c0fb1c25d6808..2cdc456dd7dcc4e531eb8d70aef465d128c012da 100644 (file)
@@ -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;
 }
-
index f832cb60c7d9fe3f5cb7a1eaf9f854f4cef33baf..8059917f9df809394ce5a0c63c4095de8a0b0bf5 100644 (file)
@@ -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;
     }
 }
index 11bd5e1444f946f4dc2575e01c3ee65602843a3a..30f49db063578a4169cea5123936ab2ae1bff61f 100644 (file)
@@ -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)
 }
-
index 6564c54a21ae1d161a479cd5010e5fc6f3a65b6b..44bc4ed7c4dc2e479cea174591245f66f73d166d 100644 (file)
@@ -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 (file)
index 0000000..efe39f2
--- /dev/null
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file branch_policy/branch_policy.hpp
+ * Contains a base class for branch policies.
+ */
+
+#ifndef PB_DS_BRANCH_POLICY_BASE_HPP
+#define PB_DS_BRANCH_POLICY_BASE_HPP
+
+#include <ext/pb_ds/tag_and_trait.hpp>
+
+namespace __gnu_pbds
+{
+  /// A null node updator, indicating that no node updates are required.
+  template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
+    struct null_node_update : public null_type
+    { };
+
+  namespace detail
+  {
+    /// Primary template, base class for branch structure policies.
+    template<typename Node_CItr, typename Node_Itr, typename _Alloc>
+      struct branch_policy
+      {
+      protected:
+       typedef typename Node_Itr::value_type           it_type;
+       typedef typename std::iterator_traits<it_type>::value_type value_type;
+       typedef typename value_type::first_type         key_type;
+
+       typedef typename remove_const<value_type>::type rcvalue_type;
+       typedef typename remove_const<key_type>::type   rckey_type;
+
+       typedef typename _Alloc::template rebind<rcvalue_type>::other rebind_v;
+       typedef typename _Alloc::template rebind<rckey_type>::other   rebind_k;
+
+       typedef typename rebind_v::reference            reference;
+       typedef typename rebind_v::const_reference      const_reference;
+       typedef typename rebind_v::const_pointer        const_pointer;
+
+       typedef typename rebind_k::const_reference      key_const_reference;
+
+       static inline key_const_reference
+       extract_key(const_reference r_val)
+       { return r_val.first; }
+
+       virtual it_type
+       end() = 0;
+
+       it_type
+       end_iterator() const
+       { return const_cast<branch_policy*>(this)->end(); }
+
+       virtual
+       ~branch_policy() { }
+      };
+
+    /// Specialization for const iterators.
+    template<typename Node_CItr, typename _Alloc>
+      struct branch_policy<Node_CItr, Node_CItr, _Alloc>
+      {
+      protected:
+       typedef typename Node_CItr::value_type             it_type;
+               typedef typename std::iterator_traits<it_type>::value_type value_type;
+       typedef typename remove_const<value_type>::type            rcvalue_type;
+       typedef typename _Alloc::template rebind<rcvalue_type>::other rebind_v;
+       typedef typename rebind_v::reference            reference;
+       typedef typename rebind_v::const_reference      const_reference;
+       typedef typename rebind_v::const_pointer        const_pointer;
+
+       typedef value_type                              key_type;
+       typedef typename rebind_v::const_reference      key_const_reference;
+
+       static inline key_const_reference
+       extract_key(const_reference r_val)
+       { return r_val; }
+
+       virtual it_type
+       end() const = 0;
+
+       it_type
+       end_iterator() const
+       { return end(); }
+
+       virtual
+       ~branch_policy() { }
+      };
+  } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_BRANCH_POLICY_BASE_HPP
similarity index 69%
rename from libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
rename to libstdc++-v3/include/ext/pb_ds/detail/branch_policy/null_node_metadata.hpp
index 5f04e14b4700ce9e97e9fce26f8ca7f2c64d6d44..caa8dd738d3754bb9f20a4c1f326536e5c40822a 100644 (file)
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 
-// Copyright (C) 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the terms
 // warranty.
 
 /**
- * @file null_metadata.hpp
- * Contains an implementation struct for this type of heap's node.
+ * @file branch_policy/null_node_metadata.hpp
+ * Contains an implementation class for tree-like classes.
  */
 
-#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_0_METADATA_HPP
-#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_0_METADATA_HPP
+#ifndef PB_DS_0_NODE_METADATA_HPP
+#define PB_DS_0_NODE_METADATA_HPP
+
+#include <ext/pb_ds/detail/types_traits.hpp>
 
 namespace __gnu_pbds
 {
   namespace detail
   {
-
-    struct null_left_child_next_sibling_heap_node_metadata
-    { };
-
+    /// Constant node iterator.
+    template<typename Key, typename Data, typename _Alloc>
+      struct dumnode_const_iterator
+      {
+      private:
+       typedef types_traits<Key, Data, _Alloc, false>  __traits_type;
+       typedef typename __traits_type::pointer         const_iterator;
+       
+      public:
+       typedef const_iterator                          value_type;
+       typedef const_iterator                          const_reference;
+       typedef const_reference                         reference;
+      };
   } // namespace detail
 } // namespace __gnu_pbds
 
-#endif // #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_0_METADATA_HPP
+#endif
similarity index 51%
rename from libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
rename to libstdc++-v3/include/ext/pb_ds/detail/branch_policy/traits.hpp
index 36272eda8229228b6ca08f29fb8ad668e3651c3c..92f9f444453a7f7ac29e857f846d71a18f88fbcf 100644 (file)
@@ -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
 // warranty.
 
 /**
- * @file node_metadata_base.hpp
- * Contains an internal PB_DS_BASE_C_DEC for a patricia tree.
+ * @file branch_policy/traits.hpp
+ * Contains an implementation class for tree-like classes.
  */
 
-#ifndef PB_DS_PAT_TRIE_NODE_METADATA_BASE_HPP
-#define PB_DS_PAT_TRIE_NODE_METADATA_BASE_HPP
+#ifndef PB_DS_NODE_AND_IT_TRAITS_HPP
+#define PB_DS_NODE_AND_IT_TRAITS_HPP
 
-#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+#include <ext/pb_ds/detail/types_traits.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/traits.hpp>
+#include <ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp>
+#include <ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp>
+
+#define PB_DS_DEBUG_VERIFY(_Cond)                                      \
+  _GLIBCXX_DEBUG_VERIFY_AT(_Cond,                                      \
+                          _M_message(#_Cond" assertion from %1;:%2;")  \
+                          ._M_string(__FILE__)._M_integer(__LINE__)    \
+                          ,__file,__line)
 
 namespace __gnu_pbds
 {
   namespace detail
   {
-
-    template<typename Metadata, class Allocator>
-    struct pat_trie_node_metadata_base
-    {
-    public:
-      typedef Metadata metadata_type;
-
-      typedef
-      typename Allocator::template rebind<
-       metadata_type>::other::const_reference
-      const_metadata_reference;
-
-    public:
-      inline const_metadata_reference
-      get_metadata() const
-      {
-       return (m_metadata);
-      }
-
-    public:
-      metadata_type m_metadata;
-    };
-
-    template<typename Allocator>
-    struct pat_trie_node_metadata_base<
-      null_node_metadata,
-      Allocator>
-    {
-    public:
-      typedef null_node_metadata metadata_type;
-    };
+    /// Tree traits class, primary template.
+    template<typename Key,
+            typename Data,
+            typename Cmp_Fn,
+            template<typename Node_CItr,
+                     typename Node_Itr,
+                     typename Cmp_Fn_,
+                     typename _Alloc>
+            class Node_Update,
+            typename Tag,
+            typename _Alloc>
+    struct tree_traits;
+
+    /// Trie traits class, primary template.
+    template<typename Key,
+            typename Data,
+            typename _ATraits,
+            template<typename Node_CItr,
+                     typename Node_Itr,
+                     typename _ATraits_,
+                     typename _Alloc>
+            class Node_Update,
+            typename Tag,
+            typename _Alloc>
+    struct trie_traits;
 
   } // namespace detail
 } // namespace __gnu_pbds
 
-#endif // #ifndef PB_DS_PAT_TRIE_NODE_BASE_HPP
+#include <ext/pb_ds/detail/rb_tree_map_/traits.hpp>
+#include <ext/pb_ds/detail/splay_tree_/traits.hpp>
+#include <ext/pb_ds/detail/ov_tree_map_/traits.hpp>
+#include <ext/pb_ds/detail/pat_trie_/traits.hpp>
+
+#undef PB_DS_DEBUG_VERIFY
 
+#endif // #ifndef PB_DS_NODE_AND_IT_TRAITS_HPP
index 149a206a4e73e713bab2c381cf3b4460d30f2d32..f1c2540e7d523a3cdbbb451d19a7762d14ab4e9a 100644 (file)
@@ -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_.
  */
 
 #include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp>
 #ifdef _GLIBCXX_DEBUG
 #include <ext/pb_ds/detail/debug_map_base.hpp>
-#endif 
+#endif
 #ifdef PB_DS_HT_MAP_TRACE_
 #include <iostream>
-#endif 
+#endif
 #include <debug/debug.h>
 
 namespace __gnu_pbds
 {
   namespace detail
   {
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_CC_HASH_NAME cc_ht_map
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_CC_HASH_NAME cc_ht_set
+#endif
 
 #define PB_DS_CLASS_T_DEC \
     template<typename Key, typename Mapped, typename Hash_Fn, \
-            typename Eq_Fn, typename Allocator, bool Store_Hash, \
+            typename Eq_Fn, typename _Alloc, bool Store_Hash, \
             typename Comb_Hash_Fn, typename Resize_Policy>
 
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CLASS_NAME cc_ht_map_data_
-#endif 
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_CLASS_NAME cc_ht_map_no_data_
-#endif 
-
 #define PB_DS_CLASS_C_DEC \
-    PB_DS_CLASS_NAME<Key, Mapped, Hash_Fn, Eq_Fn, Allocator,   \
+    PB_DS_CC_HASH_NAME<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc,    \
                     Store_Hash, Comb_Hash_Fn, Resize_Policy>
 
 #define PB_DS_HASH_EQ_FN_C_DEC \
-    hash_eq_fn<Key, Eq_Fn, Allocator, Store_Hash>
+    hash_eq_fn<Key, Eq_Fn, _Alloc, Store_Hash>
 
 #define PB_DS_RANGED_HASH_FN_C_DEC \
-    ranged_hash_fn<Key,        Hash_Fn, Allocator, Comb_Hash_Fn, Store_Hash>
+    ranged_hash_fn<Key,        Hash_Fn, _Alloc, Comb_Hash_Fn, Store_Hash>
 
-#define PB_DS_TYPES_TRAITS_C_DEC \
-    types_traits<Key, Mapped, Allocator, Store_Hash>
+#define PB_DS_CC_HASH_TRAITS_BASE \
+    types_traits<Key, Mapped, _Alloc, Store_Hash>
 
 #ifdef _GLIBCXX_DEBUG
 #define PB_DS_DEBUG_MAP_BASE_C_DEC \
-    debug_map_base<Key,        Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference>
-#endif 
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#endif 
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped_Data()
+    debug_map_base<Key,        Eq_Fn, \
+                 typename _Alloc::template rebind<Key>::other::const_reference>
 #endif
 
-    // <011i$i0|\|-<|-|4i|\|i|\|g |-|4$|-| 74813.
+    /// Collision chaining hash.
     template<typename Key,
             typename Mapped,
             typename Hash_Fn,
             typename Eq_Fn,
-            typename Allocator,
+            typename _Alloc,
             bool Store_Hash,
             typename Comb_Hash_Fn,
             typename Resize_Policy >
-    class PB_DS_CLASS_NAME:
+    class PB_DS_CC_HASH_NAME:
 #ifdef _GLIBCXX_DEBUG
       protected PB_DS_DEBUG_MAP_BASE_C_DEC,
-#endif 
+#endif
       public PB_DS_HASH_EQ_FN_C_DEC,
       public Resize_Policy,
       public PB_DS_RANGED_HASH_FN_C_DEC,
-      public PB_DS_TYPES_TRAITS_C_DEC
+      public PB_DS_CC_HASH_TRAITS_BASE
     {
     private:
-      typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
-      typedef typename traits_base::comp_hash comp_hash;
-      typedef typename traits_base::value_type value_type_;
-      typedef typename traits_base::pointer pointer_;
+      typedef PB_DS_CC_HASH_TRAITS_BASE                traits_base;
+      typedef typename traits_base::comp_hash  comp_hash;
+      typedef typename traits_base::value_type         value_type_;
+      typedef typename traits_base::pointer    pointer_;
       typedef typename traits_base::const_pointer const_pointer_;
-      typedef typename traits_base::reference reference_;
+      typedef typename traits_base::reference  reference_;
       typedef typename traits_base::const_reference const_reference_;
 
-      struct entry : public traits_base::stored_value_type
+      struct entry : public traits_base::stored_data_type
       {
-       typename Allocator::template rebind<entry>::other::pointer m_p_next;
+       typename _Alloc::template rebind<entry>::other::pointer m_p_next;
       };
 
-      typedef cond_dealtor<entry, Allocator> cond_dealtor_t;
+      typedef cond_dealtor<entry, _Alloc>      cond_dealtor_t;
 
-      typedef typename Allocator::template rebind<entry>::other entry_allocator;
+      typedef typename _Alloc::template rebind<entry>::other entry_allocator;
       typedef typename entry_allocator::pointer entry_pointer;
       typedef typename entry_allocator::const_pointer const_entry_pointer;
       typedef typename entry_allocator::reference entry_reference;
       typedef typename entry_allocator::const_reference const_entry_reference;
 
-      typedef typename Allocator::template rebind<entry_pointer>::other entry_pointer_allocator;
+      typedef typename _Alloc::template rebind<entry_pointer>::other entry_pointer_allocator;
       typedef typename entry_pointer_allocator::pointer entry_pointer_array;
 
       typedef PB_DS_RANGED_HASH_FN_C_DEC ranged_hash_fn_base;
@@ -149,12 +139,12 @@ namespace __gnu_pbds
       typedef Resize_Policy resize_base;
 
 #ifdef _GLIBCXX_DEBUG
-      typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
-#endif 
+      typedef PB_DS_DEBUG_MAP_BASE_C_DEC       debug_base;
+#endif
 
-#define PB_DS_GEN_POS std::pair<entry_pointer, typename Allocator::size_type>
+#define PB_DS_GEN_POS std::pair<entry_pointer, typename _Alloc::size_type>
 
-#include <ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp>
 #include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>
 #include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>
 #include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>
@@ -162,13 +152,13 @@ namespace __gnu_pbds
 #undef PB_DS_GEN_POS
 
     public:
-      typedef Allocator allocator_type;
-      typedef typename Allocator::size_type size_type;
-      typedef typename Allocator::difference_type difference_type;
-      typedef Hash_Fn hash_fn;
-      typedef Eq_Fn eq_fn;
-      typedef Comb_Hash_Fn comb_hash_fn;
-      typedef Resize_Policy resize_policy;
+      typedef _Alloc                           allocator_type;
+      typedef typename _Alloc::size_type       size_type;
+      typedef typename _Alloc::difference_type         difference_type;
+      typedef Hash_Fn                          hash_fn;
+      typedef Eq_Fn                            eq_fn;
+      typedef Comb_Hash_Fn                     comb_hash_fn;
+      typedef Resize_Policy                    resize_policy;
 
       enum
        {
@@ -177,55 +167,55 @@ namespace __gnu_pbds
 
       typedef typename traits_base::key_type key_type;
       typedef typename traits_base::key_pointer key_pointer;
-      typedef typename traits_base::const_key_pointer const_key_pointer;
+      typedef typename traits_base::key_const_pointer key_const_pointer;
       typedef typename traits_base::key_reference key_reference;
-      typedef typename traits_base::const_key_reference const_key_reference;
+      typedef typename traits_base::key_const_reference key_const_reference;
       typedef typename traits_base::mapped_type mapped_type;
       typedef typename traits_base::mapped_pointer mapped_pointer;
-      typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
+      typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
       typedef typename traits_base::mapped_reference mapped_reference;
-      typedef typename traits_base::const_mapped_reference const_mapped_reference;
-      typedef typename traits_base::value_type value_type;
-      typedef typename traits_base::pointer pointer;
+      typedef typename traits_base::mapped_const_reference mapped_const_reference;
+      typedef typename traits_base::value_type         value_type;
+      typedef typename traits_base::pointer    pointer;
       typedef typename traits_base::const_pointer const_pointer;
-      typedef typename traits_base::reference reference;
+      typedef typename traits_base::reference  reference;
       typedef typename traits_base::const_reference const_reference;
 
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-      typedef point_iterator_ point_iterator;
-#endif 
+      typedef point_iterator_                  point_iterator;
+#endif
 
 #ifdef PB_DS_DATA_FALSE_INDICATOR
-      typedef const_point_iterator_ point_iterator;
-#endif 
+      typedef point_const_iterator_            point_iterator;
+#endif
 
-      typedef const_point_iterator_ const_point_iterator;
+      typedef point_const_iterator_            point_const_iterator;
 
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-      typedef iterator_ iterator;
-#endif 
+      typedef iterator_                        iterator;
+#endif
 
 #ifdef PB_DS_DATA_FALSE_INDICATOR
-      typedef const_iterator_ iterator;
-#endif 
+      typedef const_iterator_                  iterator;
+#endif
 
-      typedef const_iterator_ const_iterator;
+      typedef const_iterator_                  const_iterator;
 
-      PB_DS_CLASS_NAME();
+      PB_DS_CC_HASH_NAME();
 
-      PB_DS_CLASS_NAME(const Hash_Fn&);
+      PB_DS_CC_HASH_NAME(const Hash_Fn&);
 
-      PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&);
+      PB_DS_CC_HASH_NAME(const Hash_Fn&, const Eq_Fn&);
 
-      PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&);
+      PB_DS_CC_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&);
 
-      PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&, 
+      PB_DS_CC_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&,
                       const Resize_Policy&);
 
-      PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+      PB_DS_CC_HASH_NAME(const PB_DS_CLASS_C_DEC&);
 
       virtual
-      ~PB_DS_CLASS_NAME();
+      ~PB_DS_CC_HASH_NAME();
 
       void
       swap(PB_DS_CLASS_C_DEC&);
@@ -246,28 +236,28 @@ namespace __gnu_pbds
       inline bool
       empty() const;
 
-      Hash_Fn& 
+      Hash_Fn&
       get_hash_fn();
 
-      const Hash_Fn& 
+      const Hash_Fn&
       get_hash_fn() const;
 
-      Eq_Fn& 
+      Eq_Fn&
       get_eq_fn();
 
-      const Eq_Fn& 
+      const Eq_Fn&
       get_eq_fn() const;
 
-      Comb_Hash_Fn& 
+      Comb_Hash_Fn&
       get_comb_hash_fn();
 
-      const Comb_Hash_Fn& 
+      const Comb_Hash_Fn&
       get_comb_hash_fn() const;
 
-      Resize_Policy& 
+      Resize_Policy&
       get_resize_policy();
 
-      const Resize_Policy& 
+      const Resize_Policy&
       get_resize_policy() const;
 
       inline std::pair<point_iterator, bool>
@@ -275,30 +265,30 @@ namespace __gnu_pbds
       { return insert_imp(r_val, traits_base::m_store_extra_indicator); }
 
       inline mapped_reference
-      operator[](const_key_reference r_key)
+      operator[](key_const_reference r_key)
       {
 #ifdef PB_DS_DATA_TRUE_INDICATOR
        return (subscript_imp(r_key, traits_base::m_store_extra_indicator));
-#else 
+#else
        insert(r_key);
-       return traits_base::s_null_mapped;
-#endif 
+       return traits_base::s_null_type;
+#endif
       }
 
       inline point_iterator
-      find(const_key_reference);
+      find(key_const_reference);
 
-      inline const_point_iterator
-      find(const_key_reference) const;
+      inline point_const_iterator
+      find(key_const_reference) const;
 
       inline point_iterator
       find_end();
 
-      inline const_point_iterator
+      inline point_const_iterator
       find_end() const;
 
       inline bool
-      erase(const_key_reference);
+      erase(key_const_reference);
 
       template<typename Pred>
       inline size_type
@@ -321,13 +311,13 @@ namespace __gnu_pbds
 
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_valid(const char* file, int line) const;
-#endif 
+      assert_valid(const char*, int) const;
+#endif
 
 #ifdef PB_DS_HT_MAP_TRACE_
       void
       trace() const;
-#endif 
+#endif
 
     private:
       void
@@ -340,19 +330,23 @@ namespace __gnu_pbds
       do_resize_if_needed_no_throw();
 
       void
-      resize_imp(size_type new_size);
+      resize_imp(size_type);
 
       void
-      do_resize(size_type new_size);
+      do_resize(size_type);
 
       void
       resize_imp_no_exceptions(size_type, entry_pointer_array, size_type);
 
       inline entry_pointer
-      resize_imp_no_exceptions_reassign_pointer(entry_pointer, entry_pointer_array, false_type);
+      resize_imp_no_exceptions_reassign_pointer(entry_pointer,
+                                               entry_pointer_array,
+                                               false_type);
 
       inline entry_pointer
-      resize_imp_no_exceptions_reassign_pointer(entry_pointer, entry_pointer_array, true_type);
+      resize_imp_no_exceptions_reassign_pointer(entry_pointer,
+                                               entry_pointer_array,
+                                               true_type);
 
       void
       deallocate_links_in_list(entry_pointer);
@@ -368,14 +362,14 @@ namespace __gnu_pbds
 
 #ifdef PB_DS_DATA_TRUE_INDICATOR
       inline mapped_reference
-      subscript_imp(const_key_reference r_key, false_type)
+      subscript_imp(key_const_reference r_key, false_type)
       {
        _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
-        const size_type pos = ranged_hash_fn_base::operator()(r_key);
+       const size_type pos = ranged_hash_fn_base::operator()(r_key);
        entry_pointer p_e = m_entries[pos];
        resize_base::notify_insert_search_start();
 
-       while (p_e != 0 
+       while (p_e != 0
               && !hash_eq_fn_base::operator()(p_e->m_value.first, r_key))
          {
            resize_base::notify_insert_search_collision();
@@ -394,14 +388,15 @@ namespace __gnu_pbds
       }
 
       inline mapped_reference
-      subscript_imp(const_key_reference r_key, true_type)
+      subscript_imp(key_const_reference r_key, true_type)
       {
        _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
        comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);
        entry_pointer p_e = m_entries[pos_hash_pair.first];
        resize_base::notify_insert_search_start();
-       while (p_e != 0 && 
-              !hash_eq_fn_base::operator()(p_e->m_value.first, p_e->m_hash, r_key, pos_hash_pair.second))
+       while (p_e != 0 &&
+              !hash_eq_fn_base::operator()(p_e->m_value.first, p_e->m_hash,
+                                           r_key, pos_hash_pair.second))
          {
            resize_base::notify_insert_search_collision();
            p_e = p_e->m_p_next;
@@ -415,10 +410,10 @@ namespace __gnu_pbds
          }
 
        PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
-       return insert_new_imp(value_type(r_key, mapped_type()), 
+       return insert_new_imp(value_type(r_key, mapped_type()),
                              pos_hash_pair)->second;
       }
-#endif 
+#endif
 
       inline std::pair<point_iterator, bool>
       insert_imp(const_reference, false_type);
@@ -433,7 +428,8 @@ namespace __gnu_pbds
          pos = ranged_hash_fn_base::operator()(PB_DS_V2F(r_val));
 
        // Following lines might throw an exception.
-       entry_pointer p_e = get_entry(r_val, traits_base::m_no_throw_copies_indicator);
+       entry_pointer p_e = get_entry(r_val,
+                                     traits_base::m_no_throw_copies_indicator);
 
        // At this point no exceptions can be thrown.
        p_e->m_p_next = m_entries[pos];
@@ -452,7 +448,8 @@ namespace __gnu_pbds
        if (do_resize_if_needed())
          r_pos_hash_pair = ranged_hash_fn_base::operator()(PB_DS_V2F(r_val));
 
-       entry_pointer p_e = get_entry(r_val, traits_base::m_no_throw_copies_indicator);
+       entry_pointer p_e = get_entry(r_val,
+                                     traits_base::m_no_throw_copies_indicator);
 
        // At this point no exceptions can be thrown.
        p_e->m_hash = r_pos_hash_pair.second;
@@ -465,11 +462,11 @@ namespace __gnu_pbds
       }
 
       inline pointer
-      find_key_pointer(const_key_reference r_key, false_type)
+      find_key_pointer(key_const_reference r_key, false_type)
       {
        entry_pointer p_e = m_entries[ranged_hash_fn_base::operator()(r_key)];
        resize_base::notify_find_search_start();
-       while (p_e != 0 && 
+       while (p_e != 0 &&
               !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
          {
            resize_base::notify_find_search_collision();
@@ -483,17 +480,17 @@ namespace __gnu_pbds
          PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
        else
          PB_DS_CHECK_KEY_EXISTS(r_key)
-#endif 
+#endif
        return &p_e->m_value;
       }
 
       inline pointer
-      find_key_pointer(const_key_reference r_key, true_type)
+      find_key_pointer(key_const_reference r_key, true_type)
       {
        comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);
        entry_pointer p_e = m_entries[pos_hash_pair.first];
        resize_base::notify_find_search_start();
-       while (p_e != 0 && 
+       while (p_e != 0 &&
               !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
                                            p_e->m_hash,
                                            r_key, pos_hash_pair.second))
@@ -509,30 +506,30 @@ namespace __gnu_pbds
          PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
        else
          PB_DS_CHECK_KEY_EXISTS(r_key)
-#endif 
+#endif
        return &p_e->m_value;
       }
 
       inline bool
-      erase_in_pos_imp(const_key_reference, size_type);
+      erase_in_pos_imp(key_const_reference, size_type);
 
       inline bool
-      erase_in_pos_imp(const_key_reference, const comp_hash&);
+      erase_in_pos_imp(key_const_reference, const comp_hash&);
 
       inline void
       erase_entry_pointer(entry_pointer&);
 
 #ifdef PB_DS_DATA_TRUE_INDICATOR
       void
-      inc_it_state(pointer& r_p_value, 
+      inc_it_state(pointer& r_p_value,
                   std::pair<entry_pointer, size_type>& r_pos) const
       {
-       inc_it_state((const_mapped_pointer& )r_p_value, r_pos);
+       inc_it_state((mapped_const_pointer& )r_p_value, r_pos);
       }
-#endif 
+#endif
 
       void
-      inc_it_state(const_pointer& r_p_value, 
+      inc_it_state(const_pointer& r_p_value,
                   std::pair<entry_pointer, size_type>& r_pos) const
       {
        _GLIBCXX_DEBUG_ASSERT(r_p_value != 0);
@@ -554,7 +551,7 @@ namespace __gnu_pbds
       }
 
       void
-      get_start_it_state(pointer& r_p_value, 
+      get_start_it_state(pointer& r_p_value,
                         std::pair<entry_pointer, size_type>& r_pos) const
       {
        for (r_pos.second = 0; r_pos.second < m_num_e; ++r_pos.second)
@@ -570,26 +567,26 @@ namespace __gnu_pbds
 #ifdef _GLIBCXX_DEBUG
       void
       assert_entry_pointer_array_valid(const entry_pointer_array,
-                                      const char* file, int line) const;
+                                      const char*, int) const;
 
       void
       assert_entry_pointer_valid(const entry_pointer, true_type,
-                                const char* file, int line) const;
+                                const char*, int) const;
 
       void
       assert_entry_pointer_valid(const entry_pointer, false_type,
-                                const char* file, int line) const;
-#endif 
+                                const char*, int) const;
+#endif
 
 #ifdef PB_DS_HT_MAP_TRACE_
       void
       trace_list(const_entry_pointer) const;
-#endif 
+#endif
 
     private:
 #ifdef PB_DS_DATA_TRUE_INDICATOR
       friend class iterator_;
-#endif 
+#endif
 
       friend class const_iterator_;
 
@@ -598,7 +595,7 @@ namespace __gnu_pbds
       static iterator                  s_end_it;
       static const_iterator            s_const_end_it;
       static point_iterator            s_find_end_it;
-      static const_point_iterator      s_const_find_end_it;
+      static point_const_iterator      s_const_find_end_it;
 
       size_type                        m_num_e;
       size_type                        m_num_used_e;
@@ -606,8 +603,8 @@ namespace __gnu_pbds
 
       enum
        {
-         store_hash_ok = !Store_Hash 
-                         || !is_same<Hash_Fn, __gnu_pbds::null_hash_fn>::value
+         store_hash_ok = !Store_Hash
+                         || !is_same<Hash_Fn, __gnu_pbds::null_type>::value
        };
 
       PB_DS_STATIC_ASSERT(sth, store_hash_ok);
@@ -629,12 +626,8 @@ namespace __gnu_pbds
 #undef PB_DS_CLASS_C_DEC
 #undef PB_DS_HASH_EQ_FN_C_DEC
 #undef PB_DS_RANGED_HASH_FN_C_DEC
-#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_CC_HASH_TRAITS_BASE
 #undef PB_DS_DEBUG_MAP_BASE_C_DEC
-#undef PB_DS_CLASS_NAME
-#undef PB_DS_V2F
-#undef PB_DS_V2S
-
+#undef PB_DS_CC_HASH_NAME
   } // namespace detail
 } // namespace __gnu_pbds
-
index c61eff99b90409e487141f1c3a34f7b9bc8695bc..4f7116f573f86772a7c7de131adc1b8743b19407 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file cmp_fn_imps.hpp
+ * @file cc_hash_table_map_/cmp_fn_imps.hpp
  * Contains implementations of cc_ht_map_'s entire container comparison related
  *    functions.
  */
@@ -58,9 +58,9 @@ cmp_with_other(const Other_Map_Type& other) const
   for (typename Other_Map_Type::const_iterator it = other.begin();
        it != other.end(); ++it)
     {
-      const_key_reference r_key = const_key_reference(PB_DS_V2F(*it));
+      key_const_reference r_key = key_const_reference(PB_DS_V2F(*it));
 
-      const_mapped_pointer p_mapped_value =
+      mapped_const_pointer p_mapped_value =
        const_cast<PB_DS_CLASS_C_DEC& >(*this).
        find_key_pointer(r_key, traits_base::m_store_extra_indicator);
 
index fa3f31df003a69869286b2313e6b7b2fc5d7a5fc..5b2db9b0f642f635c9115e929a3284991d8cbe35 100644 (file)
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the terms
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file cond_key_dtor_entry_dealtor.hpp
+ * @file cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
  * Contains a conditional key destructor, used for exception handling.
  */
 
@@ -42,65 +42,43 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-
-#define PB_DS_CLASS_T_DEC template<typename HT_Map>
-#define PB_DS_CLASS_C_DEC PB_DS_CKDED_CLASS_NAME<HT_Map>
-
-    /**
-     * A conditional key destructor, used for exception handling.
-     **/
+    /// Conditional dey destructor, cc_hash.
     template<typename HT_Map>
-    class PB_DS_CKDED_CLASS_NAME
+    class cond_dealtor
     {
     public:
-      typedef typename HT_Map::entry entry;
-      typedef typename HT_Map::entry_allocator entry_allocator;
-      typedef typename HT_Map::key_type key_type;
+      typedef typename HT_Map::entry           entry;
+      typedef typename HT_Map::entry_allocator         entry_allocator;
+      typedef typename HT_Map::key_type        key_type;
 
-      inline
-      PB_DS_CKDED_CLASS_NAME(entry_allocator* p_a, entry* p_e);
+      cond_dealtor(entry_allocator* p_a, entry* p_e)
+      : m_p_a(p_a), m_p_e(p_e), m_key_destruct(false),
+       m_no_action_destructor(false)
+      { }
 
       inline
-      ~PB_DS_CKDED_CLASS_NAME();
+      ~cond_dealtor();
 
-      inline void
-      set_key_destruct();
+      void
+      set_key_destruct()
+      { m_key_destruct = true; }
 
-      inline void
-      set_no_action_destructor();
+      void
+      set_no_action_destructor()
+      { m_no_action_destructor = true; }
 
     protected:
-      entry_allocator* const m_p_a;
-      entry* const m_p_e;
+      entry_allocator* const                   m_p_a;
+      entry* const                             m_p_e;
 
-      bool m_key_destruct;
-      bool m_no_action_destructor;
+      bool                                     m_key_destruct;
+      bool                                     m_no_action_destructor;
     };
 
-    PB_DS_CLASS_T_DEC
-    inline
-    PB_DS_CLASS_C_DEC::
-    PB_DS_CKDED_CLASS_NAME(entry_allocator* p_a, entry* p_e) 
-    : m_p_a(p_a), m_p_e(p_e), m_key_destruct(false), 
-      m_no_action_destructor(false)
-    { }
-
-    PB_DS_CLASS_T_DEC
-    inline void
-    PB_DS_CLASS_C_DEC::
-    set_key_destruct()
-    { m_key_destruct = true; }
-
-    PB_DS_CLASS_T_DEC
-    inline void
-    PB_DS_CLASS_C_DEC::
-    set_no_action_destructor()
-    { m_no_action_destructor = true; }
-
-    PB_DS_CLASS_T_DEC
+    template<typename HT_Map>
     inline
-    PB_DS_CLASS_C_DEC::
-    ~PB_DS_CKDED_CLASS_NAME()
+    cond_dealtor<HT_Map>::
+    ~cond_dealtor()
     {
       if (m_no_action_destructor)
        return;
@@ -108,10 +86,5 @@ namespace __gnu_pbds
        m_p_e->m_value.first.~key_type();
       m_p_a->deallocate(m_p_e, 1);
     }
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
   } // namespace detail
 } // namespace __gnu_pbds
-
index 8278fd7e662bf738de55a89e476b0dca4cc2284f..9d37d9f86c3227a2eea9a3e6732e2be13addacbe 100644 (file)
@@ -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
index 4f1cce64806ea4cf4c782ff313e7176fa31cd08f..1f68349d929388d283445395491d764f1b8ca61e 100644 (file)
@@ -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.
index a2b6fa11149534cdea0360fe25583517ccf9cab2..f6a73af6d65de6a9118171630c50dcd138bf88eb 100644 (file)
@@ -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);)
index d10ff7862ccaabbac723f145378babe6c8c5f9e2..c5af1d3ea4aa9034fe258b7a38c2c8dd96bba5df 100644 (file)
@@ -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.
  */
 
index 4a02bbfcc5df6bd4cfe09122b12baf7c5669840d..1c19cac95901b57f52e9e6a5aa510d37f0e41dea 100644 (file)
@@ -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
index 07f2998bceca5d8bbcec0ad1a8576a1c4c1411ab..76ad8c6bff5cc24537bcd45633aa32eb09c76f60 100644 (file)
@@ -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.
  */
 
index 079991193355941e7083596842dcbf7ab48cd5e7..74404035f997f03178e16462b18ef6469ab25424 100644 (file)
@@ -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.
  */
 
index c6febe421a1e16095efde0a86a09ac23dc168b80..c9c4b1c745d6907f59c3e5c76f3877e3210aad24 100644 (file)
@@ -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.
  */
 
index ffe32103cbea7d236e18d7a934dee7b3eb1e1e0b..1e2661efa55a434f8ff67691e3b3135a973043b3 100644 (file)
@@ -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;
     }
 }
-
index 09d34f2c0b1ac4d86f913979fefe76c3c6c66a8f..a4cddeafb67619050d6fc6794b5046bec518390c 100644 (file)
@@ -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;
     }
 }
-
index 32ca47d6e3f7a59f5a321b7949020f4e09a0e9e2..e3f363f41ed39cc9922d2ceac5538de859aad3ba 100644 (file)
 // warranty.
 
 /**
- * @file find_fn_imps.hpp
+ * @file cc_hash_table_map_/find_fn_imps.hpp
  * Contains implementations of cc_ht_map_'s find related functions.
  */
 
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::point_iterator
 PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key)
+find(key_const_reference r_key)
 {
   PB_DS_ASSERT_VALID((*this))
   return find_key_pointer(r_key, traits_base::m_store_extra_indicator);
 }
 
 PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
 PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key) const
+find(key_const_reference r_key) const
 {
   PB_DS_ASSERT_VALID((*this))
   return const_cast<PB_DS_CLASS_C_DEC& >(*this).find_key_pointer(r_key, 
@@ -64,7 +64,7 @@ find_end()
 { return 0; }
 
 PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
 PB_DS_CLASS_C_DEC::
 find_end() const
 { return 0; }
index 1db51c990a63453b3d414f3ba83416209a27a51a..d532c4f45bec9b5b969be03a10eccb0ceeb8f5ef 100644 (file)
@@ -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.
  */
index 2b429960c00837f306b153395ba789aeb67dec76..99eea41c598165969bced1c588b7ffa06136b19d 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file info_fn_imps.hpp
+ * @file cc_hash_table_map_/info_fn_imps.hpp
  * Contains implementations of cc_ht_map_'s entire container info related
  * functions.
  */
@@ -76,8 +76,8 @@ cmp_with_other(const Other_Map_Type& other) const
   for (typename Other_Map_Type::const_iterator it = other.begin();
        it != other.end(); ++it)
     {
-      const_key_reference r_key =(const_key_reference)PB_DS_V2F(*it);
-      const_mapped_pointer p_mapped_value =
+      key_const_reference r_key =(key_const_reference)PB_DS_V2F(*it);
+      mapped_const_pointer p_mapped_value =
        const_cast<PB_DS_CLASS_C_DEC& >(*this).
        find_key_pointer(r_key, traits_base::m_store_extra_indicator);
 
index 0679dbe6e74c73e6fb89f8cd96cfcb1b82515f56..dc7d44cc504c1a527a5af632d9d0cc2622b9009a 100644 (file)
@@ -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.
  */
 
index acbd8a78d0789ea6690c997f8258ba707991591c..ba898739589b2b1551a8da6c54ba17b2df0bbfde 100644 (file)
@@ -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();
index 1224880ecc9408a3338f99ffbb007cd8eb2da815..f4553976cfb4d6aa506f56417b14e16cea5c915a 100644 (file)
@@ -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();
index a7592b7f1f708d81a8f5268d7699f0ea22b01af6..5be4a9caab0fe9a3e14746c7a2dcfa0284470211 100644 (file)
@@ -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().
  */
index 9a661b3619724ade82c83e8f8e3d5178fdf38af6..5bf12c8f166b04396ef11d42b537fcc1882e2cf8 100644 (file)
@@ -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.
  */
index 4e3f48dd12d99fc5eb68dd20666cd23c94dbb17b..66145b81da10ca48ab5bfd11b5a158ff6f2c379f 100644 (file)
@@ -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.
  */
 
index 6577630f0f031ca338b36a708c85f435122e1b63..f43850818b6d9d3a3a8f7c8be7f1db9648d31e63 100644 (file)
@@ -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
index c1adb61b190b9670e2e21d40d8671aef96cbce98..1901b803938f215fd9687a8fb037401eac1527c9 100644 (file)
@@ -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
index 0d5ec85f2e5009a27b5ad3bea3c82e9c787f2229..ff11890e6936bf3281ac64edaa65d6516b163177 100644 (file)
@@ -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
index b9c1ee20e5eb1b423e7ed1036972ddc886e44e36..3c07f95a496d5ea31a685066fdec45cd99324269 100644 (file)
@@ -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.
  */
 
index 497977d97ccb88ef2bbc5bffda856ac701ac6464..ede1d6a8fc98c54a451fe7061301b66e9a6d29a9 100644 (file)
@@ -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.
  */
 
index 1ee48a2ac666d7c0bbab7109641a6b7426cb4c14..eb87bea9e24810341968d941fd966229b3cf14de 100644 (file)
@@ -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.
  */
 
 
 namespace __gnu_pbds
 {
-
   namespace detail
   {
-
-#define PB_DS_COND_DEALTOR_CLASS_T_DEC         \
-    template<typename Entry, class Allocator>
-
-#define PB_DS_COND_DEALTOR_CLASS_C_DEC                         \
-    cond_dealtor<                                              \
-                                               Entry,          \
-                                               Allocator>
-
-    template<typename Entry, class Allocator>
-    class cond_dealtor
-    {
-    public:
-      typedef
-      typename Allocator::template rebind<Entry>::other
-      entry_allocator;
-
-      typedef typename entry_allocator::pointer entry_pointer;
-
-    public:
-      inline
-      cond_dealtor(entry_pointer p_e);
-
-      inline
-      ~cond_dealtor();
-
-      inline void
-      set_no_action();
-
-    private:
-      entry_pointer m_p_e;
-
-      bool m_no_action_destructor;
-
-      static entry_allocator s_alloc;
-    };
-
-    PB_DS_COND_DEALTOR_CLASS_T_DEC
-    typename PB_DS_COND_DEALTOR_CLASS_C_DEC::entry_allocator
-    PB_DS_COND_DEALTOR_CLASS_C_DEC::s_alloc;
-
-    PB_DS_COND_DEALTOR_CLASS_T_DEC
-    inline
-    PB_DS_COND_DEALTOR_CLASS_C_DEC::
-    cond_dealtor(entry_pointer p_e) :
-      m_p_e(p_e),
-      m_no_action_destructor(false)
-    { }
-
-    PB_DS_COND_DEALTOR_CLASS_T_DEC
-    inline void
-    PB_DS_COND_DEALTOR_CLASS_C_DEC::
-    set_no_action()
-    {
-      m_no_action_destructor = true;
-    }
-
-    PB_DS_COND_DEALTOR_CLASS_T_DEC
-    inline
-    PB_DS_COND_DEALTOR_CLASS_C_DEC::
-    ~cond_dealtor()
-    {
-      if (m_no_action_destructor)
-        return;
-
-      s_alloc.deallocate(m_p_e, 1);
-    }
-
-#undef PB_DS_COND_DEALTOR_CLASS_T_DEC
-#undef PB_DS_COND_DEALTOR_CLASS_C_DEC
-
+    /// Conditional deallocate constructor argument.
+    template<typename Entry, typename _Alloc>
+      class cond_dealtor
+      {
+       typedef typename _Alloc::template rebind<Entry> __rebind_e;
+
+      public:
+       typedef typename __rebind_e::other              entry_allocator;
+       typedef typename entry_allocator::pointer       entry_pointer;
+
+       cond_dealtor(entry_pointer p_e)
+       : m_p_e(p_e), m_no_action_destructor(false) { }
+
+       ~cond_dealtor()
+       {
+         if (m_no_action_destructor)
+           return;
+         s_alloc.deallocate(m_p_e, 1);
+       }
+
+       void
+       set_no_action()
+       { m_no_action_destructor = true; }
+
+      private:
+       entry_pointer           m_p_e;
+       bool                    m_no_action_destructor;
+       static entry_allocator  s_alloc;
+      };
+
+    template<typename Entry, class _Alloc>
+      typename cond_dealtor<Entry, _Alloc>::entry_allocator
+      cond_dealtor<Entry, _Alloc>::s_alloc;
   } // namespace detail
-
 } // namespace __gnu_pbds
 
 #endif // #ifndef PB_DS_COND_DEALTOR_HPP
-
index 20c99886879623ac6c6683b1e64e4a062f1d7b4a..a960b7d2317049454a0a3c55057b649fee0b80ea 100644 (file)
@@ -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.
  */
 
index 2964b2d30c6dd03509963df1859c3b4601ff1fe0..37217d950b710b4d94ac36a106c6500620847917 100644 (file)
@@ -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
                                                           __FILE__, __LINE__);)
 
 #define PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_V2F(X) (X).first
+#define PB_DS_V2S(X) (X).second
+#define PB_DS_EP2VP(X)& ((X)->m_value)
 #include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
-#undef PB_DS_DATA_TRUE_INDICATOR
-
-#define PB_DS_DATA_FALSE_INDICATOR
-#include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
-#undef PB_DS_DATA_FALSE_INDICATOR
-
-#define PB_DS_DATA_TRUE_INDICATOR
+#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
 #include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
-#undef PB_DS_DATA_TRUE_INDICATOR
-
-#define PB_DS_DATA_FALSE_INDICATOR
-#include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
-#undef PB_DS_DATA_FALSE_INDICATOR
-
-#define PB_DS_DATA_TRUE_INDICATOR
-#include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
-#undef PB_DS_DATA_TRUE_INDICATOR
-
-#define PB_DS_DATA_FALSE_INDICATOR
 #include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
-#undef PB_DS_DATA_FALSE_INDICATOR
-
-#define PB_DS_DATA_TRUE_INDICATOR
-#include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
-#undef PB_DS_DATA_TRUE_INDICATOR
-
-#define PB_DS_DATA_FALSE_INDICATOR
 #include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
-#undef PB_DS_DATA_FALSE_INDICATOR
-
-#define PB_DS_DATA_TRUE_INDICATOR
-#include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
-#undef PB_DS_DATA_TRUE_INDICATOR
-
-#define PB_DS_DATA_FALSE_INDICATOR
 #include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
-#undef PB_DS_DATA_FALSE_INDICATOR
-
-#define PB_DS_DATA_TRUE_INDICATOR
-#include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
-#undef PB_DS_DATA_TRUE_INDICATOR
-
-#define PB_DS_DATA_FALSE_INDICATOR
 #include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
-#undef PB_DS_DATA_FALSE_INDICATOR
-
-#define PB_DS_DATA_TRUE_INDICATOR
 #include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>
 #undef PB_DS_DATA_TRUE_INDICATOR
+#undef PB_DS_V2F
+#undef PB_DS_V2S
+#undef PB_DS_EP2VP
 
 #define PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_V2F(X) (X)
+#define PB_DS_V2S(X) Mapped_Data()
+#define PB_DS_EP2VP(X)& ((X)->m_value.first)
+#include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
+#include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
+#include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
+#include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
+#include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
 #include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>
 #undef PB_DS_DATA_FALSE_INDICATOR
+#undef PB_DS_V2F
+#undef PB_DS_V2S
+#undef PB_DS_EP2VP
 
 #undef PB_DS_CHECK_KEY_DOES_NOT_EXIST
 #undef PB_DS_CHECK_KEY_EXISTS
@@ -124,28 +102,26 @@ namespace __gnu_pbds
 {
 namespace detail
 {
-  // Primary template.
-  template<typename Key, typename Mapped, typename Data_Structure_Taq,
-          typename Policy_Tl, typename Alloc>
-    struct container_base_dispatch;
-
-  template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
-    struct container_base_dispatch<Key, Mapped, list_update_tag, 
-                                  Policy_Tl, Alloc>
+  /// Specialization for list-update map.
+  template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
+    struct container_base_dispatch<Key, Mapped, _Alloc, list_update_tag,
+                                  Policy_Tl>
     {
     private:
       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>      at0;
       typedef typename at0::type                               at0t;
       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>      at1;
       typedef typename at1::type                               at1t;
-      
+
     public:
-      typedef lu_map_data_<Key, Mapped, at0t, Alloc, at1t>     type;
+      /// Dispatched type.
+      typedef lu_map<Key, Mapped, at0t, _Alloc, at1t>  type;
     };
 
-  template<typename Key, typename Policy_Tl, typename Alloc>
-    struct container_base_dispatch<Key, null_mapped_type, list_update_tag,
-                                  Policy_Tl, Alloc>
+  /// Specialization for list-update set.
+  template<typename Key, typename _Alloc, typename Policy_Tl>
+    struct container_base_dispatch<Key, null_type, _Alloc, list_update_tag,
+                                  Policy_Tl>
     {
     private:
       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>      at0;
@@ -154,34 +130,39 @@ namespace detail
       typedef typename at1::type                               at1t;
 
     public:
-      typedef lu_map_no_data_<Key, null_mapped_type, at0t, Alloc, at1t> type;
+      /// Dispatched type.
+      typedef lu_set<Key, null_type, at0t, _Alloc, at1t> type;
     };
 
-  template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
-    struct container_base_dispatch<Key, Mapped, pat_trie_tag, Policy_Tl, Alloc>
+  /// Specialization for PATRICIA trie map.
+  template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
+  struct container_base_dispatch<Key, Mapped, _Alloc, pat_trie_tag, Policy_Tl>
     {
     private:
       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>      at1;
       typedef typename at1::type                               at1t;
 
     public:
-      typedef pat_trie_data_<Key, Mapped, at1t, Alloc>                 type;
+      typedef pat_trie_map<Key, Mapped, at1t, _Alloc>          type;
     };
 
-  template<typename Key, typename Policy_Tl, typename Alloc>
-    struct container_base_dispatch<Key, null_mapped_type, pat_trie_tag,
-                                  Policy_Tl, Alloc>
+  /// Specialization for PATRICIA trie set.
+  template<typename Key, typename _Alloc, typename Policy_Tl>
+    struct container_base_dispatch<Key, null_type, _Alloc, pat_trie_tag,
+                                  Policy_Tl>
     {
     private:
       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1>      at1;
       typedef typename at1::type                               at1t;
 
     public:
-      typedef pat_trie_no_data_<Key, null_mapped_type, at1t, Alloc> type;
+      /// Dispatched type.
+      typedef pat_trie_set<Key, null_type, at1t, _Alloc> type;
     };
 
-  template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
-    struct container_base_dispatch<Key, Mapped, rb_tree_tag, Policy_Tl, Alloc>
+  /// Specialization for R-B tree map.
+  template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
+    struct container_base_dispatch<Key, Mapped, _Alloc, rb_tree_tag, Policy_Tl>
     {
     private:
       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>      at0;
@@ -190,12 +171,14 @@ namespace detail
       typedef typename at1::type                               at1t;
 
     public:
-      typedef rb_tree_data_<Key, Mapped, at0t, at1t, Alloc>    type;
+      /// Dispatched type.
+      typedef rb_tree_map<Key, Mapped, at0t, at1t, _Alloc>     type;
     };
 
-  template<typename Key, typename Policy_Tl, typename Alloc>
-    struct container_base_dispatch<Key, null_mapped_type, rb_tree_tag,
-                                  Policy_Tl, Alloc>
+  /// Specialization for R-B tree set.
+  template<typename Key, typename _Alloc, typename Policy_Tl>
+    struct container_base_dispatch<Key, null_type, _Alloc, rb_tree_tag,
+                                  Policy_Tl>
     {
     private:
       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>      at0;
@@ -204,12 +187,13 @@ namespace detail
       typedef typename at1::type                               at1t;
 
     public:
-      typedef rb_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;
+      typedef rb_tree_set<Key, null_type, at0t, at1t, _Alloc> type;
     };
 
-  template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
-    struct container_base_dispatch<Key, Mapped, splay_tree_tag, 
-                                  Policy_Tl, Alloc>
+  /// Specialization splay tree map.
+  template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
+  struct container_base_dispatch<Key, Mapped, _Alloc, splay_tree_tag,
+                                  Policy_Tl>
     {
     private:
       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>      at0;
@@ -218,12 +202,14 @@ namespace detail
       typedef typename at1::type                               at1t;
 
     public:
-      typedef splay_tree_data_<Key, Mapped, at0t, at1t, Alloc>         type;
+      /// Dispatched type.
+      typedef splay_tree_map<Key, Mapped, at0t, at1t, _Alloc>  type;
     };
 
-  template<typename Key, typename Policy_Tl, typename Alloc>
-    struct container_base_dispatch<Key, null_mapped_type, splay_tree_tag,
-                                  Policy_Tl, Alloc>
+  /// Specialization splay tree set.
+  template<typename Key, typename _Alloc, typename Policy_Tl>
+    struct container_base_dispatch<Key, null_type, _Alloc, splay_tree_tag,
+                                  Policy_Tl>
     {
     private:
       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>      at0;
@@ -232,11 +218,13 @@ namespace detail
       typedef typename at1::type                               at1t;
 
     public:
-      typedef splay_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;
+      /// Dispatched type.
+      typedef splay_tree_set<Key, null_type, at0t, at1t, _Alloc> type;
   };
 
-  template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
-    struct container_base_dispatch<Key, Mapped, ov_tree_tag, Policy_Tl, Alloc>
+    /// Specialization ordered-vector tree map.
+  template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
+    struct container_base_dispatch<Key, Mapped, _Alloc, ov_tree_tag, Policy_Tl>
     {
     private:
       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>      at0;
@@ -245,12 +233,14 @@ namespace detail
       typedef typename at1::type                               at1t;
 
     public:
-      typedef ov_tree_data_<Key, Mapped, at0t, at1t, Alloc>    type;
+      /// Dispatched type.
+      typedef ov_tree_map<Key, Mapped, at0t, at1t, _Alloc>     type;
   };
 
-  template<typename Key, typename Policy_Tl, typename Alloc>
-    struct container_base_dispatch<Key, null_mapped_type, ov_tree_tag,
-                                  Policy_Tl, Alloc>
+    /// Specialization ordered-vector tree set.
+  template<typename Key, typename _Alloc, typename Policy_Tl>
+    struct container_base_dispatch<Key, null_type, _Alloc, ov_tree_tag,
+                                  Policy_Tl>
     {
     private:
       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>      at0;
@@ -259,11 +249,13 @@ namespace detail
       typedef typename at1::type                               at1t;
 
     public:
-      typedef ov_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;
+      /// Dispatched type.
+      typedef ov_tree_set<Key, null_type, at0t, at1t, _Alloc> type;
   };
 
-  template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
-    struct container_base_dispatch<Key, Mapped, cc_hash_tag, Policy_Tl, Alloc>
+    /// Specialization colision-chaining hash map.
+  template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
+    struct container_base_dispatch<Key, Mapped, _Alloc, cc_hash_tag, Policy_Tl>
     {
     private:
       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>      at0;
@@ -278,13 +270,15 @@ namespace detail
       typedef typename at4::type                               at4t;
 
     public:
-      typedef cc_ht_map_data_<Key, Mapped, at0t, at1t, Alloc, at3t::value, 
-                             at4t, at2t>                       type;
+      /// Dispatched type.
+      typedef cc_ht_map<Key, Mapped, at0t, at1t, _Alloc, 
+                       at3t::value, at4t, at2t>                type;
   };
 
-  template<typename Key, typename Policy_Tl, typename Alloc>
-    struct container_base_dispatch<Key, null_mapped_type, cc_hash_tag, 
-                                  Policy_Tl, Alloc>
+    /// Specialization colision-chaining hash set.
+  template<typename Key, typename _Alloc, typename Policy_Tl>
+    struct container_base_dispatch<Key, null_type, _Alloc, cc_hash_tag,
+                                  Policy_Tl>
     {
     private:
       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>      at0;
@@ -299,12 +293,14 @@ namespace detail
       typedef typename at4::type                               at4t;
 
     public:
-      typedef cc_ht_map_no_data_<Key, null_mapped_type, at0t, at1t, Alloc, 
+      /// Dispatched type.
+      typedef cc_ht_set<Key, null_type, at0t, at1t, _Alloc,
                                 at3t::value, at4t, at2t>       type;
   };
 
-  template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
-    struct container_base_dispatch<Key, Mapped, gp_hash_tag, Policy_Tl, Alloc>
+    /// Specialization general-probe hash map.
+  template<typename Key, typename Mapped, typename _Alloc, typename Policy_Tl>
+    struct container_base_dispatch<Key, Mapped, _Alloc, gp_hash_tag, Policy_Tl>
     {
     private:
       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>      at0;
@@ -321,13 +317,15 @@ namespace detail
       typedef typename at5::type                               at5t;
 
     public:
-      typedef gp_ht_map_data_<Key, Mapped, at0t, at1t, Alloc, at3t::value, 
-                             at4t, at5t, at2t>                 type;
+      /// Dispatched type.
+      typedef gp_ht_map<Key, Mapped, at0t, at1t, _Alloc, 
+                       at3t::value, at4t, at5t, at2t>          type;
   };
 
-  template<typename Key, typename Policy_Tl, typename Alloc>
-    struct container_base_dispatch<Key, null_mapped_type, gp_hash_tag,
-                                  Policy_Tl, Alloc>
+    /// Specialization general-probe hash set.
+  template<typename Key, typename _Alloc, typename Policy_Tl>
+    struct container_base_dispatch<Key, null_type, _Alloc, gp_hash_tag,
+                                  Policy_Tl>
     {
     private:
       typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>      at0;
@@ -344,10 +342,11 @@ namespace detail
       typedef typename at5::type                               at5t;
 
     public:
-      typedef gp_ht_map_no_data_<Key, null_mapped_type, at0t, at1t, Alloc,
-                                at3t::value, at4t, at5t, at2t> type;
+      /// Dispatched type.
+      typedef gp_ht_set<Key, null_type, at0t, at1t, _Alloc,
+                       at3t::value, at4t, at5t, at2t>          type;
   };
 } // namespace detail
 } // namespace __gnu_pbds
 
-#endif 
+#endif
index a9a0b42d263d61f1756ec4217f2039ec8da8acda..c1709ba452d4a64c1cba7ca9072a150cba0a193f 100644 (file)
@@ -35,7 +35,7 @@
 // warranty.
 
 /**
- * @file debug_map_base.hpp
+ * @file detail/debug_map_base.hpp
  * Contains a debug-mode base for all maps.
  */
 
@@ -63,73 +63,69 @@ namespace __gnu_pbds
     { return (__out << '(' << p.first << ',' << p.second << ')'); }
 
 #define PB_DS_CLASS_T_DEC \
-    template<typename Key, class Eq_Fn, typename Const_Key_Reference>
+    template<typename Key, typename Eq_Fn, typename Const_Key_Reference>
 
 #define PB_DS_CLASS_C_DEC \
     debug_map_base<Key, Eq_Fn, Const_Key_Reference>
 
-    template<typename Key, class Eq_Fn, typename Const_Key_Reference>
+    /// Debug base class.
+    template<typename Key, typename Eq_Fn, typename Const_Key_Reference>
     class debug_map_base
     {
     private:
-      typedef typename std::allocator<Key>             key_allocator;
-      typedef typename key_allocator::size_type        size_type;
-      typedef Const_Key_Reference                      const_key_reference;
-      typedef std::_GLIBCXX_STD_C::list<Key>           key_set;
-      typedef typename key_set::iterator               key_set_iterator;
-      typedef typename key_set::const_iterator                 const_key_set_iterator;
-      typedef __gnu_cxx::throw_allocator_random<Key>   key_db_allocator;
-      typedef typename key_db_allocator::never_adjustor        never_adjustor;
+      typedef Const_Key_Reference                      key_const_reference;
+      typedef std::_GLIBCXX_STD_C::list<Key>           key_repository;
+      typedef typename key_repository::size_type               size_type;
+      typedef typename key_repository::iterator                iterator;
+      typedef typename key_repository::const_iterator          const_iterator;
 
     protected:
       debug_map_base();
 
-      debug_map_base(const PB_DS_CLASS_C_DEC& other);
+      debug_map_base(const PB_DS_CLASS_C_DEC&);
 
       ~debug_map_base();
 
       inline void
-      insert_new(const_key_reference r_key);
+      insert_new(key_const_reference);
 
       inline void
-      erase_existing(const_key_reference r_key);
+      erase_existing(key_const_reference);
 
       void
       clear();
 
       inline void
-      check_key_exists(const_key_reference r_key,
-                      const char* file, int line) const;
+      check_key_exists(key_const_reference, const char*, int) const;
 
       inline void
-      check_key_does_not_exist(const_key_reference r_key,
-                              const char* file, int line) const;
+      check_key_does_not_exist(key_const_reference, const char*, int) const;
 
       inline void
-      check_size(size_type size, const char* file, int line) const;
+      check_size(size_type, const char*, int) const;
 
       void
-      swap(PB_DS_CLASS_C_DEC& other);
+      swap(PB_DS_CLASS_C_DEC&);
 
       template<typename Cmp_Fn>
       void
-      split(const_key_reference, Cmp_Fn, PB_DS_CLASS_C_DEC&);
+      split(key_const_reference, Cmp_Fn, PB_DS_CLASS_C_DEC&);
 
       void
-      join(PB_DS_CLASS_C_DEC& other, bool with_cleanup = true);
+      join(PB_DS_CLASS_C_DEC&, bool with_cleanup = true);
 
     private:
       void
-      assert_valid(const char* file, int line) const;
+      assert_valid(const char*, int) const;
 
-      const_key_set_iterator
-      find(const_key_reference r_key) const;
+      const_iterator
+      find(key_const_reference) const;
 
-      key_set_iterator
-      find(const_key_reference r_key);
+      iterator
+      find(key_const_reference);
 
-      key_set  m_key_set;
-      Eq_Fn    m_eq;
+      key_repository   m_keys;
+      Eq_Fn            m_eq;
     };
 
     PB_DS_CLASS_T_DEC
@@ -139,7 +135,8 @@ namespace __gnu_pbds
 
     PB_DS_CLASS_T_DEC
     PB_DS_CLASS_C_DEC::
-    debug_map_base(const PB_DS_CLASS_C_DEC& other) : m_key_set(other.m_key_set)
+    debug_map_base(const PB_DS_CLASS_C_DEC& other)
+    : m_keys(other.m_keys), m_eq(other.m_eq)
     { PB_DS_ASSERT_VALID((*this)) }
 
     PB_DS_CLASS_T_DEC
@@ -150,20 +147,19 @@ namespace __gnu_pbds
     PB_DS_CLASS_T_DEC
     inline void
     PB_DS_CLASS_C_DEC::
-    insert_new(const_key_reference r_key)
+    insert_new(key_const_reference r_key)
     {
       PB_DS_ASSERT_VALID((*this))
 
-      if (find(r_key) != m_key_set.end())
+      if (find(r_key) != m_keys.end())
        {
          std::cerr << "insert_new key already present " << r_key << std::endl;
-         std::abort;
+         std::abort();
        }
 
-      never_adjustor never;
       __try
        {
-         m_key_set.push_back(r_key);
+         m_keys.push_back(r_key);
        }
       __catch(...)
        {
@@ -177,16 +173,16 @@ namespace __gnu_pbds
     PB_DS_CLASS_T_DEC
     inline void
     PB_DS_CLASS_C_DEC::
-    erase_existing(const_key_reference r_key)
+    erase_existing(key_const_reference r_key)
     {
       PB_DS_ASSERT_VALID((*this))
-      key_set_iterator it = find(r_key);
-      if (it == m_key_set.end())
+      iterator it = find(r_key);
+      if (it == m_keys.end())
        {
          std::cerr << "erase_existing" << r_key << std::endl;
          std::abort();
        }
-      m_key_set.erase(it);
+      m_keys.erase(it);
       PB_DS_ASSERT_VALID((*this))
     }
 
@@ -196,18 +192,18 @@ namespace __gnu_pbds
     clear()
     {
       PB_DS_ASSERT_VALID((*this))
-      m_key_set.clear();
+      m_keys.clear();
       PB_DS_ASSERT_VALID((*this))
     }
 
     PB_DS_CLASS_T_DEC
     inline void
     PB_DS_CLASS_C_DEC::
-    check_key_exists(const_key_reference r_key,
+    check_key_exists(key_const_reference r_key,
                     const char* __file, int __line) const
     {
       assert_valid(__file, __line);
-      if (find(r_key) == m_key_set.end())
+      if (find(r_key) == m_keys.end())
        {
          std::cerr << __file << ':' << __line << ": check_key_exists "
                    << r_key << std::endl;
@@ -218,11 +214,11 @@ namespace __gnu_pbds
     PB_DS_CLASS_T_DEC
     inline void
     PB_DS_CLASS_C_DEC::
-    check_key_does_not_exist(const_key_reference r_key,
+    check_key_does_not_exist(key_const_reference r_key,
                             const char* __file, int __line) const
     {
       assert_valid(__file, __line);
-      if (find(r_key) != m_key_set.end())
+      if (find(r_key) != m_keys.end())
        {
          using std::cerr;
          using std::endl;
@@ -238,11 +234,11 @@ namespace __gnu_pbds
     check_size(size_type size, const char* __file, int __line) const
     {
       assert_valid(__file, __line);
-      const size_type key_set_size = m_key_set.size();
-      if (size != key_set_size)
+      const size_type keys_size = m_keys.size();
+      if (size != keys_size)
        {
-         std::cerr << __file << ':' << __line << ": check_size " << size
-                   << " != " << key_set_size << std::endl;
+         std::cerr << __file << ':' << __line << ": check_size "
+                   << size << " != " << keys_size << std::endl;
          std::abort();
        }
      }
@@ -253,31 +249,32 @@ namespace __gnu_pbds
     swap(PB_DS_CLASS_C_DEC& other)
     {
       PB_DS_ASSERT_VALID((*this))
-      m_key_set.swap(other.m_key_set);
+      m_keys.swap(other.m_keys);
+      std::swap(m_eq, other.m_eq);
       PB_DS_ASSERT_VALID((*this))
     }
 
     PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::const_key_set_iterator
+    typename PB_DS_CLASS_C_DEC::const_iterator
     PB_DS_CLASS_C_DEC::
-    find(const_key_reference r_key) const
+    find(key_const_reference r_key) const
     {
       PB_DS_ASSERT_VALID((*this))
-      typedef const_key_set_iterator iterator_type;
-      for (iterator_type it = m_key_set.begin(); it != m_key_set.end(); ++it)
+      typedef const_iterator iterator_type;
+      for (iterator_type it = m_keys.begin(); it != m_keys.end(); ++it)
        if (m_eq(*it, r_key))
          return it;
-      return m_key_set.end();
+      return m_keys.end();
     }
 
     PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::key_set_iterator
+    typename PB_DS_CLASS_C_DEC::iterator
     PB_DS_CLASS_C_DEC::
-    find(const_key_reference r_key)
+    find(key_const_reference r_key)
     {
       PB_DS_ASSERT_VALID((*this))
-      key_set_iterator it = m_key_set.begin();
-      while (it != m_key_set.end())
+      iterator it = m_keys.begin();
+      while (it != m_keys.end())
        {
          if (m_eq(*it, r_key))
            return it;
@@ -291,12 +288,12 @@ namespace __gnu_pbds
     PB_DS_CLASS_C_DEC::
     assert_valid(const char* __file, int __line) const
     {
-      const_key_set_iterator prime_it = m_key_set.begin();
-      while (prime_it != m_key_set.end())
+      const_iterator prime_it = m_keys.begin();
+      while (prime_it != m_keys.end())
        {
-         const_key_set_iterator sec_it = prime_it;
+         const_iterator sec_it = prime_it;
          ++sec_it;
-         while (sec_it != m_key_set.end())
+         while (sec_it != m_keys.end())
            {
              PB_DS_DEBUG_VERIFY(!m_eq(*sec_it, *prime_it));
              PB_DS_DEBUG_VERIFY(!m_eq(*prime_it, *sec_it));
@@ -310,15 +307,15 @@ namespace __gnu_pbds
     template<typename Cmp_Fn>
     void
     PB_DS_CLASS_C_DEC::
-    split(const_key_reference r_key, Cmp_Fn cmp_fn, PB_DS_CLASS_C_DEC& other)
+    split(key_const_reference r_key, Cmp_Fn cmp_fn, PB_DS_CLASS_C_DEC& other)
     {
       other.clear();
-      key_set_iterator it = m_key_set.begin();
-      while (it != m_key_set.end())
-       if (cmp_fn(r_key, * it))
+      iterator it = m_keys.begin();
+      while (it != m_keys.end())
+       if (cmp_fn(r_key, *it))
          {
            other.insert_new(*it);
-           it = m_key_set.erase(it);
+           it = m_keys.erase(it);
          }
        else
          ++it;
@@ -329,16 +326,16 @@ namespace __gnu_pbds
     PB_DS_CLASS_C_DEC::
     join(PB_DS_CLASS_C_DEC& other, bool with_cleanup)
     {
-      key_set_iterator it = other.m_key_set.begin();
-      while (it != other.m_key_set.end())
+      iterator it = other.m_keys.begin();
+      while (it != other.m_keys.end())
        {
          insert_new(*it);
          if (with_cleanup)
-           it = other.m_key_set.erase(it);
+           it = other.m_keys.erase(it);
          else
            ++it;
        }
-      _GLIBCXX_DEBUG_ASSERT(!with_cleanup || other.m_key_set.empty());
+      _GLIBCXX_DEBUG_ASSERT(!with_cleanup || other.m_keys.empty());
     }
 
 #undef PB_DS_CLASS_T_DEC
index ec95bca640252f8bc8dd05c513c200b8abd9585b..389bdcdb637b24dc212c04c0c8bc12008e2592e6 100644 (file)
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the terms
@@ -51,6 +51,7 @@ namespace __gnu_pbds
 {
   namespace detail
   {
+    /// Equivalence function.
     template<typename Key, class Cmp_Fn>
     struct eq_by_less : private Cmp_Fn
     {
index b21c252e2c049213dc3873c860de068805fffcce..6255d55eb0e73460f3533eb0f14863cef849a716 100644 (file)
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the terms
@@ -36,7 +36,7 @@
 /**
  * @file hash_eq_fn.hpp
  * Contains 2 eqivalence functions, one employing a hash value,
- *    and one ignoring it.
+ * and one ignoring it.
  */
 
 #ifndef PB_DS_HASH_EQ_FN_HPP
@@ -49,130 +49,60 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-    template<typename Key, class Eq_Fn, class Allocator, bool Store_Hash>
-    struct hash_eq_fn;
+    template<typename Key, typename Eq_Fn, typename _Alloc, bool Store_Hash>
+      struct hash_eq_fn;
 
-#define PB_DS_CLASS_T_DEC \
-    template<typename Key, class Eq_Fn, class Allocator>
-
-#define PB_DS_CLASS_C_DEC \
-    hash_eq_fn<Key, Eq_Fn, Allocator, false>
-
-    /**
-     * Specialization 1- The client requests that hash values not be stored.
-     **/
-    template<typename Key, class Eq_Fn, class Allocator>
-    struct hash_eq_fn<Key, Eq_Fn, Allocator, false> : public Eq_Fn
+    /// Specialization 1 - The client requests that hash values not be stored.
+    template<typename Key, typename Eq_Fn, typename _Alloc>
+    struct hash_eq_fn<Key, Eq_Fn, _Alloc, false> : public Eq_Fn
     {
-      typedef Eq_Fn eq_fn_base;
-
-      typedef typename Allocator::template rebind<Key>::other key_allocator;
-
-      typedef typename key_allocator::const_reference const_key_reference;
+      typedef Eq_Fn                                       eq_fn_base;
+      typedef typename _Alloc::template rebind<Key>::other key_allocator;
+      typedef typename key_allocator::const_reference     key_const_reference;
 
-      hash_eq_fn();
+      hash_eq_fn() { }
 
-      hash_eq_fn(const Eq_Fn& r_eq_fn);
+      hash_eq_fn(const Eq_Fn& r_eq_fn) : Eq_Fn(r_eq_fn) { }
 
-      inline bool
-      operator()(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const;
+      bool
+      operator()(key_const_reference r_lhs_key, 
+                key_const_reference r_rhs_key) const
+      { return eq_fn_base::operator()(r_lhs_key, r_rhs_key); }
 
-      inline void
-      swap(const PB_DS_CLASS_C_DEC& other);
+      void
+      swap(const hash_eq_fn& other)
+      { std::swap((Eq_Fn&)(*this), (Eq_Fn&)other); }
     };
 
-    PB_DS_CLASS_T_DEC
-    PB_DS_CLASS_C_DEC::
-    hash_eq_fn()
-    { }
-
-    PB_DS_CLASS_T_DEC
-    inline void
-    PB_DS_CLASS_C_DEC::
-    swap(const PB_DS_CLASS_C_DEC& other)
-    { std::swap((Eq_Fn& )(*this), (Eq_Fn& )other); }
-
-    PB_DS_CLASS_T_DEC
-    PB_DS_CLASS_C_DEC::
-    hash_eq_fn(const Eq_Fn& r_eq_fn) :
-      Eq_Fn(r_eq_fn)
-    { }
-
-    PB_DS_CLASS_T_DEC
-    inline bool
-    PB_DS_CLASS_C_DEC::
-    operator()(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const
-    { return (eq_fn_base::operator()(r_lhs_key, r_rhs_key)); }
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
-#define PB_DS_CLASS_T_DEC \
-    template<typename Key, class Eq_Fn, class Allocator>
-
-#define PB_DS_CLASS_C_DEC \
-    hash_eq_fn<Key, Eq_Fn, Allocator, true>
-
-    /**
-     * Specialization 2- The client requests that hash values be stored.
-     **/
-    template<typename Key, class Eq_Fn, class Allocator>
-    struct hash_eq_fn<Key, Eq_Fn, Allocator, true> :
-      public Eq_Fn
-    {
-      typedef typename Allocator::size_type size_type;
-
-      typedef Eq_Fn eq_fn_base;
 
-      typedef typename Allocator::template rebind<Key>::other key_allocator;
+    /// Specialization 2 - The client requests that hash values be stored.
+    template<typename Key, class Eq_Fn, class _Alloc>
+    struct hash_eq_fn<Key, Eq_Fn, _Alloc, true> : public Eq_Fn
+    {
+      typedef typename _Alloc::size_type                  size_type;
+      typedef Eq_Fn                                       eq_fn_base;
+      typedef typename _Alloc::template rebind<Key>::other key_allocator;
+      typedef typename key_allocator::const_reference     key_const_reference;
 
-      typedef typename key_allocator::const_reference const_key_reference;
+      hash_eq_fn() { }
 
-      hash_eq_fn();
+      hash_eq_fn(const Eq_Fn& r_eq_fn) : Eq_Fn(r_eq_fn) { }
 
-      hash_eq_fn(const Eq_Fn& r_eq_fn);
+      bool
+      operator()(key_const_reference r_lhs_key, size_type lhs_hash, 
+                key_const_reference r_rhs_key, size_type rhs_hash) const
+      {
+       _GLIBCXX_DEBUG_ASSERT(!eq_fn_base::operator()(r_lhs_key, r_rhs_key) 
+                             || lhs_hash == rhs_hash);
 
-      inline bool
-      operator()(const_key_reference r_lhs_key, size_type lhs_hash, 
-                const_key_reference r_rhs_key, size_type rhs_hash) const;
+       return (lhs_hash == rhs_hash && 
+               eq_fn_base::operator()(r_lhs_key, r_rhs_key));
+      }
 
-      inline void
-      swap(const PB_DS_CLASS_C_DEC& other);
+      void
+      swap(const hash_eq_fn& other)
+      { std::swap((Eq_Fn&)(*this), (Eq_Fn&)(other)); }
     };
-
-    PB_DS_CLASS_T_DEC
-    PB_DS_CLASS_C_DEC::
-    hash_eq_fn()
-    { }
-
-    PB_DS_CLASS_T_DEC
-    PB_DS_CLASS_C_DEC::
-    hash_eq_fn(const Eq_Fn& r_eq_fn) :
-      Eq_Fn(r_eq_fn)
-    { }
-
-    PB_DS_CLASS_T_DEC
-    inline bool
-    PB_DS_CLASS_C_DEC::
-    operator()(const_key_reference r_lhs_key, size_type lhs_hash, 
-              const_key_reference r_rhs_key, size_type rhs_hash) const
-    {
-      _GLIBCXX_DEBUG_ASSERT(!eq_fn_base::operator()(r_lhs_key, r_rhs_key) 
-                           || lhs_hash == rhs_hash);
-
-      return (lhs_hash == rhs_hash && 
-             eq_fn_base::operator()(r_lhs_key, r_rhs_key));
-    }
-
-    PB_DS_CLASS_T_DEC
-    inline void
-    PB_DS_CLASS_C_DEC::
-    swap(const PB_DS_CLASS_C_DEC& other)
-    { std::swap((Eq_Fn& )(*this), (Eq_Fn& )(other)); }
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
   } // namespace detail
 } // namespace __gnu_pbds
 
index 90f17094a0f1fd42fa8e27582f80e6cc89427b80..8a51541b528b34bfe7a15db4070bf5666b6412d7 100644 (file)
@@ -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
index ec8069839b0d3cfec5f86f23ae7e6705ee9c8721..d077cbf3cea75d5819dd59ced9186d5341e8e17b 100644 (file)
@@ -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;
index 5f304875908267f3890e756326ad545a0d6958fa..ff83c20b8f53d8d584141dddd6c8ac3ad7bcf5cf 100644 (file)
@@ -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);
index eca853a2092c8ae9252b1d4fdafdfe98b73b0699..cad9a733be937bb2eaf56dbb47009ab45761e07c 100644 (file)
@@ -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.
  */
 
index ba8f54e5dea1c347cb0c170f4ef11b8aacbb2ce0..ff9bdae14a09d473cec3b849661b8df6300f5c81 100644 (file)
@@ -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;
index 2c2833eacbf51c0c810387198aeec5fa838df632..488b6b9236cbaae1751b2526701ab3b1915c1d68 100644 (file)
@@ -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);
index e57d5cc7f2d8d16c3af1f3a5da764d53c5354f2b..0e6227bc7cf9c0a76200fb43511fc098de439ebd 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file erase_fn_imps.hpp
+ * @file gp_hash_table_map_/erase_fn_imps.hpp
  * Contains implementations of gp_ht_map_'s erase related functions.
  */
 
@@ -93,7 +93,7 @@ erase_if(Pred pred)
 PB_DS_CLASS_T_DEC
 inline bool
 PB_DS_CLASS_C_DEC::
-erase(const_key_reference r_key)
+erase(key_const_reference r_key)
 { return erase_imp(r_key, traits_base::m_store_extra_indicator); }
 
 #include <ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp>
index 67e64e91ab6ceae02e9b2e9c8e5c44c6ad4a74b3..d95b9a72b4634340a6cddcd7a48bbf4dd767b7be 100644 (file)
@@ -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);
index 02dc63ea5bb8ec52f3d9ccff743b0feaf69e52c0..9ccad4f94b7af95b48aa8b77db9f94289dc42265 100644 (file)
@@ -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;
index d8b32fe171916e1253037c558a481730540d2573..e6e9c5f0da9b937d09a4ad5f7eff2939eb25fd2c 100644 (file)
 // warranty.
 
 /**
- * @file find_fn_imps.hpp
+ * @file gp_hash_table_map_/find_fn_imps.hpp
  * Contains implementations of gp_ht_map_'s find related functions.
  */
 
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::point_iterator
 PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key)
+find(key_const_reference r_key)
 {
   PB_DS_ASSERT_VALID((*this))
   return find_key_pointer(r_key, traits_base::m_store_extra_indicator);
 }
 
 PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
 PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key) const
+find(key_const_reference r_key) const
 {
   PB_DS_ASSERT_VALID((*this))
   return const_cast<PB_DS_CLASS_C_DEC&>(*this).find_key_pointer(r_key, traits_base::m_store_extra_indicator);
@@ -63,7 +63,7 @@ find_end()
 { return 0; }
 
 PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
 PB_DS_CLASS_C_DEC::
 find_end() const
 { return 0; }
index 298604c80e28ffb5f67358c197a9498cbff86125..2af9781b5e3de73a2f89ac164eb35077c32e09b9 100644 (file)
@@ -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)
 
index a44b8326e28a520718812e1e7d73810f3f62d3eb..80c7788c70fd3e248bd3fa913f2d3ad69a9ed9d5 100644 (file)
@@ -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.
  */
index a9179d5363d4e73731d50c1c7cca6cd72d40ca89..4ce94aefecdac63311ba31cb2991d64df0e63fdd 100644 (file)
@@ -35,8 +35,8 @@
 // warranty.
 
 /**
- * @file gp_ht_map_.hpp
- * Contains an implementation class for gp_ht_map_.
+ * @file gp_hash_table_map_/gp_ht_map_.hpp
+ * Contains an implementation class for general probing hash.
  */
 
 #include <ext/pb_ds/tag_and_trait.hpp>
@@ -47,7 +47,7 @@
 #include <utility>
 #ifdef PB_DS_HT_MAP_TRACE_
 #include <iostream>
-#endif 
+#endif
 #ifdef _GLIBCXX_DEBUG
 #include <ext/pb_ds/detail/debug_map_base.hpp>
 #endif
@@ -57,73 +57,66 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-#define PB_DS_CLASS_T_DEC \
-    template<typename Key, typename Mapped, typename Hash_Fn, typename Eq_Fn, \
-            typename Allocator, bool Store_Hash, typename Comb_Probe_Fn, \
-            typename Probe_Fn, typename Resize_Policy>
-
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CLASS_NAME gp_ht_map_data_
+#define PB_DS_GP_HASH_NAME gp_ht_map
 #endif
 
 #ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_CLASS_NAME gp_ht_map_no_data_
-#endif 
+#define PB_DS_GP_HASH_NAME gp_ht_set
+#endif
+
+#define PB_DS_CLASS_T_DEC \
+   template<typename Key, typename Mapped, typename Hash_Fn, typename Eq_Fn, \
+           typename _Alloc, bool Store_Hash, typename Comb_Probe_Fn, \
+           typename Probe_Fn,  typename Resize_Policy>
 
 #define PB_DS_CLASS_C_DEC \
-    PB_DS_CLASS_NAME<Key, Mapped, Hash_Fn, Eq_Fn, Allocator,   \
-                    Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy>
+   PB_DS_GP_HASH_NAME<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, \
+                   Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy>
 
 #define PB_DS_HASH_EQ_FN_C_DEC \
-    hash_eq_fn<Key, Eq_Fn, Allocator, Store_Hash>
+    hash_eq_fn<Key, Eq_Fn, _Alloc, Store_Hash>
 
 #define PB_DS_RANGED_PROBE_FN_C_DEC \
-    ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, Store_Hash>
+   ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, Store_Hash>
 
-#define PB_DS_TYPES_TRAITS_C_DEC \
-    types_traits<Key, Mapped, Allocator, Store_Hash>
+#define PB_DS_GP_HASH_TRAITS_BASE \
+   types_traits<Key, Mapped, _Alloc, Store_Hash>
 
 #ifdef _GLIBCXX_DEBUG
 #define PB_DS_DEBUG_MAP_BASE_C_DEC \
-    debug_map_base<Key, Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference>
-#endif 
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#endif 
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped()
+   debug_map_base<Key, Eq_Fn, \
+                 typename _Alloc::template rebind<Key>::other::const_reference>
 #endif
 
+
+    /// General probing hash.
     template<typename Key,
             typename Mapped,
             typename Hash_Fn,
             typename Eq_Fn,
-            typename Allocator,
+            typename _Alloc,
             bool Store_Hash,
             typename Comb_Probe_Fn,
             typename Probe_Fn,
             typename Resize_Policy>
-    class PB_DS_CLASS_NAME :
+    class PB_DS_GP_HASH_NAME :
 #ifdef _GLIBCXX_DEBUG
       protected PB_DS_DEBUG_MAP_BASE_C_DEC,
-#endif 
+#endif
       public PB_DS_HASH_EQ_FN_C_DEC,
       public Resize_Policy,
       public PB_DS_RANGED_PROBE_FN_C_DEC,
-      public PB_DS_TYPES_TRAITS_C_DEC
+      public PB_DS_GP_HASH_TRAITS_BASE
     {
     private:
-      typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
-      typedef typename traits_base::value_type value_type_;
-      typedef typename traits_base::pointer pointer_;
+      typedef PB_DS_GP_HASH_TRAITS_BASE                traits_base;
+      typedef typename traits_base::value_type         value_type_;
+      typedef typename traits_base::pointer    pointer_;
       typedef typename traits_base::const_pointer const_pointer_;
-      typedef typename traits_base::reference reference_;
+      typedef typename traits_base::reference  reference_;
       typedef typename traits_base::const_reference const_reference_;
-      typedef typename traits_base::comp_hash comp_hash;
+      typedef typename traits_base::comp_hash  comp_hash;
 
       enum entry_status
        {
@@ -132,30 +125,30 @@ namespace __gnu_pbds
          erased_entry_status
        } __attribute__ ((packed));
 
-      struct entry : public traits_base::stored_value_type
+      struct entry : public traits_base::stored_data_type
       {
        entry_status m_stat;
       };
 
-      typedef typename Allocator::template rebind<entry>::other entry_allocator;
+      typedef typename _Alloc::template rebind<entry>::other entry_allocator;
       typedef typename entry_allocator::pointer entry_pointer;
       typedef typename entry_allocator::const_pointer const_entry_pointer;
       typedef typename entry_allocator::reference entry_reference;
       typedef typename entry_allocator::const_reference const_entry_reference;
       typedef typename entry_allocator::pointer entry_array;
 
-      typedef PB_DS_RANGED_PROBE_FN_C_DEC ranged_probe_fn_base;
+      typedef PB_DS_RANGED_PROBE_FN_C_DEC      ranged_probe_fn_base;
 
 #ifdef _GLIBCXX_DEBUG
-      typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
-#endif 
+      typedef PB_DS_DEBUG_MAP_BASE_C_DEC       debug_base;
+#endif
 
-      typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base;
-      typedef Resize_Policy resize_base;
+      typedef PB_DS_HASH_EQ_FN_C_DEC           hash_eq_fn_base;
+      typedef Resize_Policy                    resize_base;
 
-#define PB_DS_GEN_POS typename Allocator::size_type
+#define PB_DS_GEN_POS typename _Alloc::size_type
 
-#include <ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp>
 #include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>
 #include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>
 #include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>
@@ -163,30 +156,30 @@ namespace __gnu_pbds
 #undef PB_DS_GEN_POS
 
     public:
-      typedef Allocator allocator_type;
-      typedef typename Allocator::size_type size_type;
-      typedef typename Allocator::difference_type difference_type;
-      typedef Hash_Fn hash_fn;
-      typedef Eq_Fn eq_fn;
-      typedef Probe_Fn probe_fn;
-      typedef Comb_Probe_Fn comb_probe_fn;
-      typedef Resize_Policy resize_policy;
+      typedef _Alloc                           allocator_type;
+      typedef typename _Alloc::size_type       size_type;
+      typedef typename _Alloc::difference_type         difference_type;
+      typedef Hash_Fn                          hash_fn;
+      typedef Eq_Fn                            eq_fn;
+      typedef Probe_Fn                                 probe_fn;
+      typedef Comb_Probe_Fn                    comb_probe_fn;
+      typedef Resize_Policy                    resize_policy;
 
       enum
        {
          store_hash = Store_Hash
        };
 
-      typedef typename traits_base::key_type key_type;
+      typedef typename traits_base::key_type   key_type;
       typedef typename traits_base::key_pointer key_pointer;
-      typedef typename traits_base::const_key_pointer const_key_pointer;
+      typedef typename traits_base::key_const_pointer key_const_pointer;
       typedef typename traits_base::key_reference key_reference;
-      typedef typename traits_base::const_key_reference const_key_reference;
+      typedef typename traits_base::key_const_reference key_const_reference;
       typedef typename traits_base::mapped_type mapped_type;
       typedef typename traits_base::mapped_pointer mapped_pointer;
-      typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
+      typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
       typedef typename traits_base::mapped_reference mapped_reference;
-      typedef typename traits_base::const_mapped_reference const_mapped_reference;
+      typedef typename traits_base::mapped_const_reference mapped_const_reference;
       typedef typename traits_base::value_type value_type;
       typedef typename traits_base::pointer pointer;
       typedef typename traits_base::const_pointer const_pointer;
@@ -194,50 +187,50 @@ namespace __gnu_pbds
       typedef typename traits_base::const_reference const_reference;
 
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-      typedef point_iterator_ point_iterator;
-#endif 
+      typedef point_iterator_                  point_iterator;
+#endif
 
 #ifdef PB_DS_DATA_FALSE_INDICATOR
-      typedef const_point_iterator_ point_iterator;
-#endif 
+      typedef point_const_iterator_            point_iterator;
+#endif
 
-      typedef const_point_iterator_ const_point_iterator;
+      typedef point_const_iterator_            point_const_iterator;
 
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-      typedef iterator_ iterator;
-#endif 
+      typedef iterator_                        iterator;
+#endif
 
 #ifdef PB_DS_DATA_FALSE_INDICATOR
-      typedef const_iterator_ iterator;
-#endif 
+      typedef const_iterator_                  iterator;
+#endif
 
-      typedef const_iterator_ const_iterator;
+      typedef const_iterator_                  const_iterator;
 
-      PB_DS_CLASS_NAME();
+      PB_DS_GP_HASH_NAME();
 
-      PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+      PB_DS_GP_HASH_NAME(const PB_DS_CLASS_C_DEC&);
 
-      PB_DS_CLASS_NAME(const Hash_Fn&);
+      PB_DS_GP_HASH_NAME(const Hash_Fn&);
 
-      PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&);
+      PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&);
 
-      PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&);
+      PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&);
 
-      PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&, 
+      PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,
                       const Probe_Fn&);
 
-      PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&, 
+      PB_DS_GP_HASH_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,
                       const Probe_Fn&, const Resize_Policy&);
 
       template<typename It>
       void
-      copy_from_range(It first_it, It last_it);
+      copy_from_range(It, It);
 
       virtual
-      ~PB_DS_CLASS_NAME();
+      ~PB_DS_GP_HASH_NAME();
 
       void
-      swap(PB_DS_CLASS_C_DEC& other);
+      swap(PB_DS_CLASS_C_DEC&);
 
       inline size_type
       size() const;
@@ -248,72 +241,72 @@ namespace __gnu_pbds
       inline bool
       empty() const;
 
-      Hash_Fn& 
+      Hash_Fn&
       get_hash_fn();
 
-      const Hash_Fn& 
+      const Hash_Fn&
       get_hash_fn() const;
 
-      Eq_Fn& 
+      Eq_Fn&
       get_eq_fn();
 
-      const Eq_Fn& 
+      const Eq_Fn&
       get_eq_fn() const;
 
-      Probe_Fn& 
+      Probe_Fn&
       get_probe_fn();
 
-      const Probe_Fn& 
+      const Probe_Fn&
       get_probe_fn() const;
 
-      Comb_Probe_Fn& 
+      Comb_Probe_Fn&
       get_comb_probe_fn();
 
-      const Comb_Probe_Fn& 
+      const Comb_Probe_Fn&
       get_comb_probe_fn() const;
 
-      Resize_Policy& 
+      Resize_Policy&
       get_resize_policy();
 
-      const Resize_Policy& 
+      const Resize_Policy&
       get_resize_policy() const;
 
       inline std::pair<point_iterator, bool>
       insert(const_reference r_val)
       {
-       _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid(__FILE__, __LINE__);)
-        return insert_imp(r_val, traits_base::m_store_extra_indicator);
+       _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid(__FILE__, __LINE__);)
+       return insert_imp(r_val, traits_base::m_store_extra_indicator);
       }
 
       inline mapped_reference
-      operator[](const_key_reference r_key)
+      operator[](key_const_reference r_key)
       {
 #ifdef PB_DS_DATA_TRUE_INDICATOR
        return subscript_imp(r_key, traits_base::m_store_extra_indicator);
-#else 
+#else
        insert(r_key);
-        return traits_base::s_null_mapped;
+       return traits_base::s_null_type;
 #endif
       }
 
       inline point_iterator
-      find(const_key_reference r_key);
+      find(key_const_reference);
 
-      inline const_point_iterator
-      find(const_key_reference r_key) const;
+      inline point_const_iterator
+      find(key_const_reference) const;
 
       inline point_iterator
       find_end();
 
-      inline const_point_iterator
+      inline point_const_iterator
       find_end() const;
 
       inline bool
-      erase(const_key_reference r_key);
+      erase(key_const_reference);
 
       template<typename Pred>
       inline size_type
-      erase_if(Pred prd);
+      erase_if(Pred);
 
       void
       clear();
@@ -332,18 +325,18 @@ namespace __gnu_pbds
 
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_valid(const char* file, int line) const;
-#endif 
+      assert_valid(const char*, int) const;
+#endif
 
 #ifdef PB_DS_HT_MAP_TRACE_
       void
       trace() const;
-#endif 
+#endif
 
     private:
 #ifdef PB_DS_DATA_TRUE_INDICATOR
       friend class iterator_;
-#endif 
+#endif
 
       friend class const_iterator_;
 
@@ -378,10 +371,10 @@ namespace __gnu_pbds
       resize_imp_reassign(entry_pointer, entry_array, true_type);
 
       inline size_type
-      find_ins_pos(const_key_reference, false_type);
+      find_ins_pos(key_const_reference, false_type);
 
       inline comp_hash
-      find_ins_pos(const_key_reference, true_type);
+      find_ins_pos(key_const_reference, true_type);
 
       inline std::pair<point_iterator, bool>
       insert_imp(const_reference, false_type);
@@ -399,14 +392,12 @@ namespace __gnu_pbds
                             traits_base::m_store_extra_indicator);
 
        _GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);
-
        entry* const p_e = m_entries + pos;
        new (&p_e->m_value) value_type(r_val);
        p_e->m_stat = valid_entry_status;
        resize_base::notify_inserted(++m_num_used_e);
 
        _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));)
-
        _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
        return &p_e->m_value;
       }
@@ -432,18 +423,17 @@ namespace __gnu_pbds
        resize_base::notify_inserted(++m_num_used_e);
 
        _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));)
-
        _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
        return &p_e->m_value;
       }
 
 #ifdef PB_DS_DATA_TRUE_INDICATOR
       inline mapped_reference
-      subscript_imp(const_key_reference key, false_type)
+      subscript_imp(key_const_reference key, false_type)
       {
        _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
 
-       const size_type pos = find_ins_pos(key, 
+       const size_type pos = find_ins_pos(key,
                                         traits_base::m_store_extra_indicator);
 
        entry_pointer p_e = &m_entries[pos];
@@ -455,12 +445,12 @@ namespace __gnu_pbds
       }
 
       inline mapped_reference
-      subscript_imp(const_key_reference key, true_type)
+      subscript_imp(key_const_reference key, true_type)
       {
        _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
 
-       comp_hash pos_hash_pair =
-         find_ins_pos(key, traits_base::m_store_extra_indicator);
+       comp_hash pos_hash_pair = find_ins_pos(key,
+                                        traits_base::m_store_extra_indicator);
 
        if (m_entries[pos_hash_pair.first].m_stat != valid_entry_status)
          return insert_new_imp(value_type(key, mapped_type()),
@@ -472,16 +462,16 @@ namespace __gnu_pbds
 #endif
 
       inline pointer
-      find_key_pointer(const_key_reference key, false_type)
+      find_key_pointer(key_const_reference key, false_type)
       {
        const size_type hash = ranged_probe_fn_base::operator()(key);
-       size_type i;
        resize_base::notify_find_search_start();
 
        // Loop until entry is found or until all possible entries accessed.
-       for (i = 0; i < m_num_e; ++i)
+       for (size_type i = 0; i < m_num_e; ++i)
          {
-           const size_type pos = ranged_probe_fn_base::operator()(key, hash, i);
+           const size_type pos = ranged_probe_fn_base::operator()(key,
+                                                                  hash, i);
 
            entry* const p_e = m_entries + pos;
            switch (p_e->m_stat)
@@ -516,14 +506,13 @@ namespace __gnu_pbds
       }
 
       inline pointer
-      find_key_pointer(const_key_reference key, true_type)
+      find_key_pointer(key_const_reference key, true_type)
       {
        comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(key);
-       size_type i;
        resize_base::notify_find_search_start();
 
        // Loop until entry is found or until all possible entries accessed.
-       for (i = 0; i < m_num_e; ++i)
+       for (size_type i = 0; i < m_num_e; ++i)
          {
            const size_type pos =
              ranged_probe_fn_base::operator()(key, pos_hash_pair.second, i);
@@ -564,19 +553,19 @@ namespace __gnu_pbds
       }
 
       inline bool
-      erase_imp(const_key_reference, true_type);
+      erase_imp(key_const_reference, true_type);
 
       inline bool
-      erase_imp(const_key_reference, false_type);
+      erase_imp(key_const_reference, false_type);
 
       inline void
-      erase_entry(entry_pointer p_e);
+      erase_entry(entry_pointer);
 
 #ifdef PB_DS_DATA_TRUE_INDICATOR
       void
       inc_it_state(pointer& r_p_value, size_type& r_pos) const
-      { inc_it_state((const_mapped_pointer& )r_p_value, r_pos); }
-#endif 
+      { inc_it_state((mapped_const_pointer& )r_p_value, r_pos); }
+#endif
 
       void
       inc_it_state(const_pointer& r_p_value, size_type& r_pos) const
@@ -627,12 +616,12 @@ namespace __gnu_pbds
 #ifdef _GLIBCXX_DEBUG
       void
       assert_entry_array_valid(const entry_array, false_type,
-                              const char* file, int line) const;
+                              const char*, int) const;
 
       void
       assert_entry_array_valid(const entry_array, true_type,
-                              const char* file, int line) const;
-#endif 
+                              const char*, int) const;
+#endif
 
       static entry_allocator   s_entry_allocator;
       static iterator          s_end_it;
@@ -644,8 +633,8 @@ namespace __gnu_pbds
 
       enum
        {
-         store_hash_ok = !Store_Hash 
-                         || !is_same<Hash_Fn, __gnu_pbds::null_hash_fn>::value
+         store_hash_ok = !Store_Hash
+                         || !is_same<Hash_Fn, __gnu_pbds::null_type>::value
        };
 
       PB_DS_STATIC_ASSERT(sth, store_hash_ok);
@@ -666,12 +655,8 @@ namespace __gnu_pbds
 #undef PB_DS_CLASS_C_DEC
 #undef PB_DS_HASH_EQ_FN_C_DEC
 #undef PB_DS_RANGED_PROBE_FN_C_DEC
-#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_GP_HASH_TRAITS_BASE
 #undef PB_DS_DEBUG_MAP_BASE_C_DEC
-#undef PB_DS_CLASS_NAME
-#undef PB_DS_V2F
-#undef PB_DS_V2S
-
+#undef PB_DS_GP_HASH_NAME
   } // namespace detail
 } // namespace __gnu_pbds
-
index 423a9288e5ef4554d58085707223439fd10d466e..8fa762b7718037220dc527ab7c4dbf0a691ff89a 100644 (file)
@@ -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
index 101ce8c6be782d673d1f19d84996fb1ab56e01e4..03731778bec77f46124f8a39acb3dbee992306f8 100644 (file)
@@ -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.
  */
 
index 95c9054f3b7dfa632c2110f12f012e20f86db19c..03b2c9b8ee392b8df8beec9915338c954a850a8b 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file insert_no_store_hash_fn_imps.hpp
+ * @file gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
  * Contains implementations of gp_ht_map_'s insert related functions,
  * when the hash value is not stored.
  */
@@ -42,7 +42,7 @@
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::size_type
 PB_DS_CLASS_C_DEC::
-find_ins_pos(const_key_reference r_key, false_type)
+find_ins_pos(key_const_reference r_key, false_type)
 {
   size_type hash = ranged_probe_fn_base::operator()(r_key);
   size_type i;
@@ -95,7 +95,7 @@ inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
 PB_DS_CLASS_C_DEC::
 insert_imp(const_reference r_val, false_type)
 {
-  const_key_reference r_key = PB_DS_V2F(r_val);
+  key_const_reference r_key = PB_DS_V2F(r_val);
   const size_type pos = find_ins_pos(r_key, 
                                     traits_base::m_store_extra_indicator);
 
index a27d9d202c9f0bdda43c77fa1dac6f716f4c9900..856306a7ab137293f31943973655e62fcfd77083 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file insert_store_hash_fn_imps.hpp
+ * @file gp_hash_table_map_/insert_store_hash_fn_imps.hpp
  * Contains implementations of gp_ht_map_'s find related functions,
  * when the hash value is stored.
  */
@@ -42,7 +42,7 @@
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::comp_hash
 PB_DS_CLASS_C_DEC::
-find_ins_pos(const_key_reference r_key, true_type)
+find_ins_pos(key_const_reference r_key, true_type)
 {
   PB_DS_ASSERT_VALID((*this))
   comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);
@@ -100,7 +100,7 @@ inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
 PB_DS_CLASS_C_DEC::
 insert_imp(const_reference r_val, true_type)
 {
-  const_key_reference r_key = PB_DS_V2F(r_val);
+  key_const_reference r_key = PB_DS_V2F(r_val);
   comp_hash pos_hash_pair = find_ins_pos(r_key, 
                                         traits_base::m_store_extra_indicator);
 
index ff1f80f28fdabd635fa37afe0241f9d05fa63b29..695b03eedc0c6d4b98722a0daa65a9d31b023690 100644 (file)
@@ -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
index b1a3f7a7e6745d91dc23d22de8781c8977d4798c..22afeb7690f6d18b8406f913912833543aa6158b 100644 (file)
@@ -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
index 70381f10602bbe104924b8e083f8f47a1791496e..76b6174efef739cc0545419a6397fb1a0752dfe6 100644 (file)
@@ -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)
index 1d2839e0ac7b62d3c73b249c1a32e7517685358b..8819238b6da0f826b12ce924fef36556f798f979 100644 (file)
@@ -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)
index 765e9624b8f55366e81366598c408fa21df6c85d..c291747ed149fee13c7898e3ac868e1ab62f2991 100644 (file)
@@ -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;
index dac063927f69446c4eb22958c11a5e955b4eef62..74aeba4d63d49c8c0a851103a3c038212453e3a4 100644 (file)
@@ -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.
  */
 
index c3fe13c0082bfe1c98dff76e826f0d1311737ff7..0e6a7da087e34842023c499153e8a4b1288c93f1 100644 (file)
@@ -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.
  */
 
index 970cfc1e55370ac38ce501694d34a94572bb305c..19855ac1e8bab91c80d5702efe18cfea16f1b780 100644 (file)
@@ -47,7 +47,7 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-    template<typename Allocator>
+    template<typename _Alloc>
     class probe_fn_base
     {
     protected:
index 24899272f8fd5aa3b8d627f96cb17ff594769488..8567851f79839e20a0a5c1bd6ac36f75ca6e81f6 100644 (file)
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the terms
@@ -42,7 +42,6 @@
 #ifndef PB_DS_RANGED_HASH_FN_HPP
 #define PB_DS_RANGED_HASH_FN_HPP
 
-#include <ext/pb_ds/detail/basic_types.hpp>
 #include <utility>
 #include <debug/debug.h>
 
@@ -50,33 +49,33 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-    template<typename Key, typename Hash_Fn, typename Allocator
+    template<typename Key, typename Hash_Fn, typename _Alloc
             typename Comb_Hash_Fn, bool Store_Hash>
     class ranged_hash_fn;
 
 #define PB_DS_CLASS_T_DEC \
-    template<typename Key, typename Hash_Fn, typename Allocator, \
+    template<typename Key, typename Hash_Fn, typename _Alloc, \
             typename Comb_Hash_Fn>
 
 #define PB_DS_CLASS_C_DEC \
-    ranged_hash_fn<Key,        Hash_Fn, Allocator, Comb_Hash_Fn, false>
+    ranged_hash_fn<Key,        Hash_Fn, _Alloc, Comb_Hash_Fn, false>
 
     /**
      * Specialization 1
      * The client supplies a hash function and a ranged hash function,
      * and requests that hash values not be stored.
      **/
-    template<typename Key, typename Hash_Fn, typename Allocator
+    template<typename Key, typename Hash_Fn, typename _Alloc
             typename Comb_Hash_Fn>
-    class ranged_hash_fn< Key, Hash_Fn, Allocator, Comb_Hash_Fn, false> 
+    class ranged_hash_fn< Key, Hash_Fn, _Alloc, Comb_Hash_Fn, false> 
     : public Hash_Fn, public Comb_Hash_Fn
     {
     protected:
-      typedef typename Allocator::size_type size_type;
+      typedef typename _Alloc::size_type size_type;
       typedef Hash_Fn hash_fn_base;
       typedef Comb_Hash_Fn comb_hash_fn_base;
-      typedef typename Allocator::template rebind< Key>::other key_allocator;
-      typedef typename key_allocator::const_reference const_key_reference;
+      typedef typename _Alloc::template rebind< Key>::other key_allocator;
+      typedef typename key_allocator::const_reference key_const_reference;
 
       ranged_hash_fn(size_type);
 
@@ -91,7 +90,7 @@ namespace __gnu_pbds
       notify_resized(size_type);
 
       inline size_type
-      operator()(const_key_reference) const;
+      operator()(key_const_reference) const;
     };
 
     PB_DS_CLASS_T_DEC
@@ -130,36 +129,36 @@ namespace __gnu_pbds
     PB_DS_CLASS_T_DEC
     inline typename PB_DS_CLASS_C_DEC::size_type
     PB_DS_CLASS_C_DEC::
-    operator()(const_key_reference r_key) const
+    operator()(key_const_reference r_key) const
     { return (comb_hash_fn_base::operator()(hash_fn_base::operator()(r_key)));}
 
 #undef PB_DS_CLASS_T_DEC
 #undef PB_DS_CLASS_C_DEC
 
 #define PB_DS_CLASS_T_DEC \
-    template<typename Key, typename Hash_Fn, typename Allocator, \
+    template<typename Key, typename Hash_Fn, typename _Alloc, \
             typename Comb_Hash_Fn>
 
 #define PB_DS_CLASS_C_DEC \
-    ranged_hash_fn<Key,Hash_Fn,        Allocator, Comb_Hash_Fn, true>
+    ranged_hash_fn<Key,Hash_Fn,        _Alloc, Comb_Hash_Fn, true>
 
     /**
      * Specialization 2
      * The client supplies a hash function and a ranged hash function,
      * and requests that hash values be stored.
      **/
-    template<typename Key, typename Hash_Fn, typename Allocator,
+    template<typename Key, typename Hash_Fn, typename _Alloc,
             typename Comb_Hash_Fn>
-    class ranged_hash_fn<Key, Hash_Fn, Allocator, Comb_Hash_Fn, true> 
+    class ranged_hash_fn<Key, Hash_Fn, _Alloc, Comb_Hash_Fn, true> 
     : public Hash_Fn, public Comb_Hash_Fn
     {
     protected:
-      typedef typename Allocator::size_type size_type;
+      typedef typename _Alloc::size_type size_type;
       typedef std::pair<size_type, size_type> comp_hash;
       typedef Hash_Fn hash_fn_base;
       typedef Comb_Hash_Fn comb_hash_fn_base;
-      typedef typename Allocator::template rebind<Key>::other key_allocator;
-      typedef typename key_allocator::const_reference const_key_reference;
+      typedef typename _Alloc::template rebind<Key>::other key_allocator;
+      typedef typename key_allocator::const_reference key_const_reference;
 
       ranged_hash_fn(size_type);
 
@@ -174,10 +173,10 @@ namespace __gnu_pbds
       notify_resized(size_type);
 
       inline comp_hash
-      operator()(const_key_reference) const;
+      operator()(key_const_reference) const;
 
       inline comp_hash
-      operator()(const_key_reference, size_type) const;
+      operator()(key_const_reference, size_type) const;
     };
 
     PB_DS_CLASS_T_DEC
@@ -216,7 +215,7 @@ namespace __gnu_pbds
     PB_DS_CLASS_T_DEC
     inline typename PB_DS_CLASS_C_DEC::comp_hash
     PB_DS_CLASS_C_DEC::
-    operator()(const_key_reference r_key) const
+    operator()(key_const_reference r_key) const
     {
       const size_type hash = hash_fn_base::operator()(r_key);
       return std::make_pair(comb_hash_fn_base::operator()(hash), hash);
@@ -227,9 +226,9 @@ namespace __gnu_pbds
     PB_DS_CLASS_C_DEC::
     operator()
 #ifdef _GLIBCXX_DEBUG
-      (const_key_reference r_key, size_type hash) const
+      (key_const_reference r_key, size_type hash) const
 #else 
-      (const_key_reference /*r_key*/, size_type hash) const
+      (key_const_reference /*r_key*/, size_type hash) const
 #endif
     {
       _GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));
@@ -240,30 +239,30 @@ namespace __gnu_pbds
 #undef PB_DS_CLASS_C_DEC
 
 #define PB_DS_CLASS_T_DEC \
-    template<typename Key, typename Allocator, typename Comb_Hash_Fn>
+    template<typename Key, typename _Alloc, typename Comb_Hash_Fn>
 
 #define PB_DS_CLASS_C_DEC \
-    ranged_hash_fn<Key,        null_hash_fn, Allocator, Comb_Hash_Fn, false>
+    ranged_hash_fn<Key,        null_type, _Alloc, Comb_Hash_Fn, false>
 
     /**
      * Specialization 3
      * The client does not supply a hash function (by specifying
-     * null_hash_fn as the Hash_Fn parameter), and requests that hash
+     * null_type as the Hash_Fn parameter), and requests that hash
      * values not be stored.
      **/
-    template<typename Key, typename Allocator, typename Comb_Hash_Fn>
-    class ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, false> 
-    : public null_hash_fn, public Comb_Hash_Fn
+    template<typename Key, typename _Alloc, typename Comb_Hash_Fn>
+    class ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, false> 
+    : public Comb_Hash_Fn
     {
     protected:
-      typedef typename Allocator::size_type size_type;
+      typedef typename _Alloc::size_type size_type;
       typedef Comb_Hash_Fn comb_hash_fn_base;
 
       ranged_hash_fn(size_type);
 
       ranged_hash_fn(size_type, const Comb_Hash_Fn&);
 
-      ranged_hash_fn(size_type, const null_hash_fn&, const Comb_Hash_Fn&);
+      ranged_hash_fn(size_type, const null_type&, const Comb_Hash_Fn&);
 
       void
       swap(PB_DS_CLASS_C_DEC&);
@@ -282,7 +281,7 @@ namespace __gnu_pbds
 
     PB_DS_CLASS_T_DEC
     PB_DS_CLASS_C_DEC::
-    ranged_hash_fn(size_type size, const null_hash_fn& r_null_hash_fn
+    ranged_hash_fn(size_type size, const null_type& r_null_type
                   const Comb_Hash_Fn& r_comb_hash_fn) 
     : Comb_Hash_Fn(r_comb_hash_fn)
     { }
@@ -297,30 +296,30 @@ namespace __gnu_pbds
 #undef PB_DS_CLASS_C_DEC
 
 #define PB_DS_CLASS_T_DEC \
-    template<typename Key, typename Allocator, typename Comb_Hash_Fn>
+    template<typename Key, typename _Alloc, typename Comb_Hash_Fn>
 
 #define PB_DS_CLASS_C_DEC \
-    ranged_hash_fn<Key,        null_hash_fn, Allocator, Comb_Hash_Fn, true>
+    ranged_hash_fn<Key,        null_type, _Alloc, Comb_Hash_Fn, true>
 
     /**
      * Specialization 4
      * The client does not supply a hash function (by specifying
-     * null_hash_fn as the Hash_Fn parameter), and requests that hash
+     * null_type as the Hash_Fn parameter), and requests that hash
      * values be stored.
      **/
-    template<typename Key, typename Allocator, typename Comb_Hash_Fn>
-    class ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, true> 
-    : public null_hash_fn, public Comb_Hash_Fn
+    template<typename Key, typename _Alloc, typename Comb_Hash_Fn>
+    class ranged_hash_fn<Key, null_type, _Alloc, Comb_Hash_Fn, true> 
+    : public Comb_Hash_Fn
     {
     protected:
-      typedef typename Allocator::size_type size_type;
+      typedef typename _Alloc::size_type size_type;
       typedef Comb_Hash_Fn comb_hash_fn_base;
 
       ranged_hash_fn(size_type);
 
       ranged_hash_fn(size_type, const Comb_Hash_Fn&);
 
-      ranged_hash_fn(size_type, const null_hash_fn&, const Comb_Hash_Fn&);
+      ranged_hash_fn(size_type, const null_type&, const Comb_Hash_Fn&);
 
       void
       swap(PB_DS_CLASS_C_DEC&);
@@ -339,7 +338,7 @@ namespace __gnu_pbds
 
     PB_DS_CLASS_T_DEC
     PB_DS_CLASS_C_DEC::
-    ranged_hash_fn(size_type size, const null_hash_fn& r_null_hash_fn
+    ranged_hash_fn(size_type size, const null_type& r_null_type
                   const Comb_Hash_Fn& r_comb_hash_fn) 
     : Comb_Hash_Fn(r_comb_hash_fn)
     { }
index ddfba9de1f252d1ae50187d174c5dd6adb45a8b9..b13de65555ac11a2c90da8095b8f8288783143b5 100644 (file)
@@ -42,7 +42,6 @@
 #ifndef PB_DS_RANGED_PROBE_FN_HPP
 #define PB_DS_RANGED_PROBE_FN_HPP
 
-#include <ext/pb_ds/detail/basic_types.hpp>
 #include <utility>
 #include <debug/debug.h>
 
@@ -50,35 +49,35 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-    template<typename Key, typename Hash_Fn, typename Allocator,
+    template<typename Key, typename Hash_Fn, typename _Alloc,
             typename Comb_Probe_Fn, typename Probe_Fn, bool Store_Hash>
     class ranged_probe_fn;
 
 #define PB_DS_CLASS_T_DEC \
-    template<typename Key, typename Hash_Fn, typename Allocator, \
+    template<typename Key, typename Hash_Fn, typename _Alloc, \
             typename Comb_Probe_Fn, typename Probe_Fn>
 
 #define PB_DS_CLASS_C_DEC \
-    ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, false>
+    ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, false>
 
     /**
      * Specialization 1     
      * The client supplies a probe function and a ranged probe
      * function, and requests that hash values not be stored.
      **/
-    template<typename Key, typename Hash_Fn, typename Allocator,
+    template<typename Key, typename Hash_Fn, typename _Alloc,
             typename Comb_Probe_Fn, typename Probe_Fn>
-    class ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn,
+    class ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn,
                          Probe_Fn, false> 
     : public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn
     {
     protected:
-      typedef typename Allocator::size_type size_type;
+      typedef typename _Alloc::size_type size_type;
       typedef Comb_Probe_Fn comb_probe_fn_base;
       typedef Hash_Fn hash_fn_base;
       typedef Probe_Fn probe_fn_base;
-      typedef typename Allocator::template rebind<Key>::other key_allocator;
-      typedef typename key_allocator::const_reference const_key_reference;
+      typedef typename _Alloc::template rebind<Key>::other key_allocator;
+      typedef typename key_allocator::const_reference key_const_reference;
 
       ranged_probe_fn(size_type);
 
@@ -96,10 +95,10 @@ namespace __gnu_pbds
       notify_resized(size_type);
 
       inline size_type
-      operator()(const_key_reference) const;
+      operator()(key_const_reference) const;
 
       inline size_type
-      operator()(const_key_reference, size_type, size_type) const;
+      operator()(key_const_reference, size_type, size_type) const;
     };
 
     PB_DS_CLASS_T_DEC
@@ -146,13 +145,13 @@ namespace __gnu_pbds
     PB_DS_CLASS_T_DEC
     inline typename PB_DS_CLASS_C_DEC::size_type
     PB_DS_CLASS_C_DEC::
-    operator()(const_key_reference r_key) const
+    operator()(key_const_reference r_key) const
     { return comb_probe_fn_base::operator()(hash_fn_base::operator()(r_key)); }
 
     PB_DS_CLASS_T_DEC
     inline typename PB_DS_CLASS_C_DEC::size_type
     PB_DS_CLASS_C_DEC::
-    operator()(const_key_reference, size_type hash, size_type i) const
+    operator()(key_const_reference, size_type hash, size_type i) const
     {
       return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));
     }
@@ -161,30 +160,30 @@ namespace __gnu_pbds
 #undef PB_DS_CLASS_C_DEC
 
 #define PB_DS_CLASS_T_DEC \
-    template<typename Key, typename Hash_Fn, typename Allocator, \
+    template<typename Key, typename Hash_Fn, typename _Alloc, \
             typename Comb_Probe_Fn, typename Probe_Fn>
 
 #define PB_DS_CLASS_C_DEC \
-    ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, true>
+    ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, true>
 
     /**
      * Specialization 2- The client supplies a probe function and a ranged
      *    probe function, and requests that hash values not be stored.
      **/
-    template<typename Key, typename Hash_Fn, typename Allocator,
+    template<typename Key, typename Hash_Fn, typename _Alloc,
             typename Comb_Probe_Fn, typename Probe_Fn>
-    class ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, 
+    class ranged_probe_fn<Key, Hash_Fn, _Alloc, Comb_Probe_Fn, 
                          Probe_Fn, true> 
     : public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn
     {
     protected:
-      typedef typename Allocator::size_type size_type;
+      typedef typename _Alloc::size_type size_type;
       typedef std::pair<size_type, size_type> comp_hash;
       typedef Comb_Probe_Fn comb_probe_fn_base;
       typedef Hash_Fn hash_fn_base;
       typedef Probe_Fn probe_fn_base;
-      typedef typename Allocator::template rebind<Key>::other key_allocator;
-      typedef typename key_allocator::const_reference const_key_reference;
+      typedef typename _Alloc::template rebind<Key>::other key_allocator;
+      typedef typename key_allocator::const_reference key_const_reference;
 
       ranged_probe_fn(size_type);
 
@@ -203,13 +202,13 @@ namespace __gnu_pbds
       notify_resized(size_type);
 
       inline comp_hash
-      operator()(const_key_reference) const;
+      operator()(key_const_reference) const;
 
       inline size_type
-      operator()(const_key_reference, size_type, size_type) const;
+      operator()(key_const_reference, size_type, size_type) const;
 
       inline size_type
-      operator()(const_key_reference, size_type) const;
+      operator()(key_const_reference, size_type) const;
     };
 
     PB_DS_CLASS_T_DEC
@@ -256,7 +255,7 @@ namespace __gnu_pbds
     PB_DS_CLASS_T_DEC
     inline typename PB_DS_CLASS_C_DEC::comp_hash
     PB_DS_CLASS_C_DEC::
-    operator()(const_key_reference r_key) const
+    operator()(key_const_reference r_key) const
     {
       const size_type hash = hash_fn_base::operator()(r_key);
       return std::make_pair(comb_probe_fn_base::operator()(hash), hash);
@@ -265,7 +264,7 @@ namespace __gnu_pbds
     PB_DS_CLASS_T_DEC
     inline typename PB_DS_CLASS_C_DEC::size_type
     PB_DS_CLASS_C_DEC::
-    operator()(const_key_reference, size_type hash, size_type i) const
+    operator()(key_const_reference, size_type hash, size_type i) const
     {
       return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));
     }
@@ -275,9 +274,9 @@ namespace __gnu_pbds
     PB_DS_CLASS_C_DEC::
     operator()
 #ifdef _GLIBCXX_DEBUG
-      (const_key_reference r_key, size_type hash) const
+      (key_const_reference r_key, size_type hash) const
 #else 
-      (const_key_reference /*r_key*/, size_type hash) const
+      (key_const_reference /*r_key*/, size_type hash) const
 #endif 
     {
       _GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));
@@ -292,16 +291,16 @@ namespace __gnu_pbds
      * The client does not supply a hash function or probe function,
      * and requests that hash values not be stored.
      **/
-    template<typename Key, typename Allocator, typename Comb_Probe_Fn>
-    class ranged_probe_fn<Key, null_hash_fn, Allocator, Comb_Probe_Fn, 
-                         null_probe_fn, false> 
-    : public Comb_Probe_Fn, public null_hash_fn, public null_probe_fn
+    template<typename Key, typename _Alloc, typename Comb_Probe_Fn>
+    class ranged_probe_fn<Key, null_type, _Alloc, Comb_Probe_Fn, 
+                         null_type, false> 
+    : public Comb_Probe_Fn
     {
     protected:
-      typedef typename Allocator::size_type size_type;
+      typedef typename _Alloc::size_type size_type;
       typedef Comb_Probe_Fn comb_probe_fn_base;
-      typedef typename Allocator::template rebind<Key>::other key_allocator;
-      typedef typename key_allocator::const_reference const_key_reference;
+      typedef typename _Alloc::template rebind<Key>::other key_allocator;
+      typedef typename key_allocator::const_reference key_const_reference;
 
       ranged_probe_fn(size_type size)
       { Comb_Probe_Fn::notify_resized(size); }
@@ -310,9 +309,9 @@ namespace __gnu_pbds
       : Comb_Probe_Fn(r_comb_probe_fn)
       { }
 
-      ranged_probe_fn(size_type, const null_hash_fn&, 
+      ranged_probe_fn(size_type, const null_type&, 
                      const Comb_Probe_Fn& r_comb_probe_fn, 
-                     const null_probe_fn&)
+                     const null_type&)
       : Comb_Probe_Fn(r_comb_probe_fn)
       { }
 
index 7dcd82588c1bca857ab2394e13b4ff836c9aa789..3ca9001e02586dec657c60229ba6f53a64323324 100644 (file)
 #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
index 988f111ea20d1442cea811888b9b5482d33d0ef0..3092376832ccbbc2f4f0879098cee95f12fec283 100644 (file)
 #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
index 8fa04d140e5b1a28aae2ebcfb1fe3c421fc4da35..cc9aaab9134300d7d8e6ae7933092d1f365b94c5 100644 (file)
 #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
index 2bcfdf51a5422452f9c2121ec938cc5ea792f2f0..b362f3d354fbf43ca4c307bb81c37fe794b05c2a 100644 (file)
 #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
index 2448f3c798853c59aed5736633656774639bba0e..e51abe17e06cc607ec0dfb8873b3ad2a7e4c3e6d 100644 (file)
 // warranty.
 
 /**
- * @file const_iterator.hpp
+ * @file left_child_next_sibling_heap_/const_iterator.hpp
  * Contains an iterator class returned by the table's const find and insert
- *     methods.
+ * methods.
  */
 
 #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP
 #define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP
 
-#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp>
 #include <debug/debug.h>
 
 namespace __gnu_pbds
 {
   namespace detail
   {
+#define PB_DS_CLASS_C_DEC  \
+    left_child_next_sibling_heap_const_iterator_<Node, _Alloc>
 
-#define PB_DS_CLASS_C_DEC                                              \
-    left_child_next_sibling_heap_const_iterator_<Node, Allocator>
+#define PB_DS_BASIC_HEAP_CIT_BASE \
+    left_child_next_sibling_heap_node_point_const_iterator_<Node, _Alloc>
 
-#define PB_DS_BASE_C_DEC                                               \
-    left_child_next_sibling_heap_node_const_point_iterator_<Node, Allocator>
-
-    // Const point-type iterator.
-    template<typename Node, class Allocator>
-    class left_child_next_sibling_heap_const_iterator_ : public PB_DS_BASE_C_DEC
+    /// Const point-type iterator.
+    template<typename Node, typename _Alloc>
+    class left_child_next_sibling_heap_const_iterator_
+    : public PB_DS_BASIC_HEAP_CIT_BASE
     {
-
     private:
-      typedef typename PB_DS_BASE_C_DEC::node_pointer node_pointer;
-
-      typedef PB_DS_BASE_C_DEC base_type;
+      typedef PB_DS_BASIC_HEAP_CIT_BASE                base_type;
+      typedef typename base_type::node_pointer         node_pointer;
 
     public:
-
       // Category.
-      typedef std::forward_iterator_tag iterator_category;
+      typedef std::forward_iterator_tag                iterator_category;
 
       // Difference type.
-      typedef typename Allocator::difference_type difference_type;
+      typedef typename _Alloc::difference_type                 difference_type;
 
       // Iterator's value type.
-      typedef typename base_type::value_type value_type;
+      typedef typename base_type::value_type           value_type;
 
       // Iterator's pointer type.
-      typedef typename base_type::pointer pointer;
+      typedef typename base_type::pointer              pointer;
 
       // Iterator's const pointer type.
-      typedef typename base_type::const_pointer const_pointer;
+      typedef typename base_type::const_pointer        const_pointer;
 
       // Iterator's reference type.
-      typedef typename base_type::reference reference;
+      typedef typename base_type::reference            reference;
 
       // Iterator's const reference type.
-      typedef typename base_type::const_reference const_reference;
-
-    public:
+      typedef typename base_type::const_reference      const_reference;
 
       inline
-      left_child_next_sibling_heap_const_iterator_(node_pointer p_nd) : base_type(p_nd)
+      left_child_next_sibling_heap_const_iterator_(node_pointer p_nd)
+      : base_type(p_nd)
       { }
 
       // Default constructor.
@@ -115,7 +111,7 @@ namespace __gnu_pbds
       operator!=(const PB_DS_CLASS_C_DEC& other) const
       { return (base_type::m_p_nd != other.m_p_nd); }
 
-      inline PB_DS_CLASS_C_DEC& 
+      inline PB_DS_CLASS_C_DEC&
       operator++()
       {
        _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd != 0);
@@ -147,16 +143,17 @@ namespace __gnu_pbds
          {
            node_pointer p_next = base_type::m_p_nd;
            base_type::m_p_nd = base_type::m_p_nd->m_p_prev_or_parent;
-           if (base_type::m_p_nd == 0 || base_type::m_p_nd->m_p_l_child == p_next)
+           if (base_type::m_p_nd == 0
+               || base_type::m_p_nd->m_p_l_child == p_next)
              return;
          }
       }
     };
 
 #undef PB_DS_CLASS_C_DEC
-#undef PB_DS_BASE_C_DEC
+#undef PB_DS_BASIC_HEAP_CIT_BASE
 
   } // namespace detail
 } // namespace __gnu_pbds
 
-#endif 
+#endif
index 5bec709fb50bc07a72040137d55df49ff98f711a..5cec97b327384f69687b53dc498d09248a4aff56 100644 (file)
@@ -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);
index 77c23c1eb36d987c8356e79bdf255881e06f86ce..500fac11207d80b4afa2d325874aaf2911561018 100644 (file)
@@ -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;
index 056cc38fc94216bb322959dad8cded1ed92deb9b..c7d5602318b34efd29a7719b9ef342c1f638e135 100644 (file)
@@ -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)
     {
index 75e6561c393edac3105ed313ae977606a3aa94ef..3535a0351aaf159eac06e027b282455da1a4893c 100644 (file)
@@ -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_.
  */
 
index 9ffc912719c15b6c36dbb03b53a24cf6c149c2ac..e5031c8d9d0de0233ade75ec7d026fe041210840 100644 (file)
@@ -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_.
  */
 
index ec09cf641bd924b3c60e6e3378078c80f4ae7147..40b0a17c78b703345ac683d2b41c6e22fc770cd0 100644 (file)
@@ -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_.
  */
 
index d31154638103a1afc14b4a8bdb785d4791f64f53..b6f3b51710b6b00b024fe1d2b10da20ca1c1ec78 100644 (file)
@@ -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.
  */
 
 #include <ext/pb_ds/detail/cond_dealtor.hpp>
 #include <ext/pb_ds/detail/type_utils.hpp>
 #include <ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp>
-#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp>
 #include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp>
 #ifdef PB_DS_LC_NS_HEAP_TRACE_
 #include <iostream>
-#endif 
+#endif
 #include <debug/debug.h>
 
 namespace __gnu_pbds
 {
   namespace detail
   {
-
-#ifdef _GLIBCXX_DEBUG
-#define PB_DS_CLASS_T_DEC                                              \
-    template<                                                          \
-                                               typename Value_Type,    \
-                                               class Cmp_Fn,           \
-                                               typename Node_Metadata, \
-                                               class Allocator,        \
-                                               bool Single_Link_Roots>
-#else 
-#define PB_DS_CLASS_T_DEC                                              \
-    template<                                                          \
-                                               typename Value_Type,    \
-                                               class Cmp_Fn,           \
-                                               typename Node_Metadata, \
-                                               class Allocator>
-#endif 
-
-#ifdef _GLIBCXX_DEBUG
-#define PB_DS_CLASS_C_DEC                                              \
-    left_child_next_sibling_heap_<                                     \
-                                                       Value_Type,     \
-                                                       Cmp_Fn,         \
-                                                       Node_Metadata,  \
-                                                       Allocator,      \
-                                                       Single_Link_Roots>
-#else 
-#define PB_DS_CLASS_C_DEC                                              \
-    left_child_next_sibling_heap_<                                     \
-                                                       Value_Type,     \
-                                                       Cmp_Fn,         \
-                                                       Node_Metadata,  \
-                                                       Allocator>
-#endif 
-
-    /**
-     * class description = "Base class for some types of h3ap$">
-     **/
 #ifdef _GLIBCXX_DEBUG
+#define PB_DS_CLASS_T_DEC \
+    template<typename Value_Type, typename Cmp_Fn, typename Node_Metadata, \
+            typename _Alloc, bool Single_Link_Roots>
+
+#define PB_DS_CLASS_C_DEC \
+    left_child_next_sibling_heap<Value_Type, Cmp_Fn, Node_Metadata,    \
+                                 _Alloc, Single_Link_Roots>
+#else
+#define PB_DS_CLASS_T_DEC \
+    template<typename Value_Type, typename Cmp_Fn, typename Node_Metadata, \
+            typename _Alloc>
+
+#define PB_DS_CLASS_C_DEC \
+    left_child_next_sibling_heap<Value_Type, Cmp_Fn, Node_Metadata, _Alloc>
+#endif
+
+    /// Base class for a basic heap.
     template<typename Value_Type,
-            class Cmp_Fn,
+            typename Cmp_Fn,
             typename Node_Metadata,
-            class Allocator,
-            bool Single_Link_Roots>
-#else 
-    template<typename Value_Type,
-            class Cmp_Fn,
-            typename Node_Metadata,
-            class Allocator>
-#endif 
-    class left_child_next_sibling_heap_ : public Cmp_Fn
+            typename _Alloc
+#ifdef _GLIBCXX_DEBUG
+            ,bool Single_Link_Roots>
+#else
+            >
+#endif
+    class left_child_next_sibling_heap : public Cmp_Fn
     {
-
     protected:
       typedef
-      typename Allocator::template rebind<
-      left_child_next_sibling_heap_node_<
-      Value_Type,
-      Node_Metadata,
-      Allocator> >::other
+      typename _Alloc::template rebind<
+      left_child_next_sibling_heap_node_<Value_Type, Node_Metadata, 
+                                        _Alloc> >::other
       node_allocator;
 
-      typedef typename node_allocator::value_type node;
-
-      typedef typename node_allocator::pointer node_pointer;
-
-      typedef typename node_allocator::const_pointer const_node_pointer;
-
+      typedef typename node_allocator::value_type      node;
+      typedef typename node_allocator::pointer                 node_pointer;
+      typedef typename node_allocator::const_pointer   node_const_pointer;
       typedef Node_Metadata node_metadata;
-
-      typedef std::pair< node_pointer, node_pointer> node_pointer_pair;
+      typedef std::pair< node_pointer, node_pointer>   node_pointer_pair;
 
     private:
-      typedef cond_dealtor< node, Allocator> cond_dealtor_t;
+      typedef cond_dealtor< node, _Alloc>              cond_dealtor_t;
 
       enum
        {
          simple_value = is_simple<Value_Type>::value
        };
 
-      typedef integral_constant<int, simple_value> no_throw_copies_t;
+      typedef integral_constant<int, simple_value>     no_throw_copies_t;
+      typedef typename _Alloc::template rebind<Value_Type>     __rebind_v;
 
     public:
+      typedef typename _Alloc::size_type               size_type;
+      typedef typename _Alloc::difference_type         difference_type;
+      typedef Value_Type                               value_type;
 
-      typedef typename Allocator::size_type size_type;
-
-      typedef typename Allocator::difference_type difference_type;
+      typedef typename __rebind_v::other::pointer      pointer;
+      typedef typename __rebind_v::other::const_pointer const_pointer;
+      typedef typename __rebind_v::other::reference    reference;
+      typedef typename __rebind_v::other::const_reference const_reference;
 
-      typedef Value_Type value_type;
+      typedef left_child_next_sibling_heap_node_point_const_iterator_<node, _Alloc>
+      point_const_iterator;
 
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::pointer
-      pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::const_pointer
-      const_pointer;
+      typedef point_const_iterator                     point_iterator;
 
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::reference
-      reference;
-
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::const_reference
-      const_reference;
-
-      typedef
-      left_child_next_sibling_heap_node_const_point_iterator_<
-       node,
-       Allocator>
-      const_point_iterator;
-
-      typedef const_point_iterator point_iterator;
-
-      typedef
-      left_child_next_sibling_heap_const_iterator_<
-       node,
-       Allocator>
+      typedef left_child_next_sibling_heap_const_iterator_<node, _Alloc>
       const_iterator;
 
-      typedef const_iterator iterator;
-
-      typedef Cmp_Fn cmp_fn;
-
-      typedef Allocator allocator_type;
+      typedef const_iterator                           iterator;
+      typedef Cmp_Fn                                   cmp_fn;
+      typedef _Alloc                                   allocator_type;
 
     public:
 
-      left_child_next_sibling_heap_();
-
-      left_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn);
-
-      left_child_next_sibling_heap_(const PB_DS_CLASS_C_DEC& other);
+      left_child_next_sibling_heap();
+      left_child_next_sibling_heap(const Cmp_Fn&);
+      left_child_next_sibling_heap(const left_child_next_sibling_heap&);
 
       void
-      swap(PB_DS_CLASS_C_DEC& other);
+      swap(PB_DS_CLASS_C_DEC&);
 
-      ~left_child_next_sibling_heap_();
+      ~left_child_next_sibling_heap();
 
       inline bool
       empty() const;
@@ -212,10 +155,10 @@ namespace __gnu_pbds
       inline size_type
       max_size() const;
 
-      Cmp_Fn& 
+      Cmp_Fn&
       get_cmp_fn();
 
-      const Cmp_Fn& 
+      const Cmp_Fn&
       get_cmp_fn() const;
 
       inline iterator
@@ -236,100 +179,97 @@ namespace __gnu_pbds
 #ifdef PB_DS_LC_NS_HEAP_TRACE_
       void
       trace() const;
-#endif 
+#endif
 
     protected:
 
       inline node_pointer
-      get_new_node_for_insert(const_reference r_val);
+      get_new_node_for_insert(const_reference);
 
       inline static void
-      make_child_of(node_pointer p_nd, node_pointer p_new_parent);
+      make_child_of(node_pointer, node_pointer);
 
       void
-      value_swap(PB_DS_CLASS_C_DEC& other);
+      value_swap(left_child_next_sibling_heap&);
 
       inline static node_pointer
-      parent(node_pointer p_nd);
+      parent(node_pointer);
 
       inline void
-      swap_with_parent(node_pointer p_nd, node_pointer p_parent);
+      swap_with_parent(node_pointer, node_pointer);
 
       void
-      bubble_to_top(node_pointer p_nd);
+      bubble_to_top(node_pointer);
 
       inline void
-      actual_erase_node(node_pointer p_nd);
+      actual_erase_node(node_pointer);
 
       void
-      clear_imp(node_pointer p_nd);
+      clear_imp(node_pointer);
 
       void
       to_linked_list();
 
       template<typename Pred>
       node_pointer
-      prune(Pred pred);
+      prune(Pred);
 
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_valid(const char* file, int line) const;
+      assert_valid(const char*, int) const;
 
       void
-      assert_node_consistent(const_node_pointer p_nd, bool single_link,
-                            const char* file, int line) const;
+      assert_node_consistent(node_const_pointer, bool, const char*, int) const;
 
       static size_type
-      size_under_node(const_node_pointer p_nd);
+      size_under_node(node_const_pointer);
 
       static size_type
-      degree(const_node_pointer p_nd);
-#endif 
+      degree(node_const_pointer);
+#endif
 
 #ifdef PB_DS_LC_NS_HEAP_TRACE_
       static void
-      trace_node(const_node_pointer, size_type level);
-#endif 
-
-    protected:
-      node_pointer m_p_root;
-
-      size_type m_size;
+      trace_node(node_const_pointer, size_type);
+#endif
 
     private:
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_iterators(const char* file, int line) const;
+      assert_iterators(const char*, int) const;
 
       void
-      assert_size(const char* file, int line) const;
+      assert_size(const char*, int) const;
 
       static size_type
-      size_from_node(const_node_pointer p_nd);
-#endif 
+      size_from_node(node_const_pointer);
+#endif
 
       node_pointer
-      recursive_copy_node(const_node_pointer p_nd);
+      recursive_copy_node(node_const_pointer);
 
       inline node_pointer
-      get_new_node_for_insert(const_reference r_val, false_type);
+      get_new_node_for_insert(const_reference, false_type);
 
       inline node_pointer
-      get_new_node_for_insert(const_reference r_val, true_type);
+      get_new_node_for_insert(const_reference, true_type);
 
 #ifdef PB_DS_LC_NS_HEAP_TRACE_
       template<typename Metadata_>
       static void
-      trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>);
+      trace_node_metadata(node_const_pointer, type_to_type<Metadata_>);
 
       static void
-      trace_node_metadata(const_node_pointer, type_to_type<null_left_child_next_sibling_heap_node_metadata>);
-#endif 
+      trace_node_metadata(node_const_pointer,
+                         type_to_type<null_type>);
+#endif
+    protected:
+      node_pointer             m_p_root;
+      size_type                m_size;
 
     private:
-      static node_allocator s_node_allocator;
-
-      static no_throw_copies_t s_no_throw_copies_ind;
+      static node_allocator    s_node_allocator;
+      static no_throw_copies_t         s_no_throw_copies_ind;
     };
 
 #include <ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp>
@@ -347,4 +287,4 @@ namespace __gnu_pbds
   } // namespace detail
 } // namespace __gnu_pbds
 
-#endif 
+#endif
index 1cdfe288391cb80ea1cb23651c75f52b49723947..d74b86c42d94123cb7c10ae837be6b58cbac24da 100644 (file)
 // warranty.
 
 /**
- * @file node.hpp
+ * @file left_child_next_sibling_heap_/node.hpp
  * Contains an implementation struct for this type of heap's node.
  */
 
 #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP
 #define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP
 
-#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>
-
 namespace __gnu_pbds
 {
   namespace detail
   {
-
-    template<typename Value_Type, typename Metadata_Type, class Allocator>
+    /// Node.
+    template<typename _Value, typename _Metadata, typename _Alloc>
     struct left_child_next_sibling_heap_node_
     {
     private:
-      typedef
-      left_child_next_sibling_heap_node_<
-      Value_Type,
-      Metadata_Type,
-      Allocator>
-      this_type;
-
-    public:
-      typedef typename Allocator::size_type size_type;
-
-      typedef
-      typename Allocator::template rebind<
-       this_type>::other::pointer
-      node_pointer;
-
-      typedef Value_Type value_type;
-
-      typedef Metadata_Type metadata_type;
+      typedef left_child_next_sibling_heap_node_<_Value, _Metadata, _Alloc> this_type;
 
     public:
-      value_type m_value;
+      typedef _Value                           value_type;
+      typedef typename _Alloc::size_type       size_type;
+      typedef _Metadata                        metadata_type;
 
-      metadata_type m_metadata;
+      typedef typename _Alloc::template rebind<this_type>::other::pointer node_pointer;
 
-      node_pointer m_p_l_child;
-
-      node_pointer m_p_next_sibling;
-
-      node_pointer m_p_prev_or_parent;
+      value_type       m_value;
+      metadata_type    m_metadata;
+      node_pointer     m_p_l_child;
+      node_pointer     m_p_next_sibling;
+      node_pointer     m_p_prev_or_parent;
     };
 
-    template<typename Value_Type, class Allocator>
-    struct left_child_next_sibling_heap_node_<
-      Value_Type,
-      null_left_child_next_sibling_heap_node_metadata,
-      Allocator>
+    template<typename _Value, typename _Alloc>
+    struct left_child_next_sibling_heap_node_<_Value, null_type, _Alloc>
     {
     private:
-      typedef
-      left_child_next_sibling_heap_node_<
-      Value_Type,
-      null_left_child_next_sibling_heap_node_metadata,
-      Allocator>
-      this_type;
+      typedef left_child_next_sibling_heap_node_<_Value, null_type, _Alloc> this_type;
 
     public:
-      typedef typename Allocator::size_type size_type;
-
-      typedef
-      typename Allocator::template rebind<
-       this_type>::other::pointer
-      node_pointer;
-
-      typedef Value_Type value_type;
-
-    public:
-      value_type m_value;
-
-      node_pointer m_p_l_child;
+      typedef _Value                           value_type;
+      typedef typename _Alloc::size_type       size_type;
 
-      node_pointer m_p_next_sibling;
+      typedef typename _Alloc::template rebind<this_type>::other::pointer node_pointer;
 
-      node_pointer m_p_prev_or_parent;
+      value_type       m_value;
+      node_pointer     m_p_l_child;
+      node_pointer     m_p_next_sibling;
+      node_pointer     m_p_prev_or_parent;
     };
 
   } // namespace detail
similarity index 82%
rename from libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
rename to libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp
index 712a76fb7c0e9a585f5ff71d64e48a6cd0636ea1..5b29254f6aa9a03ce5579d061a0a5712c925b499 100644 (file)
@@ -34,9 +34,9 @@
 // warranty.
 
 /**
- * @file const_point_iterator.hpp
+ * @file left_child_next_sibling_heap_/point_const_iterator.hpp
  * Contains an iterator class returned by the table's const find and insert
- *     methods.
+ * methods.
  */
 
 #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP
@@ -51,18 +51,18 @@ namespace __gnu_pbds
   {
 
 #define PB_DS_CLASS_T_DEC                      \
-    template<typename Node, class Allocator>
+    template<typename Node, typename _Alloc>
 
 #define PB_DS_CLASS_C_DEC \
-    left_child_next_sibling_heap_node_const_point_iterator_<Node, Allocator>
+    left_child_next_sibling_heap_node_point_const_iterator_<Node, _Alloc>
 
-    // Const point-type iterator.
-    template<typename Node, class Allocator>
-    class left_child_next_sibling_heap_node_const_point_iterator_
+    /// Const point-type iterator.
+    template<typename Node, typename _Alloc>
+    class left_child_next_sibling_heap_node_point_const_iterator_
     {
 
     protected:
-      typedef typename Allocator::template rebind<Node>::other::pointer node_pointer;
+      typedef typename _Alloc::template rebind<Node>::other::pointer node_pointer;
 
     public:
 
@@ -77,42 +77,42 @@ namespace __gnu_pbds
 
       // Iterator's pointer type.
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        value_type>::other::pointer
       pointer;
 
       // Iterator's const pointer type.
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        value_type>::other::const_pointer
       const_pointer;
 
       // Iterator's reference type.
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        value_type>::other::reference
       reference;
 
       // Iterator's const reference type.
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        value_type>::other::const_reference
       const_reference;
 
     public:
 
       inline
-      left_child_next_sibling_heap_node_const_point_iterator_(node_pointer p_nd) : m_p_nd(p_nd)
+      left_child_next_sibling_heap_node_point_const_iterator_(node_pointer p_nd) : m_p_nd(p_nd)
       { }
 
       // Default constructor.
       inline
-      left_child_next_sibling_heap_node_const_point_iterator_() : m_p_nd(0)
+      left_child_next_sibling_heap_node_point_const_iterator_() : m_p_nd(0)
       { }
 
       // Copy constructor.
       inline
-      left_child_next_sibling_heap_node_const_point_iterator_(const PB_DS_CLASS_C_DEC& other) : m_p_nd(other.m_p_nd)
+      left_child_next_sibling_heap_node_point_const_iterator_(const PB_DS_CLASS_C_DEC& other) : m_p_nd(other.m_p_nd)
       { }
 
       // Access.
index 350b4d08af33b061da9535b0be7ef9c6986e1525..b2d0d8527d71669e29e3267fb76b0e6cb3713fe4 100644 (file)
@@ -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_.
  */
 
index d42100212e4b9c729cae363d76837eacbce217a3..28ee13e91224b8ab8c773c3fb2b66a52d51132c0 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file trace_fn_imps.hpp
+ * @file left_child_next_sibling_heap_/trace_fn_imps.hpp
  * Contains an implementation class for left_child_next_sibling_heap_.
  */
 
@@ -46,16 +46,14 @@ PB_DS_CLASS_C_DEC::
 trace() const
 {
   std::cerr << std::endl;
-
   trace_node(m_p_root, 0);
-
   std::cerr << std::endl;
 }
 
 PB_DS_CLASS_T_DEC
 void
 PB_DS_CLASS_C_DEC::
-trace_node(const_node_pointer p_nd, size_type level)
+trace_node(node_const_pointer p_nd, size_type level)
 {
   while (p_nd != 0)
     {
@@ -68,11 +66,8 @@ trace_node(const_node_pointer p_nd, size_type level)
        " left = " << p_nd->m_p_l_child << " ";
 
       trace_node_metadata(p_nd, type_to_type<node_metadata>());
-
       std::cerr << p_nd->m_value << std::endl;
-
       trace_node(p_nd->m_p_l_child, level + 1);
-
       p_nd = p_nd->m_p_next_sibling;
     }
 }
@@ -81,7 +76,7 @@ PB_DS_CLASS_T_DEC
 template<typename Metadata_>
 void
 PB_DS_CLASS_C_DEC::
-trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>)
+trace_node_metadata(node_const_pointer p_nd, type_to_type<Metadata_>)
 {
   std::cerr << "(" << p_nd->m_metadata << ") ";
 }
@@ -89,7 +84,7 @@ trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>)
 PB_DS_CLASS_T_DEC
 void
 PB_DS_CLASS_C_DEC::
-trace_node_metadata(const_node_pointer, type_to_type<null_left_child_next_sibling_heap_node_metadata>)
+trace_node_metadata(node_const_pointer, type_to_type<null_type>)
 { }
 
 #endif // #ifdef PB_DS_LC_NS_HEAP_TRACE_
index 17ddaaf3e691dd92492882495cf31115baef8500..8ec39a6acefd7c532d227abde60f713e601afe10 100644 (file)
@@ -35,8 +35,7 @@
 // warranty.
 
 /**
- * @file constructor_destructor_fn_imps.hpp
- * Contains implementations of PB_DS_CLASS_NAME.
+ * @file list_update_map_/constructor_destructor_fn_imps.hpp
  */
 
 PB_DS_CLASS_T_DEC
@@ -47,7 +46,7 @@ PB_DS_CLASS_T_DEC
 Eq_Fn PB_DS_CLASS_C_DEC::s_eq_fn;
 
 PB_DS_CLASS_T_DEC
-null_lu_metadata PB_DS_CLASS_C_DEC::s_null_lu_metadata;
+null_type PB_DS_CLASS_C_DEC::s_null_type;
 
 PB_DS_CLASS_T_DEC
 Update_Policy PB_DS_CLASS_C_DEC::s_update_policy;
@@ -68,13 +67,13 @@ copy_from_range(It first_it, It last_it)
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME() : m_p_l(0)
+PB_DS_LU_NAME() : m_p_l(0)
 { PB_DS_ASSERT_VALID((*this)) }
 
 PB_DS_CLASS_T_DEC
 template<typename It>
 PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(It first_it, It last_it) : m_p_l(0)
+PB_DS_LU_NAME(It first_it, It last_it) : m_p_l(0)
 {
   copy_from_range(first_it, last_it);
   PB_DS_ASSERT_VALID((*this));
@@ -82,19 +81,19 @@ PB_DS_CLASS_NAME(It first_it, It last_it) : m_p_l(0)
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) : 
+PB_DS_LU_NAME(const PB_DS_CLASS_C_DEC& other) :
 m_p_l(0)
 {
   __try
     {
       for (const_iterator it = other.begin(); it != other.end(); ++it)
-        {
-         entry_pointer p_l = allocate_new_entry(*it, 
-                       PB_DS_TYPES_TRAITS_C_DEC::m_no_throw_copies_indicator);
+       {
+         entry_pointer p_l = allocate_new_entry(*it,
+                                     traits_base::m_no_throw_copies_indicator);
 
          p_l->m_p_next = m_p_l;
          m_p_l = p_l;
-        }
+       }
     }
   __catch(...)
     {
@@ -134,6 +133,5 @@ deallocate_all()
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-~PB_DS_CLASS_NAME()
+~PB_DS_LU_NAME()
 { deallocate_all(); }
-
index 98391802945add4bfaf3b4d8ea54f2990eb6cb6c..510c9050015f3518071b87e732075c8d6df51b09 100644 (file)
@@ -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.
  */
 
index 021ef50d8706d0fcdb2f8400e0e545567d0494cb..f1e440a72a0557e8cde2dc0ce8026c213133c42f 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file entry_metadata_base.hpp
+ * @file list_update_map_/entry_metadata_base.hpp
  * Contains an implementation for a list update map.
  */
 
@@ -52,7 +52,7 @@ namespace __gnu_pbds
     };
     
     template<>
-    struct lu_map_entry_metadata_base<null_lu_metadata>
+    struct lu_map_entry_metadata_base<null_type>
     { };  
   } // namespace detail
 } // namespace __gnu_pbds
index dd60ea6cdce05f866ac93bf3569b3f6978a07f2d..bbd7b8355eaa0855b6ea27170b0e7c33d5780883 100644 (file)
 // 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)
index 9164b92255e1acd1f0d5ebab59d907df45f63863..0d5f98aaf7e7765ee0936c88f8778a607120a6a0 100644 (file)
 // warranty.
 
 /**
- * @file find_fn_imps.hpp
+ * @file list_update_map_/find_fn_imps.hpp
  * Contains implementations of lu_map_.
  */
 
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::entry_pointer
 PB_DS_CLASS_C_DEC::
-find_imp(const_key_reference r_key) const
+find_imp(key_const_reference r_key) const
 {
   if (m_p_l == 0)
     return 0;
@@ -85,6 +85,6 @@ apply_update(entry_pointer p_l, type_to_type<Metadata>)
 PB_DS_CLASS_T_DEC
 inline bool
 PB_DS_CLASS_C_DEC::
-apply_update(entry_pointer, type_to_type<null_lu_metadata>)
-{ return s_update_policy(s_null_lu_metadata); }
+apply_update(entry_pointer, type_to_type<null_type>)
+{ return s_update_policy(s_null_type); }
 
index 31f743cf18b9ddf079d1ea604dab50dfae8cdbde..294d73a0187bb72868015e95dfbdead2a8cbf601 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file info_fn_imps.hpp
+ * @file list_update_map_/info_fn_imps.hpp
  * Contains implementations of lu_map_.
  */
 
index 2677683f8dfde933a6d7a268e94902c46aa34d4f..9c250df49a1f4e7717f08e2042c0e9ee619fd99c 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file insert_fn_imps.hpp
+ * @file list_update_map_/insert_fn_imps.hpp
  * Contains implementations of lu_map_.
  */
 
@@ -101,6 +101,6 @@ init_entry_metadata(entry_pointer p_l, type_to_type<Metadata>)
 PB_DS_CLASS_T_DEC
 inline void
 PB_DS_CLASS_C_DEC::
-init_entry_metadata(entry_pointer, type_to_type<null_lu_metadata>)
+init_entry_metadata(entry_pointer, type_to_type<null_type>)
 { }
 
index ac3163858f1d99e044187327b723c84e3df31b5e..2a1aa6c9dd039ab072b9f23c7853ba57ccb1990d 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file iterators_fn_imps.hpp
+ * @file list_update_map_/iterators_fn_imps.hpp
  * Contains implementations of lu_map_.
  */
 
index 329f2fa780ae60ceb8eec6df20c85587a94e4fa3..9e48f17f7cdef03490aee58b33ba67a4d81ff5ed 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file lu_map_.hpp
+ * @file list_update_map_/lu_map_.hpp
  * Contains a list update map.
  */
 
 #include <ext/pb_ds/exception.hpp>
 #ifdef _GLIBCXX_DEBUG
 #include <ext/pb_ds/detail/debug_map_base.hpp>
-#endif 
+#endif
 #ifdef PB_DS_LU_MAP_TRACE_
 #include <iostream>
-#endif 
+#endif
 #include <debug/debug.h>
 
 namespace __gnu_pbds
 {
   namespace detail
   {
-#define PB_DS_CLASS_T_DEC \
-    template<typename Key, typename Mapped, class Eq_Fn, \
-            class Allocator, class Update_Policy>
-
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CLASS_NAME lu_map_data_
-#endif 
+#define PB_DS_LU_NAME lu_map
+#endif
 
 #ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_CLASS_NAME lu_map_no_data_
-#endif 
+#define PB_DS_LU_NAME lu_set
+#endif
+
+#define PB_DS_CLASS_T_DEC \
+    template<typename Key, typename Mapped, typename Eq_Fn, \
+            typename _Alloc, typename Update_Policy>
 
 #define PB_DS_CLASS_C_DEC \
-    PB_DS_CLASS_NAME<Key, Mapped, Eq_Fn, Allocator, Update_Policy>
+    PB_DS_LU_NAME<Key, Mapped, Eq_Fn, _Alloc, Update_Policy>
 
-#define PB_DS_TYPES_TRAITS_C_DEC \
-    types_traits<Key, Mapped, Allocator, false>
+#define PB_DS_LU_TRAITS_BASE \
+    types_traits<Key, Mapped, _Alloc, false>
 
 #ifdef _GLIBCXX_DEBUG
 #define PB_DS_DEBUG_MAP_BASE_C_DEC \
     debug_map_base<Key, Eq_Fn, \
-             typename Allocator::template rebind<Key>::other::const_reference>
-#endif 
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#define PB_DS_EP2VP(X)& ((X)->m_value)
-#endif 
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped_Data()
-#define PB_DS_EP2VP(X)& ((X)->m_value.first)
-#endif 
+             typename _Alloc::template rebind<Key>::other::const_reference>
+#endif
 
-    /* Skip to the lu, my darling. */
-    // list-based (with updates) associative container.
+    /// list-based (with updates) associative container.
+    /// Skip to the lu, my darling.
     template<typename Key,
             typename Mapped,
-            class Eq_Fn,
-            class Allocator,
-            class Update_Policy>
-    class PB_DS_CLASS_NAME :
+            typename Eq_Fn,
+            typename _Alloc,
+            typename Update_Policy>
+    class PB_DS_LU_NAME :
 #ifdef _GLIBCXX_DEBUG
       protected PB_DS_DEBUG_MAP_BASE_C_DEC,
-#endif 
-      public PB_DS_TYPES_TRAITS_C_DEC
+#endif
+      public PB_DS_LU_TRAITS_BASE
     {
     private:
-      typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
+      typedef PB_DS_LU_TRAITS_BASE             traits_base;
 
-      struct entry 
+      struct entry
      : public lu_map_entry_metadata_base<typename Update_Policy::metadata_type>
       {
        typename traits_base::value_type m_value;
-       typename Allocator::template rebind<entry>::other::pointer m_p_next;
+       typename _Alloc::template rebind<entry>::other::pointer m_p_next;
       };
 
-      typedef typename Allocator::template rebind<entry>::other entry_allocator;
+      typedef typename _Alloc::template rebind<entry>::other entry_allocator;
       typedef typename entry_allocator::pointer entry_pointer;
       typedef typename entry_allocator::const_pointer const_entry_pointer;
       typedef typename entry_allocator::reference entry_reference;
       typedef typename entry_allocator::const_reference const_entry_reference;
 
-      typedef typename Allocator::template rebind<entry_pointer>::other entry_pointer_allocator;
+      typedef typename _Alloc::template rebind<entry_pointer>::other entry_pointer_allocator;
       typedef typename entry_pointer_allocator::pointer entry_pointer_array;
 
       typedef typename traits_base::value_type value_type_;
@@ -133,7 +121,7 @@ namespace __gnu_pbds
 
 #define PB_DS_GEN_POS entry_pointer
 
-#include <ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp>
 #include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>
 #include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>
 #include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>
@@ -143,27 +131,27 @@ namespace __gnu_pbds
 
 #ifdef _GLIBCXX_DEBUG
       typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
-#endif 
+#endif
 
-      typedef cond_dealtor<entry, Allocator> cond_dealtor_t;
+      typedef cond_dealtor<entry, _Alloc> cond_dealtor_t;
 
     public:
-      typedef Allocator allocator_type;
-      typedef typename Allocator::size_type size_type;
-      typedef typename Allocator::difference_type difference_type;
+      typedef _Alloc allocator_type;
+      typedef typename _Alloc::size_type size_type;
+      typedef typename _Alloc::difference_type difference_type;
       typedef Eq_Fn eq_fn;
       typedef Update_Policy update_policy;
       typedef typename Update_Policy::metadata_type update_metadata;
       typedef typename traits_base::key_type key_type;
       typedef typename traits_base::key_pointer key_pointer;
-      typedef typename traits_base::const_key_pointer const_key_pointer;
+      typedef typename traits_base::key_const_pointer key_const_pointer;
       typedef typename traits_base::key_reference key_reference;
-      typedef typename traits_base::const_key_reference const_key_reference;
+      typedef typename traits_base::key_const_reference key_const_reference;
       typedef typename traits_base::mapped_type mapped_type;
       typedef typename traits_base::mapped_pointer mapped_pointer;
-      typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
+      typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
       typedef typename traits_base::mapped_reference mapped_reference;
-      typedef typename traits_base::const_mapped_reference const_mapped_reference;
+      typedef typename traits_base::mapped_const_reference mapped_const_reference;
       typedef typename traits_base::value_type value_type;
       typedef typename traits_base::pointer pointer;
       typedef typename traits_base::const_pointer const_pointer;
@@ -171,35 +159,35 @@ namespace __gnu_pbds
       typedef typename traits_base::const_reference const_reference;
 
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-      typedef point_iterator_ point_iterator;
-#endif 
+      typedef point_iterator_                  point_iterator;
+#endif
 
 #ifdef PB_DS_DATA_FALSE_INDICATOR
-      typedef const_point_iterator_ point_iterator;
-#endif 
+      typedef point_const_iterator_            point_iterator;
+#endif
 
-      typedef const_point_iterator_ const_point_iterator;
+      typedef point_const_iterator_            point_const_iterator;
 
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-      typedef iterator_ iterator;
-#endif 
+      typedef iterator_                        iterator;
+#endif
 
 #ifdef PB_DS_DATA_FALSE_INDICATOR
-      typedef const_iterator_ iterator;
-#endif 
+      typedef const_iterator_                  iterator;
+#endif
 
-      typedef const_iterator_ const_iterator;
+      typedef const_iterator_                  const_iterator;
 
     public:
-      PB_DS_CLASS_NAME();
+      PB_DS_LU_NAME();
 
-      PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+      PB_DS_LU_NAME(const PB_DS_CLASS_C_DEC&);
 
       virtual
-      ~PB_DS_CLASS_NAME();
+      ~PB_DS_LU_NAME();
 
       template<typename It>
-      PB_DS_CLASS_NAME(It first_it, It last_it);
+      PB_DS_LU_NAME(It, It);
 
       void
       swap(PB_DS_CLASS_C_DEC&);
@@ -214,38 +202,38 @@ namespace __gnu_pbds
       empty() const;
 
       inline mapped_reference
-      operator[](const_key_reference r_key)
+      operator[](key_const_reference r_key)
       {
 #ifdef PB_DS_DATA_TRUE_INDICATOR
        _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
        return insert(std::make_pair(r_key, mapped_type())).first->second;
-#else 
+#else
        insert(r_key);
-       return traits_base::s_null_mapped;
-#endif 
+       return traits_base::s_null_type;
+#endif
       }
 
       inline std::pair<point_iterator, bool>
       insert(const_reference);
 
       inline point_iterator
-      find(const_key_reference r_key)
+      find(key_const_reference r_key)
       {
        _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
        entry_pointer p_e = find_imp(r_key);
        return point_iterator(p_e == 0 ? 0: &p_e->m_value);
       }
 
-      inline const_point_iterator
-      find(const_key_reference r_key) const
+      inline point_const_iterator
+      find(key_const_reference r_key) const
       {
        _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
        entry_pointer p_e = find_imp(r_key);
-       return const_point_iterator(p_e == 0 ? 0: &p_e->m_value);
+       return point_const_iterator(p_e == 0 ? 0: &p_e->m_value);
       }
 
       inline bool
-      erase(const_key_reference);
+      erase(key_const_reference);
 
       template<typename Pred>
       inline size_type
@@ -269,7 +257,7 @@ namespace __gnu_pbds
 #ifdef _GLIBCXX_DEBUG
       void
       assert_valid(const char* file, int line) const;
-#endif 
+#endif
 
 #ifdef PB_DS_LU_MAP_TRACE_
       void
@@ -285,7 +273,7 @@ namespace __gnu_pbds
     private:
 #ifdef PB_DS_DATA_TRUE_INDICATOR
       friend class iterator_;
-#endif 
+#endif
 
       friend class const_iterator_;
 
@@ -300,7 +288,7 @@ namespace __gnu_pbds
       init_entry_metadata(entry_pointer, type_to_type<Metadata>);
 
       inline static void
-      init_entry_metadata(entry_pointer, type_to_type<null_lu_metadata>);
+      init_entry_metadata(entry_pointer, type_to_type<null_type>);
 
       void
       deallocate_all();
@@ -323,18 +311,18 @@ namespace __gnu_pbds
       apply_update(entry_pointer, type_to_type<Metadata>);
 
       inline static bool
-      apply_update(entry_pointer, type_to_type<null_lu_metadata>);
+      apply_update(entry_pointer, type_to_type<null_type>);
 
       inline entry_pointer
-      find_imp(const_key_reference) const;
+      find_imp(key_const_reference) const;
 
-      static entry_allocator s_entry_allocator;
-      static Eq_Fn s_eq_fn;
-      static Update_Policy s_update_policy;
-      static type_to_type<update_metadata> s_metadata_type_indicator;
-      static null_lu_metadata s_null_lu_metadata;
+      static entry_allocator                   s_entry_allocator;
+      static Eq_Fn                             s_eq_fn;
+      static Update_Policy                     s_update_policy;
+      static type_to_type<update_metadata>     s_metadata_type_indicator;
+      static null_type                                 s_null_type;
 
-      mutable entry_pointer m_p_l;
+      mutable entry_pointer                    m_p_l;
     };
 
 #include <ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp>
@@ -348,12 +336,8 @@ namespace __gnu_pbds
 
 #undef PB_DS_CLASS_T_DEC
 #undef PB_DS_CLASS_C_DEC
-#undef  PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_LU_TRAITS_BASE
 #undef PB_DS_DEBUG_MAP_BASE_C_DEC
-#undef PB_DS_CLASS_NAME
-#undef PB_DS_V2F
-#undef PB_DS_EP2VP
-#undef PB_DS_V2S
-
+#undef PB_DS_LU_NAME
   } // namespace detail
 } // namespace __gnu_pbds
index 009610998a5ef170e525581350be9c2340f1d048..1ee219ae55386e7bf4c7cf5065ec516d02c09424 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file trace_fn_imps.hpp
+ * @file list_update_map_/trace_fn_imps.hpp
  * Contains implementations of lu_map_.
  */
 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
deleted file mode 100644 (file)
index f74a9fb..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file counter_lu_policy_imp.hpp
- * Contains a lu counter policy implementation.
- */
-
-PB_DS_CLASS_T_DEC
-detail::counter_lu_metadata<typename Allocator::size_type>
-PB_DS_CLASS_C_DEC::
-operator()() const
-{ return (base_type::operator()(max_count)); }
-
-PB_DS_CLASS_T_DEC
-bool
-PB_DS_CLASS_C_DEC::
-operator()(metadata_reference r_data) const
-{ return (base_type::operator()(r_data, max_count)); }
similarity index 64%
rename from libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp
rename to libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp
index 8e476cb91b9088f03c713307a0d0400b926f2337..74ab81388bb787befc4a8e54417cb9a882be4bc4 100644 (file)
@@ -1,6 +1,7 @@
 // -*- C++ -*-
 
-// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011
+// Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the terms
@@ -34,7 +35,7 @@
 // warranty.
 
 /**
- * @file counter_lu_metadata.hpp
+ * @file lu_counter_metadata.hpp
  * Contains implementation of a lu counter policy's metadata.
  */
 
@@ -43,44 +44,45 @@ namespace __gnu_pbds
   namespace detail
   {
     template<typename Size_Type>
-    class counter_lu_policy_base;
+      class lu_counter_policy_base;
 
-    // A list-update metadata type that moves elements to the front of
-    // the list based on the counter algorithm.
+    /// A list-update metadata type that moves elements to the front of
+    /// the list based on the counter algorithm.
     template<typename Size_Type = std::size_t>
-    class counter_lu_metadata
-    {
-    public:
-      typedef Size_Type size_type;
+      class lu_counter_metadata
+      {
+      public:
+       typedef Size_Type       size_type;
 
-    private:
-      counter_lu_metadata(size_type init_count) : m_count(init_count)
-      { }
+      private:
+       lu_counter_metadata(size_type init_count) : m_count(init_count)
+       { }
 
-      friend class counter_lu_policy_base<size_type>;
+       friend class lu_counter_policy_base<size_type>;
 
-      mutable size_type m_count;
+       mutable size_type       m_count;
     };
 
+    /// Base class for list-update counter policy.
     template<typename Size_Type>
-    class counter_lu_policy_base
-    {
-    protected:
-      typedef Size_Type size_type;
+      class lu_counter_policy_base
+      {
+      protected:
+       typedef Size_Type       size_type;
 
-      counter_lu_metadata<size_type>
-      operator()(size_type max_size) const
-      { return counter_lu_metadata<Size_Type>(std::rand() % max_size); }
+       lu_counter_metadata<size_type>
+       operator()(size_type max_size) const
+       { return lu_counter_metadata<Size_Type>(std::rand() % max_size); }
 
-      template<typename Metadata_Reference>
-      bool
-      operator()(Metadata_Reference r_data, size_type m_max_count) const
-      {
-       if (++r_data.m_count != m_max_count)
-         return false;
-       r_data.m_count = 0;
-       return true;
-      }
-    };
+       template<typename Metadata_Reference>
+       bool
+       operator()(Metadata_Reference r_data, size_type m_max_count) const
+       {
+         if (++r_data.m_count != m_max_count)
+           return false;
+         r_data.m_count = 0;
+         return true;
+       }
+      };
   } // namespace detail
 } // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
deleted file mode 100644 (file)
index 34426c5..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file mtf_lu_policy_imp.hpp
- * Contains a move-to-front policy implementation.
- */
-
-PB_DS_CLASS_T_DEC
-null_lu_metadata PB_DS_CLASS_C_DEC::s_metadata;
-
-PB_DS_CLASS_T_DEC
-typename PB_DS_CLASS_C_DEC::metadata_type
-PB_DS_CLASS_C_DEC::
-operator()() const
-{ return s_metadata; }
-
-PB_DS_CLASS_T_DEC
-inline bool
-PB_DS_CLASS_C_DEC::
-operator()(metadata_reference /*r_data*/) const
-{ return true; }
-
index c5da1e9d004d1251b6115c702751358dac007dbf..13ee6e1c7b05932f036dbb5a841bca9dbd031f1a 100644 (file)
 #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 (file)
index e2c4b9a..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file cond_dtor.hpp
- * Contains a conditional destructor
- */
-
-template<typename Size_Type>
-class cond_dtor
-{
-public:
-  cond_dtor(value_vector a_vec, iterator& r_last_it, Size_Type total_size) 
-  : m_a_vec(a_vec), m_r_last_it(r_last_it), m_max_size(total_size),
-    m_no_action(false)
-  { }
-
-  ~cond_dtor()
-  {
-    if (m_no_action)
-      return;
-    iterator it = m_a_vec;
-    while (it != m_r_last_it)
-      {
-       it->~value_type();
-       ++it;
-      }
-
-    if (m_max_size > 0)
-      value_allocator().deallocate(m_a_vec, m_max_size);
-  }
-
-  inline void
-  set_no_action()
-  { m_no_action = true; }
-
-protected:
-  value_vector m_a_vec;
-  iterator& m_r_last_it;
-  const Size_Type m_max_size;
-  bool m_no_action;
-};
index 1c3b9dd6e47a187181232c127058d00c371d17af..494ded24bd678c32aaa2667a2911ae5053d2d81c 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file constructors_destructor_fn_imps.hpp
+ * @file ov_tree_map_/constructors_destructor_fn_imps.hpp
  * Contains an implementation class for ov_tree_.
  */
 
@@ -48,7 +48,7 @@ PB_DS_CLASS_C_DEC::s_metadata_alloc;
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-PB_DS_OV_TREE_CLASS_NAME() :
+PB_DS_OV_TREE_NAME() :
   m_a_values(0),
   m_a_metadata(0),
   m_end_it(0),
@@ -57,8 +57,8 @@ PB_DS_OV_TREE_CLASS_NAME() :
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
-  cmp_fn_base(r_cmp_fn),
+PB_DS_OV_TREE_NAME(const Cmp_Fn& r_cmp_fn) :
+  cmp_fn(r_cmp_fn),
   m_a_values(0),
   m_a_metadata(0),
   m_end_it(0),
@@ -67,9 +67,9 @@ PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
-  cmp_fn_base(r_cmp_fn),
-  node_update(r_node_update),
+PB_DS_OV_TREE_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_nodeu) :
+  cmp_fn(r_cmp_fn),
+  node_update(r_nodeu),
   m_a_values(0),
   m_a_metadata(0),
   m_end_it(0),
@@ -78,11 +78,11 @@ PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_updat
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-PB_DS_OV_TREE_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+PB_DS_OV_TREE_NAME(const PB_DS_CLASS_C_DEC& other) :
 #ifdef PB_DS_TREE_TRACE
-  PB_DS_TREE_TRACE_BASE_C_DEC(other),
-#endif 
-  cmp_fn_base(other),
+  trace_base(other),
+#endif
+  cmp_fn(other),
   node_update(other),
   m_a_values(0),
   m_a_metadata(0),
@@ -100,23 +100,14 @@ PB_DS_CLASS_C_DEC::
 copy_from_range(It first_it, It last_it)
 {
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-  typedef
-    std::map<
-    key_type,
-    mapped_type,
-    Cmp_Fn,
-    typename Allocator::template rebind<
-    value_type>::other>
+  typedef std::map<key_type, mapped_type, Cmp_Fn,
+                  typename _Alloc::template rebind<value_type>::other>
     map_type;
-#else 
-  typedef
-    std::set<
-    key_type,
-    Cmp_Fn,
-    typename Allocator::template rebind<
-    Key>::other>
+#else
+  typedef std::set<key_type, Cmp_Fn,
+                  typename _Alloc::template rebind<Key>::other>
     map_type;
-#endif 
+#endif
 
   map_type m(first_it, last_it);
   copy_from_ordered_range(m.begin(), m.end());
@@ -141,24 +132,21 @@ copy_from_ordered_range(It first_it, It last_it)
   cond_dtor<size_type> cd(a_values, target_it, len);
   while (source_it != source_end_it)
     {
-      new (const_cast<void* >(static_cast<const void* >(target_it)))
-       value_type(*source_it++);
-
+      void* __v = const_cast<void*>(static_cast<const void*>(target_it));
+      new (__v) value_type(*source_it++);
       ++target_it;
     }
 
-  reallocate_metadata((node_update* )this, len);
+  reallocate_metadata((node_update*)this, len);
   cd.set_no_action();
   m_a_values = a_values;
   m_size = len;
   m_end_it = m_a_values + m_size;
-  update(PB_DS_node_begin_imp(), (node_update* )this);
+  update(PB_DS_node_begin_imp(), (node_update*)this);
 
 #ifdef _GLIBCXX_DEBUG
   for (const_iterator dbg_it = m_a_values; dbg_it != m_end_it; ++dbg_it)
-    {
-      debug_base::insert_new(PB_DS_V2F(*dbg_it));
-    }
+    debug_base::insert_new(PB_DS_V2F(*dbg_it));
 #endif
 }
 
@@ -166,12 +154,12 @@ PB_DS_CLASS_T_DEC
 template<typename It>
 void
 PB_DS_CLASS_C_DEC::
-copy_from_ordered_range(It first_it, It last_it, It other_first_it, 
+copy_from_ordered_range(It first_it, It last_it, It other_first_it,
                        It other_last_it)
 {
   clear();
-  const size_type len = std::distance(first_it, last_it) 
-                        + std::distance(other_first_it, other_last_it);
+  const size_type len = std::distance(first_it, last_it)
+                        + std::distance(other_first_it, other_last_it);
 
   value_vector a_values = s_value_alloc.allocate(len);
 
@@ -206,9 +194,7 @@ copy_from_ordered_range(It first_it, It last_it, It other_first_it,
 
 #ifdef _GLIBCXX_DEBUG
   for (const_iterator dbg_it = m_a_values; dbg_it != m_end_it; ++dbg_it)
-    {
-      debug_base::insert_new(PB_DS_V2F(*dbg_it));
-    }
+    debug_base::insert_new(PB_DS_V2F(*dbg_it));
 #endif
 }
 
@@ -220,7 +206,10 @@ swap(PB_DS_CLASS_C_DEC& other)
   PB_DS_ASSERT_VALID((*this))
   PB_DS_ASSERT_VALID(other)
   value_swap(other);
-  std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other);
+  std::swap(static_cast<cmp_fn&>(*this),
+           static_cast<cmp_fn&>(other));
+  std::swap(static_cast<traits_base&>(*this),
+           static_cast<traits_base&>(other));
   PB_DS_ASSERT_VALID(other)
   PB_DS_ASSERT_VALID((*this))
 }
@@ -230,18 +219,18 @@ void
 PB_DS_CLASS_C_DEC::
 value_swap(PB_DS_CLASS_C_DEC& other)
 {
+  _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
   std::swap(m_a_values, other.m_a_values);
   std::swap(m_a_metadata, other.m_a_metadata);
   std::swap(m_size, other.m_size);
   std::swap(m_end_it, other.m_end_it);
-  _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
 }
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-~PB_DS_OV_TREE_CLASS_NAME()
+~PB_DS_OV_TREE_NAME()
 {
-  //PB_DS_ASSERT_VALID((*this))
+  PB_DS_ASSERT_VALID((*this))
   cond_dtor<size_type> cd(m_a_values, m_end_it, m_size);
   reallocate_metadata((node_update*)this, 0);
 }
@@ -249,7 +238,7 @@ PB_DS_CLASS_C_DEC::
 PB_DS_CLASS_T_DEC
 inline void
 PB_DS_CLASS_C_DEC::
-update(node_iterator /*it*/, null_node_update_pointer)
+update(node_iterator, null_node_update_pointer)
 { }
 
 PB_DS_CLASS_T_DEC
@@ -258,10 +247,11 @@ void
 PB_DS_CLASS_C_DEC::
 update(node_iterator nd_it, Node_Update* p_update)
 {
-  const_node_iterator end_it = PB_DS_node_end_imp();
-  if (nd_it == end_it)
-    return;
-  update(nd_it.get_l_child(), p_update);
-  update(nd_it.get_r_child(), p_update);
-  node_update::operator()(nd_it, end_it);
+  node_const_iterator end_it = PB_DS_node_end_imp();
+  if (nd_it != end_it)
+    {
+      update(nd_it.get_l_child(), p_update);
+      update(nd_it.get_r_child(), p_update);
+      node_update::operator()(nd_it, end_it);
+    }
 }
index 1ba96d8edbba1ae40dff87e2f0218d5ef7cc521a..8c27a46500f4f6e8041fbefa3ee4e007d7ddad6b 100644 (file)
@@ -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
index a9bfab64e12efbb7d39abc87e313e639c533447f..31eb7c74920b8be96a31485d0984cb5e960c944f 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file erase_fn_imps.hpp
+ * @file ov_tree_map_/erase_fn_imps.hpp
  * Contains an implementation class for ov_tree_.
  */
 
@@ -70,11 +70,12 @@ erase_if(Pred pred)
   PB_DS_ASSERT_VALID((*this))
 
 #ifdef PB_DS_REGRESSION
-    typename Allocator::group_adjustor adjust(m_size);
-#endif 
+    typename _Alloc::group_adjustor adjust(m_size);
+#endif
 
   size_type new_size = 0;
   size_type num_val_ersd = 0;
+
   for (iterator source_it = begin(); source_it != m_end_it; ++source_it)
     if (!pred(*source_it))
       ++new_size;
@@ -94,16 +95,16 @@ erase_if(Pred pred)
   for (iterator source_it = begin(); source_it != m_end_it; ++source_it)
     {
       if (!pred(*source_it))
-        {
-         new (const_cast<void*>(static_cast<const void* >(target_it)))
+       {
+         new (const_cast<void*>(static_cast<const void*>(target_it)))
            value_type(*source_it);
 
          _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(*source_it)));
          ++target_it;
-        }
+       }
     }
 
-  reallocate_metadata((node_update* )this, new_size);
+  reallocate_metadata((node_update*)this, new_size);
   cd.set_no_action();
 
   {
@@ -113,7 +114,7 @@ erase_if(Pred pred)
   m_a_values = a_new_values;
   m_size = new_size;
   m_end_it = target_it;
-  update(node_begin(), (node_update* )this);
+  update(node_begin(), (node_update*)this);
   PB_DS_ASSERT_VALID((*this))
   return num_val_ersd;
 }
@@ -131,8 +132,8 @@ erase_imp(It it)
   PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(*it))
 
 #ifdef PB_DS_REGRESSION
-    typename Allocator::group_adjustor adjust(m_size);
-#endif 
+    typename _Alloc::group_adjustor adjust(m_size);
+#endif
 
   _GLIBCXX_DEBUG_ASSERT(m_size > 0);
   value_vector a_values = s_value_alloc.allocate(m_size - 1);
@@ -149,12 +150,12 @@ erase_imp(It it)
     {
       if (source_it != it)
        {
-          _GLIBCXX_DEBUG_ONLY(++cnt;)
+         _GLIBCXX_DEBUG_ONLY(++cnt;)
          _GLIBCXX_DEBUG_ASSERT(cnt != m_size);
-          new (const_cast<void* >(static_cast<const void* >(target_it)))
+         new (const_cast<void*>(static_cast<const void*>(target_it)))
              value_type(*source_it);
 
-          ++target_it;
+         ++target_it;
        }
       else
        ret_it = target_it;
@@ -162,9 +163,9 @@ erase_imp(It it)
     }
 
   _GLIBCXX_DEBUG_ASSERT(m_size > 0);
-  reallocate_metadata((node_update* )this, m_size - 1);
+  reallocate_metadata((node_update*)this, m_size - 1);
   cd.set_no_action();
-  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::erase_existing(PB_DS_V2F(*it));)
+  _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(*it));)
   {
     cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size);
   }
@@ -172,7 +173,7 @@ erase_imp(It it)
   m_a_values = a_values;
   --m_size;
   m_end_it = m_a_values + m_size;
-  update(node_begin(), (node_update* )this);
+  update(node_begin(), (node_update*)this);
   PB_DS_ASSERT_VALID((*this))
   return It(ret_it);
 }
@@ -180,7 +181,7 @@ erase_imp(It it)
 PB_DS_CLASS_T_DEC
 bool
 PB_DS_CLASS_C_DEC::
-erase(const_key_reference r_key)
+erase(key_const_reference r_key)
 {
   point_iterator it = find(r_key);
   if (it == end())
@@ -188,4 +189,3 @@ erase(const_key_reference r_key)
   erase(it);
   return true;
 }
-
index 7eeb85b7c197524ec33742662667f02e95cf137a..6beee7118c76fbe44805da33d4c5a4de7f940b4c 100644 (file)
@@ -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_.
  */
 
index 51d1b4d34bb943cb41b1f2a99b2aa8190a2ef7f4..e96628bdd88e4c822a94cb638ba0206bcdcb219e 100644 (file)
@@ -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_.
  */
 
index 40f110084c1e19faa9c6769af0f63857a3e2390f..af866866ce0c3cbb3856638e07b8a058d8ea8f5a 100644 (file)
 // warranty.
 
 /**
- * @file iterators_fn_imps.hpp
+ * @file ov_tree_map_/iterators_fn_imps.hpp
  * Contains an implementation class for ov_tree_.
  */
 
 PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+inline typename PB_DS_CLASS_C_DEC::node_const_iterator
 PB_DS_CLASS_C_DEC::
 node_begin() const
 { return PB_DS_node_begin_imp(); }
 
 PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+inline typename PB_DS_CLASS_C_DEC::node_const_iterator
 PB_DS_CLASS_C_DEC::
 node_end() const
 { return PB_DS_node_end_imp(); }
@@ -63,11 +63,11 @@ node_end()
 { return PB_DS_node_end_imp(); }
 
 PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+inline typename PB_DS_CLASS_C_DEC::node_const_iterator
 PB_DS_CLASS_C_DEC::
 PB_DS_node_begin_imp() const
 {
-  return const_node_iterator(const_cast<pointer>(mid_pointer(begin(), end())),
+  return node_const_iterator(const_cast<pointer>(mid_pointer(begin(), end())),
                              const_cast<pointer>(begin()),
                              const_cast<pointer>(end()),(m_a_metadata == 0)?
                              0 :
@@ -75,11 +75,11 @@ PB_DS_node_begin_imp() const
 }
 
 PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+inline typename PB_DS_CLASS_C_DEC::node_const_iterator
 PB_DS_CLASS_C_DEC::
 PB_DS_node_end_imp() const
 {
-  return const_node_iterator(end(), end(), end(),
+  return node_const_iterator(end(), end(), end(),
                     (m_a_metadata == 0) ? 0 : m_a_metadata + m_size);
 }
 
index 3517896a6f50038310ed40ab1f1c8afe64aba72b..79c9504385362790b57f8f7041cb711d798c4ba8 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file node_iterators.hpp
+ * @file ov_tree_map_/node_iterators.hpp
  * Contains an implementation class for ov_tree_.
  */
 
@@ -49,28 +49,27 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-
 #define PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC        \
-    ov_tree_node_const_it_<Value_Type, Metadata_Type, Allocator>
+    ov_tree_node_const_it_<Value_Type, Metadata_Type, _Alloc>
 
-    // Const node reference.
-    template<typename Value_Type, typename Metadata_Type, class Allocator>
+    /// Const node reference.
+    template<typename Value_Type, typename Metadata_Type, typename _Alloc>
     class ov_tree_node_const_it_
     {
 
     protected:
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
       Value_Type>::other::pointer
       pointer;
 
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        Value_Type>::other::const_pointer
       const_pointer;
 
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        Metadata_Type>::other::const_pointer
       const_metadata_pointer;
 
@@ -93,18 +92,18 @@ namespace __gnu_pbds
       typedef trivial_iterator_difference_type difference_type;
 
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        Value_Type>::other::const_pointer
       value_type;
 
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        typename remove_const<
        Value_Type>::type>::other::const_pointer
       reference;
 
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        typename remove_const<
        Value_Type>::type>::other::const_pointer
       const_reference;
@@ -112,9 +111,9 @@ namespace __gnu_pbds
       typedef Metadata_Type metadata_type;
 
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        metadata_type>::other::const_reference
-      const_metadata_reference;
+      metadata_const_reference;
 
     public:
       inline
@@ -125,12 +124,12 @@ namespace __gnu_pbds
       operator*() const
       { return m_p_value; }
 
-      inline const_metadata_reference
+      inline metadata_const_reference
       get_metadata() const
       {
        enum
          {
-           has_metadata = !is_same<Metadata_Type, null_node_metadata>::value
+           has_metadata = !is_same<Metadata_Type, null_type>::value
          };
 
        PB_DS_STATIC_ASSERT(should_have_metadata, has_metadata);
@@ -196,10 +195,10 @@ namespace __gnu_pbds
     };
 
 #define PB_DS_OV_TREE_NODE_ITERATOR_C_DEC \
-    ov_tree_node_it_<Value_Type, Metadata_Type, Allocator>
+    ov_tree_node_it_<Value_Type, Metadata_Type, _Alloc>
 
-    // Node reference.
-    template<typename Value_Type, typename Metadata_Type, class Allocator>
+    /// Node reference.
+    template<typename Value_Type, typename Metadata_Type, typename _Alloc>
     class ov_tree_node_it_ : public PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC
     {
 
@@ -223,18 +222,18 @@ namespace __gnu_pbds
       typedef trivial_iterator_difference_type difference_type;
 
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        Value_Type>::other::pointer
       value_type;
 
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        typename remove_const<
        Value_Type>::type>::other::pointer
       reference;
 
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        typename remove_const<
        Value_Type>::type>::other::pointer
       const_reference;
@@ -270,7 +269,9 @@ namespace __gnu_pbds
       get_r_child() const
       {
        if (base_type::m_p_value == base_type::m_p_end_value)
-         return (this_type(base_type::m_p_end_value,  base_type::m_p_end_value,  base_type::m_p_end_value));
+         return this_type(base_type::m_p_end_value,
+                          base_type::m_p_end_value,  
+                          base_type::m_p_end_value);
 
        const_metadata_pointer p_end_metadata =
          base_type::m_p_metadata + (base_type::m_p_end_value - base_type::m_p_value);
index 06436591ef5d642eec0bbbb5c49317d7e50c2e75..20a435047dd65232232af089b0e0d3766b8e48c3 100644 (file)
 // warranty.
 
 /**
- * @file ov_tree_map_.hpp
+ * @file ov_tree_map_/ov_tree_map_.hpp
  * Contains an implementation class for ov_tree_.
  */
 
 #include <map>
 #include <set>
+#include <ext/pb_ds/exception.hpp>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
 #include <ext/pb_ds/detail/types_traits.hpp>
-#include <ext/pb_ds/detail/debug_map_base.hpp>
 #include <ext/pb_ds/detail/type_utils.hpp>
-#include <ext/pb_ds/exception.hpp>
 #include <ext/pb_ds/detail/tree_trace_base.hpp>
+#ifdef _GLIBCXX_DEBUG
+#include <ext/pb_ds/detail/debug_map_base.hpp>
+#endif
 #include <utility>
 #include <functional>
 #include <algorithm>
@@ -58,159 +60,171 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-#define PB_DS_CLASS_T_DEC \
-    template<typename Key, typename Mapped, class Cmp_Fn, \
-            class Node_And_It_Traits, class Allocator>
-
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_OV_TREE_CLASS_NAME ov_tree_data_
-#endif 
+#define PB_DS_OV_TREE_NAME ov_tree_map
+#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_node_const_iterator_map
+#endif
 
 #ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_OV_TREE_CLASS_NAME ov_tree_no_data_
-#endif 
+#define PB_DS_OV_TREE_NAME ov_tree_set
+#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_node_const_iterator_set
+#endif
 
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_const_node_iterator_data_
-#else 
-#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_const_node_iterator_no_data_
-#endif 
+#define PB_DS_CLASS_T_DEC \
+    template<typename Key, typename Mapped, typename Cmp_Fn, \
+            typename Node_And_It_Traits, typename _Alloc>
 
 #define PB_DS_CLASS_C_DEC \
-   PB_DS_OV_TREE_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>
+   PB_DS_OV_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
 
-#define PB_DS_TYPES_TRAITS_C_DEC \
-    types_traits<Key, Mapped, Allocator, false>
+#define PB_DS_OV_TREE_TRAITS_BASE \
+    types_traits<Key, Mapped, _Alloc, false>
 
 #ifdef _GLIBCXX_DEBUG
 #define PB_DS_DEBUG_MAP_BASE_C_DEC \
     debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \
-               typename Allocator::template rebind<Key>::other::const_reference>
-#endif 
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#define PB_DS_EP2VP(X)& ((X)->m_value)
-#endif 
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped_Data()
-#define PB_DS_EP2VP(X)& ((X)->m_value.first)
-#endif 
+               typename _Alloc::template rebind<Key>::other::const_reference>
+#endif
 
 #ifdef PB_DS_TREE_TRACE
 #define PB_DS_TREE_TRACE_BASE_C_DEC \
-    tree_trace_base<typename Node_And_It_Traits::const_node_iterator,  \
+    tree_trace_base<typename Node_And_It_Traits::node_const_iterator,  \
                    typename Node_And_It_Traits::node_iterator,         \
-                   Cmp_Fn, false, Allocator>
+                   Cmp_Fn, false, _Alloc>
 #endif
 
 #ifndef PB_DS_CHECK_KEY_EXISTS
 #  error Missing definition
 #endif
 
-    // Ordered-vector tree associative-container.
-    template<typename Key, typename Mapped, class Cmp_Fn,
-            class Node_And_It_Traits, class Allocator>
-    class PB_DS_OV_TREE_CLASS_NAME :
+    /// Ordered-vector tree associative-container.
+    template<typename Key, typename Mapped, typename Cmp_Fn,
+            typename Node_And_It_Traits, typename _Alloc>
+    class PB_DS_OV_TREE_NAME :
 #ifdef _GLIBCXX_DEBUG
       protected PB_DS_DEBUG_MAP_BASE_C_DEC,
-#endif 
+#endif
 #ifdef PB_DS_TREE_TRACE
       public PB_DS_TREE_TRACE_BASE_C_DEC,
-#endif 
+#endif
       public Cmp_Fn,
       public Node_And_It_Traits::node_update,
-      public PB_DS_TYPES_TRAITS_C_DEC
+      public PB_DS_OV_TREE_TRAITS_BASE
     {
     private:
-      typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
+      typedef PB_DS_OV_TREE_TRAITS_BASE                        traits_base;
+      typedef Node_And_It_Traits                       traits_type;
 
       typedef typename remove_const<typename traits_base::value_type>::type non_const_value_type;
 
-      typedef typename Allocator::template rebind<non_const_value_type>::other value_allocator;
-      typedef typename value_allocator::pointer value_vector;
-
-
-      typedef Cmp_Fn cmp_fn_base;
+      typedef typename _Alloc::template rebind<non_const_value_type>::other value_allocator;
+      typedef typename value_allocator::pointer        value_vector;
 
 #ifdef _GLIBCXX_DEBUG
-      typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
-#endif 
+      typedef PB_DS_DEBUG_MAP_BASE_C_DEC               debug_base;
+#endif
+
+#ifdef PB_DS_TREE_TRACE
+      typedef PB_DS_TREE_TRACE_BASE_C_DEC              trace_base;
+#endif
 
-      typedef typename traits_base::pointer mapped_pointer_;
-      typedef typename traits_base::const_pointer const_mapped_pointer_;
+      typedef typename traits_base::pointer            mapped_pointer_;
+      typedef typename traits_base::const_pointer      mapped_const_pointer_;
 
-      typedef typename Node_And_It_Traits::metadata_type metadata_type;
+      typedef typename traits_type::metadata_type      metadata_type;
 
-      typedef typename Allocator::template rebind<metadata_type>::other metadata_allocator;
-      typedef typename metadata_allocator::pointer metadata_pointer;
-      typedef typename metadata_allocator::const_reference const_metadata_reference;
-      typedef typename metadata_allocator::reference metadata_reference;
+      typedef typename _Alloc::template rebind<metadata_type>::other metadata_allocator;
+      typedef typename metadata_allocator::pointer     metadata_pointer;
+      typedef typename metadata_allocator::const_reference metadata_const_reference;
+      typedef typename metadata_allocator::reference   metadata_reference;
 
-      typedef
-      typename Node_And_It_Traits::null_node_update_pointer
+      typedef typename traits_type::null_node_update_pointer
       null_node_update_pointer;
 
     public:
-
-      typedef Allocator allocator_type;
-      typedef typename Allocator::size_type size_type;
-      typedef typename Allocator::difference_type difference_type;
-
-      typedef Cmp_Fn cmp_fn;
-
-      typedef typename Node_And_It_Traits::node_update node_update;
-
-      typedef typename traits_base::key_type key_type;
-      typedef typename traits_base::key_pointer key_pointer;
-      typedef typename traits_base::const_key_pointer const_key_pointer;
-      typedef typename traits_base::key_reference key_reference;
-      typedef typename traits_base::const_key_reference const_key_reference;
-      typedef typename traits_base::mapped_type mapped_type;
-      typedef typename traits_base::mapped_pointer mapped_pointer;
-      typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
-      typedef typename traits_base::mapped_reference mapped_reference;
-      typedef typename traits_base::const_mapped_reference const_mapped_reference;
-      typedef typename traits_base::value_type value_type;
-      typedef typename traits_base::pointer pointer;
-      typedef typename traits_base::const_pointer const_pointer;
-      typedef typename traits_base::reference reference;
-      typedef typename traits_base::const_reference const_reference;
-
-      typedef const_pointer const_point_iterator;
-
+      typedef ov_tree_tag                               container_category;
+      typedef _Alloc                                   allocator_type;
+      typedef typename _Alloc::size_type               size_type;
+      typedef typename _Alloc::difference_type                 difference_type;
+      typedef Cmp_Fn                                   cmp_fn;
+
+      typedef typename traits_base::key_type           key_type;
+      typedef typename traits_base::key_pointer        key_pointer;
+      typedef typename traits_base::key_const_pointer  key_const_pointer;
+      typedef typename traits_base::key_reference      key_reference;
+      typedef typename traits_base::key_const_reference key_const_reference;
+      typedef typename traits_base::mapped_type        mapped_type;
+      typedef typename traits_base::mapped_pointer     mapped_pointer;
+      typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
+      typedef typename traits_base::mapped_reference   mapped_reference;
+      typedef typename traits_base::mapped_const_reference mapped_const_reference;
+      typedef typename traits_base::value_type                 value_type;
+      typedef typename traits_base::pointer            pointer;
+      typedef typename traits_base::const_pointer      const_pointer;
+      typedef typename traits_base::reference          reference;
+      typedef typename traits_base::const_reference    const_reference;
+
+      typedef const_pointer                            point_const_iterator;
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-      typedef pointer point_iterator;
-#else 
-      typedef const_point_iterator point_iterator;
-#endif 
-
-      typedef const_point_iterator const_iterator;
-
-      typedef point_iterator iterator;
-
-#include <ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp>
+      typedef pointer                                  point_iterator;
+#else
+      typedef point_const_iterator                     point_iterator;
+#endif
 
-      typedef
-      typename Node_And_It_Traits::const_node_iterator
-      const_node_iterator;
+      typedef point_iterator                           iterator;
+      typedef point_const_iterator                     const_iterator;
+
+      /// Conditional destructor.
+      template<typename Size_Type>
+        class cond_dtor
+        {
+       public:
+         cond_dtor(value_vector a_vec, iterator& r_last_it, 
+                   Size_Type total_size) 
+         : m_a_vec(a_vec), m_r_last_it(r_last_it), m_max_size(total_size),
+           m_no_action(false)
+         { }
+
+         ~cond_dtor()
+         {
+           if (m_no_action)
+             return;
+           iterator it = m_a_vec;
+           while (it != m_r_last_it)
+             {
+               it->~value_type();
+               ++it;
+             }
+           
+           if (m_max_size > 0)
+             value_allocator().deallocate(m_a_vec, m_max_size);
+         }
 
-      typedef typename Node_And_It_Traits::node_iterator node_iterator;
+         inline void
+         set_no_action()
+         { m_no_action = true; }
+         
+       protected:
+         value_vector          m_a_vec;
+         iterator&             m_r_last_it;
+         const Size_Type       m_max_size;
+         bool                  m_no_action;
+       };
+      
+      typedef typename traits_type::node_update        node_update;
+      typedef typename traits_type::node_iterator      node_iterator;
+      typedef typename traits_type::node_const_iterator        node_const_iterator;
 
-    public:
 
-      PB_DS_OV_TREE_CLASS_NAME();
+      PB_DS_OV_TREE_NAME();
 
-      PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn&);
+      PB_DS_OV_TREE_NAME(const Cmp_Fn&);
 
-      PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn&, const node_update&);
+      PB_DS_OV_TREE_NAME(const Cmp_Fn&, const node_update&);
 
-      PB_DS_OV_TREE_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+      PB_DS_OV_TREE_NAME(const PB_DS_CLASS_C_DEC&);
 
-      ~PB_DS_OV_TREE_CLASS_NAME();
+      ~PB_DS_OV_TREE_NAME();
 
       void
       swap(PB_DS_CLASS_C_DEC&);
@@ -228,14 +242,14 @@ namespace __gnu_pbds
       inline size_type
       size() const;
 
-      Cmp_Fn& 
+      Cmp_Fn&
       get_cmp_fn();
 
-      const Cmp_Fn& 
+      const Cmp_Fn&
       get_cmp_fn() const;
 
       inline mapped_reference
-      operator[](const_key_reference r_key)
+      operator[](key_const_reference r_key)
       {
 #ifdef PB_DS_DATA_TRUE_INDICATOR
        PB_DS_ASSERT_VALID((*this))
@@ -246,19 +260,18 @@ namespace __gnu_pbds
            PB_DS_ASSERT_VALID((*this))
             return it->second;
          }
-
-       return (insert_new_val(it, std::make_pair(r_key, mapped_type()))->second);
-#else 
+       return insert_new_val(it, std::make_pair(r_key, mapped_type()))->second;
+#else
        insert(r_key);
-       return traits_base::s_null_mapped;
-#endif 
+       return traits_base::s_null_type;
+#endif
       }
 
       inline std::pair<point_iterator, bool>
       insert(const_reference r_value)
       {
        PB_DS_ASSERT_VALID((*this))
-       const_key_reference r_key = PB_DS_V2F(r_value);
+       key_const_reference r_key = PB_DS_V2F(r_value);
        point_iterator it = lower_bound(r_key);
 
        if (it != end()&&  !Cmp_Fn::operator()(r_key, PB_DS_V2F(*it)))
@@ -272,14 +285,14 @@ namespace __gnu_pbds
       }
 
       inline point_iterator
-      lower_bound(const_key_reference r_key)
+      lower_bound(key_const_reference r_key)
       {
        pointer it = m_a_values;
        pointer e_it = m_a_values + m_size;
        while (it != e_it)
          {
            pointer mid_it = it + ((e_it - it) >> 1);
-           if (cmp_fn_base::operator()(PB_DS_V2F(*mid_it), r_key))
+           if (cmp_fn::operator()(PB_DS_V2F(*mid_it), r_key))
              it = ++mid_it;
            else
              e_it = mid_it;
@@ -287,15 +300,15 @@ namespace __gnu_pbds
        return it;
       }
 
-      inline const_point_iterator
-      lower_bound(const_key_reference r_key) const
+      inline point_const_iterator
+      lower_bound(key_const_reference r_key) const
       { return const_cast<PB_DS_CLASS_C_DEC& >(*this).lower_bound(r_key); }
 
       inline point_iterator
-      upper_bound(const_key_reference r_key)
+      upper_bound(key_const_reference r_key)
       {
        iterator pot_it = lower_bound(r_key);
-       if (pot_it != end()&&  !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it)))
+       if (pot_it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it)))
          {
            PB_DS_CHECK_KEY_EXISTS(r_key)
            return ++pot_it;
@@ -305,12 +318,12 @@ namespace __gnu_pbds
        return pot_it;
       }
 
-      inline const_point_iterator
-      upper_bound(const_key_reference r_key) const
+      inline point_const_iterator
+      upper_bound(key_const_reference r_key) const
       { return const_cast<PB_DS_CLASS_C_DEC&>(*this).upper_bound(r_key); }
 
       inline point_iterator
-      find(const_key_reference r_key)
+      find(key_const_reference r_key)
       {
        PB_DS_ASSERT_VALID((*this))
        iterator pot_it = lower_bound(r_key);
@@ -324,12 +337,12 @@ namespace __gnu_pbds
        return end();
       }
 
-      inline const_point_iterator
-      find(const_key_reference r_key) const
-      { return (const_cast<PB_DS_CLASS_C_DEC& >(*this).find(r_key)); }
+      inline point_const_iterator
+      find(key_const_reference r_key) const
+      { return (const_cast<PB_DS_CLASS_C_DEC&>(*this).find(r_key)); }
 
       bool
-      erase(const_key_reference);
+      erase(key_const_reference);
 
       template<typename Pred>
       inline size_type
@@ -346,7 +359,7 @@ namespace __gnu_pbds
       join(PB_DS_CLASS_C_DEC&);
 
       void
-      split(const_key_reference, PB_DS_CLASS_C_DEC&);
+      split(key_const_reference, PB_DS_CLASS_C_DEC&);
 
       inline iterator
       begin()
@@ -364,10 +377,10 @@ namespace __gnu_pbds
       end() const
       { return m_end_it; }
 
-      inline const_node_iterator
+      inline node_const_iterator
       node_begin() const;
 
-      inline const_node_iterator
+      inline node_const_iterator
       node_end() const;
 
       inline node_iterator
@@ -379,7 +392,7 @@ namespace __gnu_pbds
     private:
 
       inline void
-      update(node_iterator /*it*/, null_node_update_pointer);
+      update(node_iterator, null_node_update_pointer);
 
       template<typename Node_Update>
       void
@@ -415,8 +428,8 @@ namespace __gnu_pbds
       insert_new_val(iterator it, const_reference r_value)
       {
 #ifdef PB_DS_REGRESSION
-         typename Allocator::group_adjustor adjust(m_size);
-#endif 
+       typename _Alloc::group_adjustor adjust(m_size);
+#endif
 
        PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_value))
 
@@ -430,23 +443,23 @@ namespace __gnu_pbds
        cond_dtor<size_type> cd(a_values, target_it, m_size + 1);
        while (source_it != it)
          {
-           new (const_cast<void* >(static_cast<const void* >(target_it)))
+           new (const_cast<void*>(static_cast<const void*>(target_it)))
              value_type(*source_it++);
            ++target_it;
          }
 
-       new (const_cast<void* >(static_cast<const void* >(ret_it = target_it)))
+       new (const_cast<void*>(static_cast<const void*>(ret_it = target_it)))
          value_type(r_value);
        ++target_it;
 
        while (source_it != source_end_it)
          {
-           new (const_cast<void* >(static_cast<const void* >(target_it)))
+           new (const_cast<void*>(static_cast<const void*>(target_it)))
              value_type(*source_it++);
            ++target_it;
          }
 
-       reallocate_metadata((node_update* )this, m_size + 1);
+       reallocate_metadata((node_update*)this, m_size + 1);
        cd.set_no_action();
        if (m_size != 0)
          {
@@ -464,20 +477,20 @@ namespace __gnu_pbds
 
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_valid(const char* file, int line) const;
+      assert_valid(const char*, int) const;
 
       void
-      assert_iterators(const char* file, int line) const;
-#endif 
+      assert_iterators(const char*, int) const;
+#endif
 
       template<typename It>
       It
-      erase_imp(It it);
+      erase_imp(It);
 
-      inline const_node_iterator
+      inline node_const_iterator
       PB_DS_node_begin_imp() const;
 
-      inline const_node_iterator
+      inline node_const_iterator
       PB_DS_node_end_imp() const;
 
       inline node_iterator
@@ -487,13 +500,13 @@ namespace __gnu_pbds
       PB_DS_node_end_imp();
 
     private:
-      static value_allocator s_value_alloc;
+      static value_allocator   s_value_alloc;
       static metadata_allocator s_metadata_alloc;
 
-      value_vector m_a_values;
-      metadata_pointer m_a_metadata;
-      iterator m_end_it;
-      size_type m_size;
+      value_vector             m_a_values;
+      metadata_pointer                 m_a_metadata;
+      iterator                         m_end_it;
+      size_type                m_size;
     };
 
 #include <ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp>
@@ -507,17 +520,12 @@ namespace __gnu_pbds
 
 #undef PB_DS_CLASS_C_DEC
 #undef PB_DS_CLASS_T_DEC
-#undef PB_DS_OV_TREE_CLASS_NAME
-#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_OV_TREE_NAME
+#undef PB_DS_OV_TREE_TRAITS_BASE
 #undef PB_DS_DEBUG_MAP_BASE_C_DEC
 #ifdef PB_DS_TREE_TRACE
 #undef PB_DS_TREE_TRACE_BASE_C_DEC
-#endif 
-
-#undef PB_DS_V2F
-#undef PB_DS_EP2VP
-#undef PB_DS_V2S
+#endif
 #undef PB_DS_CONST_NODE_ITERATOR_NAME
-
   } // namespace detail
 } // namespace __gnu_pbds
index c06d6f851f331f8b3dda82eee0adb00d547ee0cc..eafe0b039b2be1dc900fcf333f309f9ed54af728 100644 (file)
@@ -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
index 567a52e0218585249995c94aaffdd65ddea92f8d..a12c2320cc2cb9c714ed1618e923e8af245a2d96 100644 (file)
 // 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))
index 63cb0f7fb4c31fdadfffd07a36e8a9bc5c05dfbb..359e599627bce2136393ef4639cc53b1a0d4230c 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file traits.hpp
+ * @file ov_tree_map_/traits.hpp
  * Contains an implementation class for ov_tree_.
  */
 
@@ -47,135 +47,135 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-
+    /// Tree traits.
     template<typename Key,
             typename Mapped,
             class Cmp_Fn,
-            template<typename Const_Node_Iterator,
-                     class Node_Iterator,
+            template<typename Node_CItr,
+                     class Node_Itr,
                      class Cmp_Fn_,
-                     class Allocator_>
+                     typename _Alloc_>
     class Node_Update,
-            class Allocator>
+            typename _Alloc>
     struct tree_traits<
       Key,
       Mapped,
       Cmp_Fn,
       Node_Update,
       ov_tree_tag,
-      Allocator>
+      _Alloc>
     {
     private:
       typedef
       typename types_traits<
       Key,
       Mapped,
-      Allocator,
+      _Alloc,
       false>::value_type
       value_type;
 
     public:
       typedef
-      typename tree_node_metadata_selector<
+      typename tree_node_metadata_dispatch<
       Key,
       Mapped,
       Cmp_Fn,
       Node_Update,
-      Allocator>::type
+      _Alloc>::type
       metadata_type;
 
       typedef
       ov_tree_node_const_it_<
        value_type,
        metadata_type,
-       Allocator>
-      const_node_iterator;
+       _Alloc>
+      node_const_iterator;
 
       typedef
       ov_tree_node_it_<
        value_type,
        metadata_type,
-       Allocator>
+       _Alloc>
       node_iterator;
 
       typedef
       Node_Update<
-       const_node_iterator,
+       node_const_iterator,
        node_iterator,
        Cmp_Fn,
-       Allocator>
+       _Alloc>
       node_update;
 
       typedef
-      __gnu_pbds::null_tree_node_update<
-       const_node_iterator,
+      __gnu_pbds::null_node_update<
+       node_const_iterator,
        node_iterator,
        Cmp_Fn,
-       Allocator>* 
+       _Alloc>* 
       null_node_update_pointer;
     };
 
+    /// Specialization.
     template<typename Key,
             class Cmp_Fn,
-            template<typename Const_Node_Iterator,
-                     class Node_Iterator,
+            template<typename Node_CItr,
+                     class Node_Itr,
                      class Cmp_Fn_,
-                     class Allocator_>
+                     typename _Alloc_>
     class Node_Update,
-            class Allocator>
+            typename _Alloc>
     struct tree_traits<
       Key,
-      null_mapped_type,
+      null_type,
       Cmp_Fn,
       Node_Update,
       ov_tree_tag,
-      Allocator>
+      _Alloc>
     {
     private:
       typedef
       typename types_traits<
       Key,
-      null_mapped_type,
-      Allocator,
+      null_type,
+      _Alloc,
       false>::value_type
       value_type;
 
     public:
       typedef
-      typename tree_node_metadata_selector<
+      typename tree_node_metadata_dispatch<
       Key,
-      null_mapped_type,
+      null_type,
       Cmp_Fn,
       Node_Update,
-      Allocator>::type
+      _Alloc>::type
       metadata_type;
 
       typedef
       ov_tree_node_const_it_<
        value_type,
        metadata_type,
-       Allocator>
-      const_node_iterator;
+       _Alloc>
+      node_const_iterator;
 
-      typedef const_node_iterator node_iterator;
+      typedef node_const_iterator node_iterator;
 
       typedef
       Node_Update<
-       const_node_iterator,
-       const_node_iterator,
+       node_const_iterator,
+       node_const_iterator,
        Cmp_Fn,
-       Allocator>
+       _Alloc>
       node_update;
 
       typedef
-      __gnu_pbds::null_tree_node_update<
-       const_node_iterator,
+      __gnu_pbds::null_node_update<
+       node_const_iterator,
        node_iterator,
        Cmp_Fn,
-       Allocator>* 
+       _Alloc>* 
       null_node_update_pointer;
     };
-
   } // namespace detail
 } // namespace __gnu_pbds
 
index 6a70ea47601bd0a078dc1eafa5d3b59607c48577..0b836c549cdcdf94d95561df7a6c04515a28c43c 100644 (file)
@@ -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()
 { }
index 7212db2c539ca73f2795bc649b01a0b8fa9ac971..802c95e9b50b911292c86af39953365011714259 100644 (file)
@@ -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.
  */
 
index be3a41c782748b5ef2833ed01715d1e77ced1155..d6303c3294ed53078fd3703187cff45a7496a99f 100644 (file)
@@ -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.
  */
 
index c02373b2f3a9287d2545f17eceec3029351f5600..49b2ca6342dd7798929caa3d0b264f763a5adc5b 100644 (file)
@@ -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;
 }
index 07e6b00cb83faf80abb646ac36e4d6202dccdfad..ced5eeb0819289972a6b9c42063b7a6c14d51c38 100644 (file)
@@ -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))
 }
-
index 3bdb82fb649d699d5387f6863b0ed450dfe34019..85e098ad4c8d6d179ef1aa480f6bd0031a3805c1 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file pairing_heap_.hpp
+ * @file pairing_heap_/pairing_heap_.hpp
  * Contains an implementation class for a pairing heap.
  */
 
 #include <ext/pb_ds/detail/cond_dealtor.hpp>
 #include <ext/pb_ds/detail/type_utils.hpp>
 #include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>
-#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>
 #include <debug/debug.h>
 
 namespace __gnu_pbds
 {
   namespace detail
   {
-
 #define PB_DS_CLASS_T_DEC \
-  template<typename Value_Type, class Cmp_Fn, class Allocator>
+  template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
 
 #define PB_DS_CLASS_C_DEC \
-  pairing_heap_<Value_Type, Cmp_Fn, Allocator>
+  pairing_heap<Value_Type, Cmp_Fn, _Alloc>
 
 #ifdef _GLIBCXX_DEBUG
-#define PB_DS_BASE_C_DEC \
-  left_child_next_sibling_heap_<Value_Type, \
-                               Cmp_Fn, \
-                               null_left_child_next_sibling_heap_node_metadata, \
-                               Allocator, \
-                               false>
-#else 
-#define PB_DS_BASE_C_DEC                                               \
-  left_child_next_sibling_heap_<Value_Type, \
-                               Cmp_Fn, \
-                               null_left_child_next_sibling_heap_node_metadata, \
-                               Allocator>
-#endif 
-
-    /**
-     * class description = "P4ri|\|g h3ap$">
-     **/
-    template<typename Value_Type, class Cmp_Fn, class Allocator>
-    class pairing_heap_ : public PB_DS_BASE_C_DEC
-    {
+#define PB_DS_P_HEAP_BASE \
+  left_child_next_sibling_heap<Value_Type, Cmp_Fn, null_type, _Alloc, false>
+#else
+#define PB_DS_P_HEAP_BASE \
+  left_child_next_sibling_heap<Value_Type, Cmp_Fn, null_type, _Alloc>
+#endif
 
+    /// Pairing heap.
+    template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
+    class pairing_heap : public PB_DS_P_HEAP_BASE
+    {
     private:
-      typedef PB_DS_BASE_C_DEC base_type;
+      typedef PB_DS_P_HEAP_BASE                                base_type;
+      typedef typename base_type::node_pointer                 node_pointer;
 
-      typedef typename base_type::node_pointer node_pointer;
+      typedef typename _Alloc::template rebind<Value_Type>::other __rebind_a;
 
     public:
+      typedef Value_Type                               value_type;
+      typedef Cmp_Fn                                   cmp_fn;
+      typedef _Alloc                                   allocator_type;
+      typedef typename _Alloc::size_type               size_type;
+      typedef typename _Alloc::difference_type                 difference_type;
 
-      typedef typename Allocator::size_type size_type;
-
-      typedef typename Allocator::difference_type difference_type;
-
-      typedef Value_Type value_type;
-
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::pointer
-      pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::const_pointer
-      const_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::reference
-      reference;
-
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::const_reference
-      const_reference;
-
-      typedef
-      typename PB_DS_BASE_C_DEC::const_point_iterator
-      const_point_iterator;
-
-      typedef typename PB_DS_BASE_C_DEC::point_iterator point_iterator;
-
-      typedef typename PB_DS_BASE_C_DEC::const_iterator const_iterator;
-
-      typedef typename PB_DS_BASE_C_DEC::iterator iterator;
-
-      typedef Cmp_Fn cmp_fn;
-
-      typedef Allocator allocator_type;
+      typedef typename __rebind_a::pointer             pointer;
+      typedef typename __rebind_a::const_pointer       const_pointer;
+      typedef typename __rebind_a::reference           reference;
+      typedef typename __rebind_a::const_reference     const_reference;
 
+      typedef typename base_type::point_const_iterator point_const_iterator;
+      typedef typename base_type::point_iterator       point_iterator;
+      typedef typename base_type::const_iterator       const_iterator;
+      typedef typename base_type::iterator             iterator;
 
-      pairing_heap_();
+      pairing_heap();
 
-      pairing_heap_(const Cmp_Fn& r_cmp_fn);
+      pairing_heap(const Cmp_Fn&);
 
-      pairing_heap_(const PB_DS_CLASS_C_DEC& other);
+      pairing_heap(const pairing_heap&);
 
       void
-      swap(PB_DS_CLASS_C_DEC& other);
+      swap(pairing_heap&);
 
-      ~pairing_heap_();
+      ~pairing_heap();
 
       inline point_iterator
-      push(const_reference r_val);
+      push(const_reference);
 
       void
-      modify(point_iterator it, const_reference r_new_val);
+      modify(point_iterator, const_reference);
 
       inline const_reference
       top() const;
@@ -156,51 +119,51 @@ namespace __gnu_pbds
       pop();
 
       void
-      erase(point_iterator it);
+      erase(point_iterator);
 
       template<typename Pred>
       size_type
-      erase_if(Pred pred);
+      erase_if(Pred);
 
       template<typename Pred>
       void
-      split(Pred pred, PB_DS_CLASS_C_DEC& other);
+      split(Pred, pairing_heap&);
 
       void
-      join(PB_DS_CLASS_C_DEC& other);
+      join(pairing_heap&);
 
     protected:
 
       template<typename It>
       void
-      copy_from_range(It first_it, It last_it);
+      copy_from_range(It, It);
 
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_valid(const char* file, int line) const;
+      assert_valid(const char*, int) const;
 #endif
 
     private:
 
       inline void
-      push_imp(node_pointer p_nd);
+      push_imp(node_pointer);
 
       node_pointer
-      join_node_children(node_pointer p_nd);
+      join_node_children(node_pointer);
 
       node_pointer
-      forward_join(node_pointer p_nd, node_pointer p_next);
+      forward_join(node_pointer, node_pointer);
 
       node_pointer
-      back_join(node_pointer p_nd, node_pointer p_next);
+      back_join(node_pointer, node_pointer);
 
       void
-      remove_node(node_pointer p_nd);
+      remove_node(node_pointer);
     };
 
-#define PB_DS_ASSERT_NODE_CONSISTENT(_Node, _Bool)                     \
 _GLIBCXX_DEBUG_ONLY(assert_node_consistent(_Node, _Bool,             \
-                                            __FILE__, __LINE__);)
+#define PB_DS_ASSERT_NODE_CONSISTENT(_Node, _Bool) \
_GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(_Node, _Bool,   \
+                                                      __FILE__, __LINE__);)
 
 #include <ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp>
 #include <ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp>
@@ -212,7 +175,7 @@ namespace __gnu_pbds
 #undef PB_DS_ASSERT_NODE_CONSISTENT
 #undef PB_DS_CLASS_C_DEC
 #undef PB_DS_CLASS_T_DEC
-#undef PB_DS_BASE_C_DEC
+#undef PB_DS_P_HEAP_BASE
 
   } // namespace detail
 } // namespace __gnu_pbds
index e5469b9b99bae4bdb4497c60cb7f6db6df6c03fc..a74ed63b8453ebe4390c377e62a1097b0dfc7484 100644 (file)
@@ -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 (file)
index b7cdf23..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file child_iterator.hpp
- * Contains a iterator for a patricia tree.
- */
-
-struct iterator : public const_iterator
-{
-public:
-  typedef std::forward_iterator_tag iterator_category;
-  typedef typename Allocator::difference_type difference_type;
-  typedef node_pointer value_type;
-  typedef node_pointer_pointer pointer;
-  typedef node_pointer_reference reference;
-
-  inline
-  iterator(node_pointer_pointer p_p_cur = 0,  
-          node_pointer_pointer p_p_end = 0) 
-  : const_iterator(p_p_cur, p_p_end)
-  { }
-
-  inline bool
-  operator==(const iterator& other) const
-  { return const_iterator::m_p_p_cur == other.m_p_p_cur; }
-
-  inline bool
-  operator!=(const iterator& other) const
-  { return const_iterator::m_p_p_cur != other.m_p_p_cur; }
-
-  inline iterator& 
-  operator++()
-  {
-    const_iterator::operator++();
-    return *this;
-  }
-
-  inline iterator
-  operator++(int)
-  {
-    iterator ret_it(*this);
-    operator++();
-    return ret_it;
-  }
-
-  node_pointer_pointer
-  operator->()
-  {
-    _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)
-    return const_iterator::m_p_p_cur;
-  }
-
-  node_pointer
-  operator*()
-  {
-    _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)
-    return *const_iterator::m_p_p_cur;
-  }
-};
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
deleted file mode 100644 (file)
index 184b986..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file cond_dtor_entry_dealtor.hpp
- * Contains a binary tree container conditional deallocator
- */
-
-class cond_dealtor
-{
-public:
-  inline
-  cond_dealtor(leaf_pointer p_nd) : m_p_nd(p_nd),
-                                   m_no_action_dtor(false),
-                                   m_call_destructor(false)
-  { }
-
-  inline void
-  set_no_action_dtor()
-  {
-    m_no_action_dtor = true;
-  }
-
-  inline void
-  set_call_destructor()
-  {
-    m_call_destructor = true;
-  }
-
-  inline
-  ~cond_dealtor()
-  {
-    if (m_no_action_dtor)
-      return;
-
-    if (m_call_destructor)
-      m_p_nd->~leaf();
-
-    s_leaf_allocator.deallocate(m_p_nd, 1);
-  }
-
-protected:
-  leaf_pointer m_p_nd;
-  bool m_no_action_dtor;
-  bool m_call_destructor;
-};
-
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
deleted file mode 100644 (file)
index 730148e..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file const_child_iterator.hpp
- * Contains a const_iterator for a patricia tree.
- */
-
-struct const_iterator
-{
-public:
-  typedef std::forward_iterator_tag iterator_category;
-
-  typedef typename Allocator::difference_type difference_type;
-
-  typedef node_pointer value_type;
-
-  typedef node_pointer_pointer pointer;
-
-  typedef node_pointer_reference reference;
-
-public:
-  inline
-  const_iterator(node_pointer_pointer p_p_cur = 0,  
-                node_pointer_pointer p_p_end = 0) 
-  : m_p_p_cur(p_p_cur), m_p_p_end(p_p_end)
-  { }
-
-  inline bool
-  operator==(const const_iterator& other) const
-  { return m_p_p_cur == other.m_p_p_cur; }
-
-  inline bool
-  operator!=(const const_iterator& other) const
-  { return m_p_p_cur != other.m_p_p_cur; }
-
-  inline const_iterator& 
-  operator++()
-  {
-    do
-      ++m_p_p_cur;
-    while (m_p_p_cur != m_p_p_end&& * m_p_p_cur == 0);
-    return *this;
-  }
-
-  inline const_iterator
-  operator++(int)
-  {
-    const_iterator ret_it(*this);
-    operator++();
-    return ret_it;
-  }
-
-  const node_pointer_pointer
-  operator->() const
-  {
-    _GLIBCXX_DEBUG_ONLY(assert_referencible();)
-    return (m_p_p_cur);
-  }
-
-  const_node_pointer
-  operator*() const
-  {
-    _GLIBCXX_DEBUG_ONLY(assert_referencible();)
-    return (*m_p_p_cur);
-  }
-
-protected:
-#ifdef _GLIBCXX_DEBUG
-  void
-  assert_referencible() const
-  { _GLIBCXX_DEBUG_ASSERT(m_p_p_cur != m_p_p_end&& * m_p_p_cur != 0); }
-#endif 
-
-public:
-  node_pointer_pointer m_p_p_cur;
-  node_pointer_pointer m_p_p_end;
-};
-
index 6201b1d8525a8ecb84fc1b5cb853a643fe7c76b1..8370a2ec885007d328d7b4ecc5db656d9f62633a 100644 (file)
@@ -1,4 +1,4 @@
-// -*- C++ -*-
+ // -*- C++ -*-
 
 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
 // Free Software Foundation, Inc.
@@ -35,8 +35,8 @@
 // warranty.
 
 /**
- * @file constructors_destructor_fn_imps.hpp
- * Contains an implementation class for bin_search_tree_.
+ * @file pat_trie_/constructors_destructor_fn_imps.hpp
+ * Contains an implementation class for pat_trie.
  */
 
 PB_DS_CLASS_T_DEC
@@ -44,8 +44,8 @@ typename PB_DS_CLASS_C_DEC::head_allocator
 PB_DS_CLASS_C_DEC::s_head_allocator;
 
 PB_DS_CLASS_T_DEC
-typename PB_DS_CLASS_C_DEC::internal_node_allocator
-PB_DS_CLASS_C_DEC::s_internal_node_allocator;
+typename PB_DS_CLASS_C_DEC::inode_allocator
+PB_DS_CLASS_C_DEC::s_inode_allocator;
 
 PB_DS_CLASS_T_DEC
 typename PB_DS_CLASS_C_DEC::leaf_allocator
@@ -53,7 +53,7 @@ PB_DS_CLASS_C_DEC::s_leaf_allocator;
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME() :
+PB_DS_PAT_TRIE_NAME() :
   m_p_head(s_head_allocator.allocate(1)),
   m_size(0)
 {
@@ -63,8 +63,8 @@ PB_DS_CLASS_NAME() :
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const e_access_traits& r_e_access_traits) :
-  synth_e_access_traits(r_e_access_traits),
+PB_DS_PAT_TRIE_NAME(const access_traits& r_access_traits) :
+  synth_access_traits(r_access_traits),
   m_p_head(s_head_allocator.allocate(1)),
   m_size(0)
 {
@@ -74,11 +74,11 @@ PB_DS_CLASS_NAME(const e_access_traits& r_e_access_traits) :
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+PB_DS_PAT_TRIE_NAME(const PB_DS_CLASS_C_DEC& other) :
 #ifdef _GLIBCXX_DEBUG
   debug_base(other),
 #endif
-  synth_e_access_traits(other),
+  synth_access_traits(other),
   node_update(other),
   m_p_head(s_head_allocator.allocate(1)),
   m_size(0)
@@ -115,7 +115,7 @@ swap(PB_DS_CLASS_C_DEC& other)
   PB_DS_ASSERT_VALID((*this))
   PB_DS_ASSERT_VALID(other)
   value_swap(other);
-  std::swap((e_access_traits& )(*this), (e_access_traits& )other);
+  std::swap((access_traits& )(*this), (access_traits& )other);
   PB_DS_ASSERT_VALID((*this))
   PB_DS_ASSERT_VALID(other)
 }
@@ -132,7 +132,7 @@ value_swap(PB_DS_CLASS_C_DEC& other)
 
 PB_DS_CLASS_T_DEC
 PB_DS_CLASS_C_DEC::
-~PB_DS_CLASS_NAME()
+~PB_DS_PAT_TRIE_NAME()
 {
   clear();
   s_head_allocator.deallocate(m_p_head, 1);
@@ -163,36 +163,33 @@ copy_from_range(It first_it, It last_it)
 PB_DS_CLASS_T_DEC
 typename PB_DS_CLASS_C_DEC::node_pointer
 PB_DS_CLASS_C_DEC::
-recursive_copy_node(const_node_pointer p_other_nd)
+recursive_copy_node(node_const_pointer p_ncp)
 {
-  _GLIBCXX_DEBUG_ASSERT(p_other_nd != 0);
-  if (p_other_nd->m_type == pat_trie_leaf_node_type)
+  _GLIBCXX_DEBUG_ASSERT(p_ncp != 0);
+  if (p_ncp->m_type == leaf_node)
     {
-      const_leaf_pointer p_other_leaf = static_cast<const_leaf_pointer>(p_other_nd);
-
+      leaf_const_pointer p_other_lf = static_cast<leaf_const_pointer>(p_ncp);
       leaf_pointer p_new_lf = s_leaf_allocator.allocate(1);
       cond_dealtor cond(p_new_lf);
-      new (p_new_lf) leaf(p_other_leaf->value());
-      apply_update(p_new_lf, (node_update* )this);
+      new (p_new_lf) leaf(p_other_lf->value());
+      apply_update(p_new_lf, (node_update*)this);
       cond.set_no_action_dtor();
       return (p_new_lf);
     }
 
-  _GLIBCXX_DEBUG_ASSERT(p_other_nd->m_type == pat_trie_internal_node_type);
-  node_pointer a_p_children[internal_node::arr_size];
+  _GLIBCXX_DEBUG_ASSERT(p_ncp->m_type == i_node);
+  node_pointer a_p_children[inode::arr_size];
   size_type child_i = 0;
-  const_internal_node_pointer p_other_internal_nd =
-    static_cast<const_internal_node_pointer>(p_other_nd);
+  inode_const_pointer p_icp = static_cast<inode_const_pointer>(p_ncp);
 
-  typename internal_node::const_iterator child_it =
-    p_other_internal_nd->begin();
+  typename inode::const_iterator child_it = p_icp->begin();
 
-  internal_node_pointer p_ret;
+  inode_pointer p_ret;
   __try
     {
-      while (child_it != p_other_internal_nd->end())
+      while (child_it != p_icp->end())
        a_p_children[child_i++] = recursive_copy_node(*(child_it++));
-      p_ret = s_internal_node_allocator.allocate(1);
+      p_ret = s_inode_allocator.allocate(1);
     }
   __catch(...)
     {
@@ -201,8 +198,7 @@ recursive_copy_node(const_node_pointer p_other_nd)
       __throw_exception_again;
     }
 
-  new (p_ret) internal_node(p_other_internal_nd->get_e_ind(),
-                           pref_begin(a_p_children[0]));
+  new (p_ret) inode(p_icp->get_e_ind(), pref_begin(a_p_children[0]));
 
   --child_i;
   _GLIBCXX_DEBUG_ASSERT(child_i >= 1);
@@ -210,6 +206,6 @@ recursive_copy_node(const_node_pointer p_other_nd)
     p_ret->add_child(a_p_children[child_i], pref_begin(a_p_children[child_i]),
                     pref_end(a_p_children[child_i]), this);
   while (child_i-- > 0);
-  apply_update(p_ret, (node_update* )this);
+  apply_update(p_ret, (node_update*)this);
   return p_ret;
 }
index 1beceb568efabc582cded1acd28078d8d085c77e..0aa4b28c10ef90f3f2a26958a86051ddf19f6e3e 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file debug_fn_imps.hpp
+ * @file pat_trie_/debug_fn_imps.hpp
  * Contains an implementation class for pat_trie_.
  */
 
@@ -57,8 +57,8 @@ assert_valid(const char* __file, int __line) const
       return;
     }
 
-  PB_DS_DEBUG_VERIFY(m_p_head->m_p_min->m_type == pat_trie_leaf_node_type);
-  PB_DS_DEBUG_VERIFY(m_p_head->m_p_max->m_type == pat_trie_leaf_node_type);
+  PB_DS_DEBUG_VERIFY(m_p_head->m_p_min->m_type == leaf_node);
+  PB_DS_DEBUG_VERIFY(m_p_head->m_p_max->m_type == leaf_node);
   PB_DS_DEBUG_VERIFY(!empty());
 }
 
@@ -87,8 +87,8 @@ assert_reverse_iterators(const char* __file, int __line) const
   for (const_reverse_iterator it = rbegin(); it != rend(); ++it)
     {
       ++calc_size;
-      const_node_pointer p_nd =
-       const_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(PB_DS_V2F(*it));
+      node_const_pointer p_nd =
+       const_cast<PB_DS_CLASS_C_DEC*>(this)->find_imp(PB_DS_V2F(*it));
       PB_DS_DEBUG_VERIFY(p_nd == it.m_p_nd);
     }
   PB_DS_DEBUG_VERIFY(calc_size == m_size);
@@ -97,22 +97,19 @@ assert_reverse_iterators(const char* __file, int __line) const
 PB_DS_CLASS_T_DEC
 typename PB_DS_CLASS_C_DEC::size_type
 PB_DS_CLASS_C_DEC::
-recursive_count_leafs(const_node_pointer p_nd,
-                     const char* __file, int __line)
+recursive_count_leafs(node_const_pointer p_nd, const char* __file, int __line)
 {
   if (p_nd == 0)
     return (0);
-  if (p_nd->m_type == pat_trie_leaf_node_type)
+  if (p_nd->m_type == leaf_node)
     return (1);
-  PB_DS_DEBUG_VERIFY(p_nd->m_type == pat_trie_internal_node_type);
+  PB_DS_DEBUG_VERIFY(p_nd->m_type == i_node);
   size_type ret = 0;
-  for (typename internal_node::const_iterator it =
-        static_cast<const_internal_node_pointer>(p_nd)->begin();
-       it != static_cast<const_internal_node_pointer>(p_nd)->end();
+  for (typename inode::const_iterator it = static_cast<inode_const_pointer>(p_nd)->begin();
+       it != static_cast<inode_const_pointer>(p_nd)->end();
        ++it)
     ret += recursive_count_leafs(*it, __file, __line);
   return ret;
 }
 
-#endif 
-
+#endif
index cbf1b417098d47db1929414d4d94c9659db94149..c0ccd108e42961dd64f25dfca1cb162eb6de6dbd 100644 (file)
 // warranty.
 
 /**
- * @file erase_fn_imps.hpp
- * Contains an implementation class for bin_search_tree_.
+ * @file pat_trie_/erase_fn_imps.hpp
+ * Contains an implementation class for pat_trie.
  */
 
 PB_DS_CLASS_T_DEC
 inline bool
 PB_DS_CLASS_C_DEC::
-erase(const_key_reference r_key)
+erase(key_const_reference r_key)
 {
   node_pointer p_nd = find_imp(r_key);
-  if (p_nd == 0 || p_nd->m_type == pat_trie_internal_node_type)
+  if (p_nd == 0 || p_nd->m_type == i_node)
     {
       PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
       return false;
     }
 
-  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_leaf_node_type);
-  if (!synth_e_access_traits::equal_keys(PB_DS_V2F(reinterpret_cast<leaf_pointer>(p_nd)->value()), r_key))
+  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == leaf_node);
+  if (!synth_access_traits::equal_keys(PB_DS_V2F(reinterpret_cast<leaf_pointer>(p_nd)->value()), r_key))
     {
       PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
       return false;
@@ -66,48 +66,47 @@ erase(const_key_reference r_key)
 PB_DS_CLASS_T_DEC
 void
 PB_DS_CLASS_C_DEC::
-erase_fixup(internal_node_pointer p_nd)
+erase_fixup(inode_pointer p_nd)
 {
   _GLIBCXX_DEBUG_ASSERT(std::distance(p_nd->begin(), p_nd->end()) >= 1);
   if (std::distance(p_nd->begin(), p_nd->end()) == 1)
     {
       node_pointer p_parent = p_nd->m_p_parent;
       if (p_parent == m_p_head)
-       m_p_head->m_p_parent =p_nd->begin();
+       m_p_head->m_p_parent = *p_nd->begin();
       else
-        {
-         _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == pat_trie_internal_node_type);
-         node_pointer p_new_child =p_nd->begin();
-         static_cast<internal_node_pointer>(p_parent)->replace_child(
-                                                                     p_new_child,
-                                                                     pref_begin(p_new_child),
-                                                                     pref_end(p_new_child),
-                                                                     this);
-        }
+       {
+         _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == i_node);
+         node_pointer p_new_child = *p_nd->begin();
+
+         typedef inode_pointer inode_ptr;
+         inode_ptr p_internal = static_cast<inode_ptr>(p_parent);
+         p_internal->replace_child(p_new_child, pref_begin(p_new_child),
+                                   pref_end(p_new_child), this);
+       }
       (*p_nd->begin())->m_p_parent = p_nd->m_p_parent;
-      p_nd->~internal_node();
-      s_internal_node_allocator.deallocate(p_nd, 1);
+      p_nd->~inode();
+      s_inode_allocator.deallocate(p_nd, 1);
 
       if (p_parent == m_p_head)
        return;
 
-      _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == pat_trie_internal_node_type);
-      p_nd = static_cast<internal_node_pointer>(p_parent);
+      _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == i_node);
+      p_nd = static_cast<inode_pointer>(p_parent);
     }
 
   while (true)
     {
       _GLIBCXX_DEBUG_ASSERT(std::distance(p_nd->begin(), p_nd->end()) > 1);
       p_nd->update_prefixes(this);
-      apply_update(p_nd, (node_update* )this);
+      apply_update(p_nd, (node_update*)this);
       PB_DS_ASSERT_NODE_VALID(p_nd)
-      if (p_nd->m_p_parent->m_type == pat_trie_head_node_type)
-        return;
+      if (p_nd->m_p_parent->m_type == head_node)
+       return;
 
-      _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_parent->m_type ==
-                      pat_trie_internal_node_type);
+      _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_parent->m_type == i_node);
 
-      p_nd = static_cast<internal_node_pointer>(p_nd->m_p_parent);
+      p_nd = static_cast<inode_pointer>(p_nd->m_p_parent);
     }
 }
 
@@ -118,7 +117,7 @@ actual_erase_leaf(leaf_pointer p_l)
 {
   _GLIBCXX_DEBUG_ASSERT(m_size > 0);
   --m_size;
-  _GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_l->value())));
+  _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_l->value())));
   p_l->~leaf();
   s_leaf_allocator.deallocate(p_l, 1);
 }
@@ -128,15 +127,14 @@ void
 PB_DS_CLASS_C_DEC::
 clear()
 {
-  PB_DS_ASSERT_VALID((*this))
-  if (empty())
-    return;
-
-  clear_imp(m_p_head->m_p_parent);
-  m_size = 0;
-  initialize();
-  _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
-  PB_DS_ASSERT_VALID((*this))
+  if (!empty())
+    {
+      clear_imp(m_p_head->m_p_parent);
+      m_size = 0;
+      initialize();
+      _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
+      PB_DS_ASSERT_VALID((*this))
+    }
 }
 
 PB_DS_CLASS_T_DEC
@@ -144,22 +142,22 @@ void
 PB_DS_CLASS_C_DEC::
 clear_imp(node_pointer p_nd)
 {
-  if (p_nd->m_type == pat_trie_internal_node_type)
+  if (p_nd->m_type == i_node)
     {
-      _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
-      for (typename internal_node::iterator it =
-            static_cast<internal_node_pointer>(p_nd)->begin();
-          it != static_cast<internal_node_pointer>(p_nd)->end();
+      _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
+      for (typename inode::iterator it =
+            static_cast<inode_pointer>(p_nd)->begin();
+          it != static_cast<inode_pointer>(p_nd)->end();
           ++it)
-        {
+       {
          node_pointer p_child =* it;
          clear_imp(p_child);
-        }
-      s_internal_node_allocator.deallocate(static_cast<internal_node_pointer>(p_nd), 1);
+       }
+      s_inode_allocator.deallocate(static_cast<inode_pointer>(p_nd), 1);
       return;
     }
 
-  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_leaf_node_type);
+  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == leaf_node);
   static_cast<leaf_pointer>(p_nd)->~leaf();
   s_leaf_allocator.deallocate(static_cast<leaf_pointer>(p_nd), 1);
 }
@@ -176,7 +174,7 @@ erase(const_iterator it)
 
   const_iterator ret_it = it;
   ++ret_it;
-  _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);
+  _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);
   erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
   PB_DS_ASSERT_VALID((*this))
   return ret_it;
@@ -194,7 +192,7 @@ erase(iterator it)
     return it;
   iterator ret_it = it;
   ++ret_it;
-  _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);
+  _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);
   erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
   PB_DS_ASSERT_VALID((*this))
   return ret_it;
@@ -213,7 +211,7 @@ erase(const_reverse_iterator it)
   const_reverse_iterator ret_it = it;
   ++ret_it;
 
-  _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);
+  _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);
   erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
   PB_DS_ASSERT_VALID((*this))
   return ret_it;
@@ -232,7 +230,7 @@ erase(reverse_iterator it)
   reverse_iterator ret_it = it;
   ++ret_it;
 
-  _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);
+  _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == leaf_node);
   erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
   PB_DS_ASSERT_VALID((*this))
   return ret_it;
@@ -254,8 +252,8 @@ erase_if(Pred pred)
       PB_DS_ASSERT_VALID((*this))
       if (pred(*it))
        {
-          ++num_ersd;
-          it = erase(it);
+         ++num_ersd;
+         it = erase(it);
        }
       else
        ++it;
@@ -271,7 +269,7 @@ PB_DS_CLASS_C_DEC::
 erase_leaf(leaf_pointer p_l)
 {
   update_min_max_for_erased_leaf(p_l);
-  if (p_l->m_p_parent->m_type == pat_trie_head_node_type)
+  if (p_l->m_p_parent->m_type == head_node)
     {
       _GLIBCXX_DEBUG_ASSERT(size() == 1);
       clear();
@@ -279,11 +277,9 @@ erase_leaf(leaf_pointer p_l)
     }
 
   _GLIBCXX_DEBUG_ASSERT(size() > 1);
-  _GLIBCXX_DEBUG_ASSERT(p_l->m_p_parent->m_type ==
-                  pat_trie_internal_node_type);
+  _GLIBCXX_DEBUG_ASSERT(p_l->m_p_parent->m_type == i_node);
 
-  internal_node_pointer p_parent =
-    static_cast<internal_node_pointer>(p_l->m_p_parent);
+  inode_pointer p_parent = static_cast<inode_pointer>(p_l->m_p_parent);
 
   p_parent->remove_child(p_l);
   erase_fixup(p_parent);
@@ -302,7 +298,7 @@ update_min_max_for_erased_leaf(leaf_pointer p_l)
       return;
     }
 
-  if (p_l == static_cast<const_leaf_pointer>(m_p_head->m_p_min))
+  if (p_l == static_cast<leaf_const_pointer>(m_p_head->m_p_min))
     {
       iterator it(p_l);
       ++it;
@@ -310,7 +306,7 @@ update_min_max_for_erased_leaf(leaf_pointer p_l)
       return;
     }
 
-  if (p_l == static_cast<const_leaf_pointer>(m_p_head->m_p_max))
+  if (p_l == static_cast<leaf_const_pointer>(m_p_head->m_p_max))
     {
       iterator it(p_l);
       --it;
index e2e20f186d77be2fedd24db9acc1f5c0622b047d..bbef9d7a04365631cb2c5221a165b2d6fa530744 100644 (file)
 // warranty.
 
 /**
- * @file find_fn_imps.hpp
- * Contains an implementation class for bin_search_tree_.
+ * @file pat_trie_/find_fn_imps.hpp
+ * Contains an implementation class for pat_trie.
  */
 
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::point_iterator
 PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key)
+find(key_const_reference r_key)
 {
   PB_DS_ASSERT_VALID((*this))
   node_pointer p_nd = find_imp(r_key);
 
-  if (p_nd == 0 || p_nd->m_type != pat_trie_leaf_node_type)
+  if (p_nd == 0 || p_nd->m_type != leaf_node)
     {
       PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
       return end();
     }
 
-  if (synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_nd)->value()), r_key))
+  if (synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_nd)->value()), r_key))
     {
       PB_DS_CHECK_KEY_EXISTS(r_key)
       return iterator(p_nd);
@@ -63,21 +63,21 @@ find(const_key_reference r_key)
 }
 
 PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
 PB_DS_CLASS_C_DEC::
-find(const_key_reference r_key) const
+find(key_const_reference r_key) const
 {
   PB_DS_ASSERT_VALID((*this))
 
-  const_node_pointer p_nd = const_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(r_key);
+  node_const_pointer p_nd = const_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(r_key);
 
-  if (p_nd == 0 || p_nd->m_type != pat_trie_leaf_node_type)
+  if (p_nd == 0 || p_nd->m_type != leaf_node)
     {
       PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
       return end();
     }
 
-  if (synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value()), r_key))
+  if (synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value()), r_key))
     {
       PB_DS_CHECK_KEY_EXISTS(r_key)
       return const_iterator(const_cast<node_pointer>(p_nd));
@@ -90,23 +90,23 @@ find(const_key_reference r_key) const
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::node_pointer
 PB_DS_CLASS_C_DEC::
-find_imp(const_key_reference r_key)
+find_imp(key_const_reference r_key)
 {
   if (empty())
-    return (0);
+    return 0;
 
-  typename synth_e_access_traits::const_iterator b_it =
-    synth_e_access_traits::begin(r_key);
-  typename synth_e_access_traits::const_iterator e_it =
-    synth_e_access_traits::end(r_key);
+  typename synth_access_traits::const_iterator b_it =
+    synth_access_traits::begin(r_key);
+  typename synth_access_traits::const_iterator e_it =
+    synth_access_traits::end(r_key);
 
   node_pointer p_nd = m_p_head->m_p_parent;
   _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
 
-  while (p_nd->m_type != pat_trie_leaf_node_type)
+  while (p_nd->m_type != leaf_node)
     {
-      _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
-      node_pointer p_next_nd = static_cast<internal_node_pointer>(p_nd)->get_child_node(b_it,  e_it,  this);
+      _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
+      node_pointer p_next_nd = static_cast<inode_pointer>(p_nd)->get_child_node(b_it,  e_it,  this);
 
       if (p_next_nd == 0)
        return p_nd;
@@ -118,7 +118,7 @@ find_imp(const_key_reference r_key)
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::node_pointer
 PB_DS_CLASS_C_DEC::
-lower_bound_imp(const_key_reference r_key)
+lower_bound_imp(key_const_reference r_key)
 {
   if (empty())
     return (m_p_head);
@@ -126,30 +126,30 @@ lower_bound_imp(const_key_reference r_key)
   node_pointer p_nd = m_p_head->m_p_parent;
   _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
 
-  typename PB_DS_CLASS_C_DEC::const_e_iterator b_it =
-    synth_e_access_traits::begin(r_key);
+  typename PB_DS_CLASS_C_DEC::a_const_iterator b_it =
+    synth_access_traits::begin(r_key);
 
-  typename PB_DS_CLASS_C_DEC::const_e_iterator e_it =
-    synth_e_access_traits::end(r_key);
+  typename PB_DS_CLASS_C_DEC::a_const_iterator e_it =
+    synth_access_traits::end(r_key);
 
   size_type checked_ind = 0;
   while (true)
     {
-      if (p_nd->m_type == pat_trie_leaf_node_type)
+      if (p_nd->m_type == leaf_node)
         {
-         if (!synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value()), r_key))
+         if (!synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value()), r_key))
            return p_nd;
          iterator it(p_nd);
          ++it;
          return it.m_p_nd;
         }
 
-      _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
+      _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
       const size_type new_checked_ind =
-       static_cast<internal_node_pointer>(p_nd)->get_e_ind();
+       static_cast<inode_pointer>(p_nd)->get_e_ind();
 
       p_nd =
-       static_cast<internal_node_pointer>(p_nd)->get_lower_bound_child_node(                b_it, e_it, checked_ind, this);
+       static_cast<inode_pointer>(p_nd)->get_lower_bound_child_node(                b_it, e_it, checked_ind, this);
       checked_ind = new_checked_ind;
     }
 }
@@ -157,84 +157,84 @@ lower_bound_imp(const_key_reference r_key)
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::point_iterator
 PB_DS_CLASS_C_DEC::
-lower_bound(const_key_reference r_key)
+lower_bound(key_const_reference r_key)
 { return point_iterator(lower_bound_imp(r_key)); }
 
 PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
 PB_DS_CLASS_C_DEC::
-lower_bound(const_key_reference r_key) const
+lower_bound(key_const_reference r_key) const
 {
-  return const_point_iterator(const_cast<PB_DS_CLASS_C_DEC* >(this)->lower_bound_imp(r_key));
+  return point_const_iterator(const_cast<PB_DS_CLASS_C_DEC* >(this)->lower_bound_imp(r_key));
 }
 
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::point_iterator
 PB_DS_CLASS_C_DEC::
-upper_bound(const_key_reference r_key)
+upper_bound(key_const_reference r_key)
 {
   point_iterator l_bound_it = lower_bound(r_key);
 
   _GLIBCXX_DEBUG_ASSERT(l_bound_it == end() ||
-                  !synth_e_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
+                  !synth_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
                                                    r_key));
 
   if (l_bound_it == end() ||
-      synth_e_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
+      synth_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
     return l_bound_it;
 
   return ++l_bound_it;
 }
 
 PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+inline typename PB_DS_CLASS_C_DEC::point_const_iterator
 PB_DS_CLASS_C_DEC::
-upper_bound(const_key_reference r_key) const
+upper_bound(key_const_reference r_key) const
 {
-  const_point_iterator l_bound_it = lower_bound(r_key);
+  point_const_iterator l_bound_it = lower_bound(r_key);
 
   _GLIBCXX_DEBUG_ASSERT(l_bound_it == end() ||
-                  !synth_e_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
+                  !synth_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
                                                    r_key));
 
   if (l_bound_it == end() ||
-      synth_e_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
+      synth_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
     return l_bound_it;
   return ++l_bound_it;
 }
 
 PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_e_iterator
+inline typename PB_DS_CLASS_C_DEC::a_const_iterator
 PB_DS_CLASS_C_DEC::
-pref_begin(const_node_pointer p_nd)
+pref_begin(node_const_pointer p_nd)
 {
-  if (p_nd->m_type == pat_trie_leaf_node_type)
-    return (synth_e_access_traits::begin(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value())));
+  if (p_nd->m_type == leaf_node)
+    return (synth_access_traits::begin(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value())));
 
-  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
-  return static_cast<const_internal_node_pointer>(p_nd)->pref_b_it();
+  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
+  return static_cast<inode_const_pointer>(p_nd)->pref_b_it();
 }
 
 PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_e_iterator
+inline typename PB_DS_CLASS_C_DEC::a_const_iterator
 PB_DS_CLASS_C_DEC::
-pref_end(const_node_pointer p_nd)
+pref_end(node_const_pointer p_nd)
 {
-  if (p_nd->m_type == pat_trie_leaf_node_type)
-    return (synth_e_access_traits::end(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value())));
+  if (p_nd->m_type == leaf_node)
+    return (synth_access_traits::end(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value())));
 
-  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
-  return static_cast<const_internal_node_pointer>(p_nd)->pref_e_it();
+  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
+  return static_cast<inode_const_pointer>(p_nd)->pref_e_it();
 }
 
 PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_leaf_pointer
+inline typename PB_DS_CLASS_C_DEC::leaf_const_pointer
 PB_DS_CLASS_C_DEC::
-leftmost_descendant(const_node_pointer p_nd)
+leftmost_descendant(node_const_pointer p_nd)
 {
-  if (p_nd->m_type == pat_trie_leaf_node_type)
-    return static_cast<const_leaf_pointer>(p_nd);
-  return static_cast<const_internal_node_pointer>(p_nd)->leftmost_descendant();
+  if (p_nd->m_type == leaf_node)
+    return static_cast<leaf_const_pointer>(p_nd);
+  return static_cast<inode_const_pointer>(p_nd)->leftmost_descendant();
 }
 
 PB_DS_CLASS_T_DEC
@@ -242,19 +242,19 @@ inline typename PB_DS_CLASS_C_DEC::leaf_pointer
 PB_DS_CLASS_C_DEC::
 leftmost_descendant(node_pointer p_nd)
 {
-  if (p_nd->m_type == pat_trie_leaf_node_type)
+  if (p_nd->m_type == leaf_node)
     return static_cast<leaf_pointer>(p_nd);
-  return static_cast<internal_node_pointer>(p_nd)->leftmost_descendant();
+  return static_cast<inode_pointer>(p_nd)->leftmost_descendant();
 }
 
 PB_DS_CLASS_T_DEC
-inline typename PB_DS_CLASS_C_DEC::const_leaf_pointer
+inline typename PB_DS_CLASS_C_DEC::leaf_const_pointer
 PB_DS_CLASS_C_DEC::
-rightmost_descendant(const_node_pointer p_nd)
+rightmost_descendant(node_const_pointer p_nd)
 {
-  if (p_nd->m_type == pat_trie_leaf_node_type)
-    return static_cast<const_leaf_pointer>(p_nd);
-  return static_cast<const_internal_node_pointer>(p_nd)->rightmost_descendant();
+  if (p_nd->m_type == leaf_node)
+    return static_cast<leaf_const_pointer>(p_nd);
+  return static_cast<inode_const_pointer>(p_nd)->rightmost_descendant();
 }
 
 PB_DS_CLASS_T_DEC
@@ -262,8 +262,8 @@ inline typename PB_DS_CLASS_C_DEC::leaf_pointer
 PB_DS_CLASS_C_DEC::
 rightmost_descendant(node_pointer p_nd)
 {
-  if (p_nd->m_type == pat_trie_leaf_node_type)
+  if (p_nd->m_type == leaf_node)
     return static_cast<leaf_pointer>(p_nd);
-  return static_cast<internal_node_pointer>(p_nd)->rightmost_descendant();
+  return static_cast<inode_pointer>(p_nd)->rightmost_descendant();
 }
 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/head.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/head.hpp
deleted file mode 100644 (file)
index bca847d..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file head.hpp
- * Contains a leaf for a patricia tree.
- */
-
-#ifndef PB_DS_PAT_TRIE_IHEAD_HPP
-#define PB_DS_PAT_TRIE_IHEAD_HPP
-
-#include <ext/pb_ds/detail/pat_trie_/node_base.hpp>
-#include <debug/debug.h>
-
-namespace __gnu_pbds
-{
-  namespace detail
-  {
-#define PB_DS_CLASS_T_DEC \
-    template<typename Type_Traits, typename E_Access_Traits,   \
-             typename Metadata, typename Allocator>
-
-#define PB_DS_CLASS_C_DEC \
-    pat_trie_head<Type_Traits, E_Access_Traits,        Metadata, Allocator>
-
-#define PB_DS_BASE_C_DEC \
-    pat_trie_node_base<Type_Traits, E_Access_Traits, Metadata, Allocator>
-
-    template<typename Type_Traits,
-            typename E_Access_Traits,
-            typename Metadata,
-            typename Allocator>
-    struct pat_trie_head : public PB_DS_BASE_C_DEC
-    {
-    private:
-      typedef E_Access_Traits e_access_traits;
-
-      typedef
-      typename Allocator::template rebind<
-       e_access_traits>::other::const_pointer
-      const_e_access_traits_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       PB_DS_BASE_C_DEC>::other::pointer
-      node_pointer;
-
-#ifdef _GLIBCXX_DEBUG
-      typedef
-      typename PB_DS_BASE_C_DEC::subtree_debug_info
-      subtree_debug_info;
-#endif 
-
-    public:
-      pat_trie_head();
-
-#ifdef _GLIBCXX_DEBUG
-      virtual subtree_debug_info
-      assert_valid_imp(const_e_access_traits_pointer p_traits,
-                      const char* file, int line) const;
-#endif 
-
-    public:
-      node_pointer m_p_min;
-
-      node_pointer m_p_max;
-    };
-
-    PB_DS_CLASS_T_DEC
-    PB_DS_CLASS_C_DEC::
-    pat_trie_head() : PB_DS_BASE_C_DEC(pat_trie_head_node_type)
-    { }
-
-#ifdef _GLIBCXX_DEBUG
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::subtree_debug_info
-    PB_DS_CLASS_C_DEC::
-    assert_valid_imp(const_e_access_traits_pointer /*p_traits*/,
-                    const char* __file, int __line) const
-    {
-      _GLIBCXX_DEBUG_VERIFY_AT(false,
-                              _M_message("Assertion from %1;:%2;")
-                              ._M_string(__FILE__)._M_integer(__LINE__),
-                              __file, __line);
-      return subtree_debug_info();
-    }
-#endif 
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-#undef PB_DS_BASE_C_DEC
-
-  } // namespace detail
-} // namespace __gnu_pbds
-
-#endif
-
index 81d7096a94d74547c49ccf680d806cfe706ac214..8246b5182520db189a92e304827a6fc9d5dfb7f6 100644 (file)
@@ -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(); }
 
index 9afce8b0945d69a04cb806e0c4114a5c1d5a7c69..1b11280fd321d653eb95ed18bf2cefd40ccb0cb1 100644 (file)
@@ -34,8 +34,8 @@
 // warranty.
 
 /**
- * @file insert_join_fn_imps.hpp
- * Contains an implementation class for bin_search_tree_.
+ * @file pat_trie_/insert_join_fn_imps.hpp
+ * Contains an implementation class for pat_trie.
  */
 
 PB_DS_CLASS_T_DEC
@@ -45,7 +45,7 @@ join(PB_DS_CLASS_C_DEC& other)
 {
   PB_DS_ASSERT_VALID((*this))
   PB_DS_ASSERT_VALID(other)
-  split_join_branch_bag bag;
+  branch_bag bag;
   if (!join_prep(other, bag))
     {
       PB_DS_ASSERT_VALID((*this))
@@ -53,7 +53,7 @@ join(PB_DS_CLASS_C_DEC& other)
       return;
     }
 
-  m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent, 
+  m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent,
                                  other.m_p_head->m_p_parent, 0, bag);
 
   m_p_head->m_p_parent->m_p_parent = m_p_head;
@@ -68,7 +68,7 @@ join(PB_DS_CLASS_C_DEC& other)
 PB_DS_CLASS_T_DEC
 bool
 PB_DS_CLASS_C_DEC::
-join_prep(PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)
+join_prep(PB_DS_CLASS_C_DEC& other, branch_bag& r_bag)
 {
   PB_DS_ASSERT_VALID((*this))
   PB_DS_ASSERT_VALID(other)
@@ -82,12 +82,12 @@ join_prep(PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)
     }
 
   const bool greater =
-    synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_max)->value()),
-                                   PB_DS_V2F(static_cast<const_leaf_pointer>(other.m_p_head->m_p_min)->value()));
+    synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_max)->value()),
+                                   PB_DS_V2F(static_cast<leaf_const_pointer>(other.m_p_head->m_p_min)->value()));
 
   const bool lesser =
-    synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(other.m_p_head->m_p_max)->value()),
-                                   PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_min)->value()));
+    synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(other.m_p_head->m_p_max)->value()),
+                                   PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_min)->value()));
 
   if (!greater && !lesser)
     __throw_join_error();
@@ -100,91 +100,92 @@ join_prep(PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)
 PB_DS_CLASS_T_DEC
 void
 PB_DS_CLASS_C_DEC::
-rec_join_prep(const_node_pointer p_l, const_node_pointer p_r, split_join_branch_bag& r_bag)
+rec_join_prep(node_const_pointer p_l, node_const_pointer p_r, 
+             branch_bag& r_bag)
 {
-  if (p_l->m_type == pat_trie_leaf_node_type)
+  if (p_l->m_type == leaf_node)
     {
-      if (p_r->m_type == pat_trie_leaf_node_type)
-        {
-         rec_join_prep(static_cast<const_leaf_pointer>(p_l),
-                       static_cast<const_leaf_pointer>(p_r), r_bag);
+      if (p_r->m_type == leaf_node)
+       {
+         rec_join_prep(static_cast<leaf_const_pointer>(p_l),
+                       static_cast<leaf_const_pointer>(p_r), r_bag);
          return;
-        }
+       }
 
-      _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);
-      rec_join_prep(static_cast<const_leaf_pointer>(p_l),
-                   static_cast<const_internal_node_pointer>(p_r), r_bag);
+      _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);
+      rec_join_prep(static_cast<leaf_const_pointer>(p_l),
+                   static_cast<inode_const_pointer>(p_r), r_bag);
       return;
     }
 
-  _GLIBCXX_DEBUG_ASSERT(p_l->m_type == pat_trie_internal_node_type);
-  if (p_r->m_type == pat_trie_leaf_node_type)
+  _GLIBCXX_DEBUG_ASSERT(p_l->m_type == i_node);
+  if (p_r->m_type == leaf_node)
     {
-      rec_join_prep(static_cast<const_internal_node_pointer>(p_l),
-                   static_cast<const_leaf_pointer>(p_r), r_bag);
+      rec_join_prep(static_cast<inode_const_pointer>(p_l),
+                   static_cast<leaf_const_pointer>(p_r), r_bag);
       return;
     }
 
-  _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);
+  _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);
 
-  rec_join_prep(static_cast<const_internal_node_pointer>(p_l),
-               static_cast<const_internal_node_pointer>(p_r), r_bag);
+  rec_join_prep(static_cast<inode_const_pointer>(p_l),
+               static_cast<inode_const_pointer>(p_r), r_bag);
 }
 
 PB_DS_CLASS_T_DEC
 void
 PB_DS_CLASS_C_DEC::
-rec_join_prep(const_leaf_pointer /*p_l*/, const_leaf_pointer /*p_r*/, 
-             split_join_branch_bag& r_bag)
+rec_join_prep(leaf_const_pointer /*p_l*/, leaf_const_pointer /*p_r*/,
+             branch_bag& r_bag)
 { r_bag.add_branch(); }
 
 PB_DS_CLASS_T_DEC
 void
 PB_DS_CLASS_C_DEC::
-rec_join_prep(const_leaf_pointer /*p_l*/, const_internal_node_pointer /*p_r*/, 
-             split_join_branch_bag& r_bag)
+rec_join_prep(leaf_const_pointer /*p_l*/, inode_const_pointer /*p_r*/,
+             branch_bag& r_bag)
 { r_bag.add_branch(); }
 
 PB_DS_CLASS_T_DEC
 void
 PB_DS_CLASS_C_DEC::
-rec_join_prep(const_internal_node_pointer /*p_l*/, const_leaf_pointer /*p_r*/, 
-             split_join_branch_bag& r_bag)
+rec_join_prep(inode_const_pointer /*p_l*/, leaf_const_pointer /*p_r*/,
+             branch_bag& r_bag)
 { r_bag.add_branch(); }
 
 PB_DS_CLASS_T_DEC
 void
 PB_DS_CLASS_C_DEC::
-rec_join_prep(const_internal_node_pointer p_l, const_internal_node_pointer p_r,
-             split_join_branch_bag& r_bag)
+rec_join_prep(inode_const_pointer p_l, inode_const_pointer p_r,
+             branch_bag& r_bag)
 {
-  if (p_l->get_e_ind() == p_r->get_e_ind() && 
-      synth_e_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),
+  if (p_l->get_e_ind() == p_r->get_e_ind() &&
+      synth_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),
                                            p_r->pref_b_it(), p_r->pref_e_it()))
     {
-      for (typename internal_node::const_iterator it = p_r->begin();
+      for (typename inode::const_iterator it = p_r->begin();
           it != p_r->end(); ++ it)
-        {
-         const_node_pointer p_l_join_child = p_l->get_join_child(*it, this);
+       {
+         node_const_pointer p_l_join_child = p_l->get_join_child(*it, this);
          if (p_l_join_child != 0)
            rec_join_prep(p_l_join_child, * it, r_bag);
-        }
+       }
       return;
     }
 
-  if (p_r->get_e_ind() < p_l->get_e_ind() && 
+  if (p_r->get_e_ind() < p_l->get_e_ind() &&
       p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))
     {
-      const_node_pointer p_r_join_child = p_r->get_join_child(p_l, this);
+      node_const_pointer p_r_join_child = p_r->get_join_child(p_l, this);
       if (p_r_join_child != 0)
        rec_join_prep(p_r_join_child, p_l, r_bag);
       return;
     }
 
-  if (p_r->get_e_ind() < p_l->get_e_ind() && 
+  if (p_r->get_e_ind() < p_l->get_e_ind() &&
       p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))
     {
-      const_node_pointer p_r_join_child = p_r->get_join_child(p_l, this);
+      node_const_pointer p_r_join_child = p_r->get_join_child(p_l, this);
       if (p_r_join_child != 0)
        rec_join_prep(p_r_join_child, p_l, r_bag);
       return;
@@ -195,56 +196,57 @@ rec_join_prep(const_internal_node_pointer p_l, const_internal_node_pointer p_r,
 PB_DS_CLASS_T_DEC
 typename PB_DS_CLASS_C_DEC::node_pointer
 PB_DS_CLASS_C_DEC::
-rec_join(node_pointer p_l, node_pointer p_r, size_type checked_ind, split_join_branch_bag& r_bag)
+rec_join(node_pointer p_l, node_pointer p_r, size_type checked_ind, 
+        branch_bag& r_bag)
 {
   _GLIBCXX_DEBUG_ASSERT(p_r != 0);
   if (p_l == 0)
     {
-      apply_update(p_r, (node_update* )this);
+      apply_update(p_r, (node_update*)this);
       return (p_r);
     }
 
-  if (p_l->m_type == pat_trie_leaf_node_type)
+  if (p_l->m_type == leaf_node)
     {
-      if (p_r->m_type == pat_trie_leaf_node_type)
-        {
+      if (p_r->m_type == leaf_node)
+       {
          node_pointer p_ret = rec_join(static_cast<leaf_pointer>(p_l),
                                        static_cast<leaf_pointer>(p_r), r_bag);
-         apply_update(p_ret, (node_update* )this);
+         apply_update(p_ret, (node_update*)this);
          return p_ret;
-        }
+       }
 
-      _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);
+      _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);
       node_pointer p_ret = rec_join(static_cast<leaf_pointer>(p_l),
-                                   static_cast<internal_node_pointer>(p_r),
+                                   static_cast<inode_pointer>(p_r),
                                    checked_ind, r_bag);
-      apply_update(p_ret, (node_update* )this);
+      apply_update(p_ret, (node_update*)this);
       return p_ret;
     }
 
-  _GLIBCXX_DEBUG_ASSERT(p_l->m_type == pat_trie_internal_node_type);
-  if (p_r->m_type == pat_trie_leaf_node_type)
+  _GLIBCXX_DEBUG_ASSERT(p_l->m_type == i_node);
+  if (p_r->m_type == leaf_node)
     {
-      node_pointer p_ret = rec_join(static_cast<internal_node_pointer>(p_l),
+      node_pointer p_ret = rec_join(static_cast<inode_pointer>(p_l),
                                    static_cast<leaf_pointer>(p_r),
                                    checked_ind, r_bag);
-      apply_update(p_ret, (node_update* )this);
+      apply_update(p_ret, (node_update*)this);
       return p_ret;
     }
 
-  _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);
-  node_pointer p_ret = rec_join(static_cast<internal_node_pointer>(p_l),
-                               static_cast<internal_node_pointer>(p_r), 
+  _GLIBCXX_DEBUG_ASSERT(p_r->m_type == i_node);
+  node_pointer p_ret = rec_join(static_cast<inode_pointer>(p_l),
+                               static_cast<inode_pointer>(p_r),
                                r_bag);
 
-  apply_update(p_ret, (node_update* )this);
+  apply_update(p_ret, (node_update*)this);
   return p_ret;
 }
 
 PB_DS_CLASS_T_DEC
 typename PB_DS_CLASS_C_DEC::node_pointer
 PB_DS_CLASS_C_DEC::
-rec_join(leaf_pointer p_l, leaf_pointer p_r, split_join_branch_bag& r_bag)
+rec_join(leaf_pointer p_l, leaf_pointer p_r, branch_bag& r_bag)
 {
   _GLIBCXX_DEBUG_ASSERT(p_r != 0);
   if (p_l == 0)
@@ -257,13 +259,13 @@ rec_join(leaf_pointer p_l, leaf_pointer p_r, split_join_branch_bag& r_bag)
 PB_DS_CLASS_T_DEC
 typename PB_DS_CLASS_C_DEC::node_pointer
 PB_DS_CLASS_C_DEC::
-rec_join(leaf_pointer p_l, internal_node_pointer p_r, size_type checked_ind, 
-        split_join_branch_bag& r_bag)
+rec_join(leaf_pointer p_l, inode_pointer p_r, size_type checked_ind,
+        branch_bag& r_bag)
 {
 #ifdef _GLIBCXX_DEBUG
   const size_type lhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_l);
   const size_type rhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_r);
-#endif 
+#endif
 
   _GLIBCXX_DEBUG_ASSERT(p_r != 0);
   node_pointer p_ret = rec_join(p_r, p_l, checked_ind, r_bag);
@@ -274,7 +276,7 @@ rec_join(leaf_pointer p_l, internal_node_pointer p_r, size_type checked_ind,
 PB_DS_CLASS_T_DEC
 typename PB_DS_CLASS_C_DEC::node_pointer
 PB_DS_CLASS_C_DEC::
-rec_join(internal_node_pointer p_l, leaf_pointer p_r, size_type checked_ind, split_join_branch_bag& r_bag)
+rec_join(inode_pointer p_l, leaf_pointer p_r, size_type checked_ind, branch_bag& r_bag)
 {
   _GLIBCXX_DEBUG_ASSERT(p_l != 0);
   _GLIBCXX_DEBUG_ASSERT(p_r != 0);
@@ -282,14 +284,14 @@ rec_join(internal_node_pointer p_l, leaf_pointer p_r, size_type checked_ind, spl
 #ifdef _GLIBCXX_DEBUG
   const size_type lhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_l);
   const size_type rhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_r);
-#endif 
+#endif
 
   if (!p_l->should_be_mine(pref_begin(p_r), pref_end(p_r), checked_ind, this))
     {
       node_pointer p_ret = insert_branch(p_l, p_r, r_bag);
       PB_DS_ASSERT_NODE_VALID(p_ret)
       _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_ret) ==
-                                   lhs_leafs + rhs_leafs);
+                                   lhs_leafs + rhs_leafs);
       return p_ret;
     }
 
@@ -312,7 +314,8 @@ rec_join(internal_node_pointer p_l, leaf_pointer p_r, size_type checked_ind, spl
 PB_DS_CLASS_T_DEC
 typename PB_DS_CLASS_C_DEC::node_pointer
 PB_DS_CLASS_C_DEC::
-rec_join(internal_node_pointer p_l, internal_node_pointer p_r, split_join_branch_bag& r_bag)
+rec_join(inode_pointer p_l, inode_pointer p_r, 
+        branch_bag& r_bag)
 {
   _GLIBCXX_DEBUG_ASSERT(p_l != 0);
   _GLIBCXX_DEBUG_ASSERT(p_r != 0);
@@ -320,29 +323,29 @@ rec_join(internal_node_pointer p_l, internal_node_pointer p_r, split_join_branch
 #ifdef _GLIBCXX_DEBUG
   const size_type lhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_l);
   const size_type rhs_leafs = PB_DS_RECURSIVE_COUNT_LEAFS(p_r);
-#endif 
+#endif
 
-  if (p_l->get_e_ind() == p_r->get_e_ind() && 
-      synth_e_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),
+  if (p_l->get_e_ind() == p_r->get_e_ind() &&
+      synth_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),
                                            p_r->pref_b_it(), p_r->pref_e_it()))
     {
-      for (typename internal_node::iterator it = p_r->begin();
+      for (typename inode::iterator it = p_r->begin();
           it != p_r->end(); ++ it)
-        {
+       {
          node_pointer p_new_child = rec_join(p_l->get_join_child(*it, this),
                                              * it, 0, r_bag);
          p_l->replace_child(p_new_child, pref_begin(p_new_child),
                             pref_end(p_new_child), this);
-        }
+       }
 
-      p_r->~internal_node();
-      s_internal_node_allocator.deallocate(p_r, 1);
+      p_r->~inode();
+      s_inode_allocator.deallocate(p_r, 1);
       PB_DS_ASSERT_NODE_VALID(p_l)
       _GLIBCXX_DEBUG_ASSERT(PB_DS_RECURSIVE_COUNT_LEAFS(p_l) == lhs_leafs + rhs_leafs);
       return p_l;
     }
 
-  if (p_l->get_e_ind() < p_r->get_e_ind() && 
+  if (p_l->get_e_ind() < p_r->get_e_ind() &&
       p_l->should_be_mine(p_r->pref_b_it(), p_r->pref_e_it(), 0, this))
     {
       node_pointer p_new_child = rec_join(p_l->get_join_child(p_r, this),
@@ -353,13 +356,13 @@ rec_join(internal_node_pointer p_l, internal_node_pointer p_r, split_join_branch
       return p_l;
     }
 
-  if (p_r->get_e_ind() < p_l->get_e_ind() && 
+  if (p_r->get_e_ind() < p_l->get_e_ind() &&
       p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))
     {
       node_pointer p_new_child = rec_join(p_r->get_join_child(p_l, this), p_l,
                                          0, r_bag);
 
-      p_r->replace_child(p_new_child, pref_begin(p_new_child), 
+      p_r->replace_child(p_new_child, pref_begin(p_new_child),
                         pref_end(p_new_child), this);
 
       PB_DS_ASSERT_NODE_VALID(p_r)
@@ -379,8 +382,8 @@ PB_DS_CLASS_C_DEC::
 insert(const_reference r_val)
 {
   node_pointer p_lf = find_imp(PB_DS_V2F(r_val));
-  if (p_lf != 0 && p_lf->m_type == pat_trie_leaf_node_type && 
-      synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_lf)->value()), PB_DS_V2F(r_val)))
+  if (p_lf != 0 && p_lf->m_type == leaf_node &&
+      synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_lf)->value()), PB_DS_V2F(r_val)))
     {
       PB_DS_CHECK_KEY_EXISTS(PB_DS_V2F(r_val))
       PB_DS_ASSERT_VALID((*this))
@@ -393,16 +396,16 @@ insert(const_reference r_val)
   cond_dealtor cond(p_new_lf);
 
   new (p_new_lf) leaf(r_val);
-  apply_update(p_new_lf, (node_update* )this);
+  apply_update(p_new_lf, (node_update*)this);
   cond.set_call_destructor();
-  split_join_branch_bag bag;
+  branch_bag bag;
   bag.add_branch();
   m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent, p_new_lf, 0, bag);
   m_p_head->m_p_parent->m_p_parent = m_p_head;
   cond.set_no_action_dtor();
   ++m_size;
   update_min_max_for_inserted_leaf(p_new_lf);
-  _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)   
+  _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
   PB_DS_ASSERT_VALID((*this))
   return std::make_pair(point_iterator(p_new_lf), true);
 }
@@ -410,17 +413,17 @@ insert(const_reference r_val)
 PB_DS_CLASS_T_DEC
 typename PB_DS_CLASS_C_DEC::size_type
 PB_DS_CLASS_C_DEC::
-keys_diff_ind(typename e_access_traits::const_iterator b_l,
-             typename e_access_traits::const_iterator e_l,
-             typename e_access_traits::const_iterator b_r,
-             typename e_access_traits::const_iterator e_r)
+keys_diff_ind(typename access_traits::const_iterator b_l,
+             typename access_traits::const_iterator e_l,
+             typename access_traits::const_iterator b_r,
+             typename access_traits::const_iterator e_r)
 {
   size_type diff_pos = 0;
   while (b_l != e_l)
     {
       if (b_r == e_r)
        return (diff_pos);
-      if (e_access_traits::e_pos(*b_l) != e_access_traits::e_pos(*b_r))
+      if (access_traits::e_pos(*b_l) != access_traits::e_pos(*b_r))
        return (diff_pos);
       ++b_l;
       ++b_r;
@@ -431,20 +434,20 @@ keys_diff_ind(typename e_access_traits::const_iterator b_l,
 }
 
 PB_DS_CLASS_T_DEC
-typename PB_DS_CLASS_C_DEC::internal_node_pointer
+typename PB_DS_CLASS_C_DEC::inode_pointer
 PB_DS_CLASS_C_DEC::
-insert_branch(node_pointer p_l, node_pointer p_r, split_join_branch_bag& r_bag)
+insert_branch(node_pointer p_l, node_pointer p_r, branch_bag& r_bag)
 {
-  typename synth_e_access_traits::const_iterator left_b_it = pref_begin(p_l);
-  typename synth_e_access_traits::const_iterator left_e_it = pref_end(p_l);
-  typename synth_e_access_traits::const_iterator right_b_it = pref_begin(p_r);
-  typename synth_e_access_traits::const_iterator right_e_it = pref_end(p_r);
+  typename synth_access_traits::const_iterator left_b_it = pref_begin(p_l);
+  typename synth_access_traits::const_iterator left_e_it = pref_end(p_l);
+  typename synth_access_traits::const_iterator right_b_it = pref_begin(p_r);
+  typename synth_access_traits::const_iterator right_e_it = pref_end(p_r);
 
-  const size_type diff_ind = keys_diff_ind(left_b_it, left_e_it, 
+  const size_type diff_ind = keys_diff_ind(left_b_it, left_e_it,
                                           right_b_it, right_e_it);
 
-  internal_node_pointer p_new_nd = r_bag.get_branch();
-  new (p_new_nd) internal_node(diff_ind, left_b_it);
+  inode_pointer p_new_nd = r_bag.get_branch();
+  new (p_new_nd) inode(diff_ind, left_b_it);
   p_new_nd->add_child(p_l, left_b_it, left_e_it, this);
   p_new_nd->add_child(p_r, right_b_it, right_e_it, this);
   p_l->m_p_parent = p_new_nd;
@@ -459,11 +462,11 @@ PB_DS_CLASS_C_DEC::
 update_min_max_for_inserted_leaf(leaf_pointer p_new_lf)
 {
   if (m_p_head->m_p_min == m_p_head ||
-      synth_e_access_traits::cmp_keys(PB_DS_V2F(p_new_lf->value()),
-                                     PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_min)->value())))
+      synth_access_traits::cmp_keys(PB_DS_V2F(p_new_lf->value()),
+                                     PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_min)->value())))
     m_p_head->m_p_min = p_new_lf;
 
   if (m_p_head->m_p_max == m_p_head ||
-      synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_max)->value()), PB_DS_V2F(p_new_lf->value())))
+      synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_max)->value()), PB_DS_V2F(p_new_lf->value())))
     m_p_head->m_p_max = p_new_lf;
 }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
deleted file mode 100644 (file)
index cb8b674..0000000
+++ /dev/null
@@ -1,603 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011
-// Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file internal_node.hpp
- * Contains an internal PB_DS_BASE_C_DEC for a patricia tree.
- */
-
-#ifndef PB_DS_PAT_TRIE_INTERNAL_NODE_HPP
-#define PB_DS_PAT_TRIE_INTERNAL_NODE_HPP
-
-#include <debug/debug.h>
-
-namespace __gnu_pbds
-{
-  namespace detail
-  {
-#define PB_DS_CLASS_T_DEC \
-    template<typename Type_Traits, typename E_Access_Traits,  \
-            typename Metadata, typename Allocator>
-
-#define PB_DS_CLASS_C_DEC \
-    pat_trie_internal_node<Type_Traits, E_Access_Traits, Metadata, Allocator>
-
-#define PB_DS_BASE_C_DEC \
-    pat_trie_node_base<Type_Traits, E_Access_Traits, Metadata, Allocator>
-
-#define PB_DS_LEAF_C_DEC \
-    pat_trie_leaf<Type_Traits, E_Access_Traits, Metadata, Allocator>
-
-    template<typename Type_Traits,
-            typename E_Access_Traits,
-            typename Metadata,
-            typename Allocator>
-    struct pat_trie_internal_node : public PB_DS_BASE_C_DEC
-    {
-    private:
-      typedef PB_DS_BASE_C_DEC                         base_type;
-      typedef Type_Traits                      type_traits;
-      typedef typename type_traits::value_type         value_type;
-      typedef typename Allocator::size_type    size_type;
-
-      typedef E_Access_Traits e_access_traits;
-      typedef typename e_access_traits::const_iterator const_e_iterator;
-      typedef typename Allocator::template rebind<e_access_traits>::other access_rebind;
-      typedef typename access_rebind::const_pointer const_e_access_traits_pointer;
-
-      typedef typename Allocator::template rebind<base_type>::other base_rebind;
-      typedef typename base_rebind::pointer node_pointer;
-      typedef typename base_rebind::const_pointer const_node_pointer;
-
-      typedef PB_DS_LEAF_C_DEC leaf;
-      typedef typename Allocator::template rebind<leaf>::other leaf_rebind;
-      typedef typename leaf_rebind::pointer leaf_pointer;
-      typedef typename leaf_rebind::const_pointer const_leaf_pointer;
-
-      typedef typename Allocator::template rebind<pat_trie_internal_node>::other internal_node_rebind;
-      typedef typename internal_node_rebind::pointer internal_node_pointer;
-      typedef typename internal_node_rebind::const_pointer const_internal_node_pointer;
-
-#ifdef _GLIBCXX_DEBUG
-      typedef typename base_type::subtree_debug_info subtree_debug_info;
-
-      virtual subtree_debug_info
-      assert_valid_imp(const_e_access_traits_pointer,
-                      const char* file, int line) const;
-#endif 
-
-      inline size_type
-      get_pref_pos(const_e_iterator, const_e_iterator, 
-                  const_e_access_traits_pointer) const;
-
-    public:
-      typedef typename Allocator::template rebind<node_pointer>::other node_pointer_rebind;
-      typedef typename node_pointer_rebind::pointer node_pointer_pointer;
-      typedef typename node_pointer_rebind::reference node_pointer_reference;
-
-      enum
-       {
-         arr_size = E_Access_Traits::max_size + 1
-       };
-      PB_DS_STATIC_ASSERT(min_arr_size, arr_size >= 2);
-
-#include <ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp>
-#include <ext/pb_ds/detail/pat_trie_/child_iterator.hpp>
-
-      pat_trie_internal_node(size_type, const const_e_iterator);
-
-      void
-      update_prefixes(const_e_access_traits_pointer);
-
-      const_iterator
-      begin() const;
-
-      iterator
-      begin();
-
-      const_iterator
-      end() const;
-
-      iterator
-      end();
-
-      inline node_pointer
-      get_child_node(const_e_iterator, const_e_iterator, 
-                    const_e_access_traits_pointer);
-
-      inline const_node_pointer
-      get_child_node(const_e_iterator, const_e_iterator, 
-                    const_e_access_traits_pointer) const;
-
-      inline iterator
-      get_child_it(const_e_iterator, const_e_iterator, 
-                  const_e_access_traits_pointer);
-
-      inline node_pointer
-      get_lower_bound_child_node(const_e_iterator, const_e_iterator, 
-                                size_type, const_e_access_traits_pointer);
-
-      inline node_pointer
-      add_child(node_pointer, const_e_iterator, const_e_iterator, 
-               const_e_access_traits_pointer);
-
-      inline const_node_pointer
-      get_join_child(const_node_pointer, const_e_access_traits_pointer) const;
-
-      inline node_pointer
-      get_join_child(node_pointer, const_e_access_traits_pointer);
-
-      void
-      remove_child(node_pointer p_nd);
-
-      iterator
-      remove_child(iterator it);
-
-      void
-      replace_child(node_pointer, const_e_iterator, const_e_iterator, 
-                   const_e_access_traits_pointer);
-
-      inline const_e_iterator
-      pref_b_it() const;
-
-      inline const_e_iterator
-      pref_e_it() const;
-
-      inline size_type
-      get_e_ind() const;
-
-      bool
-      should_be_mine(const_e_iterator, const_e_iterator, size_type, 
-                    const_e_access_traits_pointer) const;
-
-      leaf_pointer
-      leftmost_descendant();
-
-      const_leaf_pointer
-      leftmost_descendant() const;
-
-      leaf_pointer
-      rightmost_descendant();
-
-      const_leaf_pointer
-      rightmost_descendant() const;
-
-#ifdef _GLIBCXX_DEBUG
-      size_type
-      e_ind() const;
-#endif 
-
-    private:
-      pat_trie_internal_node(const pat_trie_internal_node&);
-
-      size_type
-      get_begin_pos() const;
-
-      const size_type m_e_ind;
-      const_e_iterator m_pref_b_it;
-      const_e_iterator m_pref_e_it;
-      node_pointer m_a_p_children[arr_size];
-      static leaf_rebind s_leaf_alloc;
-      static internal_node_rebind s_internal_node_alloc;
-    };
-
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::leaf_rebind
-    PB_DS_CLASS_C_DEC::s_leaf_alloc;
-
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::internal_node_rebind
-    PB_DS_CLASS_C_DEC::s_internal_node_alloc;
-
-    PB_DS_CLASS_T_DEC
-    inline typename PB_DS_CLASS_C_DEC::size_type
-    PB_DS_CLASS_C_DEC::
-    get_pref_pos(const_e_iterator b_it, const_e_iterator e_it, 
-                const_e_access_traits_pointer p_traits) const
-    {
-      if (static_cast<std::size_t>(std::distance(b_it, e_it)) <= m_e_ind)
-       return 0;
-      std::advance(b_it, m_e_ind);
-      return 1 + p_traits->e_pos(*b_it);
-    }
-
-    PB_DS_CLASS_T_DEC
-    PB_DS_CLASS_C_DEC::
-    pat_trie_internal_node(size_type len, const const_e_iterator it) :
-      PB_DS_BASE_C_DEC(pat_trie_internal_node_type),
-      m_e_ind(len), m_pref_b_it(it), m_pref_e_it(it)
-    {
-      std::advance(m_pref_e_it, m_e_ind);
-      std::fill(m_a_p_children, m_a_p_children + arr_size,
-               static_cast<node_pointer>(0));
-    }
-
-    PB_DS_CLASS_T_DEC
-    void
-    PB_DS_CLASS_C_DEC::
-    update_prefixes(const_e_access_traits_pointer p_traits)
-    {
-      node_pointer p_first = *begin();
-      if (p_first->m_type == pat_trie_leaf_node_type)
-       {
-         const_leaf_pointer p = static_cast<const_leaf_pointer>(p_first);
-         m_pref_b_it = p_traits->begin(e_access_traits::extract_key(p->value()));
-       }
-      else
-       {
-         _GLIBCXX_DEBUG_ASSERT(p_first->m_type == pat_trie_internal_node_type);
-         m_pref_b_it = static_cast<internal_node_pointer>(p_first)->pref_b_it();
-       }
-      m_pref_e_it = m_pref_b_it;
-      std::advance(m_pref_e_it, m_e_ind);
-    }
-
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::const_iterator
-    PB_DS_CLASS_C_DEC::
-    begin() const
-    {
-      typedef node_pointer_pointer pointer_type;
-      pointer_type p = const_cast<pointer_type>(m_a_p_children);
-      return const_iterator(p + get_begin_pos(), p + arr_size);
-    }
-
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::iterator
-    PB_DS_CLASS_C_DEC::
-    begin()
-    {
-      return iterator(m_a_p_children + get_begin_pos(), 
-                     m_a_p_children + arr_size);
-    }
-
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::const_iterator
-    PB_DS_CLASS_C_DEC::
-    end() const
-    {
-      typedef node_pointer_pointer pointer_type;
-      pointer_type p = const_cast<pointer_type>(m_a_p_children) + arr_size;
-      return const_iterator(p, p);
-    }
-
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::iterator
-    PB_DS_CLASS_C_DEC::
-    end()
-    { return iterator(m_a_p_children + arr_size, m_a_p_children + arr_size); }
-
-    PB_DS_CLASS_T_DEC
-    inline typename PB_DS_CLASS_C_DEC::node_pointer
-    PB_DS_CLASS_C_DEC::
-    get_child_node(const_e_iterator b_it, const_e_iterator e_it, 
-                  const_e_access_traits_pointer p_traits)
-    {
-      const size_type i = get_pref_pos(b_it, e_it, p_traits);
-      _GLIBCXX_DEBUG_ASSERT(i < arr_size);
-      return m_a_p_children[i];
-    }
-
-    PB_DS_CLASS_T_DEC
-    inline typename PB_DS_CLASS_C_DEC::iterator
-    PB_DS_CLASS_C_DEC::
-    get_child_it(const_e_iterator b_it, const_e_iterator e_it, 
-                const_e_access_traits_pointer p_traits)
-    {
-      const size_type i = get_pref_pos(b_it, e_it, p_traits);
-      _GLIBCXX_DEBUG_ASSERT(i < arr_size);
-      _GLIBCXX_DEBUG_ASSERT(m_a_p_children[i] != 0);
-      return iterator(m_a_p_children + i, m_a_p_children + i);
-    }
-
-    PB_DS_CLASS_T_DEC
-    inline typename PB_DS_CLASS_C_DEC::const_node_pointer
-    PB_DS_CLASS_C_DEC::
-    get_child_node(const_e_iterator b_it, const_e_iterator e_it, 
-                  const_e_access_traits_pointer p_traits) const
-    { return const_cast<node_pointer>(get_child_node(b_it, e_it, p_traits)); }
-
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::node_pointer
-    PB_DS_CLASS_C_DEC::
-    get_lower_bound_child_node(const_e_iterator b_it, const_e_iterator e_it, 
-                              size_type checked_ind, 
-                              const_e_access_traits_pointer p_traits)
-    {
-      if (!should_be_mine(b_it, e_it, checked_ind, p_traits))
-       {
-         if (p_traits->cmp_prefixes(b_it, e_it, m_pref_b_it, m_pref_e_it, true))
-           return leftmost_descendant();
-         return rightmost_descendant();
-       }
-
-      size_type i = get_pref_pos(b_it, e_it, p_traits);
-      _GLIBCXX_DEBUG_ASSERT(i < arr_size);
-
-      if (m_a_p_children[i] != 0)
-       return m_a_p_children[i];
-
-      while (++i < arr_size)
-       if (m_a_p_children[i] != 0)
-         {
-           if (m_a_p_children[i]->m_type == pat_trie_leaf_node_type)
-             return m_a_p_children[i];
-
-           _GLIBCXX_DEBUG_ASSERT(m_a_p_children[i]->m_type == pat_trie_internal_node_type);
-
-           return static_cast<internal_node_pointer>(m_a_p_children[i])->leftmost_descendant();
-         }
-
-      return rightmost_descendant();
-    }
-
-    PB_DS_CLASS_T_DEC
-    inline typename PB_DS_CLASS_C_DEC::node_pointer
-    PB_DS_CLASS_C_DEC::
-    add_child(node_pointer p_nd, const_e_iterator b_it, const_e_iterator e_it, 
-             const_e_access_traits_pointer p_traits)
-    {
-      const size_type i = get_pref_pos(b_it, e_it, p_traits);
-      _GLIBCXX_DEBUG_ASSERT(i < arr_size);
-      if (m_a_p_children[i] == 0)
-       {
-         m_a_p_children[i] = p_nd;
-         p_nd->m_p_parent = this;
-         return p_nd;
-       }
-      return m_a_p_children[i];
-    }
-
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::const_node_pointer
-    PB_DS_CLASS_C_DEC::
-    get_join_child(const_node_pointer p_nd, const_e_access_traits_pointer p_traits) const
-    {
-      node_pointer p = const_cast<node_pointer>(p_nd);
-      return const_cast<internal_node_pointer>(this)->get_join_child(p, p_traits);
-    }
-
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::node_pointer
-    PB_DS_CLASS_C_DEC::
-    get_join_child(node_pointer p_nd, const_e_access_traits_pointer p_traits)
-    {
-      size_type i;
-      const_e_iterator b_it;
-      const_e_iterator e_it;
-      if (p_nd->m_type == pat_trie_leaf_node_type)
-       {
-         typename Type_Traits::const_key_reference r_key =
-           e_access_traits::extract_key(static_cast<const_leaf_pointer>(p_nd)->value());
-
-         b_it = p_traits->begin(r_key);
-         e_it = p_traits->end(r_key);
-       }
-      else
-       {
-         b_it = static_cast<internal_node_pointer>(p_nd)->pref_b_it();
-         e_it = static_cast<internal_node_pointer>(p_nd)->pref_e_it();
-       }
-      i = get_pref_pos(b_it, e_it, p_traits);
-      _GLIBCXX_DEBUG_ASSERT(i < arr_size);
-      return m_a_p_children[i];
-    }
-
-    PB_DS_CLASS_T_DEC
-    void
-    PB_DS_CLASS_C_DEC::
-    remove_child(node_pointer p_nd)
-    {
-      size_type i = 0;
-      for (; i < arr_size; ++i)
-       if (m_a_p_children[i] == p_nd)
-         {
-           m_a_p_children[i] = 0;
-           return;
-         }
-      _GLIBCXX_DEBUG_ASSERT(i != arr_size);
-    }
-
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::iterator
-    PB_DS_CLASS_C_DEC::
-    remove_child(iterator it)
-    {
-      iterator ret = it;
-      ++ret;
-      * it.m_p_p_cur = 0;
-      return ret;
-    }
-
-    PB_DS_CLASS_T_DEC
-    void
-    PB_DS_CLASS_C_DEC::
-    replace_child(node_pointer p_nd, const_e_iterator b_it, 
-                 const_e_iterator e_it, 
-                 const_e_access_traits_pointer p_traits)
-    {
-      const size_type i = get_pref_pos(b_it, e_it, p_traits);
-      _GLIBCXX_DEBUG_ASSERT(i < arr_size);
-      m_a_p_children[i] = p_nd;
-      p_nd->m_p_parent = this;
-    }
-
-    PB_DS_CLASS_T_DEC
-    inline typename PB_DS_CLASS_C_DEC::const_e_iterator
-    PB_DS_CLASS_C_DEC::
-    pref_b_it() const
-    { return m_pref_b_it; }
-
-    PB_DS_CLASS_T_DEC
-    inline typename PB_DS_CLASS_C_DEC::const_e_iterator
-    PB_DS_CLASS_C_DEC::
-    pref_e_it() const
-    { return m_pref_e_it; }
-
-    PB_DS_CLASS_T_DEC
-    inline typename PB_DS_CLASS_C_DEC::size_type
-    PB_DS_CLASS_C_DEC::
-    get_e_ind() const
-    { return m_e_ind; }
-
-    PB_DS_CLASS_T_DEC
-    bool
-    PB_DS_CLASS_C_DEC::
-    should_be_mine(const_e_iterator b_it, const_e_iterator e_it, 
-                  size_type checked_ind, 
-                  const_e_access_traits_pointer p_traits) const
-    {
-      if (m_e_ind == 0)
-       return true;
-
-      const size_type num_es = std::distance(b_it, e_it);
-      if (num_es < m_e_ind)
-       return false;
-
-      const_e_iterator key_b_it = b_it;
-      std::advance(key_b_it, checked_ind);
-      const_e_iterator key_e_it = b_it;
-      std::advance(key_e_it, m_e_ind);
-
-      const_e_iterator value_b_it = m_pref_b_it;
-      std::advance(value_b_it, checked_ind);
-      const_e_iterator value_e_it = m_pref_b_it;
-      std::advance(value_e_it, m_e_ind);
-
-      return p_traits->equal_prefixes(key_b_it, key_e_it, value_b_it, 
-                                     value_e_it);
-    }
-
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::leaf_pointer
-    PB_DS_CLASS_C_DEC::
-    leftmost_descendant()
-    {
-      node_pointer p_pot =* begin();
-      if (p_pot->m_type == pat_trie_leaf_node_type)
-       return (static_cast<leaf_pointer>(p_pot));
-      _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == pat_trie_internal_node_type);
-      return static_cast<internal_node_pointer>(p_pot)->leftmost_descendant();
-    }
-
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::const_leaf_pointer
-    PB_DS_CLASS_C_DEC::
-    leftmost_descendant() const
-    {
-      return const_cast<internal_node_pointer>(this)->leftmost_descendant();
-    }
-
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::leaf_pointer
-    PB_DS_CLASS_C_DEC::
-    rightmost_descendant()
-    {
-      const size_type num_children = std::distance(begin(), end());
-      _GLIBCXX_DEBUG_ASSERT(num_children >= 2);
-
-      iterator it = begin();
-      std::advance(it, num_children - 1);
-      node_pointer p_pot =* it;
-      if (p_pot->m_type == pat_trie_leaf_node_type)
-       return static_cast<leaf_pointer>(p_pot);
-      _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == pat_trie_internal_node_type);
-      return static_cast<internal_node_pointer>(p_pot)->rightmost_descendant();
-    }
-
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::const_leaf_pointer
-    PB_DS_CLASS_C_DEC::
-    rightmost_descendant() const
-    {
-      return const_cast<internal_node_pointer>(this)->rightmost_descendant();
-    }
-
-#ifdef _GLIBCXX_DEBUG
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::size_type
-    PB_DS_CLASS_C_DEC::
-    e_ind() const
-    { return m_e_ind; }
-#endif 
-
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::size_type
-    PB_DS_CLASS_C_DEC::
-    get_begin_pos() const
-    {
-      size_type i;
-      for (i = 0; i < arr_size && m_a_p_children[i] == 0; ++i)
-       ;
-      return i;
-    }
-
-#ifdef _GLIBCXX_DEBUG
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::subtree_debug_info
-    PB_DS_CLASS_C_DEC::
-    assert_valid_imp(const_e_access_traits_pointer p_traits,
-                    const char* __file, int __line) const
-    {
-      PB_DS_DEBUG_VERIFY(base_type::m_type == pat_trie_internal_node_type);
-      PB_DS_DEBUG_VERIFY(static_cast<size_type>(std::distance(pref_b_it(), pref_e_it())) == m_e_ind);
-      PB_DS_DEBUG_VERIFY(std::distance(begin(), end()) >= 2);
-
-      for (typename pat_trie_internal_node::const_iterator it = begin();
-          it != end(); ++it)
-       {
-         const_node_pointer p_nd =* it;
-         PB_DS_DEBUG_VERIFY(p_nd->m_p_parent == this);
-         subtree_debug_info child_ret =
-           p_nd->assert_valid_imp(p_traits, __file, __line);
-
-         PB_DS_DEBUG_VERIFY(static_cast<size_type>(std::distance(child_ret.first, child_ret.second)) >= m_e_ind);
-         PB_DS_DEBUG_VERIFY(should_be_mine(child_ret.first, child_ret.second, 0, p_traits));
-         PB_DS_DEBUG_VERIFY(get_pref_pos(child_ret.first, child_ret.second, p_traits) == static_cast<size_type>(it.m_p_p_cur - m_a_p_children));
-       }
-      return std::make_pair(pref_b_it(), pref_e_it());
-    }
-#endif 
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-#undef PB_DS_BASE_C_DEC
-#undef PB_DS_LEAF_C_DEC
-
-  } // namespace detail
-} // namespace __gnu_pbds
-
-#endif
index 85199f81cb06d2e1031b63ded48313948014f1b8..d53f1b274b36b3c88ea655d72b6c7f9de8ebd102 100644 (file)
@@ -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 (file)
index de8057a..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file leaf.hpp
- * Contains a pat_trie_leaf for a patricia tree.
- */
-
-#ifndef PB_DS_PAT_TRIE_LEAF_HPP
-#define PB_DS_PAT_TRIE_LEAF_HPP
-
-#include <debug/debug.h>
-
-namespace __gnu_pbds
-{
-  namespace detail
-  {
-
-#define PB_DS_CLASS_T_DEC                                              \
-    template<class Type_Traits,                                                \
-            class E_Access_Traits,                                     \
-            class Metadata,                                            \
-            class Allocator>
-
-#define PB_DS_CLASS_C_DEC                                              \
-    pat_trie_leaf<Type_Traits,                                         \
-                 E_Access_Traits,                                      \
-                 Metadata,                                             \
-                 Allocator>
-
-#define PB_DS_BASE_C_DEC                                               \
-    pat_trie_node_base<Type_Traits,                                    \
-                      E_Access_Traits,                                 \
-                      Metadata,                                        \
-                      Allocator>
-
-#define PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC                                \
-    pat_trie_subtree_debug_info<Type_Traits,                           \
-                               E_Access_Traits,                        \
-                               Allocator>
-
-    template<typename Type_Traits,
-            class E_Access_Traits,
-            class Metadata,
-            class Allocator>
-    struct pat_trie_leaf : public PB_DS_BASE_C_DEC
-    {
-    private:
-      typedef typename Type_Traits::value_type value_type;
-
-      typedef typename Type_Traits::const_reference const_reference;
-
-      typedef typename Type_Traits::reference reference;
-
-      typedef
-      typename Allocator::template rebind<
-       E_Access_Traits>::other::const_pointer
-      const_e_access_traits_pointer;
-
-#ifdef _GLIBCXX_DEBUG
-      typedef
-      typename PB_DS_BASE_C_DEC::subtree_debug_info
-      subtree_debug_info;
-#endif 
-
-      typedef PB_DS_BASE_C_DEC base_type;
-
-    public:
-      pat_trie_leaf(const_reference r_val);
-
-      inline reference
-      value();
-
-      inline const_reference
-      value() const;
-
-#ifdef _GLIBCXX_DEBUG
-      virtual subtree_debug_info
-      assert_valid_imp(const_e_access_traits_pointer p_traits,
-                      const char* file, int line) const;
-
-      virtual
-      ~pat_trie_leaf();
-#endif 
-
-    private:
-      pat_trie_leaf(const PB_DS_CLASS_C_DEC& other);
-
-      value_type m_value;
-    };
-
-    PB_DS_CLASS_T_DEC
-    PB_DS_CLASS_C_DEC::
-    pat_trie_leaf(const_reference r_val) :
-    PB_DS_BASE_C_DEC(pat_trie_leaf_node_type), m_value(r_val)
-    { }
-
-    PB_DS_CLASS_T_DEC
-    inline typename PB_DS_CLASS_C_DEC::reference
-    PB_DS_CLASS_C_DEC::
-    value()
-    { return m_value; }
-
-    PB_DS_CLASS_T_DEC
-    inline typename PB_DS_CLASS_C_DEC::const_reference
-    PB_DS_CLASS_C_DEC::
-    value() const
-    { return m_value; }
-
-#ifdef _GLIBCXX_DEBUG
-    PB_DS_CLASS_T_DEC
-    typename PB_DS_CLASS_C_DEC::subtree_debug_info
-    PB_DS_CLASS_C_DEC::
-    assert_valid_imp(const_e_access_traits_pointer p_traits,
-                    const char* __file, int __line) const
-    {
-      PB_DS_DEBUG_VERIFY(base_type::m_type == pat_trie_leaf_node_type);
-      subtree_debug_info ret;
-      const_reference r_val = value();
-      return std::make_pair(p_traits->begin(p_traits->extract_key(r_val)),
-                            p_traits->end(p_traits->extract_key(r_val)));
-    }
-
-    PB_DS_CLASS_T_DEC
-    PB_DS_CLASS_C_DEC::
-    ~pat_trie_leaf() { }
-#endif 
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-#undef PB_DS_BASE_C_DEC
-#undef PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC
-
-  } // namespace detail
-} // namespace __gnu_pbds
-
-#endif 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
deleted file mode 100644 (file)
index 6e131e4..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file node_base.hpp
- * Contains a pat_trie_node_base base for a patricia tree.
- */
-
-#ifndef PB_DS_PAT_TRIE_NODE_BASE_HPP
-#define PB_DS_PAT_TRIE_NODE_BASE_HPP
-
-#include <ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp>
-
-namespace __gnu_pbds
-{
-  namespace detail
-  {
-#define PB_DS_CLASS_T_DEC \
-    template<typename Type_Traits, typename E_Access_Traits,   \
-            typename Metadata, typename Allocator>
-
-#define PB_DS_CLASS_C_DEC \
-    pat_trie_node_base<Type_Traits, E_Access_Traits, Metadata, Allocator>
-
-#define PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC        \
-    pat_trie_subtree_debug_info<Type_Traits, E_Access_Traits, Allocator>
-
-    enum pat_trie_node_type
-      {
-       pat_trie_internal_node_type,
-       pat_trie_leaf_node_type,
-       pat_trie_head_node_type
-      };
-
-    template<typename Type_Traits,
-            typename E_Access_Traits,
-            typename Metadata,
-            typename Allocator>
-    struct pat_trie_node_base : public pat_trie_node_metadata_base<
-      Metadata,
-      Allocator>
-    {
-    public:
-      typedef
-      typename Allocator::template rebind<
-      pat_trie_node_base>::other::pointer
-      node_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       E_Access_Traits>::other::const_pointer
-      const_e_access_traits_pointer;
-
-#ifdef _GLIBCXX_DEBUG
-      typedef
-      std::pair<
-       typename E_Access_Traits::const_iterator,
-       typename E_Access_Traits::const_iterator>
-      subtree_debug_info;
-#endif 
-
-      pat_trie_node_base(pat_trie_node_type type);
-
-#ifdef _GLIBCXX_DEBUG
-      void
-      assert_valid(const_e_access_traits_pointer p_traits,
-                  const char* file, int line) const;
-
-      virtual subtree_debug_info
-      assert_valid_imp(const_e_access_traits_pointer p_traits,
-                      const char* file, int line) const = 0;
-#endif 
-
-      node_pointer m_p_parent;
-      const pat_trie_node_type m_type;
-    };
-
-    PB_DS_CLASS_T_DEC
-    PB_DS_CLASS_C_DEC::
-    pat_trie_node_base(pat_trie_node_type type) : m_type(type)
-    { }
-
-#ifdef _GLIBCXX_DEBUG
-    PB_DS_CLASS_T_DEC
-    void
-    PB_DS_CLASS_C_DEC::
-    assert_valid(const_e_access_traits_pointer p_traits,
-                const char* __file, int __line) const
-    { assert_valid_imp(p_traits, __file, __line); }
-#endif 
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-#undef PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC
-
-  } // namespace detail
-} // namespace __gnu_pbds
-
-#endif 
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
deleted file mode 100644 (file)
index c574628..0000000
+++ /dev/null
@@ -1,338 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file node_iterators.hpp
- * Contains an implementation class for pat_trie_.
- */
-
-#ifndef PB_DS_PAT_TRIE_NODE_ITERATORS_HPP
-#define PB_DS_PAT_TRIE_NODE_ITERATORS_HPP
-
-#include <debug/debug.h>
-
-namespace __gnu_pbds
-{
-  namespace detail
-  {
-
-#define PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC                       \
-    pat_trie_const_node_it_<                                           \
-                                                       Node,           \
-                                                       Leaf,           \
-                                                       Head,           \
-                                                       Internal_Node,  \
-                                                       Const_Iterator, \
-                                                       Iterator,       \
-                                                       E_Access_Traits, \
-                                                       Allocator>
-
-#define PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC                     \
-    pat_trie_node_it_<                                         \
-                                       Node,                   \
-                                       Leaf,                   \
-                                       Head,                   \
-                                       Internal_Node,          \
-                                       Const_Iterator,         \
-                                       Iterator,               \
-                                       E_Access_Traits,        \
-                                       Allocator>
-
-    // Const node iterator.
-    template<typename Node,
-            class Leaf,
-            class Head,
-            class Internal_Node,
-            class Const_Iterator,
-            class Iterator,
-            class E_Access_Traits,
-            class Allocator>
-    class pat_trie_const_node_it_
-    {
-    protected:
-      typedef
-      typename Allocator::template rebind<
-      Node>::other::pointer
-      node_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       Leaf>::other::const_pointer
-      const_leaf_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       Leaf>::other::pointer
-      leaf_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       Internal_Node>::other::pointer
-      internal_node_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       Internal_Node>::other::const_pointer
-      const_internal_node_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       E_Access_Traits>::other::const_pointer
-      const_e_access_traits_pointer;
-
-    private:
-      inline typename E_Access_Traits::const_iterator
-      pref_begin() const
-      {
-       if (m_p_nd->m_type == pat_trie_leaf_node_type)
-         return (m_p_traits->begin(
-                                   m_p_traits->extract_key(
-                                                           static_cast<const_leaf_pointer>(m_p_nd)->value())));
-
-       _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);
-
-       return (static_cast<const_internal_node_pointer>(m_p_nd)->pref_b_it());
-      }
-
-      inline typename E_Access_Traits::const_iterator
-      pref_end() const
-      {
-       if (m_p_nd->m_type == pat_trie_leaf_node_type)
-         return (m_p_traits->end(
-                                 m_p_traits->extract_key(
-                                                         static_cast<const_leaf_pointer>(m_p_nd)->value())));
-
-       _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);
-
-       return (static_cast<const_internal_node_pointer>(m_p_nd)->pref_e_it());
-      }
-
-    public:
-
-      // Size type.
-      typedef typename Allocator::size_type size_type;
-
-      // Category.
-      typedef trivial_iterator_tag iterator_category;
-
-      // Difference type.
-      typedef trivial_iterator_difference_type difference_type;
-
-      // __Iterator's value type.
-      typedef Const_Iterator value_type;
-
-      // __Iterator's reference type.
-      typedef value_type reference;
-
-      // __Iterator's __const reference type.
-      typedef value_type const_reference;
-
-      // Element access traits.
-      typedef E_Access_Traits e_access_traits;
-
-      // A key's element __const iterator.
-      typedef typename e_access_traits::const_iterator const_e_iterator;
-
-      // Metadata type.
-      typedef typename Node::metadata_type metadata_type;
-
-      // Const metadata reference type.
-      typedef
-      typename Allocator::template rebind<
-       metadata_type>::other::const_reference
-      const_metadata_reference;
-
-      // Default constructor.
-      /*
-       inline
-       pat_trie_const_node_it_()
-      */
-      inline
-      pat_trie_const_node_it_(node_pointer p_nd = 0,  
-                             const_e_access_traits_pointer p_traits = 0) 
-      : m_p_nd(const_cast<node_pointer>(p_nd)), m_p_traits(p_traits)
-      { }
-
-      // Subtree valid prefix.
-      inline std::pair<const_e_iterator, const_e_iterator>
-      valid_prefix() const
-      { return std::make_pair(pref_begin(), pref_end()); }
-
-      // Const access; returns the __const iterator* associated with
-      // the current leaf.
-      inline const_reference
-      operator*() const
-      {
-       _GLIBCXX_DEBUG_ASSERT(num_children() == 0);
-       return Const_Iterator(m_p_nd);
-      }
-
-      // Metadata access.
-      inline const_metadata_reference
-      get_metadata() const
-      { return m_p_nd->get_metadata(); }
-
-      // Returns the number of children in the corresponding node.
-      inline size_type
-      num_children() const
-      {
-       if (m_p_nd->m_type == pat_trie_leaf_node_type)
-         return 0;
-       _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);
-       return std::distance(static_cast<internal_node_pointer>(m_p_nd)->begin(),  static_cast<internal_node_pointer>(m_p_nd)->end());
-      }
-
-      // Returns a __const node __iterator to the corresponding node's
-      // i-th child.
-      PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC
-      get_child(size_type i) const
-      {
-       _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);
-       typename Internal_Node::iterator it =
-         static_cast<internal_node_pointer>(m_p_nd)->begin();
-
-       std::advance(it, i);
-       return PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC(*it, m_p_traits);
-      }
-
-      // Compares content to a different iterator object.
-      inline bool
-      operator==(const PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC& other) const
-      { return (m_p_nd == other.m_p_nd); }
-
-      // Compares content (negatively) to a different iterator object.
-      inline bool
-      operator!=(const PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC& other) const
-      { return m_p_nd != other.m_p_nd; }
-
-    private:
-
-      friend class PB_DS_CLASS_C_DEC;
-
-    public:
-      node_pointer m_p_nd;
-
-      const_e_access_traits_pointer m_p_traits;
-    };
-
-    // Node iterator.
-    template<typename Node,
-            class Leaf,
-            class Head,
-            class Internal_Node,
-            class Const_Iterator,
-            class Iterator,
-            class E_Access_Traits,
-            class Allocator>
-    class pat_trie_node_it_ : 
-      public PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC
-
-    {
-    private:
-      typedef
-      typename Allocator::template rebind<
-      Node>::other::pointer
-      node_pointer;
-
-      typedef Iterator iterator;
-
-      typedef PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC base_type;
-
-      typedef
-      typename base_type::const_e_access_traits_pointer
-      const_e_access_traits_pointer;
-
-      typedef typename base_type::internal_node_pointer internal_node_pointer;
-
-    public:
-
-      // Size type.
-      typedef
-      typename PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC::size_type
-      size_type;
-
-      // __Iterator's value type.
-      typedef Iterator value_type;
-
-      // __Iterator's reference type.
-      typedef value_type reference;
-
-      // __Iterator's __const reference type.
-      typedef value_type const_reference;
-
-      // Default constructor.
-      /*
-       inline
-       pat_trie_node_it_() ;
-      */
-
-      inline
-      pat_trie_node_it_(node_pointer p_nd = 0,  const_e_access_traits_pointer p_traits = 0) : base_type(p_nd, p_traits)
-      { }
-
-      // Access; returns the iterator*  associated with the current leaf.
-      inline reference
-      operator*() const
-      {
-       _GLIBCXX_DEBUG_ASSERT(base_type::num_children() == 0);
-       return Iterator(base_type::m_p_nd);
-
-      }
-
-      // Returns a node __iterator to the corresponding node's i-th child.
-      PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC
-      get_child(size_type i) const
-      {
-       _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == pat_trie_internal_node_type);
-
-       typename Internal_Node::iterator it =
-         static_cast<internal_node_pointer>(base_type::m_p_nd)->begin();
-
-       std::advance(it, i);
-       return PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC(*it, base_type::m_p_traits);
-      }
-
-    private:
-      friend class PB_DS_CLASS_C_DEC;
-    };
-
-#undef PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC
-#undef PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC
-
-  } // namespace detail
-} // namespace __gnu_pbds
-
-#endif 
-
index 5313c0b97120f5a632f268394ff7b6b1af4299e9..46bb016e25ebf84acb09214394d1919e00a18525 100644 (file)
 // warranty.
 
 /**
- * @file pat_trie_.hpp
+ * @file pat_trie_/pat_trie_.hpp
  * Contains an implementation class for a patricia tree.
  */
 
-/**
- * This implementation loosely borrows ideas from:
- * 1) Fast Mergeable Integer Maps, Okasaki, Gill 1998
- * 2) Ptset: Sets of integers implemented as Patricia trees,
- *    Jean-Christophe Filliatr, 2000
- **/
-
-#include <ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp>
-#include <ext/pb_ds/detail/pat_trie_/node_base.hpp>
-#include <ext/pb_ds/exception.hpp>
-#include <ext/pb_ds/tag_and_trait.hpp>
-#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
-#include <ext/pb_ds/detail/types_traits.hpp>
-#include <ext/pb_ds/tree_policy.hpp>
-#include <ext/pb_ds/detail/cond_dealtor.hpp>
-#include <ext/pb_ds/detail/type_utils.hpp>
 #include <iterator>
 #include <utility>
 #include <algorithm>
 #include <functional>
 #include <assert.h>
 #include <list>
+#include <ext/pb_ds/exception.hpp>
+#include <ext/pb_ds/tag_and_trait.hpp>
+#include <ext/pb_ds/tree_policy.hpp>
+#include <ext/pb_ds/detail/cond_dealtor.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <ext/pb_ds/detail/types_traits.hpp>
+#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
+#include <ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp>
+#include <ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp>
 #ifdef _GLIBCXX_DEBUG
 #include <ext/pb_ds/detail/debug_map_base.hpp>
-#endif 
+#endif
 #include <debug/debug.h>
 
 namespace __gnu_pbds
 {
   namespace detail
   {
-#define PB_DS_CLASS_T_DEC \
-    template<typename Key, typename Mapped, typename Node_And_It_Traits, \
-            typename Allocator>
-
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CLASS_NAME pat_trie_data_
-#endif 
+#define PB_DS_PAT_TRIE_NAME pat_trie_map
+#endif
 
 #ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_CLASS_NAME pat_trie_no_data_
-#endif 
+#define PB_DS_PAT_TRIE_NAME pat_trie_set
+#endif
+
+#define PB_DS_CLASS_T_DEC \
+    template<typename Key, typename Mapped, typename Node_And_It_Traits, \
+            typename _Alloc>
 
 #define PB_DS_CLASS_C_DEC \
-    PB_DS_CLASS_NAME<Key, Mapped, Node_And_It_Traits, Allocator>
+    PB_DS_PAT_TRIE_NAME<Key, Mapped, Node_And_It_Traits, _Alloc>
 
-#define PB_DS_TYPES_TRAITS_C_DEC \
-    types_traits<Key, Mapped, Allocator, false>
+#define PB_DS_PAT_TRIE_TRAITS_BASE \
+    types_traits<Key, Mapped, _Alloc, false>
 
 #ifdef _GLIBCXX_DEBUG
 #define PB_DS_DEBUG_MAP_BASE_C_DEC \
-    debug_map_base<Key,        eq_by_less<Key, \
-                       std::less<Key> >, typename Allocator::template rebind<Key>::other::const_reference>
-#endif 
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#define PB_DS_EP2VP(X)& ((X)->m_value)
-#endif 
+    debug_map_base<Key,        eq_by_less<Key, std::less<Key> >, \
+                typename _Alloc::template rebind<Key>::other::const_reference>
+#endif
 
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped_Data()
-#define PB_DS_EP2VP(X)& ((X)->m_value.first)
-#endif 
 
     /**
-     * class description = PATRICIA trie implementation.">
-     **/
-    template<typename Key,
-            typename Mapped,
-            typename Node_And_It_Traits,
-            typename Allocator>
-    class PB_DS_CLASS_NAME :
+     *  @brief PATRICIA trie.
+     *
+     * This implementation loosely borrows ideas from:
+     * 1) Fast Mergeable Integer Maps, Okasaki, Gill 1998
+     * 2) Ptset: Sets of integers implemented as Patricia trees,
+     *    Jean-Christophe Filliatr, 2000
+     */
+    template<typename Key, typename Mapped, typename Node_And_It_Traits,
+            typename _Alloc>
+    class PB_DS_PAT_TRIE_NAME :
 #ifdef _GLIBCXX_DEBUG
       public PB_DS_DEBUG_MAP_BASE_C_DEC,
-#endif 
-      public Node_And_It_Traits::synth_e_access_traits,
+#endif
+      public Node_And_It_Traits::synth_access_traits,
       public Node_And_It_Traits::node_update,
-      public PB_DS_TYPES_TRAITS_C_DEC
+      public PB_DS_PAT_TRIE_TRAITS_BASE,
+      public pat_trie_base
     {
     private:
-      typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
+      typedef pat_trie_base                            base_type;
+      typedef PB_DS_PAT_TRIE_TRAITS_BASE               traits_base;
+      typedef Node_And_It_Traits                       traits_type;
+
+      typedef typename traits_type::synth_access_traits synth_access_traits;
+      typedef typename synth_access_traits::const_iterator a_const_iterator;
+
+      typedef typename traits_type::node               node;
+      typedef typename _Alloc::template rebind<node>   __rebind_n;
+      typedef typename __rebind_n::other::const_pointer node_const_pointer;
+      typedef typename __rebind_n::other::pointer      node_pointer;
+
+      typedef typename traits_type::head               head;
+      typedef typename _Alloc::template rebind<head>   __rebind_h;
+      typedef typename __rebind_h::other               head_allocator;
+      typedef typename head_allocator::pointer                 head_pointer;
+
+      typedef typename traits_type::leaf               leaf;
+      typedef typename _Alloc::template rebind<leaf>   __rebind_l;
+      typedef typename __rebind_l::other               leaf_allocator;
+      typedef typename leaf_allocator::pointer                 leaf_pointer;
+      typedef typename leaf_allocator::const_pointer   leaf_const_pointer;
+
+      typedef typename traits_type::inode              inode;
+      typedef typename inode::iterator                         inode_iterator;
+      typedef typename _Alloc::template rebind<inode>  __rebind_in;
+      typedef typename __rebind_in::other              __rebind_ina;
+      typedef typename __rebind_in::other                      inode_allocator;
+      typedef typename __rebind_ina::pointer           inode_pointer;
+      typedef typename __rebind_ina::const_pointer     inode_const_pointer;
+
+
+      /// Conditional deallocator.
+      class cond_dealtor
+      {
+      protected:
+       leaf_pointer            m_p_nd;
+       bool                    m_no_action_dtor;
+       bool                    m_call_destructor;
+
+      public:
+       cond_dealtor(leaf_pointer p_nd)
+       : m_p_nd(p_nd), m_no_action_dtor(false), m_call_destructor(false)
+       { }
 
-      typedef typename Node_And_It_Traits::synth_e_access_traits synth_e_access_traits;
-      typedef typename Allocator::template rebind<synth_e_access_traits>::other::const_pointer const_e_access_traits_pointer;
-      typedef typename synth_e_access_traits::const_iterator const_e_iterator;
+       void
+       set_no_action_dtor()
+       { m_no_action_dtor = true; }
 
-      typedef typename Node_And_It_Traits::node node;
-      typedef typename Allocator::template rebind<node>::other::const_pointer const_node_pointer;
+       void
+       set_call_destructor()
+       { m_call_destructor = true; }
 
-      typedef typename Allocator::template rebind<node>::other::pointer node_pointer;
+       ~cond_dealtor()
+       {
+         if (m_no_action_dtor)
+           return;
 
-      typedef typename Node_And_It_Traits::head head;
-      typedef typename Allocator::template rebind<head>::other head_allocator;
-      typedef typename head_allocator::pointer head_pointer;
+         if (m_call_destructor)
+           m_p_nd->~leaf();
 
-      typedef typename Node_And_It_Traits::leaf leaf;
-      typedef typename Allocator::template rebind<leaf>::other leaf_allocator;
-      typedef typename leaf_allocator::const_pointer const_leaf_pointer;
-      typedef typename leaf_allocator::pointer leaf_pointer;
+         s_leaf_allocator.deallocate(m_p_nd, 1);
+       }
+      };
 
-      typedef typename Node_And_It_Traits::internal_node internal_node;
-      typedef typename Allocator::template rebind<internal_node>::other internal_node_allocator;
-      typedef typename internal_node_allocator::const_pointer const_internal_node_pointer;
-      typedef typename internal_node_allocator::pointer internal_node_pointer;
 
-#include <ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp>
+      /// Branch bag, for split-join.
+      class branch_bag
+      {
+      private:
+       typedef inode_pointer                           __inp;
+       typedef typename _Alloc::template rebind<__inp>::other  __rebind_inp;
 
 #ifdef _GLIBCXX_DEBUG
-      typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
-#endif 
+       typedef std::_GLIBCXX_STD_C::list<__inp, __rebind_inp>  bag_type;
+#else
+       typedef std::list<__inp, __rebind_inp>                  bag_type;
+#endif
+
+       bag_type                                                m_bag;
+      public:
+       void
+       add_branch()
+       {
+         inode_pointer p_nd = s_inode_allocator.allocate(1);
+         __try
+           {
+             m_bag.push_back(p_nd);
+           }
+         __catch(...)
+           {
+             s_inode_allocator.deallocate(p_nd, 1);
+             __throw_exception_again;
+           }
+       }
+
+       inode_pointer
+       get_branch()
+       {
+         _GLIBCXX_DEBUG_ASSERT(!m_bag.empty());
+         inode_pointer p_nd = *m_bag.begin();
+         m_bag.pop_front();
+         return p_nd;
+       }
+
+       ~branch_bag()
+       {
+         while (!m_bag.empty())
+           {
+             inode_pointer p_nd = *m_bag.begin();
+             s_inode_allocator.deallocate(p_nd, 1);
+             m_bag.pop_front();
+           }
+       }
+
+       inline bool
+       empty() const
+       { return m_bag.empty(); }
+      };
 
-#include <ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp>
+#ifdef _GLIBCXX_DEBUG
+      typedef PB_DS_DEBUG_MAP_BASE_C_DEC               debug_base;
+#endif
 
-      typedef typename Node_And_It_Traits::null_node_update_pointer null_node_update_pointer;
+      typedef typename traits_type::null_node_update_pointer null_node_update_pointer;
 
     public:
-      typedef pat_trie_tag container_category;
-      typedef Allocator allocator_type;
-      typedef typename Allocator::size_type size_type;
-      typedef typename Allocator::difference_type difference_type;
-
-      typedef typename traits_base::key_type key_type;
-      typedef typename traits_base::key_pointer key_pointer;
-      typedef typename traits_base::const_key_pointer const_key_pointer;
-      typedef typename traits_base::key_reference key_reference;
-      typedef typename traits_base::const_key_reference const_key_reference;
-      typedef typename traits_base::mapped_type mapped_type;
-      typedef typename traits_base::mapped_pointer mapped_pointer;
-      typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
-      typedef typename traits_base::mapped_reference mapped_reference;
-      typedef typename traits_base::const_mapped_reference const_mapped_reference;
-      typedef typename traits_base::value_type value_type;
-      typedef typename traits_base::pointer pointer;
-      typedef typename traits_base::const_pointer const_pointer;
-      typedef typename traits_base::reference reference;
-      typedef typename traits_base::const_reference const_reference;
-
-      typedef typename Node_And_It_Traits::const_iterator const_point_iterator;
-      typedef typename Node_And_It_Traits::iterator point_iterator;
-      typedef const_point_iterator const_iterator;
-      typedef point_iterator iterator;
-
-      typedef typename Node_And_It_Traits::const_reverse_iterator const_reverse_iterator;
-      typedef typename Node_And_It_Traits::reverse_iterator reverse_iterator;
-      typedef typename Node_And_It_Traits::const_node_iterator const_node_iterator;
-      typedef typename Node_And_It_Traits::node_iterator node_iterator;
-      typedef typename Node_And_It_Traits::e_access_traits e_access_traits;
-      typedef typename Node_And_It_Traits::node_update node_update;
-
-      PB_DS_CLASS_NAME();
-
-      PB_DS_CLASS_NAME(const e_access_traits&);
-
-      PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+      typedef pat_trie_tag                             container_category;
+      typedef _Alloc                                   allocator_type;
+      typedef typename _Alloc::size_type               size_type;
+      typedef typename _Alloc::difference_type                 difference_type;
+
+      typedef typename traits_base::key_type           key_type;
+      typedef typename traits_base::key_pointer        key_pointer;
+      typedef typename traits_base::key_const_pointer  key_const_pointer;
+      typedef typename traits_base::key_reference      key_reference;
+      typedef typename traits_base::key_const_reference key_const_reference;
+      typedef typename traits_base::mapped_type        mapped_type;
+      typedef typename traits_base::mapped_pointer     mapped_pointer;
+      typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
+      typedef typename traits_base::mapped_reference   mapped_reference;
+      typedef typename traits_base::mapped_const_reference mapped_const_reference;
+      typedef typename traits_base::value_type                 value_type;
+      typedef typename traits_base::pointer            pointer;
+      typedef typename traits_base::const_pointer      const_pointer;
+      typedef typename traits_base::reference          reference;
+      typedef typename traits_base::const_reference    const_reference;
+
+      typedef typename traits_type::access_traits      access_traits;
+      typedef typename traits_type::const_iterator     point_const_iterator;
+      typedef typename traits_type::iterator           point_iterator;
+      typedef point_const_iterator                     const_iterator;
+      typedef point_iterator                           iterator;
+
+      typedef typename traits_type::reverse_iterator   reverse_iterator;
+      typedef typename traits_type::const_reverse_iterator const_reverse_iterator;
+      typedef typename traits_type::node_const_iterator node_const_iterator;
+      typedef typename traits_type::node_iterator      node_iterator;
+      typedef typename traits_type::node_update        node_update;
+
+      PB_DS_PAT_TRIE_NAME();
+
+      PB_DS_PAT_TRIE_NAME(const access_traits&);
+
+      PB_DS_PAT_TRIE_NAME(const PB_DS_CLASS_C_DEC&);
 
       void
       swap(PB_DS_CLASS_C_DEC&);
 
-      ~PB_DS_CLASS_NAME();
+      ~PB_DS_PAT_TRIE_NAME();
 
       inline bool
       empty() const;
@@ -211,55 +288,55 @@ namespace __gnu_pbds
       inline size_type
       max_size() const;
 
-      e_access_traits& 
-      get_e_access_traits();
+      access_traits&
+      get_access_traits();
 
-      const e_access_traits& 
-      get_e_access_traits() const;
+      const access_traits&
+      get_access_traits() const;
 
-      node_update& 
+      node_update&
       get_node_update();
 
-      const node_update& 
+      const node_update&
       get_node_update() const;
 
       inline std::pair<point_iterator, bool>
       insert(const_reference);
 
       inline mapped_reference
-      operator[](const_key_reference r_key)
+      operator[](key_const_reference r_key)
       {
 #ifdef PB_DS_DATA_TRUE_INDICATOR
        return insert(std::make_pair(r_key, mapped_type())).first->second;
-#else 
+#else
        insert(r_key);
-       return traits_base::s_null_mapped;
-#endif 
+       return traits_base::s_null_type;
+#endif
       }
 
       inline point_iterator
-      find(const_key_reference);
+      find(key_const_reference);
 
-      inline const_point_iterator
-      find(const_key_reference) const;
+      inline point_const_iterator
+      find(key_const_reference) const;
 
       inline point_iterator
-      lower_bound(const_key_reference);
+      lower_bound(key_const_reference);
 
-      inline const_point_iterator
-      lower_bound(const_key_reference) const;
+      inline point_const_iterator
+      lower_bound(key_const_reference) const;
 
       inline point_iterator
-      upper_bound(const_key_reference);
+      upper_bound(key_const_reference);
 
-      inline const_point_iterator
-      upper_bound(const_key_reference) const;
+      inline point_const_iterator
+      upper_bound(key_const_reference) const;
 
       void
       clear();
 
       inline bool
-      erase(const_key_reference);
+      erase(key_const_reference);
 
       inline const_iterator
       erase(const_iterator);
@@ -267,7 +344,7 @@ namespace __gnu_pbds
 #ifdef PB_DS_DATA_TRUE_INDICATOR
       inline iterator
       erase(iterator);
-#endif 
+#endif
 
       inline const_reverse_iterator
       erase(const_reverse_iterator);
@@ -275,7 +352,7 @@ namespace __gnu_pbds
 #ifdef PB_DS_DATA_TRUE_INDICATOR
       inline reverse_iterator
       erase(reverse_iterator);
-#endif 
+#endif
 
       template<typename Pred>
       inline size_type
@@ -285,7 +362,7 @@ namespace __gnu_pbds
       join(PB_DS_CLASS_C_DEC&);
 
       void
-      split(const_key_reference, PB_DS_CLASS_C_DEC&);
+      split(key_const_reference, PB_DS_CLASS_C_DEC&);
 
       inline iterator
       begin();
@@ -311,13 +388,13 @@ namespace __gnu_pbds
       inline const_reverse_iterator
       rend() const;
 
-      inline const_node_iterator
+      inline node_const_iterator
       node_begin() const;
 
       inline node_iterator
       node_begin();
 
-      inline const_node_iterator
+      inline node_const_iterator
       node_end() const;
 
       inline node_iterator
@@ -326,10 +403,9 @@ namespace __gnu_pbds
 #ifdef PB_DS_PAT_TRIE_TRACE_
       void
       trace() const;
-#endif 
+#endif
 
     protected:
-
       template<typename It>
       void
       copy_from_range(It, It);
@@ -338,10 +414,9 @@ namespace __gnu_pbds
       value_swap(PB_DS_CLASS_C_DEC&);
 
       node_pointer
-      recursive_copy_node(const_node_pointer);
+      recursive_copy_node(node_const_pointer);
 
     private:
-
       void
       initialize();
 
@@ -353,54 +428,46 @@ namespace __gnu_pbds
       apply_update(node_pointer, Node_Update_*);
 
       bool
-      join_prep(PB_DS_CLASS_C_DEC&, split_join_branch_bag&);
+      join_prep(PB_DS_CLASS_C_DEC&, branch_bag&);
 
       void
-      rec_join_prep(const_node_pointer, const_node_pointer, 
-                   split_join_branch_bag&);
+      rec_join_prep(node_const_pointer, node_const_pointer, branch_bag&);
 
       void
-      rec_join_prep(const_leaf_pointer, const_leaf_pointer, 
-                   split_join_branch_bag&);
+      rec_join_prep(leaf_const_pointer, leaf_const_pointer, branch_bag&);
 
       void
-      rec_join_prep(const_leaf_pointer, const_internal_node_pointer, 
-                   split_join_branch_bag&);
+      rec_join_prep(leaf_const_pointer, inode_const_pointer, branch_bag&);
 
       void
-      rec_join_prep(const_internal_node_pointer, const_leaf_pointer, 
-                   split_join_branch_bag&);
+      rec_join_prep(inode_const_pointer, leaf_const_pointer, branch_bag&);
 
       void
-      rec_join_prep(const_internal_node_pointer, const_internal_node_pointer, 
-                   split_join_branch_bag&);
+      rec_join_prep(inode_const_pointer, inode_const_pointer, branch_bag&);
 
       node_pointer
-      rec_join(node_pointer, node_pointer, size_type, split_join_branch_bag&);
+      rec_join(node_pointer, node_pointer, size_type, branch_bag&);
 
       node_pointer
-      rec_join(leaf_pointer, leaf_pointer, split_join_branch_bag&);
+      rec_join(leaf_pointer, leaf_pointer, branch_bag&);
 
       node_pointer
-      rec_join(leaf_pointer, internal_node_pointer, size_type, 
-              split_join_branch_bag&);
+      rec_join(leaf_pointer, inode_pointer, size_type, branch_bag&);
 
       node_pointer
-      rec_join(internal_node_pointer, leaf_pointer, size_type, 
-              split_join_branch_bag&);
+      rec_join(inode_pointer, leaf_pointer, size_type, branch_bag&);
 
       node_pointer
-      rec_join(internal_node_pointer, internal_node_pointer, 
-              split_join_branch_bag&);
+      rec_join(inode_pointer, inode_pointer, branch_bag&);
 
       size_type
-      keys_diff_ind(typename e_access_traits::const_iterator,
-                   typename e_access_traits::const_iterator,
-                   typename e_access_traits::const_iterator,
-                   typename e_access_traits::const_iterator);
+      keys_diff_ind(typename access_traits::const_iterator,
+                   typename access_traits::const_iterator,
+                   typename access_traits::const_iterator,
+                   typename access_traits::const_iterator);
 
-      internal_node_pointer
-      insert_branch(node_pointer, node_pointer, split_join_branch_bag&);
+      inode_pointer
+      insert_branch(node_pointer, node_pointer, branch_bag&);
 
       void
       update_min_max_for_inserted_leaf(leaf_pointer);
@@ -415,90 +482,87 @@ namespace __gnu_pbds
       clear_imp(node_pointer);
 
       void
-      erase_fixup(internal_node_pointer);
+      erase_fixup(inode_pointer);
 
       void
       update_min_max_for_erased_leaf(leaf_pointer);
 
-      static inline const_e_iterator
-      pref_begin(const_node_pointer);
+      static inline a_const_iterator
+      pref_begin(node_const_pointer);
 
-      static inline const_e_iterator
-      pref_end(const_node_pointer);
+      static inline a_const_iterator
+      pref_end(node_const_pointer);
 
       inline node_pointer
-      find_imp(const_key_reference);
+      find_imp(key_const_reference);
 
       inline node_pointer
-      lower_bound_imp(const_key_reference);
+      lower_bound_imp(key_const_reference);
 
       inline node_pointer
-      upper_bound_imp(const_key_reference);
+      upper_bound_imp(key_const_reference);
 
-      inline static const_leaf_pointer
-      leftmost_descendant(const_node_pointer);
+      inline static leaf_const_pointer
+      leftmost_descendant(node_const_pointer);
 
       inline static leaf_pointer
       leftmost_descendant(node_pointer);
 
-      inline static const_leaf_pointer
-      rightmost_descendant(const_node_pointer);
+      inline static leaf_const_pointer
+      rightmost_descendant(node_const_pointer);
 
       inline static leaf_pointer
       rightmost_descendant(node_pointer);
 
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_valid(const char* file, int line) const;
+      assert_valid(const char*, int) const;
 
       void
-      assert_iterators(const char* file, int line) const;
+      assert_iterators(const char*, int) const;
 
       void
-      assert_reverse_iterators(const char* file, int line) const;
+      assert_reverse_iterators(const char*, int) const;
 
       static size_type
-      recursive_count_leafs(const_node_pointer,
-                           const char* file, int line);
-#endif 
+      recursive_count_leafs(node_const_pointer, const char*, int);
+#endif
 
 #ifdef PB_DS_PAT_TRIE_TRACE_
       static void
-      trace_node(const_node_pointer, size_type);
+      trace_node(node_const_pointer, size_type);
 
       template<typename Metadata_>
       static void
-      trace_node_metadata(const_node_pointer, type_to_type<Metadata_>);
+      trace_node_metadata(node_const_pointer, type_to_type<Metadata_>);
 
       static void
-      trace_node_metadata(const_node_pointer, type_to_type<null_node_metadata>);
-#endif 
+      trace_node_metadata(node_const_pointer, type_to_type<null_type>);
+#endif
 
       leaf_pointer
-      split_prep(const_key_reference, PB_DS_CLASS_C_DEC&, 
-                split_join_branch_bag&);
+      split_prep(key_const_reference, PB_DS_CLASS_C_DEC&, branch_bag&);
 
       node_pointer
-      rec_split(node_pointer, const_e_iterator, const_e_iterator, 
-               PB_DS_CLASS_C_DEC&, split_join_branch_bag&);
+      rec_split(node_pointer, a_const_iterator, a_const_iterator,
+               PB_DS_CLASS_C_DEC&, branch_bag&);
 
       void
-      split_insert_branch(size_type, const_e_iterator, 
-                         typename internal_node::iterator, 
-                         size_type, split_join_branch_bag&);
+      split_insert_branch(size_type, a_const_iterator, inode_iterator,
+                         size_type, branch_bag&);
 
-      static head_allocator s_head_allocator;
-      static internal_node_allocator s_internal_node_allocator;
-      static leaf_allocator s_leaf_allocator;
+      static head_allocator            s_head_allocator;
+      static inode_allocator           s_inode_allocator;
+      static leaf_allocator            s_leaf_allocator;
 
-      head_pointer m_p_head;
-      size_type m_size;
+      head_pointer                     m_p_head;
+      size_type                        m_size;
     };
 
-#define PB_DS_ASSERT_NODE_VALID(X)                                     \
+#define PB_DS_ASSERT_NODE_VALID(X) \
   _GLIBCXX_DEBUG_ONLY(X->assert_valid(this, __FILE__, __LINE__);)
 
-#define PB_DS_RECURSIVE_COUNT_LEAFS(X)                                 \
+#define PB_DS_RECURSIVE_COUNT_LEAFS(X) \
   recursive_count_leafs(X, __FILE__, __LINE__)
 
 #include <ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp>
@@ -517,12 +581,8 @@ namespace __gnu_pbds
 #undef PB_DS_ASSERT_NODE_VALID
 #undef PB_DS_CLASS_C_DEC
 #undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_NAME
-#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_PAT_TRIE_NAME
+#undef PB_DS_PAT_TRIE_TRAITS_BASE
 #undef PB_DS_DEBUG_MAP_BASE_C_DEC
-#undef PB_DS_V2F
-#undef PB_DS_EP2VP
-#undef PB_DS_V2S
-
   } // namespace detail
 } // namespace __gnu_pbds
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp
new file mode 100644 (file)
index 0000000..b3718b5
--- /dev/null
@@ -0,0 +1,1357 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file pat_trie_/pat_trie_base.hpp
+ * Contains the base class for a patricia tree.
+ */
+
+#ifndef PB_DS_PAT_TRIE_BASE
+#define PB_DS_PAT_TRIE_BASE
+
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+  namespace detail
+  {
+    /// Base type for PATRICIA trees.
+    struct pat_trie_base
+    {
+      /// Three types of nodes.
+      enum node_type
+       {
+         i_node,
+         leaf_node,
+         head_node
+       };
+
+      /// Metadata base primary template.
+      template<typename Metadata, typename _Alloc>
+       struct _Metadata
+       {
+         typedef Metadata                                      metadata_type;
+         typedef _Alloc                                        allocator_type;
+         typedef typename _Alloc::template rebind<Metadata>    __rebind_m;
+         typedef typename __rebind_m::other::const_reference  const_reference;
+
+         const_reference
+         get_metadata() const
+         { return m_metadata; }
+
+         metadata_type                                         m_metadata;
+       };
+
+      /// Specialization for null metadata.
+      template<typename _Alloc>
+       struct _Metadata<null_type, _Alloc>
+       {
+         typedef null_type                                     metadata_type;
+         typedef _Alloc                                        allocator_type;
+       };
+
+
+      /// Node base.
+      template<typename _ATraits, typename Metadata>
+      struct _Node_base
+      : public Metadata
+      {
+      private:
+       typedef typename Metadata::allocator_type               _Alloc;
+
+      public:
+       typedef _Alloc                                          allocator_type;
+       typedef _ATraits                                        access_traits;
+       typedef typename _ATraits::type_traits                  type_traits;
+       typedef typename _Alloc::template rebind<_Node_base>    __rebind_n;
+       typedef typename __rebind_n::other::pointer             node_pointer;
+
+       node_pointer                                            m_p_parent;
+       const node_type                                         m_type;
+
+       _Node_base(node_type type) : m_type(type)
+       { }
+
+       typedef typename _Alloc::template rebind<_ATraits>    __rebind_at;
+       typedef typename __rebind_at::other::const_pointer    a_const_pointer;
+       typedef typename _ATraits::const_iterator             a_const_iterator;
+
+#ifdef _GLIBCXX_DEBUG
+       typedef std::pair<a_const_iterator, a_const_iterator> node_debug_info;
+
+       void
+       assert_valid(a_const_pointer p_traits,
+                    const char* __file, int __line) const
+       { assert_valid_imp(p_traits, __file, __line); }
+
+       virtual node_debug_info
+       assert_valid_imp(a_const_pointer, const char*, int) const = 0;
+#endif
+      };
+
+
+    /// Head node for PATRICIA tree.
+    template<typename _ATraits, typename Metadata>
+    struct _Head
+    : public _Node_base<_ATraits, Metadata>
+    {
+      typedef _Node_base<_ATraits, Metadata>                   base_type;
+      typedef typename base_type::type_traits                  type_traits;
+      typedef typename base_type::node_pointer                 node_pointer;
+
+      node_pointer                                             m_p_min;
+      node_pointer                                             m_p_max;
+
+      _Head() : base_type(head_node) { }
+
+#ifdef _GLIBCXX_DEBUG
+      typedef typename base_type::node_debug_info                     node_debug_info;
+      typedef typename base_type::a_const_pointer             a_const_pointer;
+
+      virtual node_debug_info
+      assert_valid_imp(a_const_pointer, const char* __file, int __line) const
+      {
+       _GLIBCXX_DEBUG_VERIFY_AT(false,
+                                _M_message("Assertion from %1;:%2;")
+                                ._M_string(__FILE__)._M_integer(__LINE__),
+                                __file, __line);
+       return node_debug_info();
+      }
+#endif
+    };
+
+
+    /// Leaf node for PATRICIA tree.
+    template<typename _ATraits, typename Metadata>
+    struct _Leaf
+    : public _Node_base<_ATraits, Metadata>
+    {
+      typedef _Node_base<_ATraits, Metadata>                   base_type;
+      typedef typename base_type::type_traits                  type_traits;
+      typedef typename type_traits::value_type                 value_type;
+      typedef typename type_traits::reference                  reference;
+      typedef typename type_traits::const_reference                    const_reference;
+
+    private:
+      value_type                                               m_value;
+
+      _Leaf(const _Leaf&);
+
+    public:
+      _Leaf(const_reference other)
+      : base_type(leaf_node), m_value(other) { }
+
+      reference
+      value()
+      { return m_value; }
+
+      const_reference
+      value() const
+      { return m_value; }
+
+#ifdef _GLIBCXX_DEBUG
+      typedef typename base_type::node_debug_info                      node_debug_info;
+      typedef typename base_type::a_const_pointer                      a_const_pointer;
+
+      virtual node_debug_info
+      assert_valid_imp(a_const_pointer p_traits,
+                      const char* __file, int __line) const
+      {
+       PB_DS_DEBUG_VERIFY(base_type::m_type == leaf_node);
+       node_debug_info ret;
+       const_reference r_val = value();
+       return std::make_pair(p_traits->begin(p_traits->extract_key(r_val)),
+                             p_traits->end(p_traits->extract_key(r_val)));
+      }
+
+      virtual
+      ~_Leaf() { }
+#endif
+    };
+
+
+    /// Internal node type, PATRICIA tree.
+    template<typename _ATraits, typename Metadata>
+    struct _Inode
+    : public _Node_base<_ATraits, Metadata>
+    {
+      typedef _Node_base<_ATraits, Metadata>                   base_type;
+      typedef typename base_type::type_traits                  type_traits;
+      typedef typename base_type::access_traits                        access_traits;
+      typedef typename type_traits::value_type                         value_type;
+      typedef typename base_type::allocator_type               _Alloc;
+      typedef _Alloc                                           allocator_type;
+      typedef typename _Alloc::size_type                       size_type;
+
+    private:
+      typedef typename base_type::a_const_pointer                     a_const_pointer;
+      typedef typename base_type::a_const_iterator                   a_const_iterator;
+
+      typedef typename base_type::node_pointer                 node_pointer;
+      typedef typename _Alloc::template rebind<base_type>      __rebind_n;
+      typedef typename __rebind_n::other::const_pointer      node_const_pointer;
+
+      typedef _Leaf<_ATraits, Metadata>                                leaf;
+      typedef typename _Alloc::template rebind<leaf>::other    __rebind_l;
+      typedef typename __rebind_l::pointer                     leaf_pointer;
+      typedef typename __rebind_l::const_pointer           leaf_const_pointer;
+
+      typedef typename _Alloc::template rebind<_Inode>::other  __rebind_in;
+      typedef typename __rebind_in::pointer                    inode_pointer;
+      typedef typename __rebind_in::const_pointer          inode_const_pointer;
+
+      inline size_type
+      get_pref_pos(a_const_iterator, a_const_iterator, a_const_pointer) const;
+
+    public:
+      typedef typename _Alloc::template rebind<node_pointer>::other __rebind_np;
+      typedef typename __rebind_np::pointer            node_pointer_pointer;
+      typedef typename __rebind_np::reference          node_pointer_reference;
+
+      enum
+       {
+         arr_size = _ATraits::max_size + 1
+       };
+      PB_DS_STATIC_ASSERT(min_arr_size, arr_size >= 2);
+
+
+      /// Constant child iterator.
+      struct const_iterator
+      {
+       node_pointer_pointer                            m_p_p_cur;
+       node_pointer_pointer                            m_p_p_end;
+
+       typedef std::forward_iterator_tag               iterator_category;
+       typedef typename _Alloc::difference_type        difference_type;
+       typedef node_pointer                            value_type;
+       typedef node_pointer_pointer                    pointer;
+       typedef node_pointer_reference                  reference;
+
+       const_iterator(node_pointer_pointer p_p_cur = 0,
+                      node_pointer_pointer p_p_end = 0)
+       : m_p_p_cur(p_p_cur), m_p_p_end(p_p_end)
+       { }
+
+       bool
+       operator==(const const_iterator& other) const
+       { return m_p_p_cur == other.m_p_p_cur; }
+
+       bool
+       operator!=(const const_iterator& other) const
+       { return m_p_p_cur != other.m_p_p_cur; }
+
+       const_iterator&
+       operator++()
+       {
+         do
+           ++m_p_p_cur;
+         while (m_p_p_cur != m_p_p_end && *m_p_p_cur == 0);
+         return *this;
+       }
+
+       const_iterator
+       operator++(int)
+       {
+         const_iterator ret_it(*this);
+         operator++();
+         return ret_it;
+       }
+
+       const node_pointer_pointer
+       operator->() const
+       {
+         _GLIBCXX_DEBUG_ONLY(assert_referencible();)
+         return m_p_p_cur;
+       }
+
+       node_const_pointer
+       operator*() const
+       {
+         _GLIBCXX_DEBUG_ONLY(assert_referencible();)
+         return *m_p_p_cur;
+       }
+
+      protected:
+#ifdef _GLIBCXX_DEBUG
+       void
+       assert_referencible() const
+       { _GLIBCXX_DEBUG_ASSERT(m_p_p_cur != m_p_p_end && *m_p_p_cur != 0); }
+#endif
+      };
+
+
+      /// Child iterator.
+      struct iterator : public const_iterator
+      {
+      public:
+       typedef std::forward_iterator_tag               iterator_category;
+       typedef typename _Alloc::difference_type        difference_type;
+       typedef node_pointer                            value_type;
+       typedef node_pointer_pointer                    pointer;
+       typedef node_pointer_reference                  reference;
+
+       inline
+       iterator(node_pointer_pointer p_p_cur = 0,
+                node_pointer_pointer p_p_end = 0)
+       : const_iterator(p_p_cur, p_p_end) { }
+
+       bool
+       operator==(const iterator& other) const
+       { return const_iterator::m_p_p_cur == other.m_p_p_cur; }
+
+       bool
+       operator!=(const iterator& other) const
+       { return const_iterator::m_p_p_cur != other.m_p_p_cur; }
+
+       iterator&
+       operator++()
+       {
+         const_iterator::operator++();
+         return *this;
+       }
+
+       iterator
+       operator++(int)
+       {
+         iterator ret_it(*this);
+         operator++();
+         return ret_it;
+       }
+
+       node_pointer_pointer
+       operator->()
+       {
+         _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)
+         return const_iterator::m_p_p_cur;
+       }
+
+       node_pointer
+       operator*()
+       {
+         _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)
+         return *const_iterator::m_p_p_cur;
+       }
+      };
+
+
+      _Inode(size_type, const a_const_iterator);
+
+      void
+      update_prefixes(a_const_pointer);
+
+      const_iterator
+      begin() const;
+
+      iterator
+      begin();
+
+      const_iterator
+      end() const;
+
+      iterator
+      end();
+
+      inline node_pointer
+      get_child_node(a_const_iterator, a_const_iterator, a_const_pointer);
+
+      inline node_const_pointer
+      get_child_node(a_const_iterator, a_const_iterator, a_const_pointer) const;
+
+      inline iterator
+      get_child_it(a_const_iterator, a_const_iterator, a_const_pointer);
+
+      inline node_pointer
+      get_lower_bound_child_node(a_const_iterator, a_const_iterator,
+                                size_type, a_const_pointer);
+
+      inline node_pointer
+      add_child(node_pointer, a_const_iterator, a_const_iterator,
+               a_const_pointer);
+
+      inline node_const_pointer
+      get_join_child(node_const_pointer, a_const_pointer) const;
+
+      inline node_pointer
+      get_join_child(node_pointer, a_const_pointer);
+
+      void
+      remove_child(node_pointer);
+
+      void
+      remove_child(iterator);
+
+      void
+      replace_child(node_pointer, a_const_iterator, a_const_iterator,
+                   a_const_pointer);
+
+      inline a_const_iterator
+      pref_b_it() const;
+
+      inline a_const_iterator
+      pref_e_it() const;
+
+      bool
+      should_be_mine(a_const_iterator, a_const_iterator, size_type,
+                    a_const_pointer) const;
+
+      leaf_pointer
+      leftmost_descendant();
+
+      leaf_const_pointer
+      leftmost_descendant() const;
+
+      leaf_pointer
+      rightmost_descendant();
+
+      leaf_const_pointer
+      rightmost_descendant() const;
+
+#ifdef _GLIBCXX_DEBUG
+      typedef typename base_type::node_debug_info             node_debug_info;
+
+      virtual node_debug_info
+      assert_valid_imp(a_const_pointer, const char*, int) const;
+#endif
+
+      size_type
+      get_e_ind() const
+      { return m_e_ind; }
+
+    private:
+      _Inode(const _Inode&);
+
+      size_type
+      get_begin_pos() const;
+
+      static __rebind_l                        s_leaf_alloc;
+      static __rebind_in               s_inode_alloc;
+
+      const size_type                  m_e_ind;
+      a_const_iterator                         m_pref_b_it;
+      a_const_iterator                         m_pref_e_it;
+      node_pointer                     m_a_p_children[arr_size];
+    };
+
+#define PB_DS_CONST_IT_C_DEC \
+    _CIter<Node, Leaf, Head, Inode, Is_Forward_Iterator>
+
+#define PB_DS_CONST_ODIR_IT_C_DEC \
+    _CIter<Node, Leaf, Head, Inode, !Is_Forward_Iterator>
+
+#define PB_DS_IT_C_DEC \
+    _Iter<Node, Leaf, Head, Inode, Is_Forward_Iterator>
+
+#define PB_DS_ODIR_IT_C_DEC \
+    _Iter<Node, Leaf, Head, Inode, !Is_Forward_Iterator>
+
+
+    /// Const iterator.
+    template<typename Node, typename Leaf, typename Head, typename Inode,
+            bool Is_Forward_Iterator>
+    class _CIter
+    {
+    public:
+      // These types are all the same for the first four template arguments.
+      typedef typename Node::allocator_type            allocator_type;
+      typedef typename Node::type_traits               type_traits;
+
+      typedef std::bidirectional_iterator_tag          iterator_category;
+      typedef typename allocator_type::difference_type difference_type;
+      typedef typename type_traits::value_type         value_type;
+      typedef typename type_traits::pointer            pointer;
+      typedef typename type_traits::reference          reference;
+      typedef typename type_traits::const_pointer      const_pointer;
+      typedef typename type_traits::const_reference    const_reference;
+
+      typedef allocator_type                           _Alloc;
+      typedef typename _Alloc::template rebind<Node>   __rebind_n;
+      typedef typename __rebind_n::other::pointer      node_pointer;
+      typedef typename _Alloc::template rebind<Leaf>   __rebind_l;
+      typedef typename __rebind_l::other::pointer      leaf_pointer;
+      typedef typename __rebind_l::other::const_pointer        leaf_const_pointer;
+      typedef typename _Alloc::template rebind<Head>   __rebind_h;
+      typedef typename __rebind_h::other::pointer      head_pointer;
+
+      typedef typename _Alloc::template rebind<Inode> __rebind_in;
+      typedef typename __rebind_in::other::pointer     inode_pointer;
+      typedef typename Inode::iterator                 inode_iterator;
+
+      node_pointer                                     m_p_nd;
+
+      _CIter(node_pointer p_nd = 0) : m_p_nd(p_nd)
+      { }
+
+      _CIter(const PB_DS_CONST_ODIR_IT_C_DEC& other)
+      : m_p_nd(other.m_p_nd)
+      { }
+
+      _CIter&
+      operator=(const _CIter& other)
+      {
+       m_p_nd = other.m_p_nd;
+       return *this;
+      }
+
+      _CIter&
+      operator=(const PB_DS_CONST_ODIR_IT_C_DEC& other)
+      {
+       m_p_nd = other.m_p_nd;
+       return *this;
+      }
+
+      const_pointer
+      operator->() const
+      {
+       _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == leaf_node);
+       return &static_cast<leaf_pointer>(m_p_nd)->value();
+      }
+
+      const_reference
+      operator*() const
+      {
+       _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == leaf_node);
+       return static_cast<leaf_pointer>(m_p_nd)->value();
+      }
+
+      bool
+      operator==(const _CIter& other) const
+      { return m_p_nd == other.m_p_nd; }
+
+      bool
+      operator==(const PB_DS_CONST_ODIR_IT_C_DEC& other) const
+      { return m_p_nd == other.m_p_nd; }
+
+      bool
+      operator!=(const _CIter& other) const
+      { return m_p_nd != other.m_p_nd; }
+
+      bool
+      operator!=(const PB_DS_CONST_ODIR_IT_C_DEC& other) const
+      { return m_p_nd != other.m_p_nd; }
+
+      _CIter&
+      operator++()
+      {
+       inc(integral_constant<int, Is_Forward_Iterator>());
+       return *this;
+      }
+
+      _CIter
+      operator++(int)
+      {
+       _CIter ret_it(m_p_nd);
+       operator++();
+       return ret_it;
+      }
+
+      _CIter&
+      operator--()
+      {
+       dec(integral_constant<int, Is_Forward_Iterator>());
+       return *this;
+      }
+
+      _CIter
+      operator--(int)
+      {
+       _CIter ret_it(m_p_nd);
+       operator--();
+       return ret_it;
+      }
+
+    protected:
+      void
+      inc(false_type)
+      { dec(true_type()); }
+
+      void
+      inc(true_type)
+      {
+       if (m_p_nd->m_type == head_node)
+         {
+           m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_min;
+           return;
+         }
+
+       node_pointer p_y = m_p_nd->m_p_parent;
+       while (p_y->m_type != head_node && get_larger_sibling(m_p_nd) == 0)
+         {
+           m_p_nd = p_y;
+           p_y = p_y->m_p_parent;
+         }
+
+       if (p_y->m_type == head_node)
+         {
+           m_p_nd = p_y;
+           return;
+         }
+       m_p_nd = leftmost_descendant(get_larger_sibling(m_p_nd));
+      }
+
+      void
+      dec(false_type)
+      { inc(true_type()); }
+
+      void
+      dec(true_type)
+      {
+       if (m_p_nd->m_type == head_node)
+         {
+           m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_max;
+           return;
+         }
+
+       node_pointer p_y = m_p_nd->m_p_parent;
+       while (p_y->m_type != head_node && get_smaller_sibling(m_p_nd) == 0)
+         {
+           m_p_nd = p_y;
+           p_y = p_y->m_p_parent;
+         }
+
+       if (p_y->m_type == head_node)
+         {
+           m_p_nd = p_y;
+           return;
+         }
+       m_p_nd = rightmost_descendant(get_smaller_sibling(m_p_nd));
+      }
+
+      static node_pointer
+      get_larger_sibling(node_pointer p_nd)
+      {
+       inode_pointer p_parent = static_cast<inode_pointer>(p_nd->m_p_parent);
+
+       inode_iterator it = p_parent->begin();
+       while (*it != p_nd)
+         ++it;
+
+       inode_iterator next_it = it;
+       ++next_it;
+       return (next_it == p_parent->end())? 0 : *next_it;
+      }
+
+      static node_pointer
+      get_smaller_sibling(node_pointer p_nd)
+      {
+       inode_pointer p_parent = static_cast<inode_pointer>(p_nd->m_p_parent);
+
+       inode_iterator it = p_parent->begin();
+       if (*it == p_nd)
+         return 0;
+
+       inode_iterator prev_it;
+       do
+         {
+           prev_it = it;
+           ++it;
+           if (*it == p_nd)
+             return *prev_it;
+         }
+       while (true);
+
+       _GLIBCXX_DEBUG_ASSERT(false);
+       return 0;
+      }
+
+      static leaf_pointer
+      leftmost_descendant(node_pointer p_nd)
+      {
+       if (p_nd->m_type == leaf_node)
+         return static_cast<leaf_pointer>(p_nd);
+       return static_cast<inode_pointer>(p_nd)->leftmost_descendant();
+      }
+
+      static leaf_pointer
+      rightmost_descendant(node_pointer p_nd)
+      {
+       if (p_nd->m_type == leaf_node)
+         return static_cast<leaf_pointer>(p_nd);
+       return static_cast<inode_pointer>(p_nd)->rightmost_descendant();
+      }
+    };
+
+
+    /// Iterator.
+    template<typename Node, typename Leaf, typename Head, typename Inode,
+            bool Is_Forward_Iterator>
+    class _Iter
+    : public _CIter<Node, Leaf, Head, Inode, Is_Forward_Iterator>
+    {
+    public:
+      typedef _CIter<Node, Leaf, Head, Inode, Is_Forward_Iterator>
+                                                       base_type;
+      typedef typename base_type::allocator_type       allocator_type;
+      typedef typename base_type::type_traits          type_traits;
+      typedef typename type_traits::value_type         value_type;
+      typedef typename type_traits::pointer            pointer;
+      typedef typename type_traits::reference          reference;
+
+      typedef typename base_type::node_pointer         node_pointer;
+      typedef typename base_type::leaf_pointer         leaf_pointer;
+      typedef typename base_type::leaf_const_pointer   leaf_const_pointer;
+      typedef typename base_type::head_pointer         head_pointer;
+      typedef typename base_type::inode_pointer        inode_pointer;
+
+      _Iter(node_pointer p_nd = 0)
+      : base_type(p_nd) { }
+
+      _Iter(const PB_DS_ODIR_IT_C_DEC& other)
+      : base_type(other.m_p_nd) { }
+
+      _Iter&
+      operator=(const _Iter& other)
+      {
+       base_type::m_p_nd = other.m_p_nd;
+       return *this;
+      }
+
+      _Iter&
+      operator=(const PB_DS_ODIR_IT_C_DEC& other)
+      {
+       base_type::m_p_nd = other.m_p_nd;
+       return *this;
+      }
+
+      pointer
+      operator->() const
+      {
+       _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == leaf_node);
+       return &static_cast<leaf_pointer>(base_type::m_p_nd)->value();
+      }
+
+      reference
+      operator*() const
+      {
+       _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == leaf_node);
+       return static_cast<leaf_pointer>(base_type::m_p_nd)->value();
+      }
+
+      _Iter&
+      operator++()
+      {
+       base_type::operator++();
+       return *this;
+      }
+
+      _Iter
+      operator++(int)
+      {
+       _Iter ret(base_type::m_p_nd);
+       operator++();
+       return ret;
+      }
+
+      _Iter&
+      operator--()
+      {
+       base_type::operator--();
+       return *this;
+      }
+
+      _Iter
+      operator--(int)
+      {
+       _Iter ret(base_type::m_p_nd);
+       operator--();
+       return ret;
+      }
+    };
+
+#undef PB_DS_CONST_ODIR_IT_C_DEC
+#undef PB_DS_ODIR_IT_C_DEC
+
+
+#define PB_DS_PAT_TRIE_NODE_CONST_ITERATOR_C_DEC \
+    _Node_citer<Node, Leaf, Head, Inode, _CIterator, Iterator, _ATraits, _Alloc>
+
+#define PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC \
+    _Node_iter<Node, Leaf, Head, Inode, _CIterator, Iterator, _ATraits, _Alloc>
+
+    /// Node const iterator.
+    template<typename Node,
+            typename Leaf,
+            typename Head,
+            typename Inode,
+            typename _CIterator,
+            typename Iterator,
+            typename _Alloc>
+    class _Node_citer
+    {
+    protected:
+      typedef typename _Alloc::template rebind<Node>   __rebind_n;
+      typedef typename __rebind_n::other::pointer      node_pointer;
+
+      typedef typename _Alloc::template rebind<Leaf>   __rebind_l;
+      typedef typename __rebind_l::other::pointer      leaf_pointer;
+      typedef typename __rebind_l::other::const_pointer        leaf_const_pointer;
+
+      typedef typename _Alloc::template rebind<Inode>  __rebind_in;
+      typedef typename __rebind_in::other::pointer     inode_pointer;
+      typedef typename __rebind_in::other::const_pointer inode_const_pointer;
+
+      typedef typename Node::a_const_pointer           a_const_pointer;
+      typedef typename Node::a_const_iterator          a_const_iterator;
+
+    private:
+      a_const_iterator
+      pref_begin() const
+      {
+       if (m_p_nd->m_type == leaf_node)
+         {
+           leaf_const_pointer lcp = static_cast<leaf_const_pointer>(m_p_nd);
+           return m_p_traits->begin(m_p_traits->extract_key(lcp->value()));
+         }
+       _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);
+       return static_cast<inode_const_pointer>(m_p_nd)->pref_b_it();
+      }
+
+      a_const_iterator
+      pref_end() const
+      {
+       if (m_p_nd->m_type == leaf_node)
+         {
+           leaf_const_pointer lcp = static_cast<leaf_const_pointer>(m_p_nd);
+           return m_p_traits->end(m_p_traits->extract_key(lcp->value()));
+         }
+       _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);
+       return static_cast<inode_const_pointer>(m_p_nd)->pref_e_it();
+      }
+
+    public:
+      typedef trivial_iterator_tag                     iterator_category;
+      typedef trivial_iterator_difference_type                 difference_type;
+      typedef typename _Alloc::size_type               size_type;
+
+      typedef _CIterator                               value_type;
+      typedef value_type                               reference;
+      typedef value_type                               const_reference;
+
+      // Metadata type.
+      typedef typename Node::metadata_type             metadata_type;
+
+      // Const metadata reference type.
+      typedef typename _Alloc::template rebind<metadata_type> __rebind_m;
+      typedef typename __rebind_m::other               __rebind_ma;
+      typedef typename __rebind_ma::const_reference    metadata_const_reference;
+
+      inline
+      _Node_citer(node_pointer p_nd = 0, a_const_pointer p_traits = 0)
+      : m_p_nd(const_cast<node_pointer>(p_nd)), m_p_traits(p_traits)
+      { }
+
+      // Subtree valid prefix.
+      std::pair<a_const_iterator, a_const_iterator>
+      valid_prefix() const
+      { return std::make_pair(pref_begin(), pref_end()); }
+
+      // Const access; returns the __const iterator* associated with
+      // the current leaf.
+      const_reference
+      operator*() const
+      {
+       _GLIBCXX_DEBUG_ASSERT(num_children() == 0);
+       return _CIterator(m_p_nd);
+      }
+
+      // Metadata access.
+      metadata_const_reference
+      get_metadata() const
+      { return m_p_nd->get_metadata(); }
+
+      // Returns the number of children in the corresponding node.
+      size_type
+      num_children() const
+      {
+       if (m_p_nd->m_type == leaf_node)
+         return 0;
+       _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);
+       inode_pointer inp = static_cast<inode_pointer>(m_p_nd);
+       return std::distance(inp->begin(), inp->end());
+      }
+
+      // Returns a __const node __iterator to the corresponding node's
+      // i-th child.
+      _Node_citer
+      get_child(size_type i) const
+      {
+       _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == i_node);
+       inode_pointer inp = static_cast<inode_pointer>(m_p_nd);
+       typename Inode::iterator it = inp->begin();
+       std::advance(it, i);
+       return _Node_citer(*it, m_p_traits);
+      }
+
+      // Compares content to a different iterator object.
+      bool
+      operator==(const _Node_citer& other) const
+      { return m_p_nd == other.m_p_nd; }
+
+      // Compares content (negatively) to a different iterator object.
+      bool
+      operator!=(const _Node_citer& other) const
+      { return m_p_nd != other.m_p_nd; }
+
+      node_pointer                     m_p_nd;
+      a_const_pointer                  m_p_traits;
+    };
+
+
+    /// Node iterator.
+    template<typename Node,
+            typename Leaf,
+            typename Head,
+            typename Inode,
+            typename _CIterator,
+            typename Iterator,
+            typename _Alloc>
+    class _Node_iter
+    : public _Node_citer<Node, Leaf, Head, Inode, _CIterator, Iterator, _Alloc>
+    {
+    private:
+      typedef _Node_citer<Node, Leaf, Head, Inode,
+                         _CIterator, Iterator, _Alloc> base_type;
+      typedef typename _Alloc::template rebind<Node>   __rebind_n;
+      typedef typename __rebind_n::other::pointer      node_pointer;
+      typedef typename base_type::inode_pointer        inode_pointer;
+      typedef typename base_type::a_const_pointer      a_const_pointer;
+      typedef Iterator                                         iterator;
+
+    public:
+      typedef typename base_type::size_type            size_type;
+
+      typedef Iterator                                         value_type;
+      typedef value_type                               reference;
+      typedef value_type                               const_reference;
+
+      _Node_iter(node_pointer p_nd = 0, a_const_pointer p_traits = 0)
+      : base_type(p_nd, p_traits)
+      { }
+
+      // Access; returns the iterator*  associated with the current leaf.
+      reference
+      operator*() const
+      {
+       _GLIBCXX_DEBUG_ASSERT(base_type::num_children() == 0);
+       return iterator(base_type::m_p_nd);
+      }
+
+      // Returns a node __iterator to the corresponding node's i-th child.
+      _Node_iter
+      get_child(size_type i) const
+      {
+       _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == i_node);
+
+       typename Inode::iterator it =
+         static_cast<inode_pointer>(base_type::m_p_nd)->begin();
+
+       std::advance(it, i);
+       return _Node_iter(*it, base_type::m_p_traits);
+      }
+    };
+    };
+
+
+#define PB_DS_CLASS_T_DEC \
+    template<typename _ATraits, typename Metadata>
+
+#define PB_DS_CLASS_C_DEC \
+    pat_trie_base::_Inode<_ATraits, Metadata>
+
+    PB_DS_CLASS_T_DEC
+    typename PB_DS_CLASS_C_DEC::__rebind_l
+    PB_DS_CLASS_C_DEC::s_leaf_alloc;
+
+    PB_DS_CLASS_T_DEC
+    typename PB_DS_CLASS_C_DEC::__rebind_in
+    PB_DS_CLASS_C_DEC::s_inode_alloc;
+
+    PB_DS_CLASS_T_DEC
+    inline typename PB_DS_CLASS_C_DEC::size_type
+    PB_DS_CLASS_C_DEC::
+    get_pref_pos(a_const_iterator b_it, a_const_iterator e_it,
+                a_const_pointer p_traits) const
+    {
+      if (static_cast<std::size_t>(std::distance(b_it, e_it)) <= m_e_ind)
+       return 0;
+      std::advance(b_it, m_e_ind);
+      return 1 + p_traits->e_pos(*b_it);
+    }
+
+    PB_DS_CLASS_T_DEC
+    PB_DS_CLASS_C_DEC::
+    _Inode(size_type len, const a_const_iterator it)
+    : base_type(i_node), m_e_ind(len), m_pref_b_it(it), m_pref_e_it(it)
+    {
+      std::advance(m_pref_e_it, m_e_ind);
+      std::fill(m_a_p_children, m_a_p_children + arr_size,
+               static_cast<node_pointer>(0));
+    }
+
+    PB_DS_CLASS_T_DEC
+    void
+    PB_DS_CLASS_C_DEC::
+    update_prefixes(a_const_pointer p_traits)
+    {
+      node_pointer p_first = *begin();
+      if (p_first->m_type == leaf_node)
+       {
+         leaf_const_pointer p = static_cast<leaf_const_pointer>(p_first);
+         m_pref_b_it = p_traits->begin(access_traits::extract_key(p->value()));
+       }
+      else
+       {
+         inode_pointer p = static_cast<inode_pointer>(p_first);
+         _GLIBCXX_DEBUG_ASSERT(p_first->m_type == i_node);
+         m_pref_b_it = p->pref_b_it();
+       }
+      m_pref_e_it = m_pref_b_it;
+      std::advance(m_pref_e_it, m_e_ind);
+    }
+
+    PB_DS_CLASS_T_DEC
+    typename PB_DS_CLASS_C_DEC::const_iterator
+    PB_DS_CLASS_C_DEC::
+    begin() const
+    {
+      typedef node_pointer_pointer pointer_type;
+      pointer_type p = const_cast<pointer_type>(m_a_p_children);
+      return const_iterator(p + get_begin_pos(), p + arr_size);
+    }
+
+    PB_DS_CLASS_T_DEC
+    typename PB_DS_CLASS_C_DEC::iterator
+    PB_DS_CLASS_C_DEC::
+    begin()
+    {
+      return iterator(m_a_p_children + get_begin_pos(),
+                     m_a_p_children + arr_size);
+    }
+
+    PB_DS_CLASS_T_DEC
+    typename PB_DS_CLASS_C_DEC::const_iterator
+    PB_DS_CLASS_C_DEC::
+    end() const
+    {
+      typedef node_pointer_pointer pointer_type;
+      pointer_type p = const_cast<pointer_type>(m_a_p_children) + arr_size;
+      return const_iterator(p, p);
+    }
+
+    PB_DS_CLASS_T_DEC
+    typename PB_DS_CLASS_C_DEC::iterator
+    PB_DS_CLASS_C_DEC::
+    end()
+    { return iterator(m_a_p_children + arr_size, m_a_p_children + arr_size); }
+
+    PB_DS_CLASS_T_DEC
+    inline typename PB_DS_CLASS_C_DEC::node_pointer
+    PB_DS_CLASS_C_DEC::
+    get_child_node(a_const_iterator b_it, a_const_iterator e_it,
+                  a_const_pointer p_traits)
+    {
+      const size_type i = get_pref_pos(b_it, e_it, p_traits);
+      _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+      return m_a_p_children[i];
+    }
+
+    PB_DS_CLASS_T_DEC
+    inline typename PB_DS_CLASS_C_DEC::iterator
+    PB_DS_CLASS_C_DEC::
+    get_child_it(a_const_iterator b_it, a_const_iterator e_it,
+                a_const_pointer p_traits)
+    {
+      const size_type i = get_pref_pos(b_it, e_it, p_traits);
+      _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+      _GLIBCXX_DEBUG_ASSERT(m_a_p_children[i] != 0);
+      return iterator(m_a_p_children + i, m_a_p_children + i);
+    }
+
+    PB_DS_CLASS_T_DEC
+    inline typename PB_DS_CLASS_C_DEC::node_const_pointer
+    PB_DS_CLASS_C_DEC::
+    get_child_node(a_const_iterator b_it, a_const_iterator e_it,
+                  a_const_pointer p_traits) const
+    { return const_cast<node_pointer>(get_child_node(b_it, e_it, p_traits)); }
+
+    PB_DS_CLASS_T_DEC
+    typename PB_DS_CLASS_C_DEC::node_pointer
+    PB_DS_CLASS_C_DEC::
+    get_lower_bound_child_node(a_const_iterator b_it, a_const_iterator e_it,
+                              size_type checked_ind,
+                              a_const_pointer p_traits)
+    {
+      if (!should_be_mine(b_it, e_it, checked_ind, p_traits))
+       {
+         if (p_traits->cmp_prefixes(b_it, e_it, m_pref_b_it,
+                                    m_pref_e_it, true))
+           return leftmost_descendant();
+         return rightmost_descendant();
+       }
+
+      size_type i = get_pref_pos(b_it, e_it, p_traits);
+      _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+
+      if (m_a_p_children[i] != 0)
+       return m_a_p_children[i];
+
+      while (++i < arr_size)
+       if (m_a_p_children[i] != 0)
+         {
+           const node_type& __nt = m_a_p_children[i]->m_type;
+           node_pointer ret = m_a_p_children[i];
+
+           if (__nt == leaf_node)
+             return ret;
+
+           _GLIBCXX_DEBUG_ASSERT(__nt == i_node);
+           inode_pointer inp = static_cast<inode_pointer>(ret);
+           return inp->leftmost_descendant();
+         }
+
+      return rightmost_descendant();
+    }
+
+    PB_DS_CLASS_T_DEC
+    inline typename PB_DS_CLASS_C_DEC::node_pointer
+    PB_DS_CLASS_C_DEC::
+    add_child(node_pointer p_nd, a_const_iterator b_it, a_const_iterator e_it,
+             a_const_pointer p_traits)
+    {
+      const size_type i = get_pref_pos(b_it, e_it, p_traits);
+      _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+      if (m_a_p_children[i] == 0)
+       {
+         m_a_p_children[i] = p_nd;
+         p_nd->m_p_parent = this;
+         return p_nd;
+       }
+      return m_a_p_children[i];
+    }
+
+    PB_DS_CLASS_T_DEC
+    typename PB_DS_CLASS_C_DEC::node_const_pointer
+    PB_DS_CLASS_C_DEC::
+    get_join_child(node_const_pointer p_nd,
+                  a_const_pointer p_tr) const
+    {
+      node_pointer p = const_cast<node_pointer>(p_nd);
+      return const_cast<inode_pointer>(this)->get_join_child(p, p_tr);
+    }
+
+    PB_DS_CLASS_T_DEC
+    typename PB_DS_CLASS_C_DEC::node_pointer
+    PB_DS_CLASS_C_DEC::
+    get_join_child(node_pointer p_nd, a_const_pointer p_traits)
+    {
+      size_type i;
+      a_const_iterator b_it;
+      a_const_iterator e_it;
+      if (p_nd->m_type == leaf_node)
+       {
+         leaf_const_pointer p = static_cast<leaf_const_pointer>(p_nd);
+
+         typedef typename type_traits::key_const_reference kcr;
+         kcr r_key = access_traits::extract_key(p->value());
+         b_it = p_traits->begin(r_key);
+         e_it = p_traits->end(r_key);
+       }
+      else
+       {
+         b_it = static_cast<inode_pointer>(p_nd)->pref_b_it();
+         e_it = static_cast<inode_pointer>(p_nd)->pref_e_it();
+       }
+      i = get_pref_pos(b_it, e_it, p_traits);
+      _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+      return m_a_p_children[i];
+    }
+
+    PB_DS_CLASS_T_DEC
+    void
+    PB_DS_CLASS_C_DEC::
+    remove_child(node_pointer p_nd)
+    {
+      size_type i = 0;
+      for (; i < arr_size; ++i)
+       if (m_a_p_children[i] == p_nd)
+         {
+           m_a_p_children[i] = 0;
+           return;
+         }
+      _GLIBCXX_DEBUG_ASSERT(i != arr_size);
+    }
+
+    PB_DS_CLASS_T_DEC
+    void
+    PB_DS_CLASS_C_DEC::
+    remove_child(iterator it)
+    { *it.m_p_p_cur = 0; }
+
+    PB_DS_CLASS_T_DEC
+    void
+    PB_DS_CLASS_C_DEC::
+    replace_child(node_pointer p_nd, a_const_iterator b_it,
+                 a_const_iterator e_it,
+                 a_const_pointer p_traits)
+    {
+      const size_type i = get_pref_pos(b_it, e_it, p_traits);
+      _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+      m_a_p_children[i] = p_nd;
+      p_nd->m_p_parent = this;
+    }
+
+    PB_DS_CLASS_T_DEC
+    inline typename PB_DS_CLASS_C_DEC::a_const_iterator
+    PB_DS_CLASS_C_DEC::
+    pref_b_it() const
+    { return m_pref_b_it; }
+
+    PB_DS_CLASS_T_DEC
+    inline typename PB_DS_CLASS_C_DEC::a_const_iterator
+    PB_DS_CLASS_C_DEC::
+    pref_e_it() const
+    { return m_pref_e_it; }
+
+    PB_DS_CLASS_T_DEC
+    bool
+    PB_DS_CLASS_C_DEC::
+    should_be_mine(a_const_iterator b_it, a_const_iterator e_it,
+                  size_type checked_ind,
+                  a_const_pointer p_traits) const
+    {
+      if (m_e_ind == 0)
+       return true;
+
+      const size_type num_es = std::distance(b_it, e_it);
+      if (num_es < m_e_ind)
+       return false;
+
+      a_const_iterator key_b_it = b_it;
+      std::advance(key_b_it, checked_ind);
+      a_const_iterator key_e_it = b_it;
+      std::advance(key_e_it, m_e_ind);
+
+      a_const_iterator value_b_it = m_pref_b_it;
+      std::advance(value_b_it, checked_ind);
+      a_const_iterator value_e_it = m_pref_b_it;
+      std::advance(value_e_it, m_e_ind);
+
+      return p_traits->equal_prefixes(key_b_it, key_e_it, value_b_it,
+                                     value_e_it);
+    }
+
+    PB_DS_CLASS_T_DEC
+    typename PB_DS_CLASS_C_DEC::leaf_pointer
+    PB_DS_CLASS_C_DEC::
+    leftmost_descendant()
+    {
+      node_pointer p_pot = *begin();
+      if (p_pot->m_type == leaf_node)
+       return (static_cast<leaf_pointer>(p_pot));
+      _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == i_node);
+      return static_cast<inode_pointer>(p_pot)->leftmost_descendant();
+    }
+
+    PB_DS_CLASS_T_DEC
+    typename PB_DS_CLASS_C_DEC::leaf_const_pointer
+    PB_DS_CLASS_C_DEC::
+    leftmost_descendant() const
+    { return const_cast<inode_pointer>(this)->leftmost_descendant(); }
+
+    PB_DS_CLASS_T_DEC
+    typename PB_DS_CLASS_C_DEC::leaf_pointer
+    PB_DS_CLASS_C_DEC::
+    rightmost_descendant()
+    {
+      const size_type num_children = std::distance(begin(), end());
+      _GLIBCXX_DEBUG_ASSERT(num_children >= 2);
+
+      iterator it = begin();
+      std::advance(it, num_children - 1);
+      node_pointer p_pot =* it;
+      if (p_pot->m_type == leaf_node)
+       return static_cast<leaf_pointer>(p_pot);
+      _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == i_node);
+      return static_cast<inode_pointer>(p_pot)->rightmost_descendant();
+    }
+
+    PB_DS_CLASS_T_DEC
+    typename PB_DS_CLASS_C_DEC::leaf_const_pointer
+    PB_DS_CLASS_C_DEC::
+    rightmost_descendant() const
+    { return const_cast<inode_pointer>(this)->rightmost_descendant(); }
+
+    PB_DS_CLASS_T_DEC
+    typename PB_DS_CLASS_C_DEC::size_type
+    PB_DS_CLASS_C_DEC::
+    get_begin_pos() const
+    {
+      size_type i = 0;
+      for (i; i < arr_size && m_a_p_children[i] == 0; ++i)
+       ;
+      return i;
+    }
+
+#ifdef _GLIBCXX_DEBUG
+    PB_DS_CLASS_T_DEC
+    typename PB_DS_CLASS_C_DEC::node_debug_info
+    PB_DS_CLASS_C_DEC::
+    assert_valid_imp(a_const_pointer p_traits,
+                    const char* __file, int __line) const
+    {
+      PB_DS_DEBUG_VERIFY(base_type::m_type == i_node);
+      PB_DS_DEBUG_VERIFY(static_cast<size_type>(std::distance(pref_b_it(), pref_e_it())) == m_e_ind);
+      PB_DS_DEBUG_VERIFY(std::distance(begin(), end()) >= 2);
+
+      for (typename _Inode::const_iterator it = begin(); it != end(); ++it)
+       {
+         node_const_pointer p_nd = *it;
+         PB_DS_DEBUG_VERIFY(p_nd->m_p_parent == this);
+         node_debug_info child_ret = p_nd->assert_valid_imp(p_traits,
+                                                            __file, __line);
+
+         PB_DS_DEBUG_VERIFY(static_cast<size_type>(std::distance(child_ret.first, child_ret.second)) >= m_e_ind);
+         PB_DS_DEBUG_VERIFY(should_be_mine(child_ret.first, child_ret.second, 0, p_traits));
+         PB_DS_DEBUG_VERIFY(get_pref_pos(child_ret.first, child_ret.second, p_traits) == static_cast<size_type>(it.m_p_p_cur - m_a_p_children));
+       }
+      return std::make_pair(pref_b_it(), pref_e_it());
+    }
+#endif
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+  } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
deleted file mode 100644 (file)
index a3e1506..0000000
+++ /dev/null
@@ -1,484 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file point_iterators.hpp
- * Contains an implementation class for bin_search_tree_.
- */
-
-#ifndef PB_DS_PAT_TRIE_FIND_ITERATORS_HPP
-#define PB_DS_PAT_TRIE_FIND_ITERATORS_HPP
-
-#include <debug/debug.h>
-
-namespace __gnu_pbds
-{
-  namespace detail
-  {
-
-#define PB_DS_CONST_IT_C_DEC                                   \
-    pat_trie_const_it_<                                                \
-                                       Type_Traits,            \
-                                       Node,                   \
-                                       Leaf,                   \
-                                       Head,                   \
-                                       Internal_Node,          \
-                                       Is_Forward_Iterator,    \
-                                       Allocator>
-
-#define PB_DS_CONST_ODIR_IT_C_DEC                              \
-    pat_trie_const_it_<                                                \
-                                       Type_Traits,            \
-                                       Node,                   \
-                                       Leaf,                   \
-                                       Head,                   \
-                                       Internal_Node,          \
-                                       !Is_Forward_Iterator,   \
-                                       Allocator>
-
-#define PB_DS_IT_C_DEC                                                 \
-    pat_trie_it_<                                                      \
-                                               Type_Traits,            \
-                                               Node,                   \
-                                               Leaf,                   \
-                                               Head,                   \
-                                               Internal_Node,          \
-                                               Is_Forward_Iterator,    \
-                                               Allocator>
-
-#define PB_DS_ODIR_IT_C_DEC                                            \
-    pat_trie_it_<                                                      \
-                                               Type_Traits,            \
-                                               Node,                   \
-                                               Leaf,                   \
-                                               Head,                   \
-                                               Internal_Node,          \
-                                               !Is_Forward_Iterator,   \
-                                               Allocator>
-
-
-    // Const iterator.
-    template<typename Type_Traits,
-            class Node,
-            class Leaf,
-            class Head,
-            class Internal_Node,
-            bool Is_Forward_Iterator,
-            class Allocator>
-    class pat_trie_const_it_
-    {
-
-    private:
-      typedef
-      typename Allocator::template rebind<
-      Node>::other::pointer
-      node_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       Leaf>::other::const_pointer
-      const_leaf_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       Leaf>::other::pointer
-      leaf_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       Head>::other::pointer
-      head_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       Internal_Node>::other::pointer
-      internal_node_pointer;
-
-    public:
-
-      typedef std::bidirectional_iterator_tag iterator_category;
-
-      typedef typename Allocator::difference_type difference_type;
-
-      typedef typename Type_Traits::value_type value_type;
-
-      typedef typename Type_Traits::pointer pointer;
-
-      typedef typename Type_Traits::const_pointer const_pointer;
-
-      typedef typename Type_Traits::reference reference;
-
-      typedef typename Type_Traits::const_reference const_reference;
-
-    public:
-
-      inline
-      pat_trie_const_it_(node_pointer p_nd = 0) : m_p_nd(p_nd)
-      { }
-
-      inline
-      pat_trie_const_it_(const PB_DS_CONST_ODIR_IT_C_DEC& other) 
-      : m_p_nd(other.m_p_nd)
-      { }
-
-      inline
-      PB_DS_CONST_IT_C_DEC& 
-      operator=(const PB_DS_CONST_IT_C_DEC& other)
-      {
-       m_p_nd = other.m_p_nd;
-       return *this;
-      }
-
-      inline
-      PB_DS_CONST_IT_C_DEC& 
-      operator=(const PB_DS_CONST_ODIR_IT_C_DEC& other)
-      {
-       m_p_nd = other.m_p_nd;
-       return *this;
-      }
-
-      inline const_pointer
-      operator->() const
-      {
-       _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_leaf_node_type);
-       return &static_cast<leaf_pointer>(m_p_nd)->value();
-      }
-
-      inline const_reference
-      operator*() const
-      {
-       _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_leaf_node_type);
-       return static_cast<leaf_pointer>(m_p_nd)->value();
-      }
-
-      inline bool
-      operator==(const PB_DS_CONST_IT_C_DEC& other) const
-      { return (m_p_nd == other.m_p_nd); }
-
-      inline bool
-      operator==(const PB_DS_CONST_ODIR_IT_C_DEC& other) const
-      { return (m_p_nd == other.m_p_nd); }
-
-      inline bool
-      operator!=(const PB_DS_CONST_IT_C_DEC& other) const
-      { return (m_p_nd != other.m_p_nd); }
-
-      inline bool
-      operator!=(const PB_DS_CONST_ODIR_IT_C_DEC& other) const
-      { return (m_p_nd != other.m_p_nd); }
-
-      inline PB_DS_CONST_IT_C_DEC& 
-      operator++()
-      {
-       inc(integral_constant<int,Is_Forward_Iterator>());
-       return *this;
-      }
-
-      inline PB_DS_CONST_IT_C_DEC
-      operator++(int)
-      {
-       PB_DS_CONST_IT_C_DEC ret_it(m_p_nd);
-       operator++();
-       return ret_it;
-      }
-
-      inline PB_DS_CONST_IT_C_DEC& 
-      operator--()
-      {
-       dec(integral_constant<int,Is_Forward_Iterator>());
-       return *this;
-      }
-
-      inline PB_DS_CONST_IT_C_DEC
-      operator--(int)
-      {
-       PB_DS_CONST_IT_C_DEC ret_it(m_p_nd);
-       operator--();
-       return ret_it;
-      }
-
-    protected:
-      inline void
-      inc(false_type)
-      { dec(true_type()); }
-
-      void
-      inc(true_type)
-      {
-       if (m_p_nd->m_type == pat_trie_head_node_type)
-         {
-           m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_min;
-           return;
-         }
-
-       node_pointer p_y = m_p_nd->m_p_parent;
-       while (p_y->m_type != pat_trie_head_node_type && 
-              get_larger_sibling(m_p_nd) == 0)
-         {
-           m_p_nd = p_y;
-           p_y = p_y->m_p_parent;
-         }
-
-       if (p_y->m_type == pat_trie_head_node_type)
-         {
-           m_p_nd = p_y;
-           return;
-         }
-       m_p_nd = leftmost_descendant(get_larger_sibling(m_p_nd));
-      }
-
-      inline void
-      dec(false_type)
-      { inc(true_type()); }
-
-      void
-      dec(true_type)
-      {
-       if (m_p_nd->m_type == pat_trie_head_node_type)
-         {
-           m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_max;
-           return;
-         }
-
-       node_pointer p_y = m_p_nd->m_p_parent;
-       while (p_y->m_type != pat_trie_head_node_type && 
-              get_smaller_sibling(m_p_nd) == 0)
-         {
-           m_p_nd = p_y;
-           p_y = p_y->m_p_parent;
-         }
-
-       if (p_y->m_type == pat_trie_head_node_type)
-         {
-           m_p_nd = p_y;
-           return;
-         }
-       m_p_nd = rightmost_descendant(get_smaller_sibling(m_p_nd));
-      }
-
-      inline static node_pointer
-      get_larger_sibling(node_pointer p_nd)
-      {
-       internal_node_pointer p_parent =
-         static_cast<internal_node_pointer>(p_nd->m_p_parent);
-
-       typename Internal_Node::iterator it = p_parent->begin();
-       while (*it != p_nd)
-         ++it;
-
-       typename Internal_Node::iterator next_it = it;
-       ++next_it;
-       return ((next_it == p_parent->end())? 0 :* next_it);
-      }
-
-      inline static node_pointer
-      get_smaller_sibling(node_pointer p_nd)
-      {
-       internal_node_pointer p_parent =
-         static_cast<internal_node_pointer>(p_nd->m_p_parent);
-
-       typename Internal_Node::iterator it = p_parent->begin();
-
-       if (*it == p_nd)
-         return (0);
-       typename Internal_Node::iterator prev_it;
-       do
-         {
-           prev_it = it;
-           ++it;
-           if (*it == p_nd)
-             return (*prev_it);
-         }
-       while (true);
-
-       _GLIBCXX_DEBUG_ASSERT(false);
-       return (0);
-      }
-
-      inline static leaf_pointer
-      leftmost_descendant(node_pointer p_nd)
-      {
-       if (p_nd->m_type == pat_trie_leaf_node_type)
-         return static_cast<leaf_pointer>(p_nd);
-       return static_cast<internal_node_pointer>(p_nd)->leftmost_descendant();
-      }
-
-      inline static leaf_pointer
-      rightmost_descendant(node_pointer p_nd)
-      {
-       if (p_nd->m_type == pat_trie_leaf_node_type)
-         return static_cast<leaf_pointer>(p_nd);
-       return static_cast<internal_node_pointer>(p_nd)->rightmost_descendant();
-      }
-
-    public:
-      node_pointer m_p_nd;
-    };
-
-    // Iterator.
-    template<typename Type_Traits,
-            class Node,
-            class Leaf,
-            class Head,
-            class Internal_Node,
-            bool Is_Forward_Iterator,
-            class Allocator>
-    class pat_trie_it_ : 
-      public PB_DS_CONST_IT_C_DEC
-
-    {
-    private:
-      typedef
-      typename Allocator::template rebind<
-      Node>::other::pointer
-      node_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       Leaf>::other::const_pointer
-      const_leaf_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       Leaf>::other::pointer
-      leaf_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       Head>::other::pointer
-      head_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       Internal_Node>::other::pointer
-      internal_node_pointer;
-
-    public:
-      typedef typename Type_Traits::value_type value_type;
-
-      typedef typename Type_Traits::const_pointer const_pointer;
-
-      typedef typename Type_Traits::pointer pointer;
-
-      typedef typename Type_Traits::const_reference const_reference;
-
-      typedef typename Type_Traits::reference reference;
-
-      inline
-      pat_trie_it_(node_pointer p_nd = 0) : PB_DS_CONST_IT_C_DEC((node_pointer)p_nd)
-      { }
-
-      inline
-      pat_trie_it_(const PB_DS_ODIR_IT_C_DEC& other) : PB_DS_CONST_IT_C_DEC(other.m_p_nd)
-      { }
-
-      inline
-      PB_DS_IT_C_DEC& 
-      operator=(const PB_DS_IT_C_DEC& other)
-      {
-       base_it_type::m_p_nd = other.m_p_nd;
-       return *this;
-      }
-
-      inline
-      PB_DS_IT_C_DEC& 
-      operator=(const PB_DS_ODIR_IT_C_DEC& other)
-      {
-       base_it_type::m_p_nd = other.m_p_nd;
-       return *this;
-      }
-
-      inline pointer
-      operator->() const
-      {
-       _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd->m_type == pat_trie_leaf_node_type);
-
-       return &static_cast<leaf_pointer>(base_it_type::m_p_nd)->value();
-      }
-
-      inline reference
-      operator*() const
-      {
-       _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd->m_type == pat_trie_leaf_node_type);
-       return static_cast<leaf_pointer>(base_it_type::m_p_nd)->value();
-      }
-
-      inline PB_DS_IT_C_DEC& 
-      operator++()
-      {
-       PB_DS_CONST_IT_C_DEC::
-         operator++();
-       return *this;
-      }
-
-      inline PB_DS_IT_C_DEC
-      operator++(int)
-      {
-       PB_DS_IT_C_DEC ret_it(base_it_type::m_p_nd);
-       operator++();
-       return ret_it;
-      }
-
-      inline PB_DS_IT_C_DEC& 
-      operator--()
-      {
-       PB_DS_CONST_IT_C_DEC::operator--();
-       return *this;
-      }
-
-      inline PB_DS_IT_C_DEC
-      operator--(int)
-      {
-       PB_DS_IT_C_DEC ret_it(base_it_type::m_p_nd);
-       operator--();
-       return ret_it;
-      }
-
-    protected:
-      typedef PB_DS_CONST_IT_C_DEC base_it_type;
-
-      friend class PB_DS_CLASS_C_DEC;
-    };
-
-#undef PB_DS_CONST_IT_C_DEC
-#undef PB_DS_CONST_ODIR_IT_C_DEC
-#undef PB_DS_IT_C_DEC
-#undef PB_DS_ODIR_IT_C_DEC
-
-  } // namespace detail
-} // namespace __gnu_pbds
-
-#endif 
-
index 79bfe4283befae291bd9cf0ba8563de9c58a8772..0afc2d40a60c1a78edee463e41fdfb85c3cd5285 100644 (file)
 // 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
index 7b2ebd5596cd141aadc0e66d0fdcc3a428f06324..6a5582da2559837a3bcc4971f743ac24f5788391 100644 (file)
@@ -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);
 }
index c7fcdb72dfd56260304f47c3e4105f3d82bb5d1b..683b3a9087c9dfc64aff606ababb1af8c6154540 100644 (file)
@@ -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
index 06add93c1a9d76b4a098212c8d014a3345ab2d5d..c2aa9cde821eb2d9ef82cc230871810c2f3d9502 100644 (file)
 // warranty.
 
 /**
- * @file split_fn_imps.hpp
- * Contains an implementation class for bin_search_tree_.
+ * @file pat_trie_/split_fn_imps.hpp
+ * Contains an implementation class for pat_trie.
  */
 
 PB_DS_CLASS_T_DEC
 void
 PB_DS_CLASS_C_DEC::
-split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
+split(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)
 {
   PB_DS_ASSERT_VALID((*this))
   PB_DS_ASSERT_VALID(other)
-  split_join_branch_bag bag;
+  branch_bag bag;
   leaf_pointer p_split_lf = split_prep(r_key, other, bag);
   if (p_split_lf == 0)
     {
@@ -57,18 +57,16 @@ split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
 
   _GLIBCXX_DEBUG_ASSERT(!bag.empty());
   other.clear();
-  m_p_head->m_p_parent = rec_split(m_p_head->m_p_parent,
-                                  pref_begin(p_split_lf),
-                                  pref_end(p_split_lf),
-                                  other,
-                                  bag);
+
+  m_p_head->m_p_parent = rec_split(m_p_head->m_p_parent, pref_begin(p_split_lf),
+                                  pref_end(p_split_lf), other, bag);
 
   m_p_head->m_p_parent->m_p_parent = m_p_head;
 
-  other.m_p_head->m_p_max = m_p_head->m_p_max;
+  head_pointer __ohead = other.m_p_head;
+  __ohead->m_p_max = m_p_head->m_p_max;
   m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent);
-  other.m_p_head->m_p_min =
-    other.leftmost_descendant(other.m_p_head->m_p_parent);
+  __ohead->m_p_min = other.leftmost_descendant(__ohead->m_p_parent);
 
   other.m_size = std::distance(other.PB_DS_CLASS_C_DEC::begin(),
                               other.PB_DS_CLASS_C_DEC::end());
@@ -80,7 +78,8 @@ split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
 PB_DS_CLASS_T_DEC
 typename PB_DS_CLASS_C_DEC::leaf_pointer
 PB_DS_CLASS_C_DEC::
-split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)
+split_prep(key_const_reference r_key, PB_DS_CLASS_C_DEC& other,
+          branch_bag& r_bag)
 {
   _GLIBCXX_DEBUG_ASSERT(r_bag.empty());
   if (m_size == 0)
@@ -88,126 +87,122 @@ split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other, split_join_branc
       other.clear();
       PB_DS_ASSERT_VALID((*this))
       PB_DS_ASSERT_VALID(other)
-      return (0);
+      return 0;
     }
 
-  if (synth_e_access_traits::cmp_keys(r_key,
-                                     PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_min)->value())))
+  if (synth_access_traits::cmp_keys(r_key,
+                                   PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_min)->value())))
     {
       other.clear();
       value_swap(other);
       PB_DS_ASSERT_VALID((*this))
       PB_DS_ASSERT_VALID(other)
-      return (0);
+      return 0;
     }
 
-  if (!synth_e_access_traits::cmp_keys(r_key,
-                                      PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_max)->value())))
+  if (!synth_access_traits::cmp_keys(r_key,
+                                      PB_DS_V2F(static_cast<leaf_const_pointer>(m_p_head->m_p_max)->value())))
     {
       PB_DS_ASSERT_VALID((*this))
       PB_DS_ASSERT_VALID(other)
-      return (0);
+      return 0;
     }
 
   iterator it = lower_bound(r_key);
 
-  if (!synth_e_access_traits::equal_keys(PB_DS_V2F(*it), r_key))
+  if (!synth_access_traits::equal_keys(PB_DS_V2F(*it), r_key))
     --it;
 
   node_pointer p_nd = it.m_p_nd;
-  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_leaf_node_type);
+  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == leaf_node);
   leaf_pointer p_ret_l = static_cast<leaf_pointer>(p_nd);
-  while (p_nd->m_type != pat_trie_head_node_type)
+  while (p_nd->m_type != head_node)
     {
       r_bag.add_branch();
       p_nd = p_nd->m_p_parent;
     }
-  _GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(synth_e_access_traits& )(*this), other);)
+  _GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(synth_access_traits&)(*this), other);)
 
-  return (p_ret_l);
+  return p_ret_l;
 }
 
 PB_DS_CLASS_T_DEC
 typename PB_DS_CLASS_C_DEC::node_pointer
 PB_DS_CLASS_C_DEC::
-rec_split(node_pointer p_nd, const_e_iterator b_it, const_e_iterator e_it, PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)
+rec_split(node_pointer p_nd, a_const_iterator b_it, a_const_iterator e_it,
+         PB_DS_CLASS_C_DEC& other, branch_bag& r_bag)
 {
-  if (p_nd->m_type == pat_trie_leaf_node_type)
+  if (p_nd->m_type == leaf_node)
     {
       _GLIBCXX_DEBUG_ASSERT(other.m_p_head->m_p_parent == 0);
-      return (p_nd);
+      return p_nd;
     }
 
-  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
-  internal_node_pointer p_internal_nd = static_cast<internal_node_pointer>(p_nd);
-
-  node_pointer p_child_ret = rec_split(p_internal_nd->get_child_node(b_it, e_it, this), b_it, e_it, other, r_bag);
+  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
+  inode_pointer p_ind = static_cast<inode_pointer>(p_nd);
 
+  node_pointer pfirst = p_ind->get_child_node(b_it, e_it, this);
+  node_pointer p_child_ret = rec_split(pfirst, b_it, e_it, other, r_bag);
   PB_DS_ASSERT_NODE_VALID(p_child_ret)
-  p_internal_nd->replace_child(p_child_ret, b_it, e_it, this);
-  apply_update(p_internal_nd, (node_update* )this);
-
-  typename internal_node::iterator child_it  =
-    p_internal_nd->get_child_it(b_it, e_it, this);
-
-  const size_type lhs_num_children =
-    std::distance(p_internal_nd->begin(), child_it) + 1;
+  p_ind->replace_child(p_child_ret, b_it, e_it, this);
+  apply_update(p_ind, (node_update*)this);
 
+  inode_iterator child_it = p_ind->get_child_it(b_it, e_it, this);
+  const size_type lhs_dist = std::distance(p_ind->begin(), child_it);
+  const size_type lhs_num_children = lhs_dist + 1;
   _GLIBCXX_DEBUG_ASSERT(lhs_num_children > 0);
 
-  size_type rhs_num_children =
-    std::distance(p_internal_nd->begin(), p_internal_nd->end()) -
-    lhs_num_children;
-
+  const size_type rhs_dist =  std::distance(p_ind->begin(), p_ind->end());
+  size_type rhs_num_children = rhs_dist - lhs_num_children;
   if (rhs_num_children == 0)
     {
-      apply_update(p_internal_nd, (node_update* )this);
-      return (p_internal_nd);
+      apply_update(p_ind, (node_update*)this);
+      return p_ind;
     }
 
-  ++child_it;
-  other.split_insert_branch(p_internal_nd->get_e_ind(),
-                           b_it, child_it, rhs_num_children, r_bag);
+  other.split_insert_branch(p_ind->get_e_ind(), b_it, child_it,
+                           rhs_num_children, r_bag);
 
-  child_it = p_internal_nd->get_child_it(b_it, e_it, this);
-  ++child_it;
+  child_it = p_ind->get_child_it(b_it, e_it, this);
   while (rhs_num_children != 0)
     {
-      child_it = p_internal_nd->remove_child(child_it);
+      ++child_it;
+      p_ind->remove_child(child_it);
       --rhs_num_children;
     }
+  apply_update(p_ind, (node_update*)this);
 
-  apply_update(p_internal_nd, (node_update* )this);
-  _GLIBCXX_DEBUG_ASSERT(std::distance(p_internal_nd->begin(),
-                                     p_internal_nd->end()) >= 1);
-
-  if (std::distance(p_internal_nd->begin(), p_internal_nd->end()) > 1)
+  const size_type int_dist = std::distance(p_ind->begin(), p_ind->end());
+  _GLIBCXX_DEBUG_ASSERT(int_dist >= 1);
+  if (int_dist > 1)
     {
-      p_internal_nd->update_prefixes(this);
-      PB_DS_ASSERT_NODE_VALID(p_internal_nd)
-      apply_update(p_internal_nd, (node_update* )this);
-      return (p_internal_nd);
+      p_ind->update_prefixes(this);
+      PB_DS_ASSERT_NODE_VALID(p_ind)
+      apply_update(p_ind, (node_update*)this);
+      return p_ind;
     }
 
-  node_pointer p_ret =* p_internal_nd->begin();
-  p_internal_nd->~internal_node();
-  s_internal_node_allocator.deallocate(p_internal_nd, 1);
-  apply_update(p_ret, (node_update* )this);
-  return (p_ret);
+  node_pointer p_ret = *p_ind->begin();
+  p_ind->~inode();
+  s_inode_allocator.deallocate(p_ind, 1);
+  apply_update(p_ret, (node_update*)this);
+  return p_ret;
 }
 
 PB_DS_CLASS_T_DEC
 void
 PB_DS_CLASS_C_DEC::
-split_insert_branch(size_type e_ind, const_e_iterator b_it, typename internal_node::iterator child_b_it, size_type num_children, split_join_branch_bag& r_bag)
+split_insert_branch(size_type e_ind, a_const_iterator b_it,
+                   inode_iterator child_b_it,
+                   size_type num_children, branch_bag& r_bag)
 {
 #ifdef _GLIBCXX_DEBUG
   if (m_p_head->m_p_parent != 0)
     PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)
-#endif 
-
-  const size_type total_num_children =((m_p_head->m_p_parent == 0)? 0 : 1) + num_children;
+#endif
 
+  const size_type start = m_p_head->m_p_parent == 0 ? 0 : 1;
+  const size_type total_num_children = start + num_children;
   if (total_num_children == 0)
     {
       _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == 0);
@@ -217,38 +212,39 @@ split_insert_branch(size_type e_ind, const_e_iterator b_it, typename internal_no
   if (total_num_children == 1)
     {
       if (m_p_head->m_p_parent != 0)
-        {
+       {
          PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)
-          return;
-        }
+         return;
+       }
 
       _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == 0);
-      m_p_head->m_p_parent =* child_b_it;
+      ++child_b_it;
+      m_p_head->m_p_parent = *child_b_it;
       m_p_head->m_p_parent->m_p_parent = m_p_head;
-      apply_update(m_p_head->m_p_parent, (node_update* )this);
+      apply_update(m_p_head->m_p_parent, (node_update*)this);
       PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)
       return;
     }
 
   _GLIBCXX_DEBUG_ASSERT(total_num_children > 1);
-  internal_node_pointer p_new_root = r_bag.get_branch();
-  new (p_new_root) internal_node(e_ind, b_it);
+  inode_pointer p_new_root = r_bag.get_branch();
+  new (p_new_root) inode(e_ind, b_it);
   size_type num_inserted = 0;
   while (num_inserted++ < num_children)
     {
-      PB_DS_ASSERT_NODE_VALID((*child_b_it))
-        p_new_root->add_child(*child_b_it, pref_begin(*child_b_it),
-                             pref_end(*child_b_it), this);
       ++child_b_it;
+      PB_DS_ASSERT_NODE_VALID((*child_b_it))
+      p_new_root->add_child(*child_b_it, pref_begin(*child_b_it),
+                           pref_end(*child_b_it), this);
     }
 
   if (m_p_head->m_p_parent != 0)
-    p_new_root->add_child(m_p_head->m_p_parent, 
+    p_new_root->add_child(m_p_head->m_p_parent,
                          pref_begin(m_p_head->m_p_parent),
                          pref_end(m_p_head->m_p_parent), this);
 
   m_p_head->m_p_parent = p_new_root;
   p_new_root->m_p_parent = m_p_head;
-  apply_update(m_p_head->m_p_parent, (node_update* )this);
+  apply_update(m_p_head->m_p_parent, (node_update*)this);
   PB_DS_ASSERT_NODE_VALID(m_p_head->m_p_parent)
 }
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp b/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
deleted file mode 100644 (file)
index 9cecae5..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file split_join_branch_bag.hpp
- * Contains an implementation class for pat_trie_.
- */
-
-class split_join_branch_bag
-{
-private:
-  typedef
-  std::list<
-  internal_node_pointer,
-  typename Allocator::template rebind<
-  internal_node_pointer>::other>
-  bag_t;
-
-public:
-
-  void
-  add_branch()
-  {
-    internal_node_pointer p_nd = s_internal_node_allocator.allocate(1);
-    __try
-      {
-       m_bag.push_back(p_nd);
-      }
-    __catch(...)
-      {
-       s_internal_node_allocator.deallocate(p_nd, 1);
-       __throw_exception_again;
-      }
-  }
-
-  internal_node_pointer
-  get_branch()
-  {
-    _GLIBCXX_DEBUG_ASSERT(!m_bag.empty());
-    internal_node_pointer p_nd =* m_bag.begin();
-    m_bag.pop_front();
-    return p_nd;
-  }
-
-  ~split_join_branch_bag()
-  {
-    while (!m_bag.empty())
-      {
-       internal_node_pointer p_nd =* m_bag.begin();
-       s_internal_node_allocator.deallocate(p_nd, 1);
-       m_bag.pop_front();
-      }
-  }
-
-  inline bool
-  empty() const
-  { return m_bag.empty(); }
-
-private:
-  bag_t m_bag;
-};
similarity index 50%
rename from libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
rename to libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp
index abf5f1185237dd32e39c57c97e6cf86c935fad7f..7cce3c530ff9da1215fc41d3495db67506be0e57 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file synth_e_access_traits.hpp
+ * @file pat_trie_/synth_access_traits.hpp
  * Contains an implementation class for a patricia tree.
  */
 
@@ -48,62 +48,56 @@ namespace __gnu_pbds
   namespace detail
   {
 
-#define PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC                              \
-    template<typename Type_Traits, bool Set, class E_Access_Traits>
+#define PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC \
+    template<typename Type_Traits, bool Set, typename _ATraits>
 
-#define PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC                              \
-    synth_e_access_traits<                                             \
-                                               Type_Traits,            \
-                                               Set,                    \
-                                               E_Access_Traits>
+#define PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC \
+    synth_access_traits<Type_Traits, Set, _ATraits>
 
-    template<typename Type_Traits, bool Set, class E_Access_Traits>
-    struct synth_e_access_traits : public E_Access_Traits
+    /// Synthetic element access traits.
+    template<typename Type_Traits, bool Set, typename _ATraits>
+    struct synth_access_traits : public _ATraits
     {
+      typedef _ATraits                                         base_type;
+      typedef typename base_type::const_iterator       const_iterator;
+      typedef Type_Traits                              type_traits;
+      typedef typename type_traits::const_reference    const_reference;
+      typedef typename type_traits::key_const_reference key_const_reference;
 
-    private:
-      typedef E_Access_Traits base_type;
-
-      typedef Type_Traits type_traits;
-
-      typedef typename type_traits::const_key_reference const_key_reference;
-
-      typedef typename type_traits::const_reference const_reference;
-
-    public:
-      synth_e_access_traits();
+      synth_access_traits();
 
-      synth_e_access_traits(const E_Access_Traits& r_traits);
+      synth_access_traits(const base_type&);
 
       inline bool
-      equal_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after = true) const;
+      equal_prefixes(const_iterator, const_iterator, const_iterator,
+                    const_iterator, bool compare_after = true) const;
 
       bool
-      equal_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const;
+      equal_keys(key_const_reference, key_const_reference) const;
 
       bool
-      cmp_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after = false) const;
+      cmp_prefixes(const_iterator, const_iterator, const_iterator,
+                  const_iterator, bool compare_after = false) const;
 
       bool
-      cmp_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const;
+      cmp_keys(key_const_reference, key_const_reference) const;
 
-      inline static const_key_reference
-      extract_key(const_reference r_val);
+      inline static key_const_reference
+      extract_key(const_reference);
 
 #ifdef _GLIBCXX_DEBUG
       bool
-      operator()(const_key_reference r_lhs, const_key_reference r_rhs);
+      operator()(key_const_reference, key_const_reference);
 #endif
 
     private:
-      inline static const_key_reference
-      extract_key(const_reference r_val, true_type);
+      inline static key_const_reference
+      extract_key(const_reference, true_type);
 
-      inline static const_key_reference
-      extract_key(const_reference r_val, false_type);
+      inline static key_const_reference
+      extract_key(const_reference, false_type);
 
-    private:
-      static integral_constant<int,Set> s_set_ind;
+      static integral_constant<int, Set> s_set_ind;
     };
 
     PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
@@ -112,26 +106,27 @@ namespace __gnu_pbds
 
     PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
     PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
-    synth_e_access_traits()
+    synth_access_traits()
     { }
 
     PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
     PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
-    synth_e_access_traits(const E_Access_Traits& r_traits) :
-      E_Access_Traits(r_traits)
+    synth_access_traits(const _ATraits& r_traits) 
+    : _ATraits(r_traits)
     { }
 
     PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
     inline bool
     PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
-    equal_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after /*= false */) const
+    equal_prefixes(const_iterator b_l, const_iterator e_l, const_iterator b_r,
+                  const_iterator e_r, bool compare_after /*= false */) const
     {
       while (b_l != e_l)
        {
          if (b_r == e_r)
-           return (false);
+           return false;
          if (base_type::e_pos(*b_l) != base_type::e_pos(*b_r))
-           return (false);
+           return false;
          ++b_l;
          ++b_r;
        }
@@ -141,84 +136,78 @@ namespace __gnu_pbds
     PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
     bool
     PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
-    equal_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const
+    equal_keys(key_const_reference r_lhs_key,
+              key_const_reference r_rhs_key) const
     {
-      return (equal_prefixes(base_type::begin(r_lhs_key),
-                            base_type::end(r_lhs_key),
-                            base_type::begin(r_rhs_key),
-                            base_type::end(r_rhs_key),
-                            true));
+      return equal_prefixes(base_type::begin(r_lhs_key),
+                           base_type::end(r_lhs_key),
+                           base_type::begin(r_rhs_key),
+                           base_type::end(r_rhs_key),
+                           true);
     }
 
     PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
     bool
     PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
-    cmp_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after /* = false*/) const
+    cmp_prefixes(const_iterator b_l, const_iterator e_l, const_iterator b_r,
+                const_iterator e_r, bool compare_after /* = false*/) const
     {
       while (b_l != e_l)
        {
          if (b_r == e_r)
-           return (false);
-         const typename base_type::size_type l_pos =
-           base_type::e_pos(*b_l);
-         const typename base_type::size_type r_pos =
-           base_type::e_pos(*b_r);
+           return false;
+
+         const typename base_type::size_type l_pos = base_type::e_pos(*b_l);
+         const typename base_type::size_type r_pos = base_type::e_pos(*b_r);
          if (l_pos != r_pos)
-           return (l_pos < r_pos);
+           return l_pos < r_pos;
          ++b_l;
          ++b_r;
        }
 
       if (!compare_after)
-       return (false);
-      return (b_r != e_r);
+       return false;
+      return b_r != e_r;
     }
 
     PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
     bool
     PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
-    cmp_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const
+    cmp_keys(key_const_reference r_lhs_key,
+            key_const_reference r_rhs_key) const
     {
-      return (cmp_prefixes(base_type::begin(r_lhs_key),
-                          base_type::end(r_lhs_key),
-                          base_type::begin(r_rhs_key),
-                          base_type::end(r_rhs_key),
-                          true));
+      return cmp_prefixes(base_type::begin(r_lhs_key),
+                         base_type::end(r_lhs_key),
+                         base_type::begin(r_rhs_key),
+                         base_type::end(r_rhs_key),
+                         true);
     }
 
     PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
-    inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::const_key_reference
+    inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference
     PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
     extract_key(const_reference r_val)
-    {
-      return (extract_key(r_val, s_set_ind));
-    }
+    { return extract_key(r_val, s_set_ind); }
 
     PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
-    inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::const_key_reference
+    inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference
     PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
     extract_key(const_reference r_val, true_type)
-    {
-      return (r_val);
-    }
+    { return r_val; }
 
     PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
-    inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::const_key_reference
+    inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::key_const_reference
     PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
     extract_key(const_reference r_val, false_type)
-    {
-      return (r_val.first);
-    }
+    { return r_val.first; }
 
 #ifdef _GLIBCXX_DEBUG
     PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
     bool
     PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
-    operator()(const_key_reference r_lhs, const_key_reference r_rhs)
-    {
-      return (cmp_keys(r_lhs, r_rhs));
-    }
-#endif 
+    operator()(key_const_reference r_lhs, key_const_reference r_rhs)
+    { return cmp_keys(r_lhs, r_rhs); }
+#endif
 
 #undef PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
 #undef PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC
@@ -226,4 +215,4 @@ namespace __gnu_pbds
   } // namespace detail
 } // namespace __gnu_pbds
 
-#endif 
+#endif
index 39cf28a1b27e413df48f5bd805d992449f4d721d..c8b54547fc89c6a8ce44b33fa7e22ad705f783be 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file trace_fn_imps.hpp
+ * @file pat_trie_/trace_fn_imps.hpp
  * Contains an implementation class for pat_trie_.
  */
 
@@ -55,7 +55,7 @@ trace() const
 PB_DS_CLASS_T_DEC
 void
 PB_DS_CLASS_C_DEC::
-trace_node(const_node_pointer p_nd, size_type level)
+trace_node(node_const_pointer p_nd, size_type level)
 {
   for (size_type i = 0; i < level; ++i)
     std::cerr << ' ';
@@ -63,7 +63,7 @@ trace_node(const_node_pointer p_nd, size_type level)
   std::cerr << ((p_nd->m_type == pat_trie_leaf_node_type) ? "l " : "i ");
 
   trace_node_metadata(p_nd, type_to_type<typename node::metadata_type>());
-  typename e_access_traits::const_iterator el_it = pref_begin(p_nd);
+  typename access_traits::const_iterator el_it = pref_begin(p_nd);
   while (el_it != pref_end(p_nd))
     {
       std::cerr <<* el_it;
@@ -76,8 +76,7 @@ trace_node(const_node_pointer p_nd, size_type level)
       return;
     }
 
-  const_internal_node_pointer p_internal =
-    static_cast<const_internal_node_pointer>(p_nd);
+  inode_const_pointer p_internal = static_cast<inode_const_pointer>(p_nd);
 
   std::cerr << " " <<
     static_cast<unsigned long>(p_internal->get_e_ind()) << std::endl;
@@ -87,8 +86,7 @@ trace_node(const_node_pointer p_nd, size_type level)
 
   for (size_type child_i = 0; child_i < num_children; ++child_i)
     {
-      typename internal_node::const_iterator child_it =
-       p_internal->begin();
+      typename inode::const_iterator child_it = p_internal->begin();
       std::advance(child_it, num_children - child_i - 1);
       trace_node(*child_it, level + 1);
     }
@@ -98,7 +96,7 @@ PB_DS_CLASS_T_DEC
 template<typename Metadata_>
 void
 PB_DS_CLASS_C_DEC::
-trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>)
+trace_node_metadata(node_const_pointer p_nd, type_to_type<Metadata_>)
 {
   std::cerr << "(" << static_cast<unsigned long>(p_nd->get_metadata()) << ") ";
 }
@@ -106,7 +104,7 @@ trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>)
 PB_DS_CLASS_T_DEC
 void
 PB_DS_CLASS_C_DEC::
-trace_node_metadata(const_node_pointer, type_to_type<null_node_metadata>)
+trace_node_metadata(node_const_pointer, type_to_type<null_type>)
 { }
 
 #endif 
index c8e7f587b55e534f58059277199c8458ec4db7a0..2e64c52480f303b96e93a19d767274f9049644dd 100644 (file)
@@ -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
 // warranty.
 
 /**
- * @file traits.hpp
+ * @file pat_trie_/traits.hpp
  * Contains an implementation class for pat_trie_.
  */
 
 #ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP
 #define PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP
 
-#include <ext/pb_ds/detail/pat_trie_/node_base.hpp>
-#include <ext/pb_ds/detail/pat_trie_/head.hpp>
-#include <ext/pb_ds/detail/pat_trie_/leaf.hpp>
-#include <ext/pb_ds/detail/pat_trie_/internal_node.hpp>
-#include <ext/pb_ds/detail/pat_trie_/point_iterators.hpp>
-#include <ext/pb_ds/detail/pat_trie_/node_iterators.hpp>
-#include <ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp>
+#include <ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp>
+#include <ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp>
 
 namespace __gnu_pbds
 {
   namespace detail
   {
-
+    /// Specialization.
     template<typename Key,
             typename Mapped,
-            class E_Access_Traits,
-            template<typename Const_Node_Iterator,
-                     class Node_Iterator,
-                     class Cmp_Fn_,
-                     class Allocator_>
-    class Node_Update,
-            class Allocator>
-    struct trie_traits<
-      Key,
-      Mapped,
-      E_Access_Traits,
-      Node_Update,
-      pat_trie_tag,
-      Allocator>
+            typename _ATraits,
+            template<typename Node_CItr,
+                     typename Node_Itr,
+                     typename Cmp_Fn_,
+                     typename _Alloc_>
+            class Node_Update,
+            typename _Alloc>
+    struct trie_traits<Key, Mapped, _ATraits, Node_Update, pat_trie_tag, _Alloc>
     {
     private:
-      typedef types_traits< Key, Mapped, Allocator, false> type_traits;
+      typedef pat_trie_base                                    base_type;
+      typedef types_traits<Key, Mapped, _Alloc, false>                 type_traits;
 
     public:
-      typedef
-      typename trie_node_metadata_selector<
-      Key,
-      Mapped,
-      E_Access_Traits,
-      Node_Update,
-      Allocator>::type
-      metadata_type;
-
-      typedef E_Access_Traits e_access_traits;
-
-      typedef
-      __gnu_pbds::detail::synth_e_access_traits<
-       type_traits,
-       false,
-       e_access_traits>
-      synth_e_access_traits;
-
-      typedef
-      pat_trie_node_base<
-       type_traits,
-       synth_e_access_traits,
-       metadata_type,
-       Allocator>
-      node;
+      typedef typename trie_node_metadata_dispatch<Key, Mapped, _ATraits, Node_Update, _Alloc>::type metadata_type;
+      typedef base_type::_Metadata<metadata_type, _Alloc>              metadata;
+      typedef _ATraits                                                 access_traits;
 
-      typedef
-      pat_trie_leaf<
-       type_traits,
-       synth_e_access_traits,
-       metadata_type,
-       Allocator>
-      leaf;
+      typedef __gnu_pbds::detail::synth_access_traits<type_traits, false, access_traits>   synth_access_traits;
 
-      typedef
-      pat_trie_head<
-       type_traits,
-       synth_e_access_traits,
-       metadata_type,
-       Allocator>
-      head;
+      typedef base_type::_Node_base<synth_access_traits, metadata>             node;
+      typedef base_type::_Head<synth_access_traits, metadata>          head;
+      typedef base_type::_Leaf<synth_access_traits, metadata>          leaf;
+      typedef base_type::_Inode<synth_access_traits, metadata>                 inode;
 
-      typedef
-      pat_trie_internal_node<
-       type_traits,
-       synth_e_access_traits,
-       metadata_type,
-       Allocator>
-      internal_node;
+      typedef base_type::_Iter<node, leaf, head, inode, true>          iterator;
+      typedef base_type::_CIter<node, leaf, head, inode, true>                 const_iterator;
+      typedef base_type::_Iter<node, leaf, head, inode, false>                 reverse_iterator;
+      typedef base_type::_CIter<node, leaf, head, inode, false>                const_reverse_iterator;
 
-      typedef
-      pat_trie_const_it_<
-       type_traits,
-       node,
-       leaf,
-       head,
-       internal_node,
-       true,
-       Allocator>
-      const_iterator;
 
-      typedef
-      pat_trie_it_<
-       type_traits,
-       node,
-       leaf,
-       head,
-       internal_node,
-       true,
-       Allocator>
-      iterator;
+      typedef base_type::_Node_citer<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_const_iterator;
 
-      typedef
-      pat_trie_const_it_<
-       type_traits,
-       node,
-       leaf,
-       head,
-       internal_node,
-       false,
-       Allocator>
-      const_reverse_iterator;
+      typedef base_type::_Node_iter<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_iterator;
 
-      typedef
-      pat_trie_it_<
-       type_traits,
-       node,
-       leaf,
-       head,
-       internal_node,
-       false,
-       Allocator>
-      reverse_iterator;
+      typedef Node_Update<node_const_iterator, node_iterator, _ATraits, _Alloc>                node_update;
 
-      typedef
-      pat_trie_const_node_it_<
-       node,
-       leaf,
-       head,
-       internal_node,
-       const_iterator,
-       iterator,
-       synth_e_access_traits,
-       Allocator>
-      const_node_iterator;
-
-      typedef
-      pat_trie_node_it_<
-       node,
-       leaf,
-       head,
-       internal_node,
-       const_iterator,
-       iterator,
-       synth_e_access_traits,
-       Allocator>
-      node_iterator;
-
-      typedef
-      Node_Update<
-       const_node_iterator,
-       node_iterator,
-       E_Access_Traits,
-       Allocator>
-      node_update;
-
-      typedef
-      __gnu_pbds::null_trie_node_update<
-       const_node_iterator,
-       node_iterator,
-       E_Access_Traits,
-       Allocator>* 
-      null_node_update_pointer;
+      typedef null_node_update<node_const_iterator, node_iterator, _ATraits, _Alloc>*          null_node_update_pointer;
     };
 
+    /// Specialization.
     template<typename Key,
-            class E_Access_Traits,
-            template<typename Const_Node_Iterator,
-                     class Node_Iterator,
-                     class Cmp_Fn_,
-                     class Allocator_>
-    class Node_Update,
-            class Allocator>
-    struct trie_traits<
-      Key,
-      null_mapped_type,
-      E_Access_Traits,
-      Node_Update,
-      pat_trie_tag,
-      Allocator>
+            typename _ATraits,
+            template<typename Node_CItr,
+                     typename Node_Itr,
+                     typename Cmp_Fn_,
+                     typename _Alloc_>
+            class Node_Update,
+            typename _Alloc>
+    struct trie_traits<Key, null_type, _ATraits, Node_Update, pat_trie_tag, _Alloc>
     {
     private:
-      typedef
-      types_traits<
-      Key,
-      null_mapped_type,
-      Allocator,
-      false>
-      type_traits;
+      typedef pat_trie_base                                    base_type;
+      typedef types_traits<Key, null_type, _Alloc, false>      type_traits;
 
     public:
-      typedef
-      typename trie_node_metadata_selector<
-      Key,
-      null_mapped_type,
-      E_Access_Traits,
-      Node_Update,
-      Allocator>::type
-      metadata_type;
-
-      typedef E_Access_Traits e_access_traits;
+      typedef typename trie_node_metadata_dispatch<Key, null_type, _ATraits, Node_Update, _Alloc>::type metadata_type;
+      typedef base_type::_Metadata<metadata_type, _Alloc>                              metadata;
+      typedef _ATraits                                                                         access_traits;
+      typedef __gnu_pbds::detail::synth_access_traits<type_traits, true, access_traits> synth_access_traits;
 
-      typedef
-      __gnu_pbds::detail::synth_e_access_traits<
-       type_traits,
-       true,
-       e_access_traits>
-      synth_e_access_traits;
+      typedef base_type::_Node_base<synth_access_traits, metadata>             node;
+      typedef base_type::_Head<synth_access_traits, metadata>          head;
+      typedef base_type::_Leaf<synth_access_traits, metadata>          leaf;
+      typedef base_type::_Inode<synth_access_traits, metadata>                 inode;
 
-      typedef
-      pat_trie_node_base<
-       type_traits,
-       synth_e_access_traits,
-       metadata_type,
-       Allocator>
-      node;
+      typedef base_type::_CIter<node, leaf, head, inode, true>                 const_iterator;
+      typedef const_iterator                                           iterator;
+      typedef base_type::_CIter<node, leaf, head, inode, false>                const_reverse_iterator;
+      typedef const_reverse_iterator                                   reverse_iterator;
 
-      typedef
-      pat_trie_leaf<
-       type_traits,
-       synth_e_access_traits,
-       metadata_type,
-       Allocator>
-      leaf;
 
-      typedef
-      pat_trie_head<
-       type_traits,
-       synth_e_access_traits,
-       metadata_type,
-       Allocator>
-      head;
+      typedef base_type::_Node_citer<node, leaf, head, inode, const_iterator, iterator, _Alloc> node_const_iterator;
 
-      typedef
-      pat_trie_internal_node<
-       type_traits,
-       synth_e_access_traits,
-       metadata_type,
-       Allocator>
-      internal_node;
+      typedef node_const_iterator                                                              node_iterator;
 
-      typedef
-      pat_trie_const_it_<
-       type_traits,
-       node,
-       leaf,
-       head,
-       internal_node,
-       true,
-       Allocator>
-      const_iterator;
+      typedef Node_Update<node_const_iterator, node_iterator, _ATraits, _Alloc>                node_update;
 
-      typedef const_iterator iterator;
-
-      typedef
-      pat_trie_const_it_<
-       type_traits,
-       node,
-       leaf,
-       head,
-       internal_node,
-       false,
-       Allocator>
-      const_reverse_iterator;
-
-      typedef const_reverse_iterator reverse_iterator;
-
-      typedef
-      pat_trie_const_node_it_<
-       node,
-       leaf,
-       head,
-       internal_node,
-       const_iterator,
-       iterator,
-       synth_e_access_traits,
-       Allocator>
-      const_node_iterator;
-
-      typedef const_node_iterator node_iterator;
-
-      typedef
-      Node_Update<
-       const_node_iterator,
-       node_iterator,
-       E_Access_Traits,
-       Allocator>
-      node_update;
-
-      typedef
-      __gnu_pbds::null_trie_node_update<
-       const_node_iterator,
-       const_node_iterator,
-       E_Access_Traits,
-       Allocator>* 
-      null_node_update_pointer;
+      typedef null_node_update<node_const_iterator, node_const_iterator, _ATraits, _Alloc>*    null_node_update_pointer;
     };
 
   } // namespace detail
 } // namespace __gnu_pbds
 
 #endif // #ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP
-
index 8c0304f695ea3af670799aacdb0be143b0059420..12ef07bd6078fb3e15b10fdc12090aa4b1662965 100644 (file)
 // warranty.
 
 /**
- * @file update_fn_imps.hpp
+ * @file pat_trie_/update_fn_imps.hpp
  * Contains an implementation class for pat_trie_.
  */
 
 PB_DS_CLASS_T_DEC
 inline void
 PB_DS_CLASS_C_DEC::
-apply_update(node_pointer /*p_nd*/, null_node_update_pointer)
+apply_update(node_pointer, null_node_update_pointer)
 { }
 
 PB_DS_CLASS_T_DEC
 template<typename Node_Update_>
 inline void
 PB_DS_CLASS_C_DEC::
-apply_update(node_pointer p_nd, Node_Update_*  /*p_update*/)
+apply_update(node_pointer p_nd, Node_Update_*)
 {
   Node_Update_::operator()(node_iterator(p_nd, this),
-                          const_node_iterator(0, this));
+                          node_const_iterator(0, this));
 }
index c48ba7c6e1a1e9dc562ed369ae2c63c0e88c0d06..739d2b18bf628ea4760d4ecce195e2818bc38e3c 100644 (file)
@@ -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.
  */
 
 
 namespace __gnu_pbds
 {
-    namespace detail
-    {
-
-      template<typename Value_Type, typename Cmp_Fn, typename Tag, typename Allocator>
-      struct priority_queue_base_dispatch;
-
-      template<typename Value_Type, typename Cmp_Fn, typename Allocator>
-      struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, pairing_heap_tag, Allocator>
+  namespace detail
+  {
+    /// Specialization for pairing_heap.
+    template<typename _VTp, typename Cmp_Fn, typename _Alloc>
+      struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, pairing_heap_tag,
+                                    null_type>
       {
-       typedef pairing_heap_< Value_Type, Cmp_Fn, Allocator> type;
+       /// Dispatched type.
+       typedef pairing_heap<_VTp, Cmp_Fn, _Alloc>              type;
       };
 
-      template<typename Value_Type, typename Cmp_Fn, typename Allocator>
-      struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, binomial_heap_tag, Allocator>
+    /// Specialization for binomial_heap.
+    template<typename _VTp, typename Cmp_Fn, typename _Alloc>
+      struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, binomial_heap_tag,
+                                    null_type>
       {
-       typedef binomial_heap_< Value_Type, Cmp_Fn, Allocator> type;
+       /// Dispatched type.
+       typedef binomial_heap<_VTp, Cmp_Fn, _Alloc>             type;
       };
 
-      template<typename Value_Type, typename Cmp_Fn, typename Allocator>
-      struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, rc_binomial_heap_tag, Allocator>
+    /// Specialization for rc_binary_heap.
+    template<typename _VTp, typename Cmp_Fn, typename _Alloc>
+      struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, rc_binomial_heap_tag,
+                                    null_type>
       {
-       typedef rc_binomial_heap_< Value_Type, Cmp_Fn, Allocator> type;
+       /// Dispatched type.
+       typedef rc_binomial_heap<_VTp, Cmp_Fn, _Alloc>          type;
       };
 
-      template<typename Value_Type, typename Cmp_Fn, typename Allocator>
-      struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, binary_heap_tag, Allocator>
+    /// Specialization for binary_heap.
+    template<typename _VTp, typename Cmp_Fn, typename _Alloc>
+      struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, binary_heap_tag,
+                                    null_type>
       {
-       typedef binary_heap_< Value_Type, Cmp_Fn, Allocator> type;
+       /// Dispatched type.
+       typedef binary_heap<_VTp, Cmp_Fn, _Alloc>               type;
       };
 
-      template<typename Value_Type, typename Cmp_Fn, typename Allocator>
-      struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, thin_heap_tag, Allocator>
+    /// Specialization for thin_heap.
+    template<typename _VTp, typename Cmp_Fn, typename _Alloc>
+      struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, thin_heap_tag,
+                                    null_type>    
       {
-       typedef thin_heap_< Value_Type, Cmp_Fn, Allocator> type;
+       /// Dispatched type.
+       typedef thin_heap<_VTp, Cmp_Fn, _Alloc>                 type;
       };
-
-    } // namespace detail
+    // @} group pbds
+  } // namespace detail
 } // namespace __gnu_pbds
 
 #endif // #ifndef PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP
index 19adc8edaadb914c2d2965f9ba0f0fa36a133aa5..669c00c29b8414f19d11fc14b8ce5a550a41e4fa 100644 (file)
@@ -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();
index fe90b0a6a3f076b61faeae6182d2a8f936cf5a7b..40961edf81f21b9ae92704cf3da96eb6f684ed01 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file debug_fn_imps.hpp
+ * @file rb_tree_map_/debug_fn_imps.hpp
  * Contains an implementation for rb_tree_.
  */
 
index 0ef925f079e9c4f0b30847315b85502e35af1fc5..14e75328970f1c88e2e24b2c17043ae6b63cfbf2 100644 (file)
 // 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())
index 9378e156502fd6a2d1472f319f6055bf54315b56..9203dd4d7a652d581ad2999bfb8f17a49a327eeb 100644 (file)
@@ -34,6 +34,6 @@
 // warranty.
 
 /**
- * @file find_fn_imps.hpp
+ * @file rb_tree_map_/find_fn_imps.hpp
  * Contains an implementation for rb_tree_.
  */
index 0bf69736e8184d657be7c7847acf14d4434ee35f..0903e211427b64b5c8b5aa5097df57c20f62855a 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file info_fn_imps.hpp
+ * @file rb_tree_map_/info_fn_imps.hpp
  * Contains an implementation for rb_tree_.
  */
 
index 55bd4ed1f0dc3638ecfb87919bf4d107eb1c1901..97dc8489ab1ae6e9c6e6dcc89c5f1998ba9dabfb 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file insert_fn_imps.hpp
+ * @file rb_tree_map_/insert_fn_imps.hpp
  * Contains an implementation for rb_tree_.
  */
 
index 3f24c762c07142c8f11abb3c4d6a036c1e009462..b6f80b2b1307221f957fbc344462bd6f4867f718 100644 (file)
@@ -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
 // warranty.
 
 /**
- * @file node.hpp
+ * @file rb_tree_map_/node.hpp
  * Contains an implementation for rb_tree_.
  */
 
 #ifndef PB_DS_RB_TREE_NODE_HPP
 #define PB_DS_RB_TREE_NODE_HPP
 
-#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>
 
 namespace __gnu_pbds
 {
   namespace detail
   {
-    template<typename Value_Type, class Metadata, class Allocator>
+    /// Node for Red-Black trees.
+    template<typename Value_Type, class Metadata, typename _Alloc>
     struct rb_tree_node_
     {
     public:
-      typedef Value_Type value_type;
-      typedef Metadata metadata_type;
+      typedef Value_Type               value_type;
+      typedef Metadata                         metadata_type;
 
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
       rb_tree_node_<
       Value_Type,
       Metadata,
-      Allocator> >::other::pointer
+      _Alloc> >::other::pointer
       node_pointer;
 
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        metadata_type>::other::reference
       metadata_reference;
 
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
        metadata_type>::other::const_reference
-      const_metadata_reference;
+      metadata_const_reference;
 
-      inline bool
+      bool
       special() const
       { return m_red; }
 
-      inline const_metadata_reference
+      metadata_const_reference
       get_metadata() const
       { return m_metadata; }
 
-      inline metadata_reference
+      metadata_reference
       get_metadata()
       { return m_metadata; }
 
@@ -93,30 +94,30 @@ namespace __gnu_pbds
       }
 #endif
 
-      node_pointer m_p_left;
-      node_pointer m_p_right;
-      node_pointer m_p_parent;
-      value_type m_value;
-      bool m_red;
-      metadata_type m_metadata;
+      node_pointer     m_p_left;
+      node_pointer     m_p_right;
+      node_pointer     m_p_parent;
+      value_type       m_value;
+      bool             m_red;
+      metadata_type    m_metadata;
     };
 
-    template<typename Value_Type, class Allocator>
-    struct rb_tree_node_<Value_Type, null_node_metadata, Allocator>
+    template<typename Value_Type, typename _Alloc>
+    struct rb_tree_node_<Value_Type, null_type, _Alloc>
     {
     public:
-      typedef Value_Type value_type;
-      typedef null_node_metadata metadata_type;
+      typedef Value_Type               value_type;
+      typedef null_type        metadata_type;
 
       typedef
-      typename Allocator::template rebind<
+      typename _Alloc::template rebind<
       rb_tree_node_<
       Value_Type,
-      null_node_metadata,
-      Allocator> >::other::pointer
+      null_type,
+      _Alloc> >::other::pointer
       node_pointer;
 
-      inline bool
+      bool
       special() const
       { return m_red; }
 
@@ -126,11 +127,11 @@ namespace __gnu_pbds
       { std::cout << PB_DS_V2F(m_value) <<(m_red? " <r> " : " <b> "); }
 #endif 
 
-      node_pointer m_p_left;
-      node_pointer m_p_right;
-      node_pointer m_p_parent;
-      value_type m_value;
-      bool m_red;
+      node_pointer     m_p_left;
+      node_pointer     m_p_right;
+      node_pointer     m_p_parent;
+      value_type       m_value;
+      bool             m_red;
     };
   } // namespace detail
 } // namespace __gnu_pbds
index 7d46c95d7e0a01fab59368571646ee6d4ddd58c5..a0e374b350ca0418971466367032e775a37cf4e6 100644 (file)
 // warranty.
 
 /**
- * @file rb_tree_.hpp
- * Contains an implementation for rb_tree_.
+ * @file rb_tree_map_/rb_tree_.hpp
+ * Contains an implementation for Red Black trees.
  */
-/*
- * This implementation uses an idea from the SGI STL (using a @a header node
- *    which is needed for efficient iteration).
- */
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR
-#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR
-#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
-#endif 
-#endif 
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR
-#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR
-#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
-#endif 
-#endif 
 
 #include <ext/pb_ds/detail/standard_policies.hpp>
-#include <ext/pb_ds/detail/basic_types.hpp>
 #include <utility>
 #include <vector>
 #include <assert.h>
@@ -69,89 +50,78 @@ namespace __gnu_pbds
   {
 #define PB_DS_CLASS_T_DEC \
     template<typename Key, typename Mapped, typename Cmp_Fn, \
-            typename Node_And_It_Traits, typename Allocator>
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CLASS_NAME rb_tree_data_
-#endif 
+            typename Node_And_It_Traits, typename _Alloc>
 
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_BASE_CLASS_NAME bin_search_tree_data_
-#endif 
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_CLASS_NAME rb_tree_no_data_
-#endif 
+# define PB_DS_RB_TREE_NAME rb_tree_map
+# define PB_DS_RB_TREE_BASE_NAME bin_search_tree_map
+#endif
 
 #ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_BASE_CLASS_NAME bin_search_tree_no_data_
-#endif 
+# define PB_DS_RB_TREE_NAME rb_tree_set
+# define PB_DS_RB_TREE_BASE_NAME bin_search_tree_set
+#endif
 
 #define PB_DS_CLASS_C_DEC \
-    PB_DS_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>
-
-#define PB_DS_BASE_C_DEC \
-    PB_DS_BASE_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>
+    PB_DS_RB_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
 
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#define PB_DS_EP2VP(X)& ((X)->m_value)
-#endif 
+#define PB_DS_RB_TREE_BASE \
+    PB_DS_RB_TREE_BASE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
 
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped_Data()
-#define PB_DS_EP2VP(X)& ((X)->m_value.first)
-#endif 
 
+    /*
+     *  @brief Red-Black tree.
+     *
+     *  This implementation uses an idea from the SGI STL (using a
+     *  @a header node which is needed for efficient iteration).
+     */
     template<typename Key,
             typename Mapped,
             typename Cmp_Fn,
             typename Node_And_It_Traits,
-            typename Allocator>
-    class PB_DS_CLASS_NAME : public PB_DS_BASE_C_DEC
+            typename _Alloc>
+    class PB_DS_RB_TREE_NAME : public PB_DS_RB_TREE_BASE
     {
     private:
-      typedef PB_DS_BASE_C_DEC base_type;
-      typedef typename base_type::node_pointer node_pointer;
+      typedef PB_DS_RB_TREE_BASE                        base_type;
+      typedef typename base_type::node_pointer                  node_pointer;
 
     public:
-      typedef Cmp_Fn cmp_fn;
-      typedef Allocator allocator_type;
-      typedef typename Allocator::size_type size_type;
-      typedef typename Allocator::difference_type difference_type;
-      typedef typename base_type::key_type key_type;
-      typedef typename base_type::key_pointer key_pointer;
-      typedef typename base_type::const_key_pointer const_key_pointer;
-      typedef typename base_type::key_reference key_reference;
-      typedef typename base_type::const_key_reference const_key_reference;
-      typedef typename base_type::mapped_type mapped_type;
-      typedef typename base_type::mapped_pointer mapped_pointer;
-      typedef typename base_type::const_mapped_pointer const_mapped_pointer;
-      typedef typename base_type::mapped_reference mapped_reference;
-      typedef typename base_type::const_mapped_reference const_mapped_reference;
-      typedef typename base_type::value_type value_type;
-      typedef typename base_type::pointer pointer;
-      typedef typename base_type::const_pointer const_pointer;
-      typedef typename base_type::reference reference;
-      typedef typename base_type::const_reference const_reference;
-      typedef typename base_type::point_iterator point_iterator;
-      typedef typename base_type::const_iterator const_point_iterator;
-      typedef typename base_type::iterator iterator;
-      typedef typename base_type::const_iterator const_iterator;
-      typedef typename base_type::reverse_iterator reverse_iterator;
+      typedef rb_tree_tag                               container_category;
+      typedef Cmp_Fn                                    cmp_fn;
+      typedef _Alloc                                    allocator_type;
+      typedef typename _Alloc::size_type                size_type;
+      typedef typename _Alloc::difference_type                  difference_type;
+      typedef typename base_type::key_type              key_type;
+      typedef typename base_type::key_pointer           key_pointer;
+      typedef typename base_type::key_const_pointer     key_const_pointer;
+      typedef typename base_type::key_reference         key_reference;
+      typedef typename base_type::key_const_reference   key_const_reference;
+      typedef typename base_type::mapped_type           mapped_type;
+      typedef typename base_type::mapped_pointer        mapped_pointer;
+      typedef typename base_type::mapped_const_pointer          mapped_const_pointer;
+      typedef typename base_type::mapped_reference      mapped_reference;
+      typedef typename base_type::mapped_const_reference mapped_const_reference;
+      typedef typename base_type::value_type            value_type;
+      typedef typename base_type::pointer               pointer;
+      typedef typename base_type::const_pointer         const_pointer;
+      typedef typename base_type::reference             reference;
+      typedef typename base_type::const_reference       const_reference;
+      typedef typename base_type::point_iterator        point_iterator;
+      typedef typename base_type::const_iterator        point_const_iterator;
+      typedef typename base_type::iterator              iterator;
+      typedef typename base_type::const_iterator        const_iterator;
+      typedef typename base_type::reverse_iterator      reverse_iterator;
       typedef typename base_type::const_reverse_iterator const_reverse_iterator;
-      typedef typename base_type::node_update node_update;
+      typedef typename base_type::node_update           node_update;
 
+      PB_DS_RB_TREE_NAME();
 
-      PB_DS_CLASS_NAME();
+      PB_DS_RB_TREE_NAME(const Cmp_Fn&);
 
-      PB_DS_CLASS_NAME(const Cmp_Fn&);
+      PB_DS_RB_TREE_NAME(const Cmp_Fn&, const node_update&);
 
-      PB_DS_CLASS_NAME(const Cmp_Fn&, const node_update&);
-
-      PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+      PB_DS_RB_TREE_NAME(const PB_DS_CLASS_C_DEC&);
 
       void
       swap(PB_DS_CLASS_C_DEC&);
@@ -164,7 +134,7 @@ namespace __gnu_pbds
       insert(const_reference);
 
       inline mapped_reference
-      operator[](const_key_reference r_key)
+      operator[](key_const_reference r_key)
       {
 #ifdef PB_DS_DATA_TRUE_INDICATOR
        _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
@@ -179,14 +149,14 @@ namespace __gnu_pbds
          }
        _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
        return ins_pair.first.m_p_nd->m_value.second;
-#else 
+#else
        insert(r_key);
-       return base_type::s_null_mapped;
-#endif 
+       return base_type::s_null_type;
+#endif
       }
 
       inline bool
-      erase(const_key_reference);
+      erase(key_const_reference);
 
       inline iterator
       erase(iterator);
@@ -202,20 +172,17 @@ namespace __gnu_pbds
       join(PB_DS_CLASS_C_DEC&);
 
       void
-      split(const_key_reference, PB_DS_CLASS_C_DEC&);
-
-    protected:
+      split(key_const_reference, PB_DS_CLASS_C_DEC&);
 
     private:
 
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_valid(const char* file, int line) const;
+      assert_valid(const char*, int) const;
 
       size_type
-      assert_node_consistent(const node_pointer, const char* file,
-                                                int line) const;
-#endif 
+      assert_node_consistent(const node_pointer, const char*, int) const;
+#endif
 
       inline static bool
       is_effectively_black(const node_pointer);
@@ -273,13 +240,8 @@ namespace __gnu_pbds
 #undef PB_DS_STRUCT_ONLY_ASSERT_VALID
 #undef PB_DS_CLASS_T_DEC
 #undef PB_DS_CLASS_C_DEC
-#undef PB_DS_CLASS_NAME
-#undef PB_DS_BASE_CLASS_NAME
-#undef PB_DS_BASE_C_DEC
-#undef PB_DS_V2F
-#undef PB_DS_EP2VP
-#undef PB_DS_V2S
-
+#undef PB_DS_RB_TREE_NAME
+#undef PB_DS_RB_TREE_BASE_NAME
+#undef PB_DS_RB_TREE_BASE
   } // namespace detail
 } // namespace __gnu_pbds
-
index 198caca88680d38ee6da5e7b593a1658fcebbb4e..54c7b2396d7f1caac270487ff8d96dfb1fbd357f 100644 (file)
@@ -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)
index 531d8e46e1c7e7478695d6f1587ea73e5b3d3da3..e6f2d8974ffeb60e44f4ab9b109df0d8204da4fe 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file traits.hpp
+ * @file rb_tree_map_/traits.hpp
  * Contains an implementation for rb_tree_.
  */
 
@@ -47,75 +47,51 @@ namespace __gnu_pbds
 {
   namespace detail
   {
+    /// Specialization.
     template<typename Key,
             typename Mapped,
             typename Cmp_Fn,
-            template<typename Const_Node_Iterator,
-                     class Node_Iterator,
-                     class Cmp_Fn_,
-                     class Allocator_>
-    class Node_Update,
-            typename Allocator>
-    struct tree_traits<
-      Key,
-      Mapped,
-      Cmp_Fn,
-      Node_Update,
-      rb_tree_tag,
-      Allocator> : public bin_search_tree_traits<
+            template<typename Node_CItr,
+                     typename Node_Itr,
+                     typename Cmp_Fn_,
+                     typename _Alloc_>
+            class Node_Update,
+            typename _Alloc>
+    struct tree_traits<Key, Mapped, Cmp_Fn, Node_Update, rb_tree_tag, _Alloc> 
+    : public bin_search_tree_traits<
       Key,
       Mapped,
       Cmp_Fn,
       Node_Update,
       rb_tree_node_<
-      typename types_traits<
-      Key,
-      Mapped,
-      Allocator,
-      false>::value_type,
-      typename tree_node_metadata_selector<
-      Key,
-      Mapped,
-      Cmp_Fn,
-      Node_Update,
-      Allocator>::type,
-      Allocator>,
-      Allocator>
+       typename types_traits<Key, Mapped, _Alloc, false>::value_type,
+       typename tree_node_metadata_dispatch<Key, Mapped, Cmp_Fn, Node_Update,
+                                            _Alloc>::type,
+       _Alloc>,
+      _Alloc>
     { };
 
+    /// Specialization.
     template<typename Key,
-            class Cmp_Fn,
-            template<typename Const_Node_Iterator,
-                     class Node_Iterator,
-                     class Cmp_Fn_,
-                     class Allocator_>
-    class Node_Update,
-            class Allocator>
-    struct tree_traits<
-      Key,
-      null_mapped_type,
-      Cmp_Fn,
-      Node_Update,
-      rb_tree_tag,
-      Allocator> : public bin_search_tree_traits<
+            typename Cmp_Fn,
+            template<typename Node_CItr,
+                     typename Node_Itr,
+                     typename Cmp_Fn_,
+                     typename _Alloc_>
+            class Node_Update,
+            typename _Alloc>
+    struct tree_traits<Key, null_type, Cmp_Fn, Node_Update, rb_tree_tag, _Alloc> 
+    : public bin_search_tree_traits<
       Key,
-      null_mapped_type,
+      null_type,
       Cmp_Fn,
       Node_Update,
       rb_tree_node_<
-      typename types_traits<
-      Key,
-      null_mapped_type,
-      Allocator,
-      false>::value_type,
-      typename tree_node_metadata_selector<
-      Key,
-      null_mapped_type,
-      Cmp_Fn,
-      Node_Update,
-      Allocator>::type,
-      Allocator>,
-      Allocator>
+      typename types_traits<Key, null_type, _Alloc, false>::value_type,
+      typename tree_node_metadata_dispatch<Key, null_type, Cmp_Fn, Node_Update,
+                                          _Alloc>::type,
+       _Alloc>,
+         _Alloc>
     { };
 
   } // namespace detail
index 35acb8f6bcdca3d4409dcdacba39a7702068f1a2..5c9c05f2f10a0501bcf844f058836e8537b1576d 100644 (file)
 // 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))
index 638810bfb44670d6bea534b8f4391820b058b868..b7a1b58fe8da277f99a29b17cfdc6cf3fa1f5247 100644 (file)
@@ -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;
index bf000625009f9ebf40c69356410f9dff40449732..a8c619e5a1cd6b3e1845d20e25b504efd49fd389 100644 (file)
@@ -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_.
  */
 
index c252b49ad8af59e03afba8754f3121da7ce8cfa3..aae0a72c97c1ebfa49319c54f665b33bd03f47fc 100644 (file)
@@ -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_.
  */
 
index 845e6726db6d418abb4b90cb818110502eb9ac68..ea27c47ba6ba5df9f9748dac98d2d36d53f11b46 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file rc.hpp
+ * @file rc_binomial_heap_/rc.hpp
  * Contains a redundant (binary counter).
  */
 
@@ -45,37 +45,22 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-
-#define PB_DS_CLASS_T_DEC \
-    template<typename Node, class Allocator>
-
-#define PB_DS_CLASS_C_DEC \
-    rc<Node, Allocator>
-
-    template<typename Node, class Allocator>
+    /// Redundant binary counter.
+    template<typename _Node, typename _Alloc>
     class rc
     {
     private:
-      typedef Allocator allocator_type;
-
-      typedef typename allocator_type::size_type size_type;
-
-      typedef Node node;
+      typedef _Alloc                                    allocator_type;
+      typedef typename allocator_type::size_type        size_type;
+      typedef _Node                                     node;
 
-      typedef
-      typename allocator_type::template rebind<
-       node>::other::pointer
-      node_pointer;
+      typedef typename _Alloc::template rebind<node>    __rebind_n;
+      typedef typename __rebind_n::other::pointer               node_pointer;
 
-      typedef
-      typename allocator_type::template rebind<
-       node_pointer>::other::pointer
-      entry_pointer;
+      typedef typename _Alloc::template rebind<node_pointer>  __rebind_np;
 
-      typedef
-      typename allocator_type::template rebind<
-       node_pointer>::other::const_pointer
-      const_entry_pointer;
+      typedef typename __rebind_np::other::pointer      entry_pointer;
+      typedef typename __rebind_np::other::const_pointer entry_const_pointer;
 
       enum
        {
@@ -83,20 +68,18 @@ namespace __gnu_pbds
        };
 
     public:
-      typedef node_pointer entry;
+      typedef node_pointer                              entry;
+      typedef entry_const_pointer                       const_iterator;
 
-      typedef const_entry_pointer const_iterator;
-
-    public:
       rc();
 
-      rc(const PB_DS_CLASS_C_DEC& other);
+      rc(const rc&);
 
       inline void
-      swap(PB_DS_CLASS_C_DEC& other);
+      swap(rc&);
 
       inline void
-      push(entry p_nd);
+      push(entry);
 
       inline node_pointer
       top() const;
@@ -121,34 +104,33 @@ namespace __gnu_pbds
 
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_valid(const char* file, int line) const;
-#endif 
+      assert_valid(const char*, int) const;
+#endif
 
 #ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
       void
       trace() const;
-#endif 
+#endif
 
     private:
-      node_pointer m_a_entries[max_entries];
-
-      size_type m_over_top;
+      node_pointer     m_a_entries[max_entries];
+      size_type        m_over_top;
     };
 
-    PB_DS_CLASS_T_DEC
-    PB_DS_CLASS_C_DEC::
+    template<typename _Node, typename _Alloc>
+    rc<_Node, _Alloc>::
     rc() : m_over_top(0)
     { PB_DS_ASSERT_VALID((*this)) }
 
-    PB_DS_CLASS_T_DEC
-    PB_DS_CLASS_C_DEC::
-    rc(const PB_DS_CLASS_C_DEC& other) : m_over_top(0)
+    template<typename _Node, typename _Alloc>
+    rc<_Node, _Alloc>::
+    rc(const rc<_Node, _Alloc>& other) : m_over_top(0)
     { PB_DS_ASSERT_VALID((*this)) }
 
-    PB_DS_CLASS_T_DEC
+    template<typename _Node, typename _Alloc>
     inline void
-    PB_DS_CLASS_C_DEC::
-    swap(PB_DS_CLASS_C_DEC& other)
+    rc<_Node, _Alloc>::
+    swap(rc<_Node, _Alloc>& other)
     {
       PB_DS_ASSERT_VALID((*this))
       PB_DS_ASSERT_VALID(other)
@@ -163,9 +145,9 @@ namespace __gnu_pbds
       PB_DS_ASSERT_VALID(other)
      }
 
-    PB_DS_CLASS_T_DEC
+    template<typename _Node, typename _Alloc>
     inline void
-    PB_DS_CLASS_C_DEC::
+    rc<_Node, _Alloc>::
     push(entry p_nd)
     {
       PB_DS_ASSERT_VALID((*this))
@@ -174,9 +156,9 @@ namespace __gnu_pbds
       PB_DS_ASSERT_VALID((*this))
     }
 
-    PB_DS_CLASS_T_DEC
+    template<typename _Node, typename _Alloc>
     inline void
-    PB_DS_CLASS_C_DEC::
+    rc<_Node, _Alloc>::
     pop()
     {
       PB_DS_ASSERT_VALID((*this))
@@ -185,9 +167,9 @@ namespace __gnu_pbds
       PB_DS_ASSERT_VALID((*this))
     }
 
-    PB_DS_CLASS_T_DEC
-    inline typename PB_DS_CLASS_C_DEC::node_pointer
-    PB_DS_CLASS_C_DEC::
+    template<typename _Node, typename _Alloc>
+    inline typename rc<_Node, _Alloc>::node_pointer
+    rc<_Node, _Alloc>::
     top() const
     {
       PB_DS_ASSERT_VALID((*this))
@@ -195,24 +177,24 @@ namespace __gnu_pbds
       return *(m_a_entries + m_over_top - 1);
     }
 
-    PB_DS_CLASS_T_DEC
+    template<typename _Node, typename _Alloc>
     inline bool
-    PB_DS_CLASS_C_DEC::
+    rc<_Node, _Alloc>::
     empty() const
     {
       PB_DS_ASSERT_VALID((*this))
       return m_over_top == 0;
     }
 
-    PB_DS_CLASS_T_DEC
-    inline typename PB_DS_CLASS_C_DEC::size_type
-    PB_DS_CLASS_C_DEC::
+    template<typename _Node, typename _Alloc>
+    inline typename rc<_Node, _Alloc>::size_type
+    rc<_Node, _Alloc>::
     size() const
     { return m_over_top; }
 
-    PB_DS_CLASS_T_DEC
+    template<typename _Node, typename _Alloc>
     void
-    PB_DS_CLASS_C_DEC::
+    rc<_Node, _Alloc>::
     clear()
     {
       PB_DS_ASSERT_VALID((*this))
@@ -220,30 +202,30 @@ namespace __gnu_pbds
       PB_DS_ASSERT_VALID((*this))
     }
 
-    PB_DS_CLASS_T_DEC
-    const typename PB_DS_CLASS_C_DEC::const_iterator
-    PB_DS_CLASS_C_DEC::
+    template<typename _Node, typename _Alloc>
+    const typename rc<_Node, _Alloc>::const_iterator
+    rc<_Node, _Alloc>::
     begin() const
     { return& m_a_entries[0]; }
 
-    PB_DS_CLASS_T_DEC
-    const typename PB_DS_CLASS_C_DEC::const_iterator
-    PB_DS_CLASS_C_DEC::
+    template<typename _Node, typename _Alloc>
+    const typename rc<_Node, _Alloc>::const_iterator
+    rc<_Node, _Alloc>::
     end() const
     { return& m_a_entries[m_over_top]; }
 
 #ifdef _GLIBCXX_DEBUG
-    PB_DS_CLASS_T_DEC
+    template<typename _Node, typename _Alloc>
     void
-    PB_DS_CLASS_C_DEC::
+    rc<_Node, _Alloc>::
     assert_valid(const char* __file, int __line) const
     { PB_DS_DEBUG_VERIFY(m_over_top < max_entries); }
-#endif 
+#endif
 
 #ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
-    PB_DS_CLASS_T_DEC
+    template<typename _Node, typename _Alloc>
     void
-    PB_DS_CLASS_C_DEC::
+    rc<_Node, _Alloc>::
     trace() const
     {
       std::cout << "rc" << std::endl;
@@ -251,12 +233,8 @@ namespace __gnu_pbds
        std::cerr << m_a_entries[i] << std::endl;
       std::cout << std::endl;
     }
-#endif 
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
+#endif
 } // namespace detail
 } // namespace __gnu_pbds
 
-#endif 
+#endif
index 767bf108861cc2024f3abbbc37c5096dd698174b..e4d6704910878d118a82b543ca40d8eddf229d1a 100644 (file)
 // warranty.
 
 /**
- * @file rc_binomial_heap_.hpp
- * Contains an implementation for rc_binomial_heap_.
- */
-
-/*
- * Redundant-counter binomial heap.
+ * @file rc_binomial_heap_/rc_binomial_heap_.hpp
+ * Contains an implementation for redundant-counter binomial heap.
  */
 
 #include <ext/pb_ds/detail/cond_dealtor.hpp>
@@ -53,114 +49,92 @@ namespace __gnu_pbds
   namespace detail
   {
 #define PB_DS_CLASS_T_DEC \
-    template<typename Value_Type, class Cmp_Fn, class Allocator>
+    template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
 
 #define PB_DS_CLASS_C_DEC \
-    rc_binomial_heap_<Value_Type, Cmp_Fn, Allocator>
-
-#define PB_DS_BASE_C_DEC \
-    binomial_heap_base_<Value_Type, Cmp_Fn, Allocator>
+    rc_binomial_heap<Value_Type, Cmp_Fn, _Alloc>
 
 #define PB_DS_RC_C_DEC \
-    rc<typename PB_DS_BASE_C_DEC::node, Allocator>
+    rc<typename binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>::node, _Alloc>
 
-    /**
-     * class description = "8y|\|0|\/|i41 h34p 74813">
-     **/
-    template<typename Value_Type, class Cmp_Fn, class Allocator>
-    class rc_binomial_heap_ : public PB_DS_BASE_C_DEC
+    /// Base class for redundant-counter binomial heap.
+    template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
+    class rc_binomial_heap
+    : public binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>
     {
-
     private:
-      typedef PB_DS_BASE_C_DEC base_type;
-
-      typedef typename base_type::node_pointer node_pointer;
-
-      typedef typename base_type::const_node_pointer const_node_pointer;
-
-      typedef PB_DS_RC_C_DEC rc_t;
+      typedef binomial_heap_base<Value_Type, Cmp_Fn, _Alloc>
+                                                       base_type;
+      typedef typename base_type::node_pointer                 node_pointer;
+      typedef typename base_type::node_const_pointer   node_const_pointer;
+      typedef PB_DS_RC_C_DEC                           rc_t;
 
     public:
+      typedef Value_Type                               value_type;
+      typedef typename _Alloc::size_type               size_type;
+      typedef typename _Alloc::difference_type                 difference_type;
+      typedef typename base_type::pointer              pointer;
+      typedef typename base_type::const_pointer        const_pointer;
+      typedef typename base_type::reference            reference;
+      typedef typename base_type::const_reference      const_reference;
+      typedef typename base_type::point_const_iterator         point_const_iterator;
+      typedef typename base_type::point_iterator       point_iterator;
+      typedef typename base_type::const_iterator       const_iterator;
+      typedef typename base_type::iterator             iterator;
+      typedef typename base_type::cmp_fn               cmp_fn;
+      typedef typename base_type::allocator_type       allocator_type;
 
-      typedef typename Allocator::size_type size_type;
-
-      typedef typename Allocator::difference_type difference_type;
-
-      typedef Value_Type value_type;
-
-      typedef typename base_type::pointer pointer;
-
-      typedef typename base_type::const_pointer const_pointer;
-
-      typedef typename base_type::reference reference;
+      rc_binomial_heap();
 
-      typedef typename base_type::const_reference const_reference;
+      rc_binomial_heap(const Cmp_Fn&);
 
-      typedef typename base_type::const_point_iterator const_point_iterator;
+      rc_binomial_heap(const PB_DS_CLASS_C_DEC&);
 
-      typedef typename base_type::point_iterator point_iterator;
-
-      typedef typename base_type::const_iterator const_iterator;
-
-      typedef typename base_type::iterator iterator;
-
-      typedef typename base_type::cmp_fn cmp_fn;
-
-      typedef typename base_type::allocator_type allocator_type;
-
-    public:
-
-      rc_binomial_heap_();
-
-      rc_binomial_heap_(const Cmp_Fn& r_cmp_fn);
-
-      rc_binomial_heap_(const PB_DS_CLASS_C_DEC& other);
-
-      ~rc_binomial_heap_();
+      ~rc_binomial_heap();
 
       void
-      swap(PB_DS_CLASS_C_DEC& other);
+      swap(PB_DS_CLASS_C_DEC&);
 
       inline point_iterator
-      push(const_reference r_val);
+      push(const_reference);
 
       void
-      modify(point_iterator it, const_reference r_new_val);
+      modify(point_iterator, const_reference);
 
       inline void
       pop();
 
       void
-      erase(point_iterator it);
+      erase(point_iterator);
 
       inline void
       clear();
 
       template<typename Pred>
       size_type
-      erase_if(Pred pred);
+      erase_if(Pred);
 
       template<typename Pred>
       void
-      split(Pred pred, PB_DS_CLASS_C_DEC& other);
+      split(Pred, PB_DS_CLASS_C_DEC&);
 
       void
-      join(PB_DS_CLASS_C_DEC& other);
+      join(PB_DS_CLASS_C_DEC&);
 
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_valid(const char* file, int line) const;
-#endif 
+      assert_valid(const char*, int) const;
+#endif
 
 #ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
       void
       trace() const;
-#endif 
+#endif
 
     private:
 
       inline node_pointer
-      link_with_next_sibling(node_pointer p_nd);
+      link_with_next_sibling(node_pointer);
 
       void
       make_0_exposed();
@@ -169,15 +143,14 @@ namespace __gnu_pbds
       make_binomial_heap();
 
 #ifdef _GLIBCXX_DEBUG
-      static const_node_pointer
-      next_2_pointer(const_node_pointer p_nd);
+      static node_const_pointer
+      next_2_pointer(node_const_pointer);
 
-      static const_node_pointer
-      next_after_0_pointer(const_node_pointer p_nd);
-#endif 
+      static node_const_pointer
+      next_after_0_pointer(node_const_pointer);
+#endif
 
-    private:
-      rc_t m_rc;
+      rc_t                     m_rc;
     };
 
 #include <ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp>
@@ -189,7 +162,6 @@ namespace __gnu_pbds
 
 #undef PB_DS_CLASS_C_DEC
 #undef PB_DS_CLASS_T_DEC
-#undef PB_DS_BASE_C_DEC
 #undef PB_DS_RC_C_DEC
   } // namespace detail
 } // namespace __gnu_pbds
index 09d637c7d584d0f9e02b6e929569255d9fb0c6e3..13bf78e51fdd218d3468cddfcd3401f9be0b3062 100644 (file)
@@ -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();
 
index 1fb3b8bd489e1c8f84ddd3a912e92804870639cd..27b5bc4b97df93e4142f008454e35856f68602d3 100644 (file)
@@ -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();
 }
 
index 33aecdf5fcc4bd68d1cc54d5e942ac14f1f841b9..97533a34e457dfa42792c65ec213b2985125404e 100644 (file)
 #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
index 963c5530a462aaeb0db5453032cebfa0b327f8f8..ebc28b7cbc7e9f8eb2cce2fcf2d145a853f0a8f5 100644 (file)
 #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
index 9b3ba031c4b0ddac63ca1afde16e96873682b1b8..b6c49aea69dfe709f531d24430184e9786a0ddc7 100644 (file)
 #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
index dea307c2bdc589b6eb77bfadff860133e73bb500..2383e9625528c1788749c46c77b480a93fff29d6 100644 (file)
@@ -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();
index 453567a0632e1dd1327f691b6ef2a8e5526e6748..e6a4694b291bfffbe86440dc29cf9ba3dcf0f6cc 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file debug_fn_imps.hpp
+ * @file splay_tree_/debug_fn_imps.hpp
  * Contains an implementation class for splay_tree_.
  */
 
index 22f8e68c44028d7b7097eb207b1208a4e22355fd..9546321e6f0e0fb2d29d4e7c39b6d845c64a7e12 100644 (file)
 // 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
index 9dfa926f402005acc38e17527edfd8ee6ba08ded..6e1a4ef06e29b95f5801bf57dddcfd016ee6b67a 100644 (file)
 // 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;
index 636b9ab255e1d8c292232352fb464ce37a2ff23f..8996903b016dda3bcfb201ea5e9ee5fcac912677 100644 (file)
@@ -34,6 +34,6 @@
 // warranty.
 
 /**
- * @file info_fn_imps.hpp
+ * @file splay_tree_/info_fn_imps.hpp
  * Contains an implementation.
  */
index 4e1179ead2ffb53b9756c4843c2f547e472d29d4..2f895b5bffa139205b4f696c45944f2be2d4d751 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file insert_fn_imps.hpp
+ * @file splay_tree_/insert_fn_imps.hpp
  * Contains an implementation class for splay_tree_.
  */
 
index fbf398d04c9301b829d509d9d15f62642092a253..111976d550018fe7f45c7e46be335b437a49b5e6 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file node.hpp
+ * @file splay_tree_/node.hpp
  * Contains an implementation struct for splay_tree_'s node.
  */
 
@@ -45,7 +45,8 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-    template<typename Value_Type, class Metadata, class Allocator>
+    /// Node for splay tree.
+    template<typename Value_Type, class Metadata, typename _Alloc>
     struct splay_tree_node_
     {
     public:
@@ -53,17 +54,17 @@ namespace __gnu_pbds
       typedef Metadata metadata_type;
 
       typedef
-      typename Allocator::template rebind<
-      splay_tree_node_<Value_Type, Metadata, Allocator> >::other::pointer
+      typename _Alloc::template rebind<
+      splay_tree_node_<Value_Type, Metadata, _Alloc> >::other::pointer
       node_pointer;
 
       typedef
-      typename Allocator::template rebind<metadata_type>::other::reference
+      typename _Alloc::template rebind<metadata_type>::other::reference
       metadata_reference;
 
       typedef
-      typename Allocator::template rebind<metadata_type>::other::const_reference
-      const_metadata_reference;
+      typename _Alloc::template rebind<metadata_type>::other::const_reference
+      metadata_const_reference;
 
 #ifdef PB_DS_BIN_SEARCH_TREE_TRACE_
       void
@@ -75,7 +76,7 @@ namespace __gnu_pbds
       special() const
       { return m_special; }
 
-      inline const_metadata_reference
+      inline metadata_const_reference
       get_metadata() const
       { return m_metadata; }
 
@@ -91,16 +92,16 @@ namespace __gnu_pbds
       metadata_type m_metadata;
     };
 
-    template<typename Value_Type, typename Allocator>
-    struct splay_tree_node_<Value_Type, null_node_metadata, Allocator>
+    template<typename Value_Type, typename _Alloc>
+    struct splay_tree_node_<Value_Type, null_type, _Alloc>
     {
     public:
       typedef Value_Type value_type;
-      typedef null_node_metadata metadata_type;
+      typedef null_type metadata_type;
 
       typedef
-      typename Allocator::template rebind<
-      splay_tree_node_<Value_Type, null_node_metadata, Allocator> >::other::pointer
+      typename _Alloc::template rebind<
+      splay_tree_node_<Value_Type, null_type, _Alloc> >::other::pointer
       node_pointer;
 
       inline bool
index b1523662c43a84340dbe91d89853b5889a7a77c5..035684509415a8068edebf539e5982e4ae66909a 100644 (file)
@@ -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)
 }
-
index b6afa758eb810a75795d3dad01bb5417614f9184..4d67dba4d8597a040b15b79de12d162e5846c127 100644 (file)
@@ -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
  *
  */
 
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR
-#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR
-#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
-#endif 
-#endif 
-
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR
-#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR
-#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
-#endif 
-#endif 
-
 #include <utility>
 #include <vector>
 #include <assert.h>
@@ -91,91 +77,75 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-#define PB_DS_CLASS_T_DEC \
-    template<typename Key, typename Mapped, typename Cmp_Fn, \
-            typename Node_And_It_Traits, typename Allocator>
-
 #ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_CLASS_NAME splay_tree_data_
-#endif 
+# define PB_DS_S_TREE_NAME splay_tree_map
+# define PB_DS_S_TREE_BASE_NAME bin_search_tree_map
+#endif
 
 #ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_CLASS_NAME splay_tree_no_data_
-#endif 
-
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_BASE_CLASS_NAME bin_search_tree_data_
-#endif 
+# define PB_DS_S_TREE_NAME splay_tree_set
+# define PB_DS_S_TREE_BASE_NAME bin_search_tree_set
+#endif
 
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_BASE_CLASS_NAME bin_search_tree_no_data_
-#endif 
+#define PB_DS_CLASS_T_DEC \
+    template<typename Key, typename Mapped, typename Cmp_Fn, \
+            typename Node_And_It_Traits, typename _Alloc>
 
 #define PB_DS_CLASS_C_DEC \
-    PB_DS_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>
+    PB_DS_S_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
 
-#define PB_DS_BASE_C_DEC \
-    PB_DS_BASE_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>
+#define PB_DS_S_TREE_BASE \
+    PB_DS_S_TREE_BASE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
 
-#ifdef PB_DS_DATA_TRUE_INDICATOR
-#define PB_DS_V2F(X) (X).first
-#define PB_DS_V2S(X) (X).second
-#define PB_DS_EP2VP(X)& ((X)->m_value)
-#endif 
 
-#ifdef PB_DS_DATA_FALSE_INDICATOR
-#define PB_DS_V2F(X) (X)
-#define PB_DS_V2S(X) Mapped_Data()
-#define PB_DS_EP2VP(X)& ((X)->m_value.first)
-#endif 
-
-    // $p14y 7r33 7481.
+    /// Splay Tree.
     template<typename Key, typename Mapped, typename Cmp_Fn,
-            typename Node_And_It_Traits, typename Allocator>
-    class PB_DS_CLASS_NAME : public PB_DS_BASE_C_DEC
+            typename Node_And_It_Traits, typename _Alloc>
+    class PB_DS_S_TREE_NAME : public PB_DS_S_TREE_BASE
     {
     private:
-      typedef PB_DS_BASE_C_DEC base_type;
+      typedef PB_DS_S_TREE_BASE                         base_type;
 #ifdef _GLIBCXX_DEBUG
       typedef base_type debug_base;
 #endif
-      typedef typename base_type::node_pointer node_pointer;
+      typedef typename base_type::node_pointer                  node_pointer;
 
     public:
-      typedef Allocator allocator_type;
-      typedef typename Allocator::size_type size_type;
-      typedef typename Allocator::difference_type difference_type;
-      typedef Cmp_Fn cmp_fn;
-      typedef typename base_type::key_type key_type;
-      typedef typename base_type::key_pointer key_pointer;
-      typedef typename base_type::const_key_pointer const_key_pointer;
-      typedef typename base_type::key_reference key_reference;
-      typedef typename base_type::const_key_reference const_key_reference;
-      typedef typename base_type::mapped_type mapped_type;
-      typedef typename base_type::mapped_pointer mapped_pointer;
-      typedef typename base_type::const_mapped_pointer const_mapped_pointer;
-      typedef typename base_type::mapped_reference mapped_reference;
-      typedef typename base_type::const_mapped_reference const_mapped_reference;
-      typedef typename base_type::value_type value_type;
-      typedef typename base_type::pointer pointer;
-      typedef typename base_type::const_pointer const_pointer;
-      typedef typename base_type::reference reference;
-      typedef typename base_type::const_reference const_reference;
-      typedef typename base_type::point_iterator point_iterator;
-      typedef typename base_type::const_iterator const_point_iterator;
-      typedef typename base_type::iterator iterator;
-      typedef typename base_type::const_iterator const_iterator;
-      typedef typename base_type::reverse_iterator reverse_iterator;
+      typedef splay_tree_tag                            container_category;
+      typedef _Alloc                                    allocator_type;
+      typedef typename _Alloc::size_type                size_type;
+      typedef typename _Alloc::difference_type                  difference_type;
+      typedef Cmp_Fn                                    cmp_fn;
+      typedef typename base_type::key_type              key_type;
+      typedef typename base_type::key_pointer           key_pointer;
+      typedef typename base_type::key_const_pointer     key_const_pointer;
+      typedef typename base_type::key_reference         key_reference;
+      typedef typename base_type::key_const_reference   key_const_reference;
+      typedef typename base_type::mapped_type           mapped_type;
+      typedef typename base_type::mapped_pointer        mapped_pointer;
+      typedef typename base_type::mapped_const_pointer          mapped_const_pointer;
+      typedef typename base_type::mapped_reference      mapped_reference;
+      typedef typename base_type::mapped_const_reference mapped_const_reference;
+      typedef typename base_type::value_type            value_type;
+      typedef typename base_type::pointer               pointer;
+      typedef typename base_type::const_pointer         const_pointer;
+      typedef typename base_type::reference             reference;
+      typedef typename base_type::const_reference       const_reference;
+      typedef typename base_type::point_iterator        point_iterator;
+      typedef typename base_type::const_iterator        point_const_iterator;
+      typedef typename base_type::iterator              iterator;
+      typedef typename base_type::const_iterator        const_iterator;
+      typedef typename base_type::reverse_iterator      reverse_iterator;
       typedef typename base_type::const_reverse_iterator const_reverse_iterator;
-      typedef typename base_type::node_update node_update;
+      typedef typename base_type::node_update           node_update;
 
-      PB_DS_CLASS_NAME();
+      PB_DS_S_TREE_NAME();
 
-      PB_DS_CLASS_NAME(const Cmp_Fn&);
+      PB_DS_S_TREE_NAME(const Cmp_Fn&);
 
-      PB_DS_CLASS_NAME(const Cmp_Fn&, const node_update&);
+      PB_DS_S_TREE_NAME(const Cmp_Fn&, const node_update&);
 
-      PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+      PB_DS_S_TREE_NAME(const PB_DS_CLASS_C_DEC&);
 
       void
       swap(PB_DS_CLASS_C_DEC&);
@@ -191,7 +161,7 @@ namespace __gnu_pbds
       insert(const_reference r_value);
 
       inline mapped_reference
-      operator[](const_key_reference r_key)
+      operator[](key_const_reference r_key)
       {
 #ifdef PB_DS_DATA_TRUE_INDICATOR
        _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
@@ -203,20 +173,20 @@ namespace __gnu_pbds
        splay(ins_pair.first.m_p_nd);
        _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
        return ins_pair.first.m_p_nd->m_value.second;
-#else 
+#else
        insert(r_key);
-       return base_type::s_null_mapped;
+       return base_type::s_null_type;
 #endif
       }
 
       inline point_iterator
-      find(const_key_reference);
+      find(key_const_reference);
 
-      inline const_point_iterator
-      find(const_key_reference) const;
+      inline point_const_iterator
+      find(key_const_reference) const;
 
       inline bool
-      erase(const_key_reference);
+      erase(key_const_reference);
 
       inline iterator
       erase(iterator it);
@@ -232,17 +202,17 @@ namespace __gnu_pbds
       join(PB_DS_CLASS_C_DEC&);
 
       void
-      split(const_key_reference, PB_DS_CLASS_C_DEC&);
+      split(key_const_reference, PB_DS_CLASS_C_DEC&);
 
     private:
       inline std::pair<point_iterator, bool>
       insert_leaf_imp(const_reference);
 
       inline node_pointer
-      find_imp(const_key_reference);
+      find_imp(key_const_reference);
 
       inline const node_pointer
-      find_imp(const_key_reference) const;
+      find_imp(key_const_reference) const;
 
 #ifdef _GLIBCXX_DEBUG
       void
@@ -250,7 +220,7 @@ namespace __gnu_pbds
 
       void
       assert_special_imp(const node_pointer, const char* file, int line) const;
-#endif 
+#endif
 
       void
       splay(node_pointer);
@@ -295,12 +265,8 @@ namespace __gnu_pbds
 #undef PB_DS_ASSERT_BASE_NODE_CONSISTENT
 #undef PB_DS_CLASS_T_DEC
 #undef PB_DS_CLASS_C_DEC
-#undef PB_DS_CLASS_NAME
-#undef PB_DS_BASE_CLASS_NAME
-#undef PB_DS_BASE_C_DEC
-#undef PB_DS_V2F
-#undef PB_DS_EP2VP
-#undef PB_DS_V2S
+#undef PB_DS_S_TREE_NAME
+#undef PB_DS_S_TREE_BASE_NAME
+#undef PB_DS_S_TREE_BASE
   } // namespace detail
 } // namespace __gnu_pbds
-
index fe4cfa57bf75cca5760fe04a8ed314af5b0ba88d..1fcfe7980507ec036188887432830da93f6360ad 100644 (file)
@@ -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))
index cfedc35c8db237c038d661483b7ca37196abf8b1..e5020ec92f0f925b41ff8b237814cc8bf9062da5 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file traits.hpp
+ * @file splay_tree_/traits.hpp
  * Contains an implementation for splay_tree_.
  */
 
@@ -47,64 +47,44 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-
+    /// Specialization.
     template<typename Key,
             typename Mapped,
-            class Cmp_Fn,
-            template<typename Const_Node_Iterator,
-                     class Node_Iterator,
-                     class Cmp_Fn_,
-                     class Allocator_>
-    class Node_Update,
-            class Allocator>
-    struct tree_traits<
-      Key,
-      Mapped,
-      Cmp_Fn,
-      Node_Update,
-      splay_tree_tag,
-      Allocator> : public bin_search_tree_traits<
-      Key,
-      Mapped,
-      Cmp_Fn,
-      Node_Update,
-      splay_tree_node_<
-      typename types_traits<
-      Key,
-      Mapped,
-      Allocator,
-      false>::value_type,
-      typename tree_node_metadata_selector<
-      Key,
-      Mapped,
-      Cmp_Fn,
-      Node_Update,
-      Allocator>::type,
-      Allocator>,
-      Allocator>
+            typename Cmp_Fn,
+            template<typename Node_CItr,
+                     typename Node_Itr,
+                     typename Cmp_Fn_,
+                     typename _Alloc_>
+            class Node_Update,
+            typename _Alloc>
+    struct tree_traits<Key, Mapped, Cmp_Fn, Node_Update, splay_tree_tag, _Alloc> 
+    : public bin_search_tree_traits<Key, Mapped, Cmp_Fn, Node_Update,
+                                   splay_tree_node_<
+      typename types_traits<Key, Mapped, _Alloc, false>::value_type,
+      typename tree_node_metadata_dispatch<Key, Mapped, Cmp_Fn, Node_Update,
+                                          _Alloc>::type,
+                                     _Alloc>,
+                                     _Alloc>
     { };
 
+    /// Specialization.
     template<typename Key,
             class Cmp_Fn,
-            template<typename Const_Node_Iterator,
-                     class Node_Iterator,
+            template<typename Node_CItr,
+                     class Node_Itr,
                      class Cmp_Fn_,
-                     class Allocator_>
+                     typename _Alloc_>
              class Node_Update,
-            class Allocator>
-    struct tree_traits<Key, null_mapped_type, Cmp_Fn, Node_Update,
-                      splay_tree_tag, Allocator> 
-    : public bin_search_tree_traits<Key, null_mapped_type, Cmp_Fn,
-                                   Node_Update, 
-          splay_tree_node_<typename types_traits<Key, null_mapped_type, Allocator, false>::value_type,
-                           typename tree_node_metadata_selector<
-      Key,
-      null_mapped_type,
-      Cmp_Fn,
-      Node_Update,
-      Allocator>::type,
-      Allocator>,
-      Allocator>
+            typename _Alloc>
+    struct tree_traits<Key, null_type, Cmp_Fn, Node_Update,
+                      splay_tree_tag, _Alloc> 
+    : public bin_search_tree_traits<Key, null_type, Cmp_Fn, Node_Update, 
+                                   splay_tree_node_<
+      typename types_traits<Key, null_type, _Alloc, false>::value_type,
+      typename tree_node_metadata_dispatch<Key, null_type, Cmp_Fn, Node_Update,
+                                          _Alloc>::type,
+                                     _Alloc>,
+                                   _Alloc>
     { };
 
   } // namespace detail
index cfbfbb0728555b5eacd03fdaec46af58095b3b50..cdb09d451d48dcff6da9da9fe88794a6b5b97026 100644 (file)
@@ -1,6 +1,6 @@
 // -*- C++ -*-
 
-// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2009, 2011 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the terms
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file standard_policies.hpp
+ * @file detail/standard_policies.hpp
  * Contains standard policies for containers.
  */
 
@@ -44,8 +44,8 @@
 #include <memory>
 #include <ext/pb_ds/hash_policy.hpp>
 #include <ext/pb_ds/list_update_policy.hpp>
+#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>
 #include <ext/pb_ds/tree_policy.hpp>
-#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
 #include <ext/pb_ds/trie_policy.hpp>
 #include <ext/pb_ds/tag_and_trait.hpp>
 #include <tr1/functional>
@@ -54,12 +54,14 @@ namespace __gnu_pbds
 {
   namespace detail
   {
+    /// default_hash_fn
     template<typename Key>
     struct default_hash_fn
     {
       typedef std::tr1::hash<Key> type;
     };
 
+    /// default_eq_fn
     template<typename Key>
     struct default_eq_fn
     {
@@ -71,11 +73,13 @@ namespace __gnu_pbds
        default_store_hash = false
       };
 
+    /// default_comb_hash_fn
     struct default_comb_hash_fn
     {
       typedef __gnu_pbds::direct_mask_range_hashing<> type;
     };
 
+    /// default_resize_policy
     template<typename Comb_Hash_Fn>
     struct default_resize_policy
     {
@@ -95,11 +99,13 @@ namespace __gnu_pbds
       typedef __gnu_pbds::hash_standard_resize_policy<size_policy_type, trigger, false, size_type> type;
     };
 
+    /// default_update_policy
     struct default_update_policy
     {
-      typedef __gnu_pbds::move_to_front_lu_policy<> type;
+      typedef __gnu_pbds::lu_move_to_front_policy<> type;
     };
 
+    /// default_probe_fn
     template<typename Comb_Probe_Fn>
     struct default_probe_fn
     {
@@ -116,21 +122,21 @@ namespace __gnu_pbds
       typedef typename cond_type::__type type;
     };
 
+    /// default_trie_access_traits
     template<typename Key>
-    struct default_trie_e_access_traits;
+    struct default_trie_access_traits;
 
-    template<typename Char, class Char_Traits>
-    struct default_trie_e_access_traits<std::basic_string<Char, Char_Traits, std::allocator<char> > >
+    template<typename Char, typename Char_Traits>
+    struct default_trie_access_traits<std::basic_string<Char, Char_Traits, std::allocator<char> > >
     {
     private:
       typedef std::basic_string<Char, Char_Traits, std::allocator<char> > string_type;
 
     public:
-      typedef __gnu_pbds::string_trie_e_access_traits<string_type> type;
+      typedef __gnu_pbds::trie_string_access_traits<string_type> type;
     };
 
   } // namespace detail
 } // namespace __gnu_pbds
 
 #endif // #ifndef PB_DS_STANDARD_POLICIES_HPP
-
index e6780516517344afb9ab93be9f62fefda0261ff7..fe0b983265f4c43d0dab7143f29fccece709c97e 100644 (file)
@@ -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
index 0673675a63ed99bc1e36a50b4cf92a6fc7c0524a..3eb8541429103cc2e20cafce83eeed12f3756591 100644 (file)
@@ -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);
index fec0ce4762feb2f4b7016e04b5306f6b8f3d868e..11b7d773f9b9957063b6735acaa6f1fcc10077fc 100644 (file)
@@ -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);
 }
-
index bbae8de91b63161c45515f82fce4643067ab62ec..d0ba860ed4fcf056b3231c89da33f0888634eac9 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file find_fn_imps.hpp
+ * @file thin_heap_/find_fn_imps.hpp
  * Contains an implementation for thin_heap_.
  */
 
index f1195bdff4d9eed2ae1bd88177e41c00cc52c31e..67b7f3a3a1a773972bb112610e16b17ce397e4a2 100644 (file)
@@ -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))
 }
 
index 96bb818894bbf3af302f5590f4076254e82fdee4..279cf6611eb8cee95bce1333c96527f8152d235e 100644 (file)
@@ -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;
index 9741ef9cf1cda35bb7f5ddadd5da7a7123cc7549..fb30eb1b774723f5b7f537902914372b0f542fc3 100644 (file)
 // warranty.
 
 /**
- * @file thin_heap_.hpp
+ * @file thin_heap_/thin_heap_.hpp
  * Contains an implementation class for a thin heap.
  */
 
 #ifndef PB_DS_THIN_HEAP_HPP
 #define PB_DS_THIN_HEAP_HPP
 
-/*
- * Thin heaps.
- * Tarjan and Kaplan.
- */
-
 #include <algorithm>
 #include <ext/pb_ds/detail/cond_dealtor.hpp>
 #include <ext/pb_ds/detail/type_utils.hpp>
 #include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>
-#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>
 #include <debug/debug.h>
 
 namespace __gnu_pbds
 {
   namespace detail
   {
-
 #define PB_DS_CLASS_T_DEC \
-    template<typename Value_Type, class Cmp_Fn, class Allocator>
+    template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
 
 #define PB_DS_CLASS_C_DEC \
-    thin_heap_<Value_Type, Cmp_Fn, Allocator>
+    thin_heap<Value_Type, Cmp_Fn, _Alloc>
 
 #ifdef _GLIBCXX_DEBUG
-#define PB_DS_BASE_C_DEC \
-    left_child_next_sibling_heap_<Value_Type, Cmp_Fn,  \
-                               typename Allocator::size_type, Allocator, true>
-#else 
-#define PB_DS_BASE_C_DEC                                               \
-    left_child_next_sibling_heap_<Value_Type, Cmp_Fn, \
-                                 typename Allocator::size_type, Allocator>
-#endif 
+#define PB_DS_BASE_T_P \
+    <Value_Type, Cmp_Fn, typename _Alloc::size_type, _Alloc, true>
+#else
+#define PB_DS_BASE_T_P \
+    <Value_Type, Cmp_Fn, typename _Alloc::size_type, _Alloc>
+#endif
 
     /**
-     * class description = "t|-|i|\| h34p">
-     **/
-    template<typename Value_Type, class Cmp_Fn, class Allocator>
-    class thin_heap_ : public PB_DS_BASE_C_DEC
+     *  Thin heap.
+     *  Base class for @ref priority_queue.
+     *
+     *  See Tarjan and Kaplan.
+     */
+    template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
+    class thin_heap
+    : public left_child_next_sibling_heap PB_DS_BASE_T_P
     {
-
     private:
-      typedef PB_DS_BASE_C_DEC base_type;
+      typedef typename _Alloc::template rebind<Value_Type>::other __rebind_a;
+      typedef left_child_next_sibling_heap PB_DS_BASE_T_P base_type;
 
     protected:
-      typedef typename base_type::node node;
-
-      typedef typename base_type::node_pointer node_pointer;
-
-      typedef typename base_type::const_node_pointer const_node_pointer;
+      typedef typename base_type::node                         node;
+      typedef typename base_type::node_pointer                 node_pointer;
+      typedef typename base_type::node_const_pointer   node_const_pointer;
 
     public:
+      typedef Value_Type                               value_type;
+      typedef Cmp_Fn                                   cmp_fn;
+      typedef _Alloc                                   allocator_type;
+      typedef typename _Alloc::size_type               size_type;
+      typedef typename _Alloc::difference_type                 difference_type;
 
-      typedef typename Allocator::size_type size_type;
-
-      typedef typename Allocator::difference_type difference_type;
-
-      typedef Value_Type value_type;
-
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::pointer
-      pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::const_pointer
-      const_pointer;
-
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::reference
-      reference;
-
-      typedef
-      typename Allocator::template rebind<
-       value_type>::other::const_reference
-      const_reference;
+      typedef typename __rebind_a::pointer             pointer;
+      typedef typename __rebind_a::const_pointer       const_pointer;
+      typedef typename __rebind_a::reference           reference;
+      typedef typename __rebind_a::const_reference             const_reference;
 
-      typedef
-      typename PB_DS_BASE_C_DEC::const_point_iterator
-      const_point_iterator;
+      typedef typename base_type::point_iterator       point_iterator;
+      typedef typename base_type::point_const_iterator         point_const_iterator;
+      typedef typename base_type::iterator             iterator;
+      typedef typename base_type::const_iterator       const_iterator;
 
-      typedef typename PB_DS_BASE_C_DEC::point_iterator point_iterator;
-
-      typedef typename PB_DS_BASE_C_DEC::const_iterator const_iterator;
-
-      typedef typename PB_DS_BASE_C_DEC::iterator iterator;
-
-      typedef Cmp_Fn cmp_fn;
-
-      typedef Allocator allocator_type;
-
-    public:
 
       inline point_iterator
-      push(const_reference r_val);
+      push(const_reference);
 
       void
-      modify(point_iterator it, const_reference r_new_val);
+      modify(point_iterator, const_reference);
 
       inline const_reference
       top() const;
@@ -148,51 +115,50 @@ namespace __gnu_pbds
       pop();
 
       void
-      erase(point_iterator it);
+      erase(point_iterator);
 
       inline void
       clear();
 
       template<typename Pred>
       size_type
-      erase_if(Pred pred);
+      erase_if(Pred);
 
       template<typename Pred>
       void
-      split(Pred pred, PB_DS_CLASS_C_DEC& other);
+      split(Pred, PB_DS_CLASS_C_DEC&);
 
       void
-      join(PB_DS_CLASS_C_DEC& other);
+      join(PB_DS_CLASS_C_DEC&);
 
     protected:
+      thin_heap();
 
-      thin_heap_();
+      thin_heap(const Cmp_Fn&);
 
-      thin_heap_(const Cmp_Fn& r_cmp_fn);
-
-      thin_heap_(const PB_DS_CLASS_C_DEC& other);
+      thin_heap(const PB_DS_CLASS_C_DEC&);
 
       void
-      swap(PB_DS_CLASS_C_DEC& other);
+      swap(PB_DS_CLASS_C_DEC&);
 
-      ~thin_heap_();
+      ~thin_heap();
 
       template<typename It>
       void
-      copy_from_range(It first_it, It last_it);
+      copy_from_range(It, It);
 
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_valid(const char* file, int line) const;
+      assert_valid(const char*, int) const;
 
       void
-      assert_max(const char* file, int line) const;
-#endif 
+      assert_max(const char*, int) const;
+#endif
 
 #ifdef PB_DS_THIN_HEAP_TRACE_
       void
       trace() const;
-#endif 
+#endif
 
     private:
       enum
@@ -200,40 +166,38 @@ namespace __gnu_pbds
          max_rank = (sizeof(size_type) << 4) + 2
        };
 
-    private:
-
       void
       initialize();
 
       inline void
-      update_max(node_pointer p_nd);
+      update_max(node_pointer);
 
       inline void
-      fix(node_pointer p_nd);
+      fix(node_pointer);
 
       inline void
-      fix_root(node_pointer p_y);
+      fix_root(node_pointer);
 
       inline void
-      fix_sibling_rank_1_unmarked(node_pointer p_y);
+      fix_sibling_rank_1_unmarked(node_pointer);
 
       inline void
-      fix_sibling_rank_1_marked(node_pointer p_y);
+      fix_sibling_rank_1_marked(node_pointer);
 
       inline void
-      fix_sibling_general_unmarked(node_pointer p_y);
+      fix_sibling_general_unmarked(node_pointer);
 
       inline void
-      fix_sibling_general_marked(node_pointer p_y);
+      fix_sibling_general_marked(node_pointer);
 
       inline void
-      fix_child(node_pointer p_y);
+      fix_child(node_pointer);
 
       inline static void
-      make_root(node_pointer p_nd);
+      make_root(node_pointer);
 
       inline void
-      make_root_and_link(node_pointer p_nd);
+      make_root_and_link(node_pointer);
 
       inline void
       remove_max_node();
@@ -242,7 +206,7 @@ namespace __gnu_pbds
       to_aux_except_max();
 
       inline void
-      add_to_aux(node_pointer p_nd);
+      add_to_aux(node_pointer);
 
       inline void
       make_from_aux();
@@ -251,27 +215,24 @@ namespace __gnu_pbds
       rank_bound();
 
       inline void
-      make_child_of(node_pointer p_nd, node_pointer p_new_parent);
+      make_child_of(node_pointer, node_pointer);
 
       inline void
-      remove_node(node_pointer p_nd);
+      remove_node(node_pointer);
 
       inline node_pointer
-      join(node_pointer p_lhs, node_pointer p_rhs) const;
+      join(node_pointer, node_pointer) const;
 
 #ifdef _GLIBCXX_DEBUG
       void
-      assert_node_consistent(const_node_pointer p_nd, bool root,
-                            const char* file, int line) const;
+      assert_node_consistent(node_const_pointer, bool, const char*, int) const;
 
       void
-      assert_aux_null(const char* file, int line) const;
-#endif 
-
-    private:
-      node_pointer m_p_max;
+      assert_aux_null(const char*, int) const;
+#endif
 
-      node_pointer m_a_aux[max_rank];
+      node_pointer     m_p_max;
+      node_pointer     m_a_aux[max_rank];
     };
 
     enum
@@ -338,7 +299,7 @@ namespace __gnu_pbds
   _GLIBCXX_DEBUG_ONLY(assert_node_consistent(_Node, _Bool,             \
                                             __FILE__, __LINE__);)
 
-#define PB_DS_ASSERT_AUX_NULL(X)                                               \
+#define PB_DS_ASSERT_AUX_NULL(X)                                       \
   _GLIBCXX_DEBUG_ONLY(X.assert_aux_null(__FILE__, __LINE__);)
 
 #include <ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp>
@@ -353,9 +314,9 @@ namespace __gnu_pbds
 #undef PB_DS_ASSERT_NODE_CONSISTENT
 #undef PB_DS_CLASS_C_DEC
 #undef PB_DS_CLASS_T_DEC
-#undef PB_DS_BASE_C_DEC
+#undef PB_DS_BASE_T_P
 
   } // namespace detail
 } // namespace __gnu_pbds
 
-#endif 
+#endif
index fc309d5c1ce0a34678b956b5119b4e2bd13358d7..63a356414d15989cfde29d97709b2c2eed1dd987 100644 (file)
@@ -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();
 }
 
index c182886ee1d03f8b71d7685a0ee1539ffccc201b..1279b4dca495ed974d5e1ef4735edb73e1bef2a1 100644 (file)
@@ -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
 // warranty.
 
 /**
- * @file node_metadata_selector.hpp
+ * @file tree_policy/node_metadata_selector.hpp
  * Contains an implementation class for trees.
  */
 
-#ifndef PB_DS_TREE_NODE_METADATA_SELECTOR_HPP
-#define PB_DS_TREE_NODE_METADATA_SELECTOR_HPP
+#ifndef PB_DS_TREE_NODE_METADATA_DISPATCH_HPP
+#define PB_DS_TREE_NODE_METADATA_DISPATCH_HPP
 
-#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>
 #include <ext/pb_ds/detail/types_traits.hpp>
 
 namespace __gnu_pbds
 {
   namespace detail
   {
+    /// Tree metadata helper.
+    template<typename Node_Update, bool _BTp>
+      struct tree_metadata_helper;
 
-    template<typename Node_Update, bool Null>
-    struct tree_metadata_helper
-    {
-      typedef typename Node_Update::metadata_type type;
-    };
+    template<typename Node_Update>
+      struct tree_metadata_helper<Node_Update, false>
+      {
+       typedef typename Node_Update::metadata_type     type;
+      };
 
     template<typename Node_Update>
-    struct tree_metadata_helper<
-      Node_Update,
-      true>
-    {
-      typedef null_node_metadata type;
-    };
+      struct tree_metadata_helper<Node_Update, true>
+      {
+       typedef null_type                               type;
+      };
 
+    /// Tree node metadata dispatch.
     template<typename Key,
             typename Data,
-            class Cmp_Fn,
-            template<typename Const_Node_Iterator,
-                     class Const_Iterator,
-                     class Cmp_Fn_,
-                     class Allocator_>
-    class Node_Update,
-            class Allocator>
-    struct tree_node_metadata_selector
+            typename Cmp_Fn,
+            template<typename Node_CItr,
+                     typename Const_Iterator,
+                     typename Cmp_Fn_,
+                     typename _Alloc_>
+            class Node_Update,
+            typename _Alloc>
+    struct tree_node_metadata_dispatch
     {
     private:
-      typedef
-      dumconst_node_iterator<
-      Key,
-      Data,
-      Allocator>
-      dumconst_node_it;
+      typedef dumnode_const_iterator<Key, Data, _Alloc>                __it_type;
+      typedef Node_Update<__it_type, __it_type, Cmp_Fn, _Alloc>        __node_u;
+      typedef null_node_update<__it_type, __it_type, Cmp_Fn, _Alloc> __nnode_u;
 
       enum
        {
-         null_update =
-         is_same<
-         Node_Update<
-         dumconst_node_it,
-         dumconst_node_it,
-         Cmp_Fn,
-         Allocator>,
-         null_tree_node_update<
-         dumconst_node_it,
-         dumconst_node_it,
-         Cmp_Fn,
-         Allocator> >::value
+         null_update = is_same<__node_u, __nnode_u>::value
        };
 
     public:
-      typedef
-      typename tree_metadata_helper<
-      Node_Update<
-      dumconst_node_it,
-      dumconst_node_it,
-      Cmp_Fn,
-      Allocator>,
-      null_update>::type
-      type;
+      typedef typename tree_metadata_helper<__node_u, null_update>::type type;
     };
-
   } // namespace detail
 } // namespace __gnu_pbds
 
-#endif // #ifndef PB_DS_TREE_NODE_METADATA_SELECTOR_HPP
+#endif // #ifndef PB_DS_TREE_NODE_METADATA_DISPATCH_HPP
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
deleted file mode 100644 (file)
index 006a3eb..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file null_node_update_imp.hpp
- * Contains an implementation of null_node_update.
- */
-
-PB_DS_CLASS_T_DEC
-template<typename Const_Node_Iterator_,
-        typename Node_Iterator_,
-        class    Cmp_Fn_,
-        typename Allocator_>
-inline void
-PB_DS_CLASS_C_DEC::
-swap(null_tree_node_update<            Const_Node_Iterator_, Node_Iterator_, Cmp_Fn_, Allocator_>& /*other*/)
-{ }
-
index d3b27925f7eb5860da6d95b44a9bd13b3aeca7c7..84397f3dffcee7f83bdaf114057eb6be5bea1b48 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file order_statistics_imp.hpp
+ * @file tree_policy/order_statistics_imp.hpp
  * Contains forward declarations for order_statistics_key
  */
 
@@ -44,95 +44,75 @@ PB_DS_CLASS_C_DEC::
 find_by_order(size_type order)
 {
   node_iterator it = node_begin();
-
   node_iterator end_it = node_end();
 
   while (it != end_it)
     {
       node_iterator l_it = it.get_l_child();
-
-      const size_type o = (l_it == end_it)?
-       0 :
-       l_it.get_metadata();
+      const size_type o = (l_it == end_it)? 0 : l_it.get_metadata();
 
       if (order == o)
-       return (*it);
+       return *it;
       else if (order < o)
        it = l_it;
       else
         {
          order -= o + 1;
-
          it = it.get_r_child();
         }
     }
 
-  return (PB_DS_BASE_C_DEC::end_iterator());
+  return base_type::end_iterator();
 }
 
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::const_iterator
 PB_DS_CLASS_C_DEC::
 find_by_order(size_type order) const
-{
-  return (const_cast<PB_DS_CLASS_C_DEC* >(this)->find_by_order(order));
-}
+{ return const_cast<PB_DS_CLASS_C_DEC*>(this)->find_by_order(order); }
 
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::size_type
 PB_DS_CLASS_C_DEC::
-order_of_key(const_key_reference r_key) const
+order_of_key(key_const_reference r_key) const
 {
-  const_node_iterator it = node_begin();
-
-  const_node_iterator end_it = node_end();
-
-  const cmp_fn& r_cmp_fn =
-    const_cast<PB_DS_CLASS_C_DEC* >(this)->get_cmp_fn();
+  node_const_iterator it = node_begin();
+  node_const_iterator end_it = node_end();
 
+  const cmp_fn& r_cmp_fn = const_cast<PB_DS_CLASS_C_DEC*>(this)->get_cmp_fn();
   size_type ord = 0;
-
   while (it != end_it)
     {
-      const_node_iterator l_it = it.get_l_child();
+      node_const_iterator l_it = it.get_l_child();
 
       if (r_cmp_fn(r_key, this->extract_key(*(*it))))
        it = l_it;
       else if (r_cmp_fn(this->extract_key(*(*it)), r_key))
         {
-
-         ord += (l_it == end_it)?
-           1 :
-           1 + l_it.get_metadata();
-
+         ord += (l_it == end_it)? 1 : 1 + l_it.get_metadata();
          it = it.get_r_child();
         }
       else
         {
-         ord += (l_it == end_it)?
-           0 :
-           l_it.get_metadata();
-
+         ord += (l_it == end_it)? 0 : l_it.get_metadata();
          it = end_it;
         }
     }
-
-  return (ord);
+  return ord;
 }
 
 PB_DS_CLASS_T_DEC
 inline void
 PB_DS_CLASS_C_DEC::
-operator()(node_iterator node_it, const_node_iterator end_nd_it) const
+operator()(node_iterator node_it, node_const_iterator end_nd_it) const
 {
-  node_iterator l_child_it = node_it.get_l_child();
-  const size_type l_rank =(l_child_it == end_nd_it)? 0 : l_child_it.get_metadata();
+  node_iterator l_it = node_it.get_l_child();
+  const size_type l_rank = (l_it == end_nd_it) ? 0 : l_it.get_metadata();
 
-  node_iterator r_child_it = node_it.get_r_child();
-  const size_type r_rank =(r_child_it == end_nd_it)? 0 : r_child_it.get_metadata();
+  node_iterator r_it = node_it.get_r_child();
+  const size_type r_rank = (r_it == end_nd_it) ? 0 : r_it.get_metadata();
 
-  const_cast<metadata_reference>(node_it.get_metadata())=
-    1 + l_rank + r_rank;
+  const_cast<metadata_reference>(node_it.get_metadata())= 1 + l_rank + r_rank;
 }
 
 PB_DS_CLASS_T_DEC
index b8c19a587f8b04bf18011378e32206d8279784e1..cb455da42d6436c133e330685fb7180981294b2b 100644 (file)
 // warranty.
 
 /**
- * @file sample_tree_node_update.hpp
+ * @file tree_policy/sample_tree_node_update.hpp
  * Contains a samle node update functor.
  */
 
 #ifndef PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP
 #define PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP
 
-// A sample node updator.
-template<typename Const_Node_Iterator,
-
-        class Node_Iterator,
-
-        class Cmp_Fn,
-
-        class Allocator
-        >
-class sample_tree_node_update
+namespace __gnu_pbds
 {
-
-public:
-
-  // Metadata type.
-  typedef std::size_t metadata_type;
-
-protected:
-
-  // Default constructor.
-  sample_tree_node_update();
-
-  // Updates the rank of a node through a node_iterator node_it; end_nd_it is the end node iterator.
-  inline void
-  operator()(node_iterator node_it, const_node_iterator end_nd_it) const;
-
-};
-
+  /// A sample node updator.
+  template<typename Const_Node_Iter, typename Node_Iter, typename Cmp_Fn,
+          typename _Alloc>
+  class sample_tree_node_update
+  {
+    typedef std::size_t metadata_type;
+
+    // Default constructor.
+    sample_tree_node_update();
+
+    // Updates the rank of a node through a node_iterator node_it;
+    // end_nd_it is the end node iterator.
+    inline void
+    operator()(node_iterator node_it, node_const_iterator end_nd_it) const;
+  };
+}
 #endif // #ifndef PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP
index e4bd65649043f5e5e68a06f89d29ef65536c49e7..78cee8680433f8e679c259a3f0e989f3814239fe 100644 (file)
@@ -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.
  */
 
 
 #ifdef PB_DS_TREE_TRACE
 
-#include <ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp>
-#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+#include <ext/pb_ds/detail/branch_policy/branch_policy.hpp>
+#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>
 
 namespace __gnu_pbds
 {
-
   namespace detail
   {
-
 #ifdef PB_DS_TREE_TRACE
 
 #define PB_DS_CLASS_T_DEC                                              \
-    template<                                                          \
-                                               class Const_Node_Iterator, \
-                                               class Node_Iterator,    \
-                                               class Cmp_Fn,           \
-                                               bool Node_Based,        \
-                                               class Allocator>
+    template<typename Node_CItr, typename Node_Itr,    \
+            typename Cmp_Fn, bool Node_Based, typename _Alloc>
 
 #define PB_DS_CLASS_C_DEC                                              \
-    tree_trace_base<                                                   \
-                                               Const_Node_Iterator,    \
-                                               Node_Iterator,          \
-                                               Cmp_Fn,                 \
-                                               Node_Based,             \
-                                               Allocator>
-
-#define PB_DS_BASE_C_DEC                                               \
-    basic_tree_policy_base<                            \
-                                                               Const_Node_Iterator, \
-                                                               Node_Iterator, \
-                                                               Allocator>
-
-    template<typename Const_Node_Iterator,
-            class Node_Iterator,
-            class Cmp_Fn,
-            bool Node_Based,
-            class Allocator>
-    class tree_trace_base : private PB_DS_BASE_C_DEC
+    tree_trace_base<Node_CItr, Node_Itr, Cmp_Fn,         \
+                   Node_Based, _Alloc>
+
+#define PB_DS_TRACE_BASE \
+    branch_policy<Node_CItr, Node_Itr, _Alloc>
+
+    /// Tracing base class.
+    template<typename Node_CItr, typename Node_Itr,
+            typename Cmp_Fn, bool Node_Based, typename _Alloc>
+    class tree_trace_base : private PB_DS_TRACE_BASE
     {
     public:
       void
       trace() const;
 
     private:
-      typedef PB_DS_BASE_C_DEC base_type;
-
-      typedef Const_Node_Iterator const_node_iterator;
+      typedef PB_DS_TRACE_BASE                         base_type;
+      typedef Node_CItr                node_const_iterator;
+      typedef typename _Alloc::size_type       size_type;
 
-      typedef typename Allocator::size_type size_type;
-
-    private:
       void
-      trace_node(const_node_iterator nd_it, size_type level) const;
+      trace_node(node_const_iterator, size_type) const;
 
       virtual bool
       empty() const = 0;
 
-      virtual const_node_iterator
+      virtual node_const_iterator
       node_begin() const = 0;
 
-      virtual const_node_iterator
+      virtual node_const_iterator
       node_end() const = 0;
 
       static void
-      print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,true>);
+      print_node_pointer(Node_CItr, integral_constant<int,true>);
 
       static void
-      print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,false>);
+      print_node_pointer(Node_CItr, integral_constant<int,false>);
 
       template<typename Metadata_>
       static void
-      trace_it_metadata(Const_Node_Iterator nd_it, type_to_type<Metadata_>);
+      trace_it_metadata(Node_CItr, type_to_type<Metadata_>);
 
       static void
-      trace_it_metadata(Const_Node_Iterator, type_to_type<null_node_metadata>);
+      trace_it_metadata(Node_CItr, type_to_type<null_type>);
     };
 
     PB_DS_CLASS_T_DEC
@@ -127,83 +109,71 @@ namespace __gnu_pbds
     trace() const
     {
       if (empty())
-        return;
-
+       return;
       trace_node(node_begin(), 0);
     }
 
     PB_DS_CLASS_T_DEC
     void
     PB_DS_CLASS_C_DEC::
-    trace_node(const_node_iterator nd_it, size_type level) const
+    trace_node(node_const_iterator nd_it, size_type level) const
     {
       if (nd_it.get_r_child() != node_end())
-        trace_node(nd_it.get_r_child(), level + 1);
+       trace_node(nd_it.get_r_child(), level + 1);
 
       for (size_type i = 0; i < level; ++i)
-        std::cerr << ' ';
+       std::cerr << ' ';
 
       print_node_pointer(nd_it, integral_constant<int,Node_Based>());
       std::cerr << base_type::extract_key(*(*nd_it));
 
-      typedef
-        type_to_type<
-       typename const_node_iterator::metadata_type>
-        m_type_ind_t;
+      typedef type_to_type<typename node_const_iterator::metadata_type>
+       m_type_ind_t;
 
       trace_it_metadata(nd_it, m_type_ind_t());
 
       std::cerr << std::endl;
 
       if (nd_it.get_l_child() != node_end())
-        trace_node(nd_it.get_l_child(), level + 1);
+       trace_node(nd_it.get_l_child(), level + 1);
     }
 
     PB_DS_CLASS_T_DEC
     template<typename Metadata_>
     void
     PB_DS_CLASS_C_DEC::
-    trace_it_metadata(Const_Node_Iterator nd_it, type_to_type<Metadata_>)
+    trace_it_metadata(Node_CItr nd_it, type_to_type<Metadata_>)
     {
-      std::cerr << " (" <<
-        static_cast<unsigned long>(nd_it.get_metadata()) << ") ";
+      const unsigned long ul = static_cast<unsigned long>(nd_it.get_metadata());
+      std::cerr << " (" << ul << ") ";
     }
 
     PB_DS_CLASS_T_DEC
     void
     PB_DS_CLASS_C_DEC::
-    trace_it_metadata(Const_Node_Iterator, type_to_type<null_node_metadata>)
+    trace_it_metadata(Node_CItr, type_to_type<null_type>)
     { }
 
     PB_DS_CLASS_T_DEC
     void
     PB_DS_CLASS_C_DEC::
-    print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,true>)
-    {
-      std::cerr << nd_it.m_p_nd << " ";
-    }
+    print_node_pointer(Node_CItr nd_it, integral_constant<int,true>)
+    { std::cerr << nd_it.m_p_nd << " "; }
 
     PB_DS_CLASS_T_DEC
     void
     PB_DS_CLASS_C_DEC::
-    print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,false>)
-    {
-      std::cerr <<* nd_it << " ";
-    }
+    print_node_pointer(Node_CItr nd_it, integral_constant<int,false>)
+    { std::cerr << *nd_it << " "; }
 
 #undef PB_DS_CLASS_T_DEC
-
 #undef PB_DS_CLASS_C_DEC
-
-#undef PB_DS_BASE_C_DEC
-
+#undef PB_DS_TRACE_BASE
 #endif // #ifdef    PB_DS_TREE_TRACE
 
   } // namespace detail
-
 } // namespace __gnu_pbds
 
 #endif // #ifdef PB_DS_TREE_TRACE
 
 #endif // #ifndef PB_DS_TREE_TRACE_BASE_HPP
-
index b4de31fd0cace44553b347adba6069bba00c1e0b..b20181b8aef9f89ca861d1024803fc652054b7f3 100644 (file)
@@ -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
 // warranty.
 
 /**
- * @file node_metadata_selector.hpp
+ * @file trie_policy/node_metadata_selector.hpp
  * Contains an implementation class for tries.
  */
 
-#ifndef PB_DS_TRIE_NODE_METADATA_SELECTOR_HPP
-#define PB_DS_TRIE_NODE_METADATA_SELECTOR_HPP
+#ifndef PB_DS_TRIE_NODE_METADATA_DISPATCH_HPP
+#define PB_DS_TRIE_NODE_METADATA_DISPATCH_HPP
 
-#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+#include <ext/pb_ds/detail/branch_policy/null_node_metadata.hpp>
 #include <ext/pb_ds/detail/types_traits.hpp>
 
 namespace __gnu_pbds
 {
   namespace detail
   {
+    /// Trie metadata helper.
+    template<typename Node_Update, bool _BTp>
+      struct trie_metadata_helper;
 
-    template<typename Node_Update, bool Null>
-    struct trie_metadata_helper
-    {
-      typedef typename Node_Update::metadata_type type;
-    };
+    template<typename Node_Update>
+      struct trie_metadata_helper<Node_Update, false>
+      {
+       typedef typename Node_Update::metadata_type     type;
+      };
 
     template<typename Node_Update>
-    struct trie_metadata_helper<
-      Node_Update,
-      true>
-    {
-      typedef null_node_metadata type;
-    };
+      struct trie_metadata_helper<Node_Update, true>
+      {
+       typedef null_type                               type;
+      };
 
+    /// Trie node metadata dispatch.
     template<typename Key,
             typename Data,
-            class Cmp_Fn,
-            template<typename Const_Node_Iterator,
-                     class Const_Iterator,
-                     class Cmp_Fn_,
-                     class Allocator_>
-    class Node_Update,
-            class Allocator>
-    struct trie_node_metadata_selector
+            typename Cmp_Fn,
+            template<typename Node_CItr,
+                     typename Const_Iterator,
+                     typename Cmp_Fn_,
+                     typename _Alloc_>
+            class Node_Update,
+            typename _Alloc>
+    struct trie_node_metadata_dispatch
     {
     private:
-      typedef
-      dumconst_node_iterator<
-      Key,
-      Data,
-      Allocator>
-      dumconst_node_it;
+      typedef dumnode_const_iterator<Key, Data, _Alloc>                __it_type;
+      typedef Node_Update<__it_type, __it_type, Cmp_Fn, _Alloc>        __node_u;
+      typedef null_node_update<__it_type, __it_type, Cmp_Fn, _Alloc> __nnode_u;
 
       enum
        {
-         null_update =
-         is_same<
-         Node_Update<
-         dumconst_node_it,
-         dumconst_node_it,
-         Cmp_Fn,
-         Allocator>,
-         null_trie_node_update<
-         dumconst_node_it,
-         dumconst_node_it,
-         Cmp_Fn,
-         Allocator> >::value
+         null_update = is_same<__node_u, __nnode_u>::value
        };
 
     public:
-      typedef
-      typename trie_metadata_helper<
-      Node_Update<
-      dumconst_node_it,
-      dumconst_node_it,
-      Cmp_Fn,
-      Allocator>,
-      null_update>::type
-      type;
+      typedef typename trie_metadata_helper<__node_u, null_update>::type type;
     };
-
   } // namespace detail
 } // namespace __gnu_pbds
 
-#endif // #ifndef PB_DS_TRIE_NODE_METADATA_SELECTOR_HPP
+#endif // #ifndef PB_DS_TRIE_NODE_METADATA_DISPATCH_HPP
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
deleted file mode 100644 (file)
index 65245e9..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-// -*- C++ -*-
-
-// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License as published by the Free Software
-// Foundation; either version 3, or (at your option) any later
-// version.
-
-// This library is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
-
-// Permission to use, copy, modify, sell, and distribute this software
-// is hereby granted without fee, provided that the above copyright
-// notice appears in all copies, and that both that copyright notice
-// and this permission notice appear in supporting documentation. None
-// of the above authors, nor IBM Haifa Research Laboratories, make any
-// representation about the suitability of this software for any
-// purpose. It is provided "as is" without express or implied
-// warranty.
-
-/**
- * @file null_node_update_imp.hpp
- * Contains an implementation of null_node_update.
- */
-
-PB_DS_CLASS_T_DEC
-template<typename Const_Node_Iterator_,
-        typename Node_Iterator_,
-        class    E_Access_Traits_,
-        typename Allocator_>
-inline void
-PB_DS_CLASS_C_DEC::
-swap(null_trie_node_update<            Const_Node_Iterator_, Node_Iterator_, E_Access_Traits_, Allocator_>& /*other*/)
-{ }
-
index cb8e24741217026361de177be8c0b7fa74d47b1f..ff9595e94a04a92e64436be030157e66129ffcbe 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file order_statistics_imp.hpp
+ * @file trie_policy/order_statistics_imp.hpp
  * Contains forward declarations for order_statistics_key
  */
 
@@ -44,35 +44,31 @@ PB_DS_CLASS_C_DEC::
 find_by_order(size_type order)
 {
   if (empty())
-    return (end());
+    return end();
 
   ++order;
-
   node_iterator nd_it = node_begin();
 
   while (true)
     {
       if (order > nd_it.get_metadata())
-       return (++base_type::rightmost_it(nd_it));
+       return ++base_type::rightmost_it(nd_it);
 
       const size_type num_children = nd_it.num_children();
-
       if (num_children == 0)
-       return (*nd_it);
+       return *nd_it;
 
       for (size_type i = 0; i < num_children; ++i)
-        {
+       {
          node_iterator child_nd_it = nd_it.get_child(i);
-
          if (order <= child_nd_it.get_metadata())
-            {
+           {
              i = num_children;
-
              nd_it = child_nd_it;
-            }
+           }
          else
            order -= child_nd_it.get_metadata();
-        }
+       }
     }
 }
 
@@ -80,81 +76,70 @@ PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::const_iterator
 PB_DS_CLASS_C_DEC::
 find_by_order(size_type order) const
-{
-  return (const_cast<PB_DS_CLASS_C_DEC* >(this)->find_by_order(order));
-}
+{ return const_cast<PB_DS_CLASS_C_DEC*>(this)->find_by_order(order); }
 
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::size_type
 PB_DS_CLASS_C_DEC::
-order_of_key(const_key_reference r_key) const
+order_of_key(key_const_reference r_key) const
 {
-  const E_Access_Traits& r_traits =
-    const_cast<PB_DS_CLASS_C_DEC* >(this)->get_e_access_traits();
+  const _ATraits& r_traits =
+    const_cast<PB_DS_CLASS_C_DEC* >(this)->get_access_traits();
 
-  return (order_of_prefix(
-                         r_traits.begin(r_key),
-                         r_traits.end(r_key)));
+  return order_of_prefix(r_traits.begin(r_key), r_traits.end(r_key));
 }
 
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::size_type
 PB_DS_CLASS_C_DEC::
-order_of_prefix(typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e) const
+order_of_prefix(typename access_traits::const_iterator b,
+               typename access_traits::const_iterator e) const
 {
   if (empty())
-    return (0);
-
-  const E_Access_Traits& r_traits =
-    const_cast<PB_DS_CLASS_C_DEC* >(this)->get_e_access_traits();
-
-  const_node_iterator nd_it = node_begin();
+    return 0;
 
-  const_node_iterator end_nd_it = node_end();
+  const _ATraits& r_traits =
+    const_cast<PB_DS_CLASS_C_DEC*>(this)->get_access_traits();
 
+  node_const_iterator nd_it = node_begin();
+  node_const_iterator end_nd_it = node_end();
   size_type ord = 0;
 
   while (true)
     {
       const size_type num_children = nd_it.num_children();
-
       if (num_children == 0)
-        {
-         const_key_reference r_key =
-           base_type::extract_key(*(*nd_it));
-
-         typename e_access_traits::const_iterator key_b =
+       {
+         key_const_reference r_key = base_type::extract_key(*(*nd_it));
+         typename access_traits::const_iterator key_b =
            r_traits.begin(r_key);
 
-         typename e_access_traits::const_iterator key_e =
+         typename access_traits::const_iterator key_e =
            r_traits.end(r_key);
 
-         return ((base_type::less(                    key_b, key_e,  b, e,  r_traits))?
-                 ord + 1 :
-                 ord);
-        }
-
-      const_node_iterator next_nd_it = end_nd_it;
+         return (base_type::less(key_b, key_e,  b, e,  r_traits)) ?
+                 ord + 1 : ord;
+       }
 
+      node_const_iterator next_nd_it = end_nd_it;
       size_type i = num_children - 1;
 
       do
-        {
-         const_node_iterator child_nd_it = nd_it.get_child(i);
+       {
+         node_const_iterator child_nd_it = nd_it.get_child(i);
 
          if (next_nd_it != end_nd_it)
            ord += child_nd_it.get_metadata();
-         else if (!base_type::less(
-                                   b, e,
+         else if (!base_type::less(b, e,
                                    child_nd_it.valid_prefix().first,
                                    child_nd_it.valid_prefix().second,
                                    r_traits))
            next_nd_it = child_nd_it;
-        }
+       }
       while (i-- > 0);
 
       if (next_nd_it == end_nd_it)
-       return (ord);
+       return ord;
 
       nd_it = next_nd_it;
     }
@@ -163,19 +148,13 @@ order_of_prefix(typename e_access_traits::const_iterator b, typename e_access_tr
 PB_DS_CLASS_T_DEC
 inline void
 PB_DS_CLASS_C_DEC::
-operator()(node_iterator nd_it, const_node_iterator /*end_nd_it*/) const
+operator()(node_iterator nd_it, node_const_iterator /*end_nd_it*/) const
 {
   const size_type num_children = nd_it.num_children();
-
   size_type children_rank = 0;
-
   for (size_type i = 0; i < num_children; ++i)
     children_rank += nd_it.get_child(i).get_metadata();
 
-  const_cast<size_type& >(nd_it.get_metadata()) =(num_children == 0)? 1 : children_rank;
+  const size_type res = (num_children == 0) ? 1 : children_rank;
+  const_cast<size_type&>(nd_it.get_metadata()) = res;
 }
-
-PB_DS_CLASS_T_DEC
-PB_DS_CLASS_C_DEC::
-~trie_order_statistics_node_update()
-{ }
index ff2799e3e95402f6c2f8395cc6745fd052fd76fc..04771dd725e995a3ea8af50a67a135ccf30d46ae 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file prefix_search_node_update_imp.hpp
+ * @file trie_policy/prefix_search_node_update_imp.hpp
  * Contains an implementation of prefix_search_node_update.
  */
 
@@ -43,13 +43,10 @@ std::pair<
   typename PB_DS_CLASS_C_DEC::const_iterator,
   typename PB_DS_CLASS_C_DEC::const_iterator>
 PB_DS_CLASS_C_DEC::
-prefix_range(const_key_reference r_key) const
+prefix_range(key_const_reference r_key) const
 {
-  const e_access_traits& r_traits = get_e_access_traits();
-
-  return (prefix_range(
-                      r_traits.begin(r_key),
-                      r_traits.end(r_key)));
+  const access_traits& r_traits = get_access_traits();
+  return (prefix_range(r_traits.begin(r_key), r_traits.end(r_key)));
 }
 
 PB_DS_CLASS_T_DEC
@@ -57,11 +54,10 @@ std::pair<
   typename PB_DS_CLASS_C_DEC::iterator,
   typename PB_DS_CLASS_C_DEC::iterator>
 PB_DS_CLASS_C_DEC::
-prefix_range(const_key_reference r_key)
+prefix_range(key_const_reference r_key)
 {
-  return (prefix_range(
-                      get_e_access_traits().begin(r_key),
-                      get_e_access_traits().end(r_key)));
+  return (prefix_range(get_access_traits().begin(r_key),
+                      get_access_traits().end(r_key)));
 }
 
 PB_DS_CLASS_T_DEC
@@ -69,13 +65,13 @@ std::pair<
   typename PB_DS_CLASS_C_DEC::const_iterator,
   typename PB_DS_CLASS_C_DEC::const_iterator>
 PB_DS_CLASS_C_DEC::
-prefix_range(typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e) const
+prefix_range(typename access_traits::const_iterator b,
+            typename access_traits::const_iterator e) const
 {
   const std::pair<iterator, iterator> non_const_ret =
     const_cast<PB_DS_CLASS_C_DEC* >(this)->prefix_range(b, e);
 
-  return (std::make_pair(
-                        const_iterator(non_const_ret.first),
+  return (std::make_pair(const_iterator(non_const_ret.first),
                         const_iterator(non_const_ret.second)));
 }
 
@@ -84,14 +80,13 @@ std::pair<
   typename PB_DS_CLASS_C_DEC::iterator,
   typename PB_DS_CLASS_C_DEC::iterator>
 PB_DS_CLASS_C_DEC::
-prefix_range(typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e)
+prefix_range(typename access_traits::const_iterator b,
+            typename access_traits::const_iterator e)
 {
-  Node_Iterator nd_it = node_begin();
-  Node_Iterator end_nd_it = node_end();
-
-  const e_access_traits& r_traits =
-    get_e_access_traits();
+  Node_Itr nd_it = node_begin();
+  Node_Itr end_nd_it = node_end();
 
+  const access_traits& r_traits = get_access_traits();
   const size_type given_range_length = std::distance(b, e);
 
   while (true)
@@ -100,17 +95,14 @@ prefix_range(typename e_access_traits::const_iterator b, typename e_access_trait
        return (std::make_pair(end(), end()));
 
       const size_type common_range_length =
-       PB_DS_BASE_C_DEC::common_prefix_len(nd_it, b, e, r_traits);
+       base_type::common_prefix_len(nd_it, b, e, r_traits);
 
       if (common_range_length >= given_range_length)
-        {
+       {
          iterator ret_b = this->leftmost_it(nd_it);
-
          iterator ret_e = this->rightmost_it(nd_it);
-
          return (std::make_pair(ret_b, ++ret_e));
-        }
-
+       }
       nd_it = next_child(nd_it, b, e, end_nd_it, r_traits);
     }
 }
@@ -118,34 +110,30 @@ prefix_range(typename e_access_traits::const_iterator b, typename e_access_trait
 PB_DS_CLASS_T_DEC
 typename PB_DS_CLASS_C_DEC::node_iterator
 PB_DS_CLASS_C_DEC::
-next_child(node_iterator nd_it, typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e, node_iterator end_nd_it, const e_access_traits& r_traits)
+next_child(node_iterator nd_it, typename access_traits::const_iterator b,
+          typename access_traits::const_iterator e, node_iterator end_nd_it,
+          const access_traits& r_traits)
 {
   const size_type num_children = nd_it.num_children();
-
   node_iterator ret = end_nd_it;
-
   size_type max_length = 0;
-
   for (size_type i = 0; i < num_children; ++i)
     {
       node_iterator pot = nd_it.get_child(i);
-
       const size_type common_range_length =
-       PB_DS_BASE_C_DEC::common_prefix_len(            pot, b, e, r_traits);
+       base_type::common_prefix_len(pot, b, e, r_traits);
 
       if (common_range_length > max_length)
-        {
+       {
          ret = pot;
-
          max_length = common_range_length;
-        }
+       }
     }
-
   return (ret);
 }
 
 PB_DS_CLASS_T_DEC
 inline void
 PB_DS_CLASS_C_DEC::
-operator()(node_iterator /*nd_it*/, const_node_iterator /*end_nd_it*/) const
+operator()(node_iterator /*nd_it*/, node_const_iterator /*end_nd_it*/) const
 { }
similarity index 67%
rename from libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp
rename to libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_access_traits.hpp
index 2ecad89c9a73ae4e9417151e8df604e5e7d32216..59edfbb5760224fc23dd87f84a2431ac3ae0ff3a 100644 (file)
 // warranty.
 
 /**
- * @file sample_trie_e_access_traits.hpp
+ * @file trie_policy/sample_trie_access_traits.hpp
  * Contains a sample probe policy.
  */
 
 #ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP
 #define PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP
 
-// A sample trie element-access traits.
-class sample_trie_e_access_traits
+namespace __gnu_pbds
 {
-
-public:
-
-  // Size type.
-  typedef std::size_t size_type;
-
-  // Key type.
-  typedef std::string key_type;
-
-  // Const key reference type.
-  typedef
-  typename Allocator::template rebind<
-    key_type>::other::const_reference
-  const_key_reference;
-
-  // Element const iterator type.
-  typedef std::string::const_iterator const_iterator;
-
-  // Element type.
-  typedef char e_type;
-
-  enum
-    {
-      max_size = 4
-    };
-
-public:
-
-  // Returns a const_iterator to the first element of r_key.
-  inline static const_iterator
-  begin(const_key_reference r_key);
-
-  // Returns a const_iterator to the after-last element of r_key.
-  inline static const_iterator
-  end(const_key_reference r_key);
-
-  // Maps an element to a position.
-  inline static size_type
-  e_pos(e_type e);
-
-};
-
+  /// A sample trie element access traits.
+  struct sample_trie_access_traits
+  {
+    typedef std::size_t                                size_type;
+    typedef std::string                                key_type;
+
+    typedef typename _Alloc::template rebind<key_type> __rebind_k;
+    typedef typename __rebind_k::other::const_reference        key_const_reference;
+    typedef std::string::const_iterator                const_iterator;
+
+    // Element type.
+    typedef char                                       e_type;
+
+    enum
+      {
+       max_size = 4
+      };
+
+    // Returns a const_iterator to the first element of r_key.
+    inline static const_iterator
+    begin(key_const_reference);
+
+    // Returns a const_iterator to the after-last element of r_key.
+    inline static const_iterator
+    end(key_const_reference);
+
+    // Maps an element to a position.
+    inline static size_type
+    e_pos(e_type);
+  };
+}
 #endif // #ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP
index 8b2c6b591f74f07cae20e14a56f446815b6c0a2f..6c97aee052a68e286410b2ff4f40b04219de7897 100644 (file)
 // warranty.
 
 /**
- * @file sample_trie_node_update.hpp
+ * @file trie_policy/sample_trie_node_update.hpp
  * Contains a samle node update functor.
  */
 
 #ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP
 #define PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP
 
-// A sample node updator.
-template<typename Const_Node_Iterator,
-
-        class Node_Iterator,
-
-        class E_Access_Traits,
-
-        class Allocator
-        >
-class sample_trie_node_update
+namespace __gnu_pbds
 {
-
-public:
-
-  // Metadata type.
-  typedef std::size_t metadata_type;
-
-protected:
-
-  // Default constructor.
-  sample_trie_node_update();
-
-  // Updates the rank of a node through a node_iterator node_it; end_nd_it is the end node iterator.
-  inline void
-  operator()(node_iterator node_it, const_node_iterator end_nd_it) const;
-
-};
-
+  /// A sample node updator.
+  template<typename Node_CItr, typename Node_Itr,
+          typename _ATraits, typename _Alloc>
+  class sample_trie_node_update
+  {
+  public:
+    typedef std::size_t                metadata_type;
+
+  protected:
+    // Default constructor.
+    sample_trie_node_update();
+
+    // Updates the rank of a node through a node_iterator node_it;
+    // end_nd_it is the end node iterator.
+    inline void
+    operator()(node_iterator, node_const_iterator) const;
+  };
+}
 #endif // #ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP
index db912a008fada4a45c2b0062b5245d30a7e86ad5..2668a87d9226134ee9b3e3d8a0bb018ea1228868 100644 (file)
 // warranty.
 
 /**
- * @file trie_policy_base.hpp
+ * @file trie_policy/trie_policy_base.hpp
  * Contains an implementation of trie_policy_base.
  */
 
 #ifndef PB_DS_TRIE_POLICY_BASE_HPP
 #define PB_DS_TRIE_POLICY_BASE_HPP
 
-#include <ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp>
+#include <ext/pb_ds/detail/branch_policy/branch_policy.hpp>
 
 namespace __gnu_pbds
 {
   namespace detail
   {
-
-#define PB_DS_CLASS_T_DEC                                              \
-    template<                                                          \
-                                               class Const_Node_Iterator, \
-                                               class Node_Iterator,    \
-                                               class E_Access_Traits,  \
-                                               typename Allocator>
-
-#define PB_DS_CLASS_C_DEC                                              \
-    trie_policy_base<                                                  \
-                                               Const_Node_Iterator,    \
-                                               Node_Iterator,          \
-                                               E_Access_Traits,        \
-                                               Allocator>
-
-#define PB_DS_BASE_C_DEC                                               \
-    basic_tree_policy_base<                            \
-                                                               Const_Node_Iterator, \
-                                                               Node_Iterator, \
-                                                               Allocator>
-
-    template<typename Const_Node_Iterator,
-            class Node_Iterator,
-            class E_Access_Traits,
-            class Allocator>
-    class trie_policy_base : public PB_DS_BASE_C_DEC
+    /// Base class for trie policies.
+    template<typename Node_CItr, typename Node_Itr,
+            typename _ATraits, typename _Alloc>
+    class trie_policy_base
+    : public branch_policy<Node_CItr, Node_Itr, _Alloc>
     {
+      typedef branch_policy<Node_CItr, Node_Itr, _Alloc> base_type;
 
     public:
-
-      typedef E_Access_Traits e_access_traits;
-
-      typedef Allocator allocator_type;
-
-      typedef typename allocator_type::size_type size_type;
-
-      typedef null_node_metadata metadata_type;
-
-      typedef Const_Node_Iterator const_node_iterator;
-
-      typedef Node_Iterator node_iterator;
-
-      typedef typename const_node_iterator::value_type const_iterator;
-
-      typedef typename node_iterator::value_type iterator;
-
-    public:
-
-      typedef typename PB_DS_BASE_C_DEC::key_type key_type;
-
-      typedef
-      typename PB_DS_BASE_C_DEC::const_key_reference
-      const_key_reference;
+      typedef _ATraits                                 access_traits;
+      typedef _Alloc                                   allocator_type;
+      typedef typename allocator_type::size_type       size_type;
+      typedef null_type                                metadata_type;
+      typedef Node_CItr                                node_const_iterator;
+      typedef Node_Itr                                         node_iterator;
+      typedef typename node_const_iterator::value_type         const_iterator;
+      typedef typename node_iterator::value_type       iterator;
+      typedef typename base_type::key_type             key_type;
+      typedef typename base_type::key_const_reference  key_const_reference;
 
     protected:
-
       virtual const_iterator
       end() const = 0;
 
       virtual iterator
       end() = 0;
 
-      virtual const_node_iterator
+      virtual node_const_iterator
       node_begin() const = 0;
 
       virtual node_iterator
       node_begin() = 0;
 
-      virtual const_node_iterator
+      virtual node_const_iterator
       node_end() const = 0;
 
       virtual node_iterator
       node_end() = 0;
 
-      virtual const e_access_traits& 
-      get_e_access_traits() const = 0;
+      virtual const access_traits&
+      get_access_traits() const = 0;
 
     private:
-      typedef
-      std::pair<
-      typename e_access_traits::const_iterator,
-      typename e_access_traits::const_iterator>
-      prefix_range_t;
-
-      typedef PB_DS_BASE_C_DEC base_type;
+      typedef typename access_traits::const_iterator   e_const_iterator;
+      typedef std::pair<e_const_iterator, e_const_iterator> prefix_range_t;
 
     protected:
       static size_type
-      common_prefix_len(node_iterator nd_it, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits);
+      common_prefix_len(node_iterator, e_const_iterator,
+                       e_const_iterator, const access_traits&);
 
       static iterator
-      leftmost_it(node_iterator nd_it);
+      leftmost_it(node_iterator);
 
       static iterator
-      rightmost_it(node_iterator nd_it);
+      rightmost_it(node_iterator);
 
       static bool
-      less(typename e_access_traits::const_iterator b_l, typename e_access_traits::const_iterator e_l, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits);
+      less(e_const_iterator, e_const_iterator, e_const_iterator,
+          e_const_iterator, const access_traits&);
     };
 
+
+#define PB_DS_CLASS_T_DEC \
+    template<typename Node_CItr, typename Node_Itr, \
+            typename _ATraits, typename _Alloc>
+
+#define PB_DS_CLASS_C_DEC \
+    trie_policy_base<Node_CItr, Node_Itr, _ATraits, _Alloc>
+
     PB_DS_CLASS_T_DEC
     typename PB_DS_CLASS_C_DEC::size_type
     PB_DS_CLASS_C_DEC::
-    common_prefix_len(node_iterator nd_it, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits)
+    common_prefix_len(node_iterator nd_it, e_const_iterator b_r,
+                     e_const_iterator e_r, const access_traits& r_traits)
     {
       prefix_range_t pref_range = nd_it.valid_prefix();
 
-      typename e_access_traits::const_iterator b_l = pref_range.first;
-      typename e_access_traits::const_iterator e_l = pref_range.second;
+      e_const_iterator b_l = pref_range.first;
+      e_const_iterator e_l = pref_range.second;
 
-      const size_type range_length_l =
-       std::distance(b_l, e_l);
-
-      const size_type range_length_r =
-       std::distance(b_r, e_r);
+      const size_type range_length_l = std::distance(b_l, e_l);
+      const size_type range_length_r = std::distance(b_r, e_r);
 
       if (range_length_r < range_length_l)
        {
          std::swap(b_l, b_r);
-
          std::swap(e_l, e_r);
        }
 
       size_type ret = 0;
-
       while (b_l != e_l)
        {
          if (r_traits.e_pos(*b_l) != r_traits.e_pos(*b_r))
-           return (ret);
+           return ret;
 
          ++ret;
-
          ++b_l;
-
          ++b_r;
        }
 
-      return (ret);
+      return ret;
     }
 
     PB_DS_CLASS_T_DEC
@@ -193,9 +157,9 @@ namespace __gnu_pbds
     leftmost_it(node_iterator nd_it)
     {
       if (nd_it.num_children() == 0)
-       return (*nd_it);
+       return *nd_it;
 
-      return (leftmost_it(nd_it.get_child(0)));
+      return leftmost_it(nd_it.get_child(0));
     }
 
     PB_DS_CLASS_T_DEC
@@ -206,44 +170,38 @@ namespace __gnu_pbds
       const size_type num_children = nd_it.num_children();
 
       if (num_children == 0)
-       return (*nd_it);
+       return *nd_it;
 
-      return (rightmost_it(nd_it.get_child(num_children - 1)));
+      return rightmost_it(nd_it.get_child(num_children - 1));
     }
 
     PB_DS_CLASS_T_DEC
     bool
     PB_DS_CLASS_C_DEC::
-    less(typename e_access_traits::const_iterator b_l, typename e_access_traits::const_iterator e_l, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits)
+    less(e_const_iterator b_l, e_const_iterator e_l,
+        e_const_iterator b_r, e_const_iterator e_r,
+        const access_traits& r_traits)
     {
       while (b_l != e_l)
        {
          if (b_r == e_r)
-           return (false);
-
-         size_type l_pos =
-           r_traits.e_pos(*b_l);
-         size_type r_pos =
-           r_traits.e_pos(*b_r);
+           return false;
 
+         size_type l_pos = r_traits.e_pos(*b_l);
+         size_type r_pos = r_traits.e_pos(*b_r);
          if (l_pos != r_pos)
            return (l_pos < r_pos);
 
          ++b_l;
          ++b_r;
        }
-
-      return (b_r != e_r);
+      return b_r != e_r;
     }
 
 #undef PB_DS_CLASS_T_DEC
-
 #undef PB_DS_CLASS_C_DEC
 
-#undef PB_DS_BASE_C_DEC
-
   } // namespace detail
 } // namespace __gnu_pbds
 
 #endif // #ifndef PB_DS_TRIE_POLICY_BASE_HPP
-
similarity index 88%
rename from libstdc++-v3/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp
rename to libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp
index 228a4a5dc32f83b01b626d6424d0afecb921bbca..c6d9c4901368dd842791bea43a495355445d2c80 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file string_trie_e_access_traits_imp.hpp
+ * @file trie_policy/trie_string_access_traits_imp.hpp
  * Contains a policy for extracting character positions from
  *    a string for a vector-based PATRICIA tree
  */
@@ -53,7 +53,7 @@ e_pos(e_type e)
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::const_iterator
 PB_DS_CLASS_C_DEC::
-begin(const_key_reference r_key)
+begin(key_const_reference r_key)
 {
   return (begin_imp(r_key, s_rev_ind));
 }
@@ -61,7 +61,7 @@ begin(const_key_reference r_key)
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::const_iterator
 PB_DS_CLASS_C_DEC::
-end(const_key_reference r_key)
+end(key_const_reference r_key)
 {
   return (end_imp(r_key, s_rev_ind));
 }
@@ -69,7 +69,7 @@ end(const_key_reference r_key)
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::const_iterator
 PB_DS_CLASS_C_DEC::
-begin_imp(const_key_reference r_key, detail::false_type)
+begin_imp(key_const_reference r_key, detail::false_type)
 {
   return (r_key.begin());
 }
@@ -77,7 +77,7 @@ begin_imp(const_key_reference r_key, detail::false_type)
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::const_iterator
 PB_DS_CLASS_C_DEC::
-begin_imp(const_key_reference r_key, detail::true_type)
+begin_imp(key_const_reference r_key, detail::true_type)
 {
   return (r_key.rbegin());
 }
@@ -85,7 +85,7 @@ begin_imp(const_key_reference r_key, detail::true_type)
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::const_iterator
 PB_DS_CLASS_C_DEC::
-end_imp(const_key_reference r_key, detail::false_type)
+end_imp(key_const_reference r_key, detail::false_type)
 {
   return (r_key.end());
 }
@@ -93,7 +93,7 @@ end_imp(const_key_reference r_key, detail::false_type)
 PB_DS_CLASS_T_DEC
 inline typename PB_DS_CLASS_C_DEC::const_iterator
 PB_DS_CLASS_C_DEC::
-end_imp(const_key_reference r_key, detail::true_type)
+end_imp(key_const_reference r_key, detail::true_type)
 {
   return (r_key.rend());
 }
index 143110c0ad9c072a02db098a4e38e1e9152bbf76..79899857b0de9337d82709a7c8623cd93d229413 100644 (file)
@@ -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.
  */
index 6d5a0783808a07125a2932d7f96308d5cd53fcc4..50db9b2bc90b403ad579669a1fa48836190c54b7 100644 (file)
@@ -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
 // warranty.
 
 /**
- * @file types_traits.hpp
+ * @file detail/types_traits.hpp
  * Contains a traits class of types used by containers.
  */
 
 #ifndef PB_DS_TYPES_TRAITS_HPP
 #define PB_DS_TYPES_TRAITS_HPP
 
-#include <ext/pb_ds/detail/basic_types.hpp>
+#include <algorithm>
+#include <utility>
+#include <ext/pb_ds/tag_and_trait.hpp>
 #include <ext/pb_ds/detail/type_utils.hpp>
 #include <utility>
 
@@ -49,34 +51,238 @@ namespace __gnu_pbds
 {
   namespace detail
   {
-    template<typename Key, typename Mapped, typename Alloc, bool Store_Extra>
-    struct vt_base_selector
-    {
-      typedef value_type_base<Key, Mapped, Alloc, Store_Extra> type;
-    };
+    /// Primary template.
+    template<typename Key, typename Mapped>
+      struct no_throw_copies
+      {
+       static const bool __simple = is_simple<Key>::value
+                                && is_simple<Mapped>::value;
+       typedef integral_constant<int, __simple>                indicator;
+      };
+
+    /// Specialization.
+    template<typename Key>
+      struct no_throw_copies<Key, null_type>
+      {
+       typedef integral_constant<int, is_simple<Key>::value>   indicator;
+      };
+
+
+    //@{
+    /**
+     *  Data properties computation.
+     */
+
+    /// Stored value.
+    template<typename _Tv>
+      struct stored_value
+      {
+       typedef _Tv     value_type;
+       value_type      m_value;
+      };
+
+    /// Stored hash.
+    template<typename _Th>
+      struct stored_hash
+      {
+       typedef _Th     hash_type;
+       hash_type       m_hash;
+      };
+
+    /// Primary template for representation of stored data.
+    /// Two types of data can be stored: value and hash.
+    template<typename _Tv, typename _Th>
+      struct stored_data
+      : public stored_value<_Tv>, public stored_hash<_Th>
+      { };
+
+    /// Specialization for representation of stored data of just value type.
+    template<typename _Tv>
+      struct stored_data<_Tv, null_type>
+      : public stored_value<_Tv>
+      { };
+
+    /// Primary template.
+    template<typename Key, typename Mapped, typename _Alloc, bool Store_Hash>
+      struct type_base;
+
+    /**
+     * Specialization of type_base for the case where the hash value
+     * is not stored alongside each value.
+     */
+    template<typename Key, typename Mapped, typename _Alloc>
+      struct type_base<Key, Mapped, _Alloc, false>
+      {
+      public:
+       typedef typename _Alloc::size_type              size_type;
+
+      private:
+       typedef typename _Alloc::template rebind<Mapped>        __rebind_m;
+       typedef typename __rebind_m::other                      __rebind_ma;
+       typedef std::pair<const Key, Mapped>                    __value_type;
+       typedef typename _Alloc::template rebind<__value_type>  __rebind_v;
+               typedef typename __rebind_v::other                      __rebind_va;
+
+      public:
+       typedef typename __rebind_ma::value_type        mapped_type;
+       typedef typename __rebind_ma::pointer           mapped_pointer;
+       typedef typename __rebind_ma::const_pointer     mapped_const_pointer;
+       typedef typename __rebind_ma::reference         mapped_reference;
+       typedef typename __rebind_ma::const_reference   mapped_const_reference;
+
+       typedef typename __rebind_va::value_type        value_type;
+       typedef typename __rebind_va::pointer           pointer;
+       typedef typename __rebind_va::const_pointer     const_pointer;
+       typedef typename __rebind_va::reference         reference;
+       typedef typename __rebind_va::const_reference   const_reference;
+
+       typedef stored_data<value_type, null_type>      stored_data_type;
+      };
+
+    /**
+     * Specialization of type_base for the case where the hash value
+     * is stored alongside each value.
+     */
+    template<typename Key, typename Mapped, typename _Alloc>
+      struct type_base<Key, Mapped, _Alloc, true>
+      {
+      public:
+       typedef typename _Alloc::size_type              size_type;
+
+      private:
+       typedef typename _Alloc::template rebind<Mapped>        __rebind_m;
+       typedef typename __rebind_m::other                      __rebind_ma;
+       typedef std::pair<const Key, Mapped>                    __value_type;
+       typedef typename _Alloc::template rebind<__value_type>  __rebind_v;
+               typedef typename __rebind_v::other                      __rebind_va;
+
+      public:
+       typedef typename __rebind_ma::value_type        mapped_type;
+       typedef typename __rebind_ma::pointer           mapped_pointer;
+       typedef typename __rebind_ma::const_pointer     mapped_const_pointer;
+       typedef typename __rebind_ma::reference         mapped_reference;
+       typedef typename __rebind_ma::const_reference   mapped_const_reference;
+
+       typedef typename __rebind_va::value_type        value_type;
+       typedef typename __rebind_va::pointer           pointer;
+       typedef typename __rebind_va::const_pointer     const_pointer;
+       typedef typename __rebind_va::reference         reference;
+       typedef typename __rebind_va::const_reference   const_reference;
+
+       typedef stored_data<value_type, size_type>      stored_data_type;
+      };
+
+
+    /**
+     * Specialization of type_base for the case where the hash value
+     * is not stored alongside each value.
+     */
+    template<typename Key, typename _Alloc>
+      struct type_base<Key, null_type, _Alloc, false>
+      {
+      public:
+       typedef typename _Alloc::size_type              size_type;
+       typedef Key                                     value_type;
+
+      private:
+       typedef typename _Alloc::template rebind<null_type>     __rebind_m;
+       typedef typename __rebind_m::other                      __rebind_ma;
+       typedef typename _Alloc::template rebind<value_type>    __rebind_v;
+               typedef typename __rebind_v::other                      __rebind_va;
+
+      public:
+       typedef typename __rebind_ma::value_type        mapped_type;
+       typedef typename __rebind_ma::pointer           mapped_pointer;
+       typedef typename __rebind_ma::const_pointer     mapped_const_pointer;
+       typedef typename __rebind_ma::reference         mapped_reference;
+       typedef typename __rebind_ma::const_reference   mapped_const_reference;
+
+       typedef typename __rebind_va::pointer           pointer;
+       typedef typename __rebind_va::const_pointer     const_pointer;
+       typedef typename __rebind_va::reference         reference;
+       typedef typename __rebind_va::const_reference   const_reference;
+
+       typedef stored_data<value_type, null_type>      stored_data_type;
+
+       static null_type                        s_null_type;
+      };
+
+    template<typename Key, typename _Alloc>
+      null_type
+      type_base<Key, null_type, _Alloc, false>::s_null_type;
+
+
+    /**
+     * Specialization of type_base for the case where the hash value
+     * is stored alongside each value.
+     */
+    template<typename Key, typename _Alloc>
+      struct type_base<Key, null_type, _Alloc, true>
+      {
+      public:
+       typedef typename _Alloc::size_type              size_type;
+       typedef Key                                     value_type;
+
+      private:
+       typedef typename _Alloc::template rebind<null_type>     __rebind_m;
+       typedef typename __rebind_m::other                      __rebind_ma;
+       typedef typename _Alloc::template rebind<value_type>    __rebind_v;
+               typedef typename __rebind_v::other                      __rebind_va;
+
+      public:
+       typedef typename __rebind_ma::value_type        mapped_type;
+       typedef typename __rebind_ma::pointer           mapped_pointer;
+       typedef typename __rebind_ma::const_pointer     mapped_const_pointer;
+       typedef typename __rebind_ma::reference         mapped_reference;
+       typedef typename __rebind_ma::const_reference   mapped_const_reference;
+
+       typedef typename __rebind_va::pointer           pointer;
+       typedef typename __rebind_va::const_pointer     const_pointer;
+       typedef typename __rebind_va::reference         reference;
+       typedef typename __rebind_va::const_reference   const_reference;
+
+       typedef stored_data<value_type, size_type>      stored_data_type;
+
+       static null_type                        s_null_type;
+      };
+
+    template<typename Key, typename _Alloc>
+      null_type
+      type_base<Key, null_type, _Alloc, true>::s_null_type;
+
+
+    /// Type base dispatch.
+    template<typename Key, typename Mapped, typename _Alloc, bool Store_Hash>
+      struct type_dispatch
+      {
+       typedef type_base<Key, Mapped, _Alloc, Store_Hash> type;
+      };
+
+    /// Traits for abstract types.
+    template<typename Key, typename Mapped, typename _Alloc, bool Store_Hash>
+      struct types_traits
+      : public type_dispatch<Key, Mapped, _Alloc, Store_Hash>::type
+      {
+      private:
+       typedef no_throw_copies<Key, Mapped>            __nothrowcopy;
+       typedef typename _Alloc::template rebind<Key>::other __rebind_a;
+
+      public:
+       typedef typename _Alloc::size_type              size_type;
+       typedef typename __rebind_a::value_type         key_type;
+       typedef typename __rebind_a::pointer            key_pointer;
+       typedef typename __rebind_a::const_pointer      key_const_pointer;
+       typedef typename __rebind_a::reference          key_reference;
+       typedef typename __rebind_a::const_reference    key_const_reference;
+       typedef std::pair<size_type, size_type>         comp_hash;
+       typedef integral_constant<int, Store_Hash>      store_extra;
+       typedef typename __nothrowcopy::indicator       no_throw_indicator;
 
-    template<typename Key, typename Mapped, typename Alloc, bool Store_Extra>
-    struct types_traits 
-    : public vt_base_selector<Key, Mapped, Alloc, Store_Extra>::type
-    {
-      typedef typename Alloc::template rebind<Key>::other key_allocator;
-      typedef typename key_allocator::value_type key_type;
-      typedef typename key_allocator::pointer key_pointer;
-      typedef typename key_allocator::const_pointer const_key_pointer;
-      typedef typename key_allocator::reference key_reference;
-      typedef typename key_allocator::const_reference const_key_reference;
-      typedef typename Alloc::size_type size_type;
-
-      // Extra value (used when the extra value is stored with each value).
-      typedef std::pair<size_type, size_type>  comp_hash;
-
-      typedef integral_constant<int, Store_Extra> store_extra;
-      store_extra      m_store_extra_indicator;
-
-      typedef typename no_throw_copies<Key, Mapped>::indicator no_throw_copies;
-      no_throw_copies  m_no_throw_copies_indicator;
+       store_extra                             m_store_extra_indicator;
+       no_throw_indicator                      m_no_throw_copies_indicator;
     };
+    //@}
   } // namespace detail
 } // namespace __gnu_pbds
 
-#endif 
+#endif
index 1641792b5feb51672d57b619c0230f0708c4ed35..d1221413c6693285bbd77190e8914954baaaaa07 100644 (file)
 // 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)
   { }
index 1aaa6824a83e5e95f0cc0f6bf88878505f538eca..52b90a511e0d759ac8245ed2aa12103b50c28154 100644 (file)
@@ -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;
similarity index 89%
rename from libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
rename to libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp
index 1cda69bb834bdbe5d6404c68a61d7d978fc3dc4c..257067a89520575d672ac201055b76c2a8845036 100644 (file)
@@ -34,7 +34,7 @@
 // warranty.
 
 /**
- * @file const_point_iterator.hpp
+ * @file unordered_iterator/point_const_iterator.hpp
  * Contains an iterator class returned by the tables' const find and insert
  *     methods.
  */
@@ -42,7 +42,7 @@
 class point_iterator_;
 
 // Const point-type iterator.
-class const_point_iterator_
+class point_const_iterator_
 {
 
 public:
@@ -71,26 +71,26 @@ public:
 public:
 
   inline
-  const_point_iterator_(const_pointer p_value) : m_p_value(p_value)
+  point_const_iterator_(const_pointer p_value) : m_p_value(p_value)
   { }
 
   // Default constructor.
   inline
-  const_point_iterator_()
+  point_const_iterator_()
 
     : m_p_value(0)
   { }
 
   // Copy constructor.
   inline
-  const_point_iterator_(const const_point_iterator_& other)
+  point_const_iterator_(const point_const_iterator_& other)
 
     : m_p_value(other.m_p_value)
   { }
 
   // Copy constructor.
   inline
-  const_point_iterator_(const point_iterator_& other)
+  point_const_iterator_(const point_iterator_& other)
 
     : m_p_value(other.m_p_value)
   { }
@@ -122,7 +122,7 @@ public:
 
   // Compares content to a different iterator object.
   inline bool
-  operator==(const const_point_iterator_& other) const
+  operator==(const point_const_iterator_& other) const
   {
     return (m_p_value == other.m_p_value);
   }
@@ -136,7 +136,7 @@ public:
 
   // Compares content (negatively) to a different iterator object.
   inline bool
-  operator!=(const const_point_iterator_& other) const
+  operator!=(const point_const_iterator_& other) const
   {
     return (m_p_value != other.m_p_value);
   }
index e17a5bf1728152de6558a84f21e847313b49e6f3..f74f03d7a483b1e88835eb763838b50536fe733f 100644 (file)
@@ -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;
 
index cefa3a10c2238e0e305c374fe0847114a605c578..1fa9303510916c99ee27556bea9c9206170e4e43 100644 (file)
 
 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<typename Size_Type>
 #define PB_DS_CLASS_C_DEC linear_probe_fn<Size_Type>
 
-  // A probe sequence policy using fixed increments.
+  /// A probe sequence policy using fixed increments.
   template<typename Size_Type = std::size_t>
   class linear_probe_fn
   {
@@ -90,7 +80,7 @@ namespace __gnu_pbds
 #define PB_DS_CLASS_T_DEC template<typename Size_Type>
 #define PB_DS_CLASS_C_DEC quadratic_probe_fn<Size_Type>
 
-  // A probe sequence policy using square increments.
+  /// A probe sequence policy using square increments.
   template<typename Size_Type = std::size_t>
   class quadratic_probe_fn
   {
@@ -114,7 +104,7 @@ namespace __gnu_pbds
 #define PB_DS_CLASS_T_DEC template<typename Size_Type>
 #define PB_DS_CLASS_C_DEC direct_mask_range_hashing<Size_Type>
 
-  // A mask range-hashing class (uses a bit-mask).
+  /// A mask range-hashing class (uses a bit-mask).
   template<typename Size_Type = std::size_t>
   class direct_mask_range_hashing 
   : public detail::mask_based_range_hashing<Size_Type>
@@ -146,7 +136,7 @@ namespace __gnu_pbds
 #define PB_DS_CLASS_T_DEC template<typename Size_Type>
 #define PB_DS_CLASS_C_DEC direct_mod_range_hashing<Size_Type>
 
-  // A mod range-hashing class (uses the modulo function).
+  /// A mod range-hashing class (uses the modulo function).
   template<typename Size_Type = std::size_t>
   class direct_mod_range_hashing 
   : public detail::mod_based_range_hashing<Size_Type>
@@ -179,8 +169,8 @@ namespace __gnu_pbds
 #define PB_DS_CLASS_C_DEC hash_load_check_resize_trigger<External_Load_Access, Size_Type>
 #define PB_DS_SIZE_BASE_C_DEC detail::hash_load_check_resize_trigger_size_base<Size_Type, External_Load_Access>
 
-  // 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<bool External_Load_Access = false, typename Size_Type = std::size_t>
   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<bool External_Load_Access, typename Size_Type>
 #define PB_DS_CLASS_C_DEC cc_hash_max_collision_check_resize_trigger<External_Load_Access, Size_Type>
 
-  // 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<bool External_Load_Access = false, typename Size_Type = std::size_t>
   class cc_hash_max_collision_check_resize_trigger
   {
@@ -395,8 +385,8 @@ namespace __gnu_pbds
 #define PB_DS_CLASS_T_DEC template<typename Size_Type>
 #define PB_DS_CLASS_C_DEC hash_exponential_size_policy<Size_Type>
 
-  // 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<typename Size_Type = std::size_t>
   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<Size_Policy, Trigger_Policy, External_Size_Access, Size_Type>
 
-  // A resize policy which delegates operations to size and trigger policies.
+  /// A resize policy which delegates operations to size and trigger policies.
   template<typename Size_Policy = hash_exponential_size_policy<>,
           typename Trigger_Policy = hash_load_check_resize_trigger<>,
           bool External_Size_Access = false,
index 54a67c6e563b0cab095bb9083352431bcfb61590..e879b8088c9034a6e11de17e78fc81d94cadec05 100644 (file)
@@ -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
 
 #include <bits/c++config.h>
 #include <cstdlib>
-#include <ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp>
+#include <ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp>
+#include <ext/pb_ds/tag_and_trait.hpp>
 
 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<typename Allocator>
-#define PB_DS_CLASS_C_DEC move_to_front_lu_policy<Allocator>
-
-  // A list-update policy that unconditionally moves elements to the
-  // front of the list.
-  template<typename Allocator = std::allocator<char> >
-  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<metadata_type>::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 <ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp>
-
-#undef PB_DS_CLASS_T_DEC
-#undef PB_DS_CLASS_C_DEC
-
-#define PB_DS_CLASS_T_DEC template<std::size_t Max_Count, class Allocator>
-#define PB_DS_CLASS_C_DEC counter_lu_policy<Max_Count, Allocator>
-
-  // A list-update policy that moves elements to the front of the list
-  // based on the counter algorithm.
-  template<std::size_t Max_Count = 5,
-          typename Allocator = std::allocator<char> >
-  class counter_lu_policy 
-  : private detail::counter_lu_policy_base<typename Allocator::size_type>
-  {
-  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<size_type> metadata_type;
-
-    // Reference to metadata on which this functor operates.
-    typedef typename Allocator::template rebind<metadata_type>::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<typename Allocator::size_type> base_type;
-  };
-
-#include <ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp>
-
-#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<typename _Alloc = std::allocator<char> >
+   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<metadata_type> __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<std::size_t Max_Count = 5, typename _Alloc = std::allocator<char> >
+    class lu_counter_policy
+    : private detail::lu_counter_policy_base<typename _Alloc::size_type>
+    {
+    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<size_type>   metadata_type;
+
+    private:
+      typedef detail::lu_counter_policy_base<size_type>        base_type;
+      typedef typename _Alloc::template rebind<metadata_type> __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
index b6088e7d73a2ceb3ebe2bae4fcc6e6832fcfb866..8cd7a26db6a1e173658d9e2e905fc56aafa7344b 100644 (file)
 
 namespace __gnu_pbds
 {
-  // A priority queue.
-  template<typename Value_Type, 
-          typename Cmp_Fn = std::less<Value_Type>,
+  /**
+   *  @brief A priority queue composed of one specific heap policy.
+   *  @ingroup pbds
+   */
+  template<typename _Tv,
+          typename Cmp_Fn = std::less<_Tv>,
           typename Tag = pairing_heap_tag,
-          typename Allocator = std::allocator<char> >
-  class priority_queue 
-  : public detail::priority_queue_base_dispatch<Value_Type,
-                                               Cmp_Fn,Tag,Allocator>::type
+          typename _Alloc = std::allocator<char> >
+  class priority_queue
+  : public detail::container_base_dispatch<_Tv, Cmp_Fn, _Alloc, Tag>::type
   {
-  private:
-    typedef typename
-    detail::priority_queue_base_dispatch<Value_Type, Cmp_Fn,
-                                        Tag, Allocator>::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<value_type>::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
index ef445336137d6f7bd16ab51198742b74c6815a5b..d5df54f58770145700756a85f2a4484a2b8367b4 100644 (file)
@@ -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
  */
 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<T> ??
-  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<typename Tag>
-  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<typename _Tag>
+    struct container_traits_base;
+
+  /// Specialization, cc hash.
   template<>
   struct container_traits_base<cc_hash_tag>
   {
-    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<gp_hash_tag>
   {
-    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<rb_tree_tag>
   {
-    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<splay_tree_tag>
   {
-    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<ov_tree_tag>
   {
-    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<pat_trie_tag>
   {
-    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<list_update_tag>
   {
-    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<pairing_heap_tag>
   {
-    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<thin_heap_tag>
   {
-    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<binomial_heap_tag>
   {
-    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<rc_binomial_heap_tag>
   {
-    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<binary_heap_tag>
   {
-    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<typename Cntnr>
-  struct container_traits 
+  struct container_traits
   : public container_traits_base<typename Cntnr::container_category>
   {
-    typedef Cntnr container_type;
-    typedef typename Cntnr::container_category container_category;
-    typedef container_traits_base<container_category> base_type;
+    typedef Cntnr                                     container_type;
+    typedef typename Cntnr::container_category         container_category;
+    typedef container_traits_base<container_category>  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<typename Key, typename Mapped, typename _Alloc, typename Tag,
+            typename Policy_Tl = null_type>
+      struct container_base_dispatch;
+  } // namespace __detail
+  //@}
 } // namespace __gnu_pbds
 
 #endif
index 4af1adbde707cfa1c118ddb0dc2ae248fe6254ab..4df9df1df2ae9c6f36bae4c2bc9a2b5751ee9d61 100644 (file)
@@ -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
 #include <bits/c++config.h>
 #include <iterator>
 #include <ext/pb_ds/detail/type_utils.hpp>
-#include <ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp>
+#include <ext/pb_ds/detail/branch_policy/branch_policy.hpp>
 
 namespace __gnu_pbds
 {
-  // A null node updator, indicating that no node updates are required.
-  template<typename Const_Node_Iterator,
-          typename Node_Iterator,
-          typename Cmp_Fn,
-          typename Allocator>
-  struct null_tree_node_update
-  { };
-
 #define PB_DS_CLASS_T_DEC \
-  template<typename Const_Node_Iterator, class Node_Iterator, class Cmp_Fn, class Allocator>
+  template<typename Node_CItr, typename Node_Itr, typename Cmp_Fn, \
+          typename _Alloc>
 
 #define PB_DS_CLASS_C_DEC \
-  tree_order_statistics_node_update<Const_Node_Iterator, Node_Iterator, Cmp_Fn, Allocator>
+  tree_order_statistics_node_update<Node_CItr, Node_Itr, Cmp_Fn, _Alloc>
 
-#define PB_DS_BASE_C_DEC                                               \
-  detail::basic_tree_policy_base<Const_Node_Iterator, Node_Iterator, Allocator>
+#define PB_DS_BRANCH_POLICY_BASE \
+  detail::branch_policy<Node_CItr, Node_Itr, _Alloc>
 
-  // Functor updating ranks of entrees.
-  template<typename Const_Node_Iterator, typename Node_Iterator, 
-          typename Cmp_Fn, typename Allocator>
-  class tree_order_statistics_node_update : private PB_DS_BASE_C_DEC
+  /// Functor updating ranks of entrees.
+  template<typename Node_CItr, typename Node_Itr, 
+          typename Cmp_Fn, typename _Alloc>
+  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<metadata_type>::other __rebind_m;
 
-    typedef typename allocator_type::template rebind<metadata_type>::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
 
index fc452104f75aacb3b917fb96fb1b1e78ad86d521..8fd4900b1336d8b312fa8a26f0dd9aecd9a2bd71 100644 (file)
@@ -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
 
 namespace __gnu_pbds
 {
-  // A null node updator, indicating that no node updates are required.
-  template<typename Const_Node_Iterator,
-          typename Node_Iterator,
-          typename E_Access_Traits,
-          typename Allocator>
-  struct null_trie_node_update
-  { };
-
-#define PB_DS_CLASS_T_DEC                                              \
-  template<typename String, typename String::value_type Min_E_Val, typename String::value_type Max_E_Val, bool Reverse, typename Allocator>
+#define PB_DS_CLASS_T_DEC \
+  template<typename String, typename String::value_type Min_E_Val, \
+          typename String::value_type Max_E_Val, bool Reverse, \
+          typename _Alloc>
 
-#define PB_DS_CLASS_C_DEC                                              \
-  string_trie_e_access_traits<String, Min_E_Val,Max_E_Val,Reverse,Allocator>
+#define PB_DS_CLASS_C_DEC \
+  trie_string_access_traits<String, Min_E_Val,Max_E_Val,Reverse,_Alloc>
 
-  // Element access traits for string types.
+  /// Element access traits for string types.
   template<typename String = std::string,
-          typename String::value_type Min_E_Val = detail::__numeric_traits<typename String::value_type>::__min, 
-          typename String::value_type Max_E_Val = detail::__numeric_traits<typename String::value_type>::__max, 
+          typename String::value_type Min_E_Val = detail::__numeric_traits<typename String::value_type>::__min,
+          typename String::value_type Max_E_Val = detail::__numeric_traits<typename String::value_type>::__max,
           bool Reverse = false,
-          typename Allocator = std::allocator<char> >
-  struct string_trie_e_access_traits
+          typename _Alloc = std::allocator<char> >
+  struct trie_string_access_traits
   {
   public:
-    typedef typename Allocator::size_type size_type;
-    typedef String key_type;
-    typedef typename Allocator::template rebind<key_type>::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<key_type>   __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<Reverse, typename String::const_reverse_iterator, typename String::const_iterator>::__type const_iterator;
+    typedef typename detail::__conditional_type<Reverse, \
+                      typename String::const_reverse_iterator, \
+                      typename String::const_iterator>::__type const_iterator;
 
     // Element type.
     typedef typename std::iterator_traits<const_iterator>::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<int, Reverse> s_rev_ind;
   };
 
-#include <ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp>
+#include <ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp>
 
 #undef PB_DS_CLASS_T_DEC
 #undef PB_DS_CLASS_C_DEC
 
 #define PB_DS_CLASS_T_DEC \
-  template<typename Const_Node_Iterator,typename Node_Iterator,class E_Access_Traits, typename Allocator>
+  template<typename Node_CItr,typename Node_Itr, \
+          typename _ATraits, typename _Alloc>
 
 #define PB_DS_CLASS_C_DEC \
-  trie_prefix_search_node_update<Const_Node_Iterator, Node_Iterator, E_Access_Traits,Allocator>
-
-#define PB_DS_BASE_C_DEC \
-  detail::trie_policy_base<Const_Node_Iterator,Node_Iterator,E_Access_Traits, Allocator>
-
-  // A node updator that allows tries to be searched for the range of
-  // values that match a certain prefix.
-  template<typename Const_Node_Iterator,
-          typename Node_Iterator,
-          typename E_Access_Traits,
-          typename Allocator>
-  class trie_prefix_search_node_update : private PB_DS_BASE_C_DEC
+  trie_prefix_search_node_update<Node_CItr, Node_Itr, \
+                                _ATraits,_Alloc>
+
+#define PB_DS_TRIE_POLICY_BASE \
+  detail::trie_policy_base<Node_CItr,Node_Itr,_ATraits, _Alloc>
+
+  /// A node updator that allows tries to be searched for the range of
+  /// values that match a certain prefix.
+  template<typename Node_CItr,
+          typename Node_Itr,
+          typename _ATraits,
+          typename _Alloc>
+  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<const_iterator, const_iterator>
-    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<iterator, iterator>
-    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<const_iterator, const_iterator>
-    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<iterator, iterator>
-    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 <ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp>
@@ -236,31 +234,32 @@ namespace __gnu_pbds
 #undef PB_DS_CLASS_C_DEC
 
 #define PB_DS_CLASS_C_DEC \
-  trie_order_statistics_node_update<Const_Node_Iterator, Node_Iterator,E_Access_Traits, Allocator>
-
-  // Functor updating ranks of entrees.
-  template<typename Const_Node_Iterator,
-          typename Node_Iterator,
-          typename E_Access_Traits,
-          typename Allocator>
-  class trie_order_statistics_node_update : private PB_DS_BASE_C_DEC
+  trie_order_statistics_node_update<Node_CItr, Node_Itr, \
+                                   _ATraits, _Alloc>
+
+  /// Functor updating ranks of entrees.
+  template<typename Node_CItr,
+          typename Node_Itr,
+          typename _ATraits,
+          typename _Alloc>
+  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<metadata_type>::other metadata_rebind;
-    typedef typename metadata_rebind::const_reference const_metadata_reference;
-    typedef typename metadata_rebind::reference metadata_reference;
+    typedef typename _Alloc::template rebind<metadata_type> __rebind_m;
+    typedef typename __rebind_m::other                         __rebind_ma;
+    typedef typename __rebind_ma::const_reference      metadata_const_reference;
+    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 <ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp>
 
 #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
 
index 61e18be476818d397cf17fcfb3e5d19b34d611cd..88b8d38fdf82fbd51fbd13140a2bfe0e26e6b783 100755 (executable)
@@ -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)
 
index e227ce17b95e859bfb3912ea1683b97ce1269b8c..48b172497377366d8e47390aee09ec4f951dd863 100644 (file)
@@ -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
index cffc3a0393701610dbf87d367cd0d5c9b275772b..0c2da1b3099047e3c3e4ccd1446984d4cf3a853e 100644 (file)
@@ -85,7 +85,6 @@
        </test>
        <test name = "text_find_timing_test_hash">
                <file name = "text_find_timing.xml"></file>
-               <cntnr name = "n_hash_map_ncah"></cntnr>
                <cntnr name = "cc_hash_mask_exp_nea_lc_1div8_1div1_nsth_map"></cntnr>
                <cntnr name = "cc_hash_mod_prime_nea_lc_1div8_1div1_nsth_map"></cntnr>
                <cntnr name = "cc_hash_mask_exp_nea_lc_1div8_1div2_sth_map"></cntnr>
index bdc423a26b3f97943ae6816f6c3ce9a24db3b73c..ba593f2354112c189d297bcbfd35776756f521ea 100644 (file)
@@ -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);
 
index 24ebe2e28983344ba87be9b6240d18669125e0d2..b516bb7853c56c39c56b0526878f5989f1784199 100644 (file)
@@ -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);
 
index 3d2cf14db3c8367c85b582b03009554872afae55..07c74e64300ffb34af896628d96bb60eeaf1c4a0 100644 (file)
@@ -80,19 +80,19 @@ int main()
 {
   {
     // Perform operations on a collision-chaining hash set.
-    cc_hash_table<int, null_mapped_type> c;
+    cc_hash_table<int, null_type> c;
     some_op_sequence(c);
   }
 
   {
     // Perform operations on a general-probing hash set.
-    gp_hash_table<int, null_mapped_type> c;
+    gp_hash_table<int, null_type> c;
     some_op_sequence(c);
   }
 
   {
     // Perform operations on a red-black tree set.
-    tree<int, null_mapped_type> c;
+    tree<int, null_type> 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<int>,
       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<int>,
       ov_tree_tag> c;
     some_op_sequence(c);
@@ -118,7 +118,7 @@ int main()
 
   {
     // Perform operations on a list-update set.
-    list_update<int, null_mapped_type> c;
+    list_update<int, null_type> c;
     some_op_sequence(c);
   }
 
index e9f33b11305c4b9784eb806c6a12095610dff3a6..e752242faf4426b426394eb0bf6addae5efe2a5f 100644 (file)
@@ -125,8 +125,8 @@ main()
   typedef
     cc_hash_table<
     string,
-    null_mapped_type,
-    null_hash_fn,
+    null_type,
+    null_type,
     equal_to<string>,
     simple_string_ranged_hash_fn>
     set_t;
index 406ab8e0c15bbe5325d2bb4cc88d81cb68200c2a..a29756fd05a0f037a6cd84ab532272e835a6c470 100644 (file)
@@ -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<class Const_Node_Iterator,
-        class Node_Iterator,
+template<class Node_CItr,
+        class Node_Itr,
         class Cmp_Fn,
-        class Allocator>
+        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<unsigned int>(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<interval>,
                   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<interval>,
                   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<interval>,
                   splay_tree_tag,
                   intervals_node_update>());
index 584574030b128d8bd3806c7d6e47bdd372df1a4b..68ef8b7438ff01a28b0117b8a521f09c464f83bd 100644 (file)
@@ -57,7 +57,7 @@ using namespace __gnu_pbds;
 typedef
 tree<
   int,
-  null_mapped_type,
+  null_type,
   less<int>,
   rb_tree_tag,
   // This policy updates nodes' metadata for order statistics.
index 28c895680e33fdd61d341b938f2cc8bbcc5db992..06ae5399cc9dbae43b9c1e8901ed9a4580b97d1d 100644 (file)
@@ -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<dna_t, string, traits_type> trie_type;
 
 int main()
index 98b99a76abcb14b0ff8f43840662655f8f5e834b..09e025aff7988a3e556394eb68f8a407edead9fb 100644 (file)
@@ -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<string, mapped_type, cmp_fn, tag_type, 
diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand_debug.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand_debug.cc
new file mode 100644 (file)
index 0000000..e41e073
--- /dev/null
@@ -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
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @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 <regression/rand/assoc/rand_regression_test.hpp>
+#include <regression/common_type.hpp>
+#include <ext/throw_allocator.h>
+#include <ext/pb_ds/tag_and_trait.hpp>
+
+#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<basic_type>  allocator_type;
+typedef std::equal_to<basic_type>                      equal_type;
+
+
+typedef __gnu_pbds::test::direct_mod_range_hashing_t_<allocator_type>
+                                                       cprobe_type1;
+
+typedef __gnu_pbds::test::direct_mask_range_hashing_t_<allocator_type>
+                                                       cprobe_type2;
+
+
+typedef __gnu_pbds::test::quadratic_probe_fn_t_<basic_type, allocator_type>
+                                                       probe_type1;
+
+typedef __gnu_pbds::test::linear_probe_fn_t_<basic_type, allocator_type>
+                                                       probe_type2;
+
+
+typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_<allocator_type,
+                                                           1, 8, 1, 2, false>
+                                                       trigger_type1;
+
+typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_<allocator_type,
+                                                           1, 8, 1, 2, true>
+                                                       trigger_type2;
+
+typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_<allocator_type,
+                                                           1, 8, 1, 1, false>
+                                                       trigger_type3;
+
+typedef __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_<allocator_type, 1, 2, false>
+                                                       trigger_type4;
+
+typedef __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_<allocator_type, 1, 2, true>
+                                                       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_<allocator_type>, trigger_type2, true, unsigned long>
+                                                       resize_type2;
+
+typedef hash_standard_resize_policy<__gnu_pbds::test::hash_exponential_size_policy_t_<allocator_type>, trigger_type5, false, unsigned long>
+                                                       resize_type3;
+
+
+
+// gp_hash 1
+typedef gp_hash_table<basic_type, basic_type, __gnu_pbds::test::hash,
+                     equal_type, cprobe_type1, probe_type1, resize_type1,
+                     false, allocator_type>
+                                                       gp_hash_type1;
+
+// gp_hash 2
+typedef gp_hash_table<basic_type, basic_type, __gnu_pbds::test::hash,
+                     equal_type, cprobe_type2, probe_type2, resize_type2,
+                     true, allocator_type>
+                                                       gp_hash_type2;
+
+
+// cc_hash 1
+typedef cc_hash_table<basic_type, basic_type, __gnu_pbds::test::hash,
+                     equal_type, cprobe_type2, resize_type3,
+                     false, allocator_type>
+                                                       cc_hash_type1;
+
+// cc_hash 2
+typedef cc_hash_table<basic_type, basic_type, __gnu_pbds::test::hash,
+                     equal_type, cprobe_type2, resize_type2,
+                     false, allocator_type>
+                                                       cc_hash_type2;
+
+// cc_hash 3
+typedef cc_hash_table<basic_type, basic_type, __gnu_pbds::test::hash,
+                     equal_type, cprobe_type1, resize_type1,
+                     true, allocator_type>
+                                                       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<test_type>::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 (file)
index 0000000..8729f41
--- /dev/null
@@ -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
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @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 <regression/rand/assoc/rand_regression_test.hpp>
+#include <regression/common_type.hpp>
+#include <ext/throw_allocator.h>
+#include <ext/pb_ds/tag_and_trait.hpp>
+
+#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<basic_type>  allocator_type;
+typedef std::equal_to<basic_type>                      equal_type;
+
+
+typedef __gnu_pbds::test::direct_mod_range_hashing_t_<allocator_type>
+                                                       cprobe_type1;
+
+typedef __gnu_pbds::test::direct_mask_range_hashing_t_<allocator_type>
+                                                       cprobe_type2;
+
+
+typedef __gnu_pbds::test::quadratic_probe_fn_t_<basic_type, allocator_type>
+                                                       probe_type1;
+
+typedef __gnu_pbds::test::linear_probe_fn_t_<basic_type, allocator_type>
+                                                       probe_type2;
+
+
+typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_<allocator_type,
+                                                           1, 8, 1, 2, false>
+                                                       trigger_type1;
+
+typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_<allocator_type,
+                                                           1, 8, 1, 2, true>
+                                                       trigger_type2;
+
+typedef __gnu_pbds::test::hash_load_check_resize_trigger_t_<allocator_type,
+                                                           1, 8, 1, 1, false>
+                                                       trigger_type3;
+
+typedef __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_<allocator_type, 1, 2, false>
+                                                       trigger_type4;
+
+typedef __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_<allocator_type, 1, 2, true>
+                                                       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_<allocator_type>, trigger_type2, true, unsigned long>
+                                                       resize_type2;
+
+typedef hash_standard_resize_policy<__gnu_pbds::test::hash_exponential_size_policy_t_<allocator_type>, trigger_type5, false, unsigned long>
+                                                       resize_type3;
+
+
+
+// gp_hash 1
+typedef gp_hash_table<basic_type, null_type, __gnu_pbds::test::hash,
+                     equal_type, cprobe_type1, probe_type1, resize_type1,
+                     false, allocator_type>
+                                                       gp_hash_type1;
+
+// gp_hash 2
+typedef gp_hash_table<basic_type, null_type, __gnu_pbds::test::hash,
+                     equal_type, cprobe_type2, probe_type2, resize_type2,
+                     true, allocator_type>
+                                                       gp_hash_type2;
+
+
+// cc_hash 1
+typedef cc_hash_table<basic_type, null_type, __gnu_pbds::test::hash,
+                     equal_type, cprobe_type2, resize_type3,
+                     false, allocator_type>
+                                                       cc_hash_type1;
+
+// cc_hash 2
+typedef cc_hash_table<basic_type, null_type, __gnu_pbds::test::hash,
+                     equal_type, cprobe_type2, resize_type2,
+                     false, allocator_type>
+                                                       cc_hash_type2;
+
+// cc_hash 3
+typedef cc_hash_table<basic_type, null_type, __gnu_pbds::test::hash,
+                     equal_type, cprobe_type1, resize_type1,
+                     true, allocator_type>
+                                                       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<test_type>::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;
+}
index 8bd77816c0225beba1cd7d13b7a79bcf0862954a..e91a753ebbf7358c1098b5b228a903140e35f716 100644 (file)
@@ -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 (file)
index 0000000..bfb2ed4
--- /dev/null
@@ -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
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @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 <regression/rand/assoc/rand_regression_test.hpp>
+#include <regression/common_type.hpp>
+#include <ext/throw_allocator.h>
+#include <ext/pb_ds/tag_and_trait.hpp>
+
+// 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<basic_type>  allocator_type;
+typedef std::equal_to<basic_type>                      equal_type;
+
+typedef __gnu_pbds::test::lu_move_to_front_policy_t_   policy_type1;
+
+typedef __gnu_pbds::test::lu_counter_policy_t_<allocator_type, 5u>
+                                                       policy_type2;
+
+
+typedef list_update<basic_type, basic_type, equal_type, policy_type1,
+                   allocator_type>
+                                                       list_type1;
+
+typedef list_update<basic_type, basic_type, equal_type, policy_type2,
+                   allocator_type>
+                                                       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<test_type>::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 (file)
index 0000000..c39eb0d
--- /dev/null
@@ -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
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @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 <regression/rand/assoc/rand_regression_test.hpp>
+#include <regression/common_type.hpp>
+#include <ext/throw_allocator.h>
+#include <ext/pb_ds/tag_and_trait.hpp>
+
+// 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<basic_type>  allocator_type;
+typedef std::equal_to<basic_type>                      equal_type;
+
+typedef __gnu_pbds::test::lu_move_to_front_policy_t_   policy_type1;
+
+typedef __gnu_pbds::test::lu_counter_policy_t_<allocator_type, 5u>
+                                                       policy_type2;
+
+
+typedef list_update<basic_type, null_type, equal_type, policy_type1,
+                   allocator_type>
+                                                       list_type1;
+
+typedef list_update<basic_type, null_type, equal_type, policy_type2,
+                   allocator_type>
+                                                       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<test_type>::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 (file)
index 0000000..dda9915
--- /dev/null
@@ -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
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file priority_queue_rand_debug.cc
+ * Contains a random-operation test for priority queues.
+ */
+
+#define PB_DS_REGRESSION
+//#define PB_DS_REGRESSION_TRACE
+
+#include <regression/rand/priority_queue/rand_regression_test.hpp>
+#include <regression/common_type.hpp>
+#include <ext/throw_allocator.h>
+#include <ext/pb_ds/tag_and_trait.hpp>
+
+#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<basic_type>  allocator_type;
+
+// pairing_heap_tag
+typedef priority_queue<basic_type, std::less<basic_type>,
+                      pairing_heap_tag, allocator_type>
+                                                       priority_queue_type1;
+
+// binomial_heap_tag
+typedef priority_queue<basic_type, std::less<basic_type>,
+                      binomial_heap_tag, allocator_type>
+                                                       priority_queue_type2;
+
+// rc_binomial_heap_tag
+typedef priority_queue<basic_type, std::less<basic_type>,
+                      rc_binomial_heap_tag, allocator_type>
+                                                       priority_queue_type3;
+
+// binary_heap_tag
+typedef priority_queue<basic_type, std::less<basic_type>,
+                      binary_heap_tag, allocator_type>
+                                                       priority_queue_type4;
+
+// thin_heap_tag
+typedef priority_queue<basic_type, std::less<basic_type>,
+                      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<test_type>::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 (file)
index 0000000..934d96d
--- /dev/null
@@ -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
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @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 <regression/rand/assoc/rand_regression_test.hpp>
+#include <regression/common_type.hpp>
+#include <ext/throw_allocator.h>
+#include <ext/pb_ds/tag_and_trait.hpp>
+
+#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<basic_type>  allocator_type;
+
+// ov_tree_tag
+typedef tree<basic_type, basic_type, std::less<basic_type>,
+            ov_tree_tag, null_node_update,
+            allocator_type>                            ov_tree_type1;
+
+typedef tree<basic_type, basic_type, std::less<basic_type>,
+            ov_tree_tag, tree_order_statistics_node_update,
+            allocator_type>                            ov_tree_type2;
+
+// rb_tree_tag
+typedef tree<basic_type, basic_type, std::less<basic_type>,
+            rb_tree_tag, null_node_update,
+            allocator_type>                            rb_tree_type1;
+
+typedef tree<basic_type, basic_type, std::less<basic_type>,
+            rb_tree_tag, tree_order_statistics_node_update,
+            allocator_type>                            rb_tree_type2;
+
+// splay_tree_tag
+typedef tree<basic_type, basic_type, std::less<basic_type>,
+            splay_tree_tag, null_node_update,
+            allocator_type>                            splay_tree_type1;
+
+typedef tree<basic_type, basic_type, std::less<basic_type>,
+            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<test_type>::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 (file)
index 0000000..146fc1f
--- /dev/null
@@ -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
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @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 <regression/rand/assoc/rand_regression_test.hpp>
+#include <regression/common_type.hpp>
+#include <ext/throw_allocator.h>
+#include <ext/pb_ds/tag_and_trait.hpp>
+
+#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<basic_type>  allocator_type;
+
+// ov_tree_tag
+typedef tree<basic_type, null_type, std::less<basic_type>,
+            ov_tree_tag, null_node_update,
+            allocator_type>                            ov_tree_type1;
+
+typedef tree<basic_type, null_type, std::less<basic_type>,
+            ov_tree_tag, tree_order_statistics_node_update,
+            allocator_type>                            ov_tree_type2;
+
+// rb_tree_tag
+typedef tree<basic_type, null_type, std::less<basic_type>,
+            rb_tree_tag, null_node_update,
+            allocator_type>                            rb_tree_type1;
+
+typedef tree<basic_type, null_type, std::less<basic_type>,
+            rb_tree_tag, tree_order_statistics_node_update,
+            allocator_type>                            rb_tree_type2;
+
+// splay_tree_tag
+typedef tree<basic_type, null_type, std::less<basic_type>,
+            splay_tree_tag, null_node_update,
+            allocator_type>                            splay_tree_type1;
+
+typedef tree<basic_type, null_type, std::less<basic_type>,
+            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<test_type>::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 (file)
index 0000000..5d7ada8
--- /dev/null
@@ -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
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @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 <regression/rand/assoc/rand_regression_test.hpp>
+#include <regression/common_type.hpp>
+#include <ext/throw_allocator.h>
+#include <ext/pb_ds/tag_and_trait.hpp>
+
+#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<basic_type>  allocator_type;
+typedef __gnu_pbds::trie_string_access_traits<basic_type, char('a'), 100,
+                                               false, allocator_type>
+                                                       etraits_type;
+
+// pat_trie_tag
+typedef trie<basic_type, basic_type, etraits_type, pat_trie_tag,
+            null_node_update, allocator_type>
+                                                       trie_type1;
+
+typedef trie<basic_type, basic_type, etraits_type, pat_trie_tag,
+            trie_order_statistics_node_update, allocator_type>
+                                                       trie_type2;
+
+typedef trie<basic_type, basic_type, etraits_type, pat_trie_tag,
+            trie_prefix_search_node_update, allocator_type>
+                                                       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<test_type>::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 (file)
index 0000000..b075e5b
--- /dev/null
@@ -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
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @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 <regression/rand/assoc/rand_regression_test.hpp>
+#include <regression/common_type.hpp>
+#include <ext/throw_allocator.h>
+#include <ext/pb_ds/tag_and_trait.hpp>
+
+#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<basic_type>  allocator_type;
+typedef __gnu_pbds::trie_string_access_traits<basic_type, char('a'), 100,
+                                               false, allocator_type>
+                                                       etraits_type;
+
+// pat_trie_tag
+typedef trie<basic_type, null_type, etraits_type, pat_trie_tag,
+            null_node_update, allocator_type>
+                                                       trie_type1;
+
+typedef trie<basic_type, null_type, etraits_type, pat_trie_tag,
+            trie_order_statistics_node_update, allocator_type>
+                                                       trie_type2;
+
+typedef trie<basic_type, null_type, etraits_type, pat_trie_tag,
+            trie_prefix_search_node_update, allocator_type>
+                                                       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<test_type>::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;
+}
index e1c7d9ec8df0694f7e2bd9461a0d365a29ff647a..f80c77b8a2ea64f88fc954aac87c66945c013b63 100644 (file)
@@ -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<vec_t::const_iterator> tst(b,  vn, vs, vm);
       typedef __gnu_test::tracker_allocator<char> alloc_t;
       {
-       typedef hash_common_types<int, __gnu_pbds::null_mapped_type, int_hash, std::equal_to<int>, alloc_t>::performance_tl tl_t;
+       typedef hash_common_types<int, __gnu_pbds::null_type, int_hash, std::equal_to<int>, alloc_t>::performance_tl tl_t;
 
        tl_t tl;
        __gnu_cxx::typelist::apply(tst, tl);
index 8c0181e986803a5a05b3660b26ff4fbe50724826..50423db3d796028db8b3b1bcb2de015e62813028 100644 (file)
@@ -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<char> callocator_type;
-      typedef __gnu_test::tracker_allocator<char> sallocator_type;
-      typedef std::basic_string<char, std::char_traits<char>, callocator_type> string_t;
+      typedef __gnu_test::tracker_allocator<char> allocator_type;
+      typedef std::char_traits<char> traits_type;
+      typedef std::basic_string<char, traits_type, allocator_type> string_t;
+      typedef std::less<string_t> cmp_type;
 
       typedef std::vector<std::pair<string_t, char> > 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<string_t, std::less<string_t>, callocator_type>::performance_tl pq_tl_t;
+       typedef pq_common_types<string_t, cmp_type, allocator_type>::performance_tl pq_tl_t;
        pq_tl_t tl;
        __gnu_cxx::typelist::apply(tst, tl);
       }
 
       {
-       typedef native_priority_queue<string_t, true, std::less<string_t>, sallocator_type> native_pq_t;
+       typedef native_priority_queue<string_t, true, cmp_type, 
+                                     allocator_type> native_pq_t;
        tst(native_pq_t());
       }
 
       {
-       typedef native_priority_queue<string_t, false, std::less<string_t>, sallocator_type> native_pq_t;
+       typedef native_priority_queue<string_t, false, cmp_type, 
+                                     allocator_type> native_pq_t;
        tst(native_pq_t());
       }
     }
index 95806685ba1d42f0147c26646917f039531b69e7..eab8950a9f41613389409d099be76cc41bd73b4b 100644 (file)
@@ -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<int, __gnu_pbds::null_mapped_type, std::less<int>, __gnu_pbds::tree_order_statistics_node_update>::performance_tl tl_t;
+       typedef tree_common_types<int, __gnu_pbds::null_type, std::less<int>, __gnu_pbds::tree_order_statistics_node_update>::performance_tl tl_t;
        tl_t tl;
        __gnu_cxx::typelist::apply(tst, tl);
       }
index c10fe01cd656ac74db82d543e89d5d8cc4060c5d..a9423e2576a069e12757b724e49cf240178d9723 100644 (file)
@@ -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<true> test_t;
        test_t tst(vn, vs, vm);
 
-       typedef tree_common_types<int, __gnu_pbds::null_mapped_type>::performance_tl tl_t;
+       typedef tree_common_types<int, __gnu_pbds::null_type>::performance_tl tl_t;
        tl_t tl;
        __gnu_cxx::typelist::apply(tst, tl);
       }
index 562f418fa22998f729967c0303e4f3b26ec80211..c95812207c20e388f85b289ef08b200fc12b483e 100644 (file)
@@ -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<Key>::type,
             class Eq_Fn = std::equal_to<Key>,
-            class Allocator = std::allocator<std::pair<const Key, Data> > >
+            typename _Alloc = std::allocator<std::pair<const Key, Data> > >
     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_<Key, Allocator> lin_p_t;
+      typedef __gnu_pbds::test::linear_probe_fn_t_<Key, _Alloc> lin_p_t;
 
-      typedef __gnu_pbds::test::quadratic_probe_fn_t_<Key, Allocator> quad_p_t;
+      typedef __gnu_pbds::test::quadratic_probe_fn_t_<Key, _Alloc> 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<Policy_Tl, 0>::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<Policy_Tl, 1>::type
        comb_hash_fn;
 
-        typedef
-       typename __gnu_cxx::typelist::at_index<
-         Policy_Tl, 2>::type
+        typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 2>::type
        trigger_policy;
 
-        typedef
-       typename __gnu_cxx::typelist::at_index<
-         Policy_Tl, 3>::type
+        typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 3>::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<size_policy, trigger_policy,
+                                               false>,
        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<Policy_Tl, 0>::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<Policy_Tl, 1>::type
        comb_hash_fn;
 
-        typedef
-       typename __gnu_cxx::typelist::at_index<
-         Policy_Tl, 2>::type
+        typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 2>::type
        trigger_policy;
 
-        typedef
-       typename __gnu_cxx::typelist::at_index<
-         Policy_Tl, 3>::type
+        typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 3>::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<size_policy, trigger_policy,
+                                               true>,
        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<Policy_Tl, 0>::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<Policy_Tl, 1>::type
        probe_fn;
 
-        typedef
-       typename __gnu_cxx::typelist::at_index<
-         Policy_Tl, 2>::type
+        typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 2>::type
        comb_probe_fn;
 
-        typedef
-       typename __gnu_cxx::typelist::at_index<
-         Policy_Tl, 3>::type
+        typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 3>::type
        trigger_policy;
 
-        typedef
-       typename __gnu_cxx::typelist::at_index<
-         Policy_Tl, 4>::type
+        typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 4>::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<size_policy, trigger_policy,
+                                               false>,
        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<Policy_Tl, 0>::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<Policy_Tl, 1>::type
        probe_fn;
 
-        typedef
-       typename __gnu_cxx::typelist::at_index<
-         Policy_Tl, 2>::type
+        typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 2>::type
        comb_probe_fn;
 
-        typedef
-       typename __gnu_cxx::typelist::at_index<
-         Policy_Tl, 3>::type
+        typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 3>::type
        trigger_policy;
 
-        typedef
-       typename __gnu_cxx::typelist::at_index<
-         Policy_Tl, 4>::type
+        typedef typename __gnu_cxx::typelist::at_index<Policy_Tl, 4>::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<size_policy, trigger_policy,
+                                               true>,
        store_hash,
-       Allocator>
+       _Alloc>
        type;
       };
 
@@ -512,19 +449,15 @@ namespace __gnu_pbds
             class Comb_Probe_Fn_TL,
             class Eq_Fn =
             std::equal_to<Key>,
-            class Allocator =
-            std::allocator<
-      std::pair<
-      const Key,
-      Data> > >
+            typename _Alloc = std::allocator<std::pair<const Key, Data> > >
     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<typename Comb_Hash_Fn_>
       struct half_resize_policy_selector;
 
-      template<typename Allocator_>
-      struct half_resize_policy_selector<
-        __gnu_pbds::test::direct_mask_range_hashing_t_<
-       Allocator_> >
+      template<typename _Alloc_>
+      struct half_resize_policy_selector<__gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc_> >
       {
         typedef mask_half_resize_policy_t type;
       };
 
-      template<typename Allocator_>
-      struct half_resize_policy_selector<
-        __gnu_pbds::test::direct_mod_range_hashing_t_<
-       Allocator_> >
+      template<typename _Alloc_>
+      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<typename Comb_Hash_Fn_>
       struct one_resize_policy_selector;
 
-      template<typename Allocator_>
-      struct one_resize_policy_selector<
-        __gnu_pbds::test::direct_mask_range_hashing_t_<
-       Allocator_> >
+      template<typename _Alloc_>
+      struct one_resize_policy_selector<__gnu_pbds::test::direct_mask_range_hashing_t_<_Alloc_> >
       {
         typedef mask_one_resize_policy_t type;
       };
 
-      template<typename Allocator_>
-      struct one_resize_policy_selector<
-        __gnu_pbds::test::direct_mod_range_hashing_t_<
-       Allocator_> >
+      template<typename _Alloc_>
+      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<typename Comb_Hash_Fn::comb_fn>::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<typename Comb_Probe_Fn::comb_fn>::type,
          false,
-         Allocator>
+         _Alloc>
        type;
       };
 
@@ -658,16 +580,15 @@ namespace __gnu_pbds
     };
 
     template<typename Key, typename Data, class Eq_Fn = std::equal_to<Key>,
-            class Allocator =
-            std::allocator<char> >
+            typename _Alloc = std::allocator<char> >
     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_<Allocator, 5> cnt_5_u;
+      typedef __gnu_pbds::test::lu_counter_policy_t_<_Alloc, 5> cnt_5_u;
 
       typedef typename __gnu_cxx::typelist::create1<mtf_u>::type lu_policy0;
 
@@ -687,20 +608,17 @@ namespace __gnu_pbds
 
       public:
         typedef
-       __gnu_pbds::list_update<Key, Data, Eq_Fn, update_policy_t, Allocator>
+       __gnu_pbds::list_update<Key, Data, Eq_Fn, update_policy_t, _Alloc>
        type;
       };
 
       typedef
-      typename __gnu_cxx::typelist::transform<
-       lu_policies,
+      typename __gnu_cxx::typelist::transform<lu_policies,
        generic_list_update_t>::type
       lu_types;
 
       typedef
-      typename __gnu_cxx::typelist::at_index<
-       lu_types,
-       0>::type
+      typename __gnu_cxx::typelist::at_index<lu_types, 0>::type
       min_lu_type;
 
     public:
@@ -711,12 +629,12 @@ namespace __gnu_pbds
     };
 
     template<typename Key, typename Data, class Cmp_Fn = std::less<Key>,
-            template<typename Const_Node_Iterator,
-                     class Node_Iterator,
+            template<typename Node_CItr,
+                     class Node_Itr,
                      class Cmp_Fn_,
-                     class Allocator_>
-    class Node_Update = __gnu_pbds::null_tree_node_update,
-            class Allocator = std::allocator<std::pair<const Key, Data> > >
+                     typename _Alloc_>
+    class Node_Update = __gnu_pbds::null_node_update,
+            typename _Alloc = std::allocator<std::pair<const Key, Data> > >
     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<typename Key,
             typename Data,
-            class E_Access_Traits =
-            typename __gnu_pbds::detail::default_trie_e_access_traits<Key>::type,
+            class _ATraits =
+            typename __gnu_pbds::detail::default_trie_access_traits<Key>::type,
             class Tag = __gnu_pbds::pat_trie_tag,
-            template<typename Const_Node_Iterator,
-                     typename Node_Iterator,
-                     class E_Access_Traits_,
-                     typename Allocator_>
-    class Node_Update = __gnu_pbds::null_trie_node_update,
-            class Allocator = std::allocator<char> >
+            template<typename Node_CItr,
+                     typename Node_Itr,
+                     class _ATraits_,
+                     typename _Alloc_>
+    class Node_Update = __gnu_pbds::null_node_update,
+            typename _Alloc = std::allocator<char> >
     class trie_common_types
     {
     private:
-      typedef __gnu_pbds::trie<Key, Data, E_Access_Traits, Tag, Node_Update, Allocator> type;
+      typedef __gnu_pbds::trie<Key, Data, _ATraits, Tag, Node_Update, _Alloc> type;
 
     public:
       typedef typename __gnu_cxx::typelist::create1<type>::type performance_tl;
index 9ee5c4dd7d528ff0b08bb3f7e3177b7098cb3b3b..b7650451f13f100d375f38ee1a16b369c2653adb 100644 (file)
@@ -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<Cntnr>::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<Cntnr>::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);
        }
index ed3747fa1c5a15c9209e574f24afde627262b74e..9f3e6bdf9bab9895f21b16bb9ffeaf0738611087 100644 (file)
@@ -54,7 +54,7 @@ namespace __gnu_pbds
       struct lu_policy_string_form;
 
       template<>
-      struct lu_policy_string_form<move_to_front_lu_policy_t_>
+      struct lu_policy_string_form<lu_move_to_front_policy_t_>
       {
        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<typename Allocator, typename Allocator::size_type Max_Count>
-      struct lu_policy_string_form<counter_lu_policy_t_<Allocator, Max_Count> >
+      template<typename _Alloc, typename _Alloc::size_type Max_Count>
+      struct lu_policy_string_form<lu_counter_policy_t_<_Alloc, Max_Count> >
       {
        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));
        }
       };
index 15cbbfda51fbf70340bd97b5224a41ea86630440..cb874d28b58d5ca6c8a4bf36c0700704b3cadb4a 100644 (file)
@@ -53,8 +53,8 @@ namespace __gnu_pbds
       template<typename Probe_Fn>
       struct probe_fn_string_form;
 
-      template<typename Key, class Allocator>
-      struct probe_fn_string_form<linear_probe_fn_t_<Key, Allocator> >
+      template<typename Key, typename _Alloc>
+      struct probe_fn_string_form<linear_probe_fn_t_<Key, _Alloc> >
       {
        static std::string
         name()
@@ -65,8 +65,8 @@ namespace __gnu_pbds
        { return make_xml_tag("Probe_Fn", "value", "linear_probe_fn"); }
       };
 
-      template<typename Key, class Allocator>
-      struct probe_fn_string_form<quadratic_probe_fn_t_<Key, Allocator> >
+      template<typename Key, typename _Alloc>
+      struct probe_fn_string_form<quadratic_probe_fn_t_<Key, _Alloc> >
       {
        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
index d2b61facb2ed24d1e6ab7b3e408d07b3ecdcee42..65655d7138741a5de0dd1c061772b1a8c09228c3 100644 (file)
@@ -55,9 +55,9 @@ namespace __gnu_pbds
       template<typename Size_Policy>
       struct size_policy_string_form;
 
-      template<typename Allocator>
+      template<typename _Alloc>
       struct size_policy_string_form<
-       __gnu_pbds::test::hash_exponential_size_policy_t_<Allocator> >
+       __gnu_pbds::test::hash_exponential_size_policy_t_<_Alloc> >
       {
        static std::string
         name()
index 80c1abe54aaeeb2eb6e352bcf60ba42406f8f583..a6322798988a74f1ac990268177d6556e57e7e83 100644 (file)
@@ -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
index fc9cacc630ab7540d10caafa146ff204c413a20c..925be58d47f2282850f0dd4c0b5ab571c845b67e 100644 (file)
@@ -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
          };
       };
index 20c52101015e27863221117c4d831e67b6e178cd..b73335e0aab9d39b435886f149b74f5d597c5537 100644 (file)
@@ -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
          };
       };
index be4fe264fa51a7963e81c521449be7ce2142d520..0d98fea7feb5389c2e80acfd33cd3da84a3e38f6 100644 (file)
@@ -53,15 +53,15 @@ namespace __gnu_pbds
       template<typename Trigger_Policy>
       struct trigger_policy_string_form;
 
-      template<typename Allocator,
-              typename Allocator::size_type Min_Load_Nom,
-              typename Allocator::size_type Min_Load_Denom,
-              typename Allocator::size_type Max_Load_Nom,
-              typename Allocator::size_type Max_Load_Denom,
+      template<typename _Alloc,
+              typename _Alloc::size_type Min_Load_Nom,
+              typename _Alloc::size_type Min_Load_Denom,
+              typename _Alloc::size_type Max_Load_Nom,
+              typename _Alloc::size_type Max_Load_Denom,
               bool External_Access>
       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<typename Allocator,
-              typename Allocator::size_type Load_Nom,
-              typename Allocator::size_type Load_Denom,
+      template<typename _Alloc,
+              typename _Alloc::size_type Load_Nom,
+              typename _Alloc::size_type Load_Denom,
               bool External_Access>
       struct trigger_policy_string_form<
        __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_<
-        Allocator,
+        _Alloc,
         Load_Nom,
         Load_Denom,
         External_Access> >
index a2655fe759d7ef4313645ea62aae8ab174202e42..bcee0a8eb03556f9f66ed0f7055dd4ba163ff0b1 100644 (file)
@@ -47,11 +47,11 @@ namespace __gnu_pbds
   namespace test
   {
     template<typename Key, class Cmp_Fn = std::less<Key>,
-            class Allocator = std::allocator<char> >
+            typename _Alloc = std::allocator<char> >
     class native_set : public PB_DS_BASE_C_DEC
     {
     private:
-      typedef std::set<Key, Cmp_Fn, typename Allocator::template rebind<Key>::other> base_type;
+      typedef std::set<Key, Cmp_Fn, typename _Alloc::template rebind<Key>::other> base_type;
 
     public:
       typedef native_tree_tag container_category;
index d7825ac63faca0ff6a4388b9a580fd39ee2de7fe..35e7ddd152add7b0eb391af561842434edeb928e 100644 (file)
@@ -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:
index 86db029e22b20e3a6ff391404e39ea6d5145120d..14d20dc08bbe98826ef39ef51fc4ea3329178482 100644 (file)
@@ -46,33 +46,33 @@ namespace __gnu_pbds
 {
   namespace test
   {
-    template<typename Allocator>
+    template<typename _Alloc>
     struct direct_mask_range_hashing_t_ 
-    : public __gnu_pbds::direct_mask_range_hashing<typename Allocator::size_type>
+    : public __gnu_pbds::direct_mask_range_hashing<typename _Alloc::size_type>
     {
-      typedef typename Allocator::size_type size_type;
+      typedef typename _Alloc::size_type size_type;
       typedef __gnu_pbds::direct_mask_range_hashing<size_type> base_type;
     };
 
-    template<typename Allocator>
+    template<typename _Alloc>
     struct direct_mod_range_hashing_t_ 
-    : public __gnu_pbds::direct_mod_range_hashing<typename Allocator::size_type>
+    : public __gnu_pbds::direct_mod_range_hashing<typename _Alloc::size_type>
     {
-      typedef typename Allocator::size_type size_type;
+      typedef typename _Alloc::size_type size_type;
       typedef __gnu_pbds::direct_mod_range_hashing<size_type> base_type;
     };
 
-    template<typename Allocator,
-            typename Allocator::size_type Min_Load_Nom,
-            typename Allocator::size_type Min_Load_Denom,
-            typename Allocator::size_type Max_Load_Nom,
-            typename Allocator::size_type Max_Load_Denom,
+    template<typename _Alloc,
+            typename _Alloc::size_type Min_Load_Nom,
+            typename _Alloc::size_type Min_Load_Denom,
+            typename _Alloc::size_type Max_Load_Nom,
+            typename _Alloc::size_type Max_Load_Denom,
             bool External_Access>
     struct hash_load_check_resize_trigger_t_ 
     : public __gnu_pbds::hash_load_check_resize_trigger<External_Access,
-                                                  typename Allocator::size_type>
+                                                  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<External_Access, size_type>  base_type;
 
       inline
@@ -87,15 +87,15 @@ namespace __gnu_pbds
        };
     };
 
-    template<typename Allocator,
-            typename Allocator::size_type Load_Nom,
-            typename Allocator::size_type Load_Denom,
+    template<typename _Alloc,
+            typename _Alloc::size_type Load_Nom,
+            typename _Alloc::size_type Load_Denom,
             bool External_Access>
     struct cc_hash_max_collision_check_resize_trigger_t_ 
     : public __gnu_pbds::cc_hash_max_collision_check_resize_trigger<External_Access,
-      typename Allocator::size_type>
+      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<External_Access, size_type> base_type;
 
       inline
@@ -113,30 +113,30 @@ namespace __gnu_pbds
     struct hash_prime_size_policy_t_ : public __gnu_pbds::hash_prime_size_policy
     { };
 
-    template<typename Allocator>
+    template<typename _Alloc>
     struct hash_exponential_size_policy_t_ 
-    : public __gnu_pbds::hash_exponential_size_policy<typename Allocator::size_type>
+    : public __gnu_pbds::hash_exponential_size_policy<typename _Alloc::size_type>
     { };
 
-    template<typename Key, class Allocator>
+    template<typename Key, typename _Alloc>
     struct linear_probe_fn_t_ 
-    : public __gnu_pbds::linear_probe_fn<typename Allocator::size_type>
+    : public __gnu_pbds::linear_probe_fn<typename _Alloc::size_type>
     { };
 
-    template<typename Key, class Allocator>
+    template<typename Key, typename _Alloc>
     struct quadratic_probe_fn_t_ 
-    : public __gnu_pbds::quadratic_probe_fn<typename Allocator::size_type>
+    : public __gnu_pbds::quadratic_probe_fn<typename _Alloc::size_type>
     { };
 
-    template<typename Allocator, typename Allocator::size_type Max_Count>
-    struct counter_lu_policy_t_ 
-    : public __gnu_pbds::counter_lu_policy<Max_Count, Allocator>
+    template<typename _Alloc, typename _Alloc::size_type Max_Count>
+    struct lu_counter_policy_t_ 
+    : public __gnu_pbds::lu_counter_policy<Max_Count, _Alloc>
     {
-      typedef __gnu_pbds::counter_lu_policy<Max_Count, Allocator> base_type;
+      typedef __gnu_pbds::lu_counter_policy<Max_Count, _Alloc> 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
index cc79b3eeca1e5b14c81917a63f82ccb9f0d3602a..b486c8c9c906beab8ed33688c13e83cd3b2b6b2a 100644 (file)
@@ -46,19 +46,19 @@ namespace __gnu_pbds
   namespace test
   {
     template<typename Value_Type, typename Cmp_Fn = std::less<Value_Type>,
-            class Allocator = std::allocator<Value_Type> >
+            typename _Alloc = std::allocator<Value_Type> >
     struct pq_common_types
     {
     private:
-      typedef __gnu_pbds::priority_queue<Value_Type, Cmp_Fn, __gnu_pbds::pairing_heap_tag, Allocator> pairing_heap_t;
+      typedef __gnu_pbds::priority_queue<Value_Type, Cmp_Fn, __gnu_pbds::pairing_heap_tag, _Alloc> pairing_heap_t;
 
-      typedef __gnu_pbds::priority_queue<Value_Type, Cmp_Fn, __gnu_pbds::binomial_heap_tag, Allocator> binomial_heap_t;
+      typedef __gnu_pbds::priority_queue<Value_Type, Cmp_Fn, __gnu_pbds::binomial_heap_tag, _Alloc> binomial_heap_t;
 
-      typedef __gnu_pbds::priority_queue<Value_Type, Cmp_Fn, __gnu_pbds::rc_binomial_heap_tag, Allocator> rc_binomial_heap_t;
+      typedef __gnu_pbds::priority_queue<Value_Type, Cmp_Fn, __gnu_pbds::rc_binomial_heap_tag, _Alloc> rc_binomial_heap_t;
 
-      typedef __gnu_pbds::priority_queue<Value_Type, Cmp_Fn, __gnu_pbds::binary_heap_tag, Allocator> binary_heap_t;
+      typedef __gnu_pbds::priority_queue<Value_Type, Cmp_Fn, __gnu_pbds::binary_heap_tag, _Alloc> binary_heap_t;
 
-      typedef __gnu_pbds::priority_queue<Value_Type, Cmp_Fn, __gnu_pbds::thin_heap_tag, Allocator> thin_heap_t;
+      typedef __gnu_pbds::priority_queue<Value_Type, Cmp_Fn, __gnu_pbds::thin_heap_tag, _Alloc> thin_heap_t;
 
       typedef typename __gnu_cxx::typelist::create5<thin_heap_t, pairing_heap_t, binomial_heap_t, rc_binomial_heap_t, binary_heap_t>::type all_tl;
 
index 6fa3667f309980a035e107c5543eb0188e3e02f0..acfa584c6c1f942de0de01ca8163755173affffb 100644 (file)
@@ -50,7 +50,7 @@ namespace __gnu_pbds
   {
 #define PB_DS_BASE_C_DEC \
     std::tr1::__unordered_map<Key, Data, Hash_Fn, Eq_Fn, \
-    typename Allocator::template rebind<std::pair<const Key, Data> >::other, Cache_Hash>
+    typename _Alloc::template rebind<std::pair<const Key, Data> >::other, Cache_Hash>
 
     template<typename Key,
             typename Data,
@@ -58,7 +58,7 @@ namespace __gnu_pbds
             typename Hash_Fn = typename __gnu_pbds::detail::default_hash_fn<Key>::type,
             typename Eq_Fn = std::equal_to<Key>,
             typename Less_Fn = std::less<Key>,
-            typename Allocator = std::allocator<char>, bool Cache_Hash = false
+            typename _Alloc = std::allocator<char>, bool Cache_Hash = false
             >
     class native_hash_map : public PB_DS_BASE_C_DEC
     {
index 8273edf36d64364e23586e2c62ee69afbd58828a..8008a0e89bf3a005ff3504598f1381d46ef3b82e 100644 (file)
@@ -49,7 +49,7 @@ namespace __gnu_pbds
   namespace test
   {
 #define PB_DS_BASE_C_DEC \
-    std::tr1::unordered_multimap<Key, Data, Hash_Fn, Eq_Fn, Allocator>
+    std::tr1::unordered_multimap<Key, Data, Hash_Fn, Eq_Fn, _Alloc>
 
     template<typename Key,
             typename Data,
@@ -57,7 +57,7 @@ namespace __gnu_pbds
        class Hash_Fn = typename __gnu_pbds::detail::default_hash_fn<Key>::type,
             class Eq_Fn = std::equal_to<Key>,
             class Less_Fn = std::less<Key>,
-            class Allocator = std::allocator<char> >
+            typename _Alloc = std::allocator<char> >
     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;
 
index d3f459624934ccb8acee1c9d3fd7e18eb29f2736..dac0c11eab93fbfdf41812a4799bc9deaeb94613 100644 (file)
@@ -50,14 +50,14 @@ namespace __gnu_pbds
   {
 #define PB_DS_BASE_C_DEC \
     std::tr1::__unordered_set<Key, Hash_Fn, Eq_Fn, \
-    typename Allocator::template rebind<Key>::other, Cache_Hash>
+    typename _Alloc::template rebind<Key>::other, Cache_Hash>
 
     template<typename Key,
             size_t Init_Size = 8,
          typename Hash_Fn = typename __gnu_pbds::detail::default_hash_fn<Key>::type,
             typename Eq_Fn = std::equal_to<Key>,
             typename Less_Fn = std::less<Key>,
-            typename Allocator = std::allocator<char>, bool Cache_Hash = false
+            typename _Alloc = std::allocator<char>, bool Cache_Hash = false
             >
     class native_hash_set : public PB_DS_BASE_C_DEC
     {
index 29170cae8e9ba6958f5071e58ca1ffac0d1f1e2e..0fae6b15c1c264a2f7a3046598714876134aff19 100644 (file)
@@ -50,10 +50,10 @@ namespace __gnu_pbds
   {
 #define PB_DS_BASE_C_DEC \
     std::map<Key, Data, Cmp_Fn,        \
-typename Allocator::template rebind<std::pair<const Key, Data > >::other >
+typename _Alloc::template rebind<std::pair<const Key, Data > >::other >
 
     template<typename Key, typename Data, class Cmp_Fn = std::less<Key>,
-            class Allocator = std::allocator<char> >
+            typename _Alloc = std::allocator<char> >
     class native_map : public PB_DS_BASE_C_DEC
     {
     private:
index 4bda5562d1ffa6901ec97034707c3ceb851b83a5..c29bfb68e5724257cdbc38b76712edf064a8c02a 100644 (file)
@@ -48,10 +48,10 @@ namespace __gnu_pbds
   {
 #define PB_DS_BASE_C_DEC \
     std::multimap<Key, Data, Less_Fn, \
-      typename Allocator::template rebind<std::pair<const Key, Data> >::other>
+      typename _Alloc::template rebind<std::pair<const Key, Data> >::other>
 
     template<typename Key, typename Data, class Less_Fn = std::less<Key>,
-            class Allocator = std::allocator<char> >
+            typename _Alloc = std::allocator<char> >
     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<Key, Data> >::other::const_reference
       const_reference;
 
index dad913fa0ab1e4d2350d1a33d44439b2f7006b2d..b2c7941034094f07c4e4287eb789eae2e0827679 100644 (file)
@@ -51,21 +51,21 @@ namespace __gnu_pbds
   {
     namespace detail
     {
-      template<typename Value_Type, bool Vector, typename Allocator>
+      template<typename Value_Type, bool Vector, typename _Alloc>
       struct base_seq
       {
       private:
-       typedef typename Allocator::template rebind<Value_Type> value_rebind;
+       typedef typename _Alloc::template rebind<Value_Type> value_rebind;
 
       public:
        typedef std::vector<Value_Type, typename value_rebind::other> type;
       };
 
-      template<typename Value_Type, typename Allocator>
-      struct base_seq<Value_Type, false, Allocator>
+      template<typename Value_Type, typename _Alloc>
+      struct base_seq<Value_Type, false, _Alloc>
       {
       private:
-       typedef typename Allocator::template rebind<Value_Type> value_rebind;
+       typedef typename _Alloc::template rebind<Value_Type> value_rebind;
 
       public:
        typedef std::deque<Value_Type, typename value_rebind::other> type;
@@ -76,20 +76,20 @@ namespace __gnu_pbds
     { };
 
 #define PB_DS_CLASS_C_DEC \
-    native_priority_queue<Value_Type, Vector, Cmp_Fn, Allocator>
+    native_priority_queue<Value_Type, Vector, Cmp_Fn, _Alloc>
 
 #define PB_DS_BASE_C_DEC \
-    std::priority_queue<Value_Type, typename detail::base_seq<Value_Type, Vector, Allocator>::type, Cmp_Fn>
+    std::priority_queue<Value_Type, typename detail::base_seq<Value_Type, Vector, _Alloc>::type, Cmp_Fn>
 
     template<typename Value_Type,
             bool Vector,
             typename Cmp_Fn = std::less<Value_Type>,
-            typename Allocator = std::allocator<char> >
+            typename _Alloc = std::allocator<char> >
     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_Type> value_rebind;
+      typedef typename _Alloc::template rebind<Value_Type> value_rebind;
 
     public:
       typedef Value_Type value_type;
index c9f448bf16e5f667836b18201c23caa7282e5ca8..c4909c726f370656fbe2c4e9bbe84bf68ed82a32 100644 (file)
@@ -48,10 +48,10 @@ namespace __gnu_pbds
   namespace test
   {
 #define PB_DS_BASE_C_DEC \
-    std::set<Key, Cmp_Fn, typename Allocator::template rebind<Key>::other>
+    std::set<Key, Cmp_Fn, typename _Alloc::template rebind<Key>::other>
 
     template<typename Key, class Cmp_Fn = std::less<Key>,
-            class Allocator = std::allocator<char> >
+            typename _Alloc = std::allocator<char> >
     class native_set : public PB_DS_BASE_C_DEC
     {
     private:
index e31abe106e604f40dd45402637143f44ffbe62bc..b4b07ea275575256a49751873f88fe6b30cd683a 100644 (file)
@@ -53,35 +53,35 @@ namespace __gnu_pbds
        { return (static_cast<size_t>(i)); }
       };
 
-      template<typename Key, typename Allocator = std::allocator<char> >
+      template<typename Key, typename _Alloc = std::allocator<char> >
       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<Key>,
-         Allocator>::performance_min_tl
+         _Alloc>::performance_min_tl
         type;
       };
 
-      template<typename Key, typename Allocator = std::allocator<char> >
+      template<typename Key, typename _Alloc = std::allocator<char> >
       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 Key,
               class Sec_Tl,
-              typename Allocator = std::allocator<char> >
+              typename _Alloc = std::allocator<char> >
       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 Key,
               class Sec_Tl,
-              typename Allocator = std::allocator<char> >
+              typename _Alloc = std::allocator<char> >
       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<typename Key, typename Mapped, typename Allocator>
+      template<typename Key, typename Mapped, typename _Alloc>
       struct hash_hash_mmap_tl_t
       {
       private:
-       typedef typename hash_set_tl_t<Mapped, Allocator>::type sec_tl_t;
+       typedef typename hash_set_tl_t<Mapped, _Alloc>::type sec_tl_t;
 
       public:
-       typedef typename hash_mmap_tl_t<Key, sec_tl_t, Allocator>::type type;
+       typedef typename hash_mmap_tl_t<Key, sec_tl_t, _Alloc>::type type;
       };
 
-      template<typename Key, typename Mapped, typename Allocator>
+      template<typename Key, typename Mapped, typename _Alloc>
       struct tree_hash_mmap_tl_t
       {
       private:
-       typedef typename hash_set_tl_t<Mapped, Allocator>::type sec_tl_t;
+       typedef typename hash_set_tl_t<Mapped, _Alloc>::type sec_tl_t;
 
       public:
-       typedef typename tree_mmap_tl_t<Key, sec_tl_t, Allocator>::type type;
+       typedef typename tree_mmap_tl_t<Key, sec_tl_t, _Alloc>::type type;
       };
 
-      template<typename Key, typename Mapped, typename Allocator>
+      template<typename Key, typename Mapped, typename _Alloc>
       struct tree_lu_mmap_tl_t
       {
       private:
-       typedef typename lu_set_tl_t<Mapped, Allocator>::type sec_tl_t;
+       typedef typename lu_set_tl_t<Mapped, _Alloc>::type sec_tl_t;
 
       public:
-       typedef typename tree_mmap_tl_t<Key, sec_tl_t, Allocator>::type type;
+       typedef typename tree_mmap_tl_t<Key, sec_tl_t, _Alloc>::type type;
       };
 
-      template<typename Key, typename Mapped, typename Allocator>
+      template<typename Key, typename Mapped, typename _Alloc>
       struct hash_lu_mmap_tl_t
       {
       private:
-       typedef typename lu_set_tl_t<Mapped, Allocator>::type sec_tl_t;
+       typedef typename lu_set_tl_t<Mapped, _Alloc>::type sec_tl_t;
 
       public:
-       typedef typename hash_mmap_tl_t<Key, sec_tl_t, Allocator>::type type;
+       typedef typename hash_mmap_tl_t<Key, sec_tl_t, _Alloc>::type type;
       };
     } // namespace detail
 
-    template<typename Key, typename Mapped, typename Allocator>
+    template<typename Key, typename Mapped, typename _Alloc>
     struct mmap_tl_t
     {
     private:
       typedef
-      typename detail::hash_hash_mmap_tl_t<Key, Mapped, Allocator>::type
+      typename detail::hash_hash_mmap_tl_t<Key, Mapped, _Alloc>::type
       hh_mmap_tl_t;
 
       typedef
-      typename detail::hash_lu_mmap_tl_t<Key, Mapped, Allocator>::type
+      typename detail::hash_lu_mmap_tl_t<Key, Mapped, _Alloc>::type
       hl_mmap_tl_t;
 
       typedef
-      typename detail::tree_hash_mmap_tl_t<Key, Mapped, Allocator>::type
+      typename detail::tree_hash_mmap_tl_t<Key, Mapped, _Alloc>::type
       th_mmap_tl_t;
 
       typedef
-      typename detail::tree_lu_mmap_tl_t<Key, Mapped, Allocator>::type
+      typename detail::tree_lu_mmap_tl_t<Key, Mapped, _Alloc>::type
       tl_mmap_tl_t;
 
     public:
index a553afeaba3a648793baa294b604b82c214d2f08..298443d314596a5345e2c4c111fce3a3ea3a51ea 100644 (file)
@@ -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<typename Cntnr_T>
@@ -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<typename Cntnr_T>
index 7e3f95bfc0c208bfe1d75bf7ecaa79b64877963b..18d2c6badcec89967525bfd69599ff606922a270 100644 (file)
@@ -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();
index 37705bc2d7d479788c8de825ab23718dc5a2a769..bcfc3bcd9fe4f33bb5b59a63e2c168921afe53b5 100644 (file)
@@ -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<basic_type, 'a', 'a' + basic_type::distinct_chars - 1, false, alloc_type> e_access_traits_t;
+  typedef __gnu_pbds::trie_string_access_traits<basic_type, 'a', 'a' + basic_type::distinct_chars - 1, false, alloc_type> access_traits_t;
 
   template<typename Data_Type>
   struct tree_types
   {
   private:
-    typedef typename tree_common_types<basic_type, Data_Type, std::less<basic_type>, __gnu_pbds::null_tree_node_update, alloc_type>::regression_tl no_order_statistics_tl_t;
+    typedef typename tree_common_types<basic_type, Data_Type, std::less<basic_type>, __gnu_pbds::null_node_update, alloc_type>::regression_tl no_order_statistics_tl_t;
 
     typedef typename tree_common_types<basic_type, Data_Type, std::less<basic_type>, __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<basic_type, Data_Type, e_access_traits_t, __gnu_pbds::pat_trie_tag, __gnu_pbds::null_trie_node_update, alloc_type>::regression_tl no_updates_tl_t;
+    typedef typename trie_common_types<basic_type, Data_Type, access_traits_t, __gnu_pbds::pat_trie_tag, __gnu_pbds::null_node_update, alloc_type>::regression_tl no_updates_tl_t;
 
-    typedef typename trie_common_types<basic_type, Data_Type, e_access_traits_t, __gnu_pbds::pat_trie_tag, __gnu_pbds::trie_order_statistics_node_update, alloc_type>::regression_tl order_statistics_tl_t;
+    typedef typename trie_common_types<basic_type, Data_Type, access_traits_t, __gnu_pbds::pat_trie_tag, __gnu_pbds::trie_order_statistics_node_update, alloc_type>::regression_tl order_statistics_tl_t;
 
-    typedef typename trie_common_types<basic_type, Data_Type, e_access_traits_t, __gnu_pbds::pat_trie_tag, __gnu_pbds::trie_prefix_search_node_update, alloc_type>::regression_tl prefix_search_tl_t;
+    typedef typename trie_common_types<basic_type, Data_Type, access_traits_t, __gnu_pbds::pat_trie_tag, __gnu_pbds::trie_prefix_search_node_update, alloc_type>::regression_tl prefix_search_tl_t;
 
   public:
     typedef typename __gnu_cxx::typelist::append<no_updates_tl_t, typename __gnu_cxx::typelist::append<prefix_search_tl_t, order_statistics_tl_t>::type>::type tl_t;
@@ -160,32 +160,27 @@ namespace test
 
   };
  
-  namespace detail
-  {
-
-  };
-
   typedef vector_adaptor<basic_type, alloc_type>       vector_type;
   typedef __gnu_cxx::typelist::create1<vector_type>::type vector_tl_t;
 
   // Associative types.
-  typedef tree_types<null_mapped_type>::tl_t           tree_set_tl_t;
-  typedef tree_types<null_mapped_type>::min_tl_t       min_tree_set_tl_t;
+  typedef tree_types<null_type>::tl_t          tree_set_tl_t;
+  typedef tree_types<null_type>::min_tl_t      min_tree_set_tl_t;
   typedef tree_types<basic_type>::tl_t                         tree_map_tl_t;
   typedef tree_types<basic_type>::min_tl_t             min_tree_map_tl_t;
 
-  typedef hash_types<null_mapped_type>::tl_t           hash_set_tl_t;
-  typedef hash_types<null_mapped_type>::min_tl_t       min_hash_set_tl_t;
+  typedef hash_types<null_type>::tl_t          hash_set_tl_t;
+  typedef hash_types<null_type>::min_tl_t      min_hash_set_tl_t;
   typedef hash_types<basic_type>::tl_t                         hash_map_tl_t;
   typedef hash_types<basic_type>::min_tl_t             min_hash_map_tl_t;
 
-  typedef lu_types<null_mapped_type>::tl_t             lu_set_tl_t;
-  typedef lu_types<null_mapped_type>::min_tl_t                 min_lu_set_tl_t;
+  typedef lu_types<null_type>::tl_t            lu_set_tl_t;
+  typedef lu_types<null_type>::min_tl_t                min_lu_set_tl_t;
   typedef lu_types<basic_type>::tl_t                   lu_map_tl_t;
   typedef lu_types<basic_type>::min_tl_t               min_lu_map_tl_t;
 
-  typedef trie_types<null_mapped_type>::tl_t           trie_set_tl_t;
-  typedef trie_types<null_mapped_type>::min_tl_t       min_trie_set_tl_t;
+  typedef trie_types<null_type>::tl_t          trie_set_tl_t;
+  typedef trie_types<null_type>::min_tl_t      min_trie_set_tl_t;
   typedef trie_types<basic_type>::tl_t                         trie_map_tl_t;
   typedef trie_types<basic_type>::min_tl_t             min_trie_map_tl_t;
 } // namespace test
index ca4433212169e102a2bba91781a60229b991ace9..48823bf04d0161df8b7024dbd4df9af1bad4d390 100644 (file)
@@ -75,7 +75,7 @@ namespace detail
     typedef typename cntnr::size_type                  size_type;
     typedef regression_test_traits<Cntnr>              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;
index 0f1586648538249d81b234e2df9e0dca8ec628be..7cc724a95f58b106d59bbb6d98e34d181dc3ce55 100644 (file)
@@ -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<typename cntnr::point_iterator, bool> 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<int,split_join>()));
+  typedef __gnu_pbds::detail::integral_constant<int, split_join> __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);
index 5f2304952364b764ffb50a7c8a43fcbb9bff0da0..936fbf5fcace61ef9f0edf4cfa0bbcde9472be91 100644 (file)
@@ -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<typename Cntnr>
     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 << " <sd> <n> <m> <tp> <ip> <ep> <cp> <mp> ['t' | 'f']" <<
-      endl << endl;
+    cerr << "usage: " << name 
+        << " <sd> <n> <m> <tp> <ip> <ep> <cp> <mp> ['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 "
index e929f3533fe7f3d2dc17f4594086b3ce9858f2e2..19cc3906eb16b4b1e09f61890c76809edfa864c2 100644 (file)
@@ -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);
index 37f8d51af74aedbbe2f02e3fa0c3a87f61e4a161..227f60b19dbbadf2c63f1139ac75b15875f3474b 100644 (file)
@@ -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<typename Cntnr>
     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;
   }
 
index 38761a1778e37ff8fcd9343dae7b8613c565944d..f8f5bae0d25e0569e94aff63876b5db54ff75ded 100644 (file)
@@ -47,58 +47,58 @@ namespace __gnu_pbds
     namespace detail
     {
 
-      template<typename Key, class Allocator>
+      template<typename Key, typename _Alloc>
       struct native_key_type;
 
-      template<typename Allocator>
+      template<typename _Alloc>
       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<typename Hd, class Tl, class Allocator>
+      template<typename Hd, class Tl, typename _Alloc>
       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<Hd, Tl> >::other::const_reference r_key)
+        native_key(typename _Alloc::template rebind<            std::pair<Hd, Tl> >::other::const_reference r_key)
        {
          return (std::make_pair(
-                                native_key_type<Hd, Allocator>::native_key(r_key.first),
-                                native_key_type<Tl, Allocator>::native_key(r_key.second)));
+                                native_key_type<Hd, _Alloc>::native_key(r_key.first),
+                                native_key_type<Tl, _Alloc>::native_key(r_key.second)));
        }
       };
 
       template<typename Native_Key_Type,
               class Key_Type,
               class Data_Type,
-              class Allocator>
+              typename _Alloc>
       struct native_type_traits_base;
 
-      template<typename Native_Key_Type, class Key_Type, class Allocator>
+      template<typename Native_Key_Type, class Key_Type, typename _Alloc>
       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<Key_Type, basic_type> >::other::const_reference r_val)
+        native_value(typename _Alloc::template rebind<            std::pair<Key_Type, basic_type> >::other::const_reference r_val)
        {
          return (std::make_pair(
-                                native_key_type<Key_Type, Allocator>::native_key(r_val.first),
+                                native_key_type<Key_Type, _Alloc>::native_key(r_val.first),
                                 std::string(r_val.second)));
        }
       };
 
-      template<typename Native_Key_Type, class Key_Type, class Allocator>
+      template<typename Native_Key_Type, class Key_Type, typename _Alloc>
       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<Key_Type, Allocator>::native_key(
+         return (native_key_type<Key_Type, _Alloc>::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<typename Key_Type, class Data_Type, class Allocator>
+      template<typename Key_Type, class Data_Type, typename _Alloc>
       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));
index a4a768e5e1c5c0b968831484955635c84ce1f360..6074f38cd72056062626f3fb8ffe236cf30e2b26 100644 (file)
@@ -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);
index c7ce5f7a314c82044686709d236925ce3dcdd58d..4c3f7cabe776b7cdcdfc7af8894b0d2018a29a36 100644 (file)
@@ -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<typename Gen>
        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<typename Gen>
        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<typename Gen>
@@ -96,11 +96,11 @@ namespace __gnu_pbds
                       std::pair<const basic_type, basic_type>)
        { 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; }
       };
index 24133cdc5878f3bcde973cbcb8040d46948f45e9..001c9c865989e93f78dc7a67d194a7a0666d5438 100644 (file)
@@ -56,7 +56,7 @@ namespace __gnu_test
   template<typename _Tp, bool _Bt = traits<_Tp>::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;
     };