Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +2 -0
- mingw/bin/windres.exe +3 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp +76 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp +77 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp +89 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp +94 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp +139 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp +60 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp +60 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp +65 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp +52 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp +78 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/eq_fn/eq_by_less.hpp +74 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp +185 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp +52 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp +46 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp +683 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp +64 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp +49 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp +117 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp +124 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp +89 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp +106 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp +143 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp +78 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp +80 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp +80 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp +80 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp +64 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp +64 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp +59 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp +113 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp +114 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp +65 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp +59 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp +365 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp +333 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp +79 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp +83 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp +83 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp +83 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp +168 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp +160 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp +158 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp +147 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp +156 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp +70 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp +181 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp +94 -0
- mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp +355 -0
.gitattributes
CHANGED
|
@@ -75,3 +75,5 @@ mingw/bin/gprof.exe filter=lfs diff=lfs merge=lfs -text
|
|
| 75 |
cmake/bin/cmake-gui.exe filter=lfs diff=lfs merge=lfs -text
|
| 76 |
ffmpeg/bin/avformat-61.dll filter=lfs diff=lfs merge=lfs -text
|
| 77 |
mingw/bin/strip.exe filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 75 |
cmake/bin/cmake-gui.exe filter=lfs diff=lfs merge=lfs -text
|
| 76 |
ffmpeg/bin/avformat-61.dll filter=lfs diff=lfs merge=lfs -text
|
| 77 |
mingw/bin/strip.exe filter=lfs diff=lfs merge=lfs -text
|
| 78 |
+
mingw/lib/gcc/mingw32/4.3.3/libstdc++.a filter=lfs diff=lfs merge=lfs -text
|
| 79 |
+
mingw/bin/windres.exe filter=lfs diff=lfs merge=lfs -text
|
mingw/bin/windres.exe
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fb1163e5e5259607994722d43703c698a2cd8b7a8f07bb94540ff4dff211bf9c
|
| 3 |
+
size 1080334
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file insert_no_store_hash_fn_imps.hpp
|
| 44 |
+
* Contains implementations of cc_ht_map_'s insert related functions,
|
| 45 |
+
* when the hash value is not stored.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
PB_DS_CLASS_T_DEC
|
| 49 |
+
inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
|
| 50 |
+
PB_DS_CLASS_C_DEC::
|
| 51 |
+
insert_imp(const_reference r_val, false_type)
|
| 52 |
+
{
|
| 53 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 54 |
+
const_key_reference r_key = PB_DS_V2F(r_val);
|
| 55 |
+
const size_type pos = ranged_hash_fn_base::operator()(r_key);
|
| 56 |
+
entry_pointer p_e = m_entries[pos];
|
| 57 |
+
resize_base::notify_insert_search_start();
|
| 58 |
+
|
| 59 |
+
while (p_e != NULL && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
|
| 60 |
+
r_key))
|
| 61 |
+
{
|
| 62 |
+
resize_base::notify_insert_search_collision();
|
| 63 |
+
p_e = p_e->m_p_next;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
resize_base::notify_insert_search_end();
|
| 67 |
+
if (p_e != NULL)
|
| 68 |
+
{
|
| 69 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
|
| 70 |
+
return std::make_pair(&p_e->m_value, false);
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
|
| 74 |
+
return std::make_pair(insert_new_imp(r_val, pos), true);
|
| 75 |
+
}
|
| 76 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file insert_store_hash_fn_imps.hpp
|
| 44 |
+
* Contains implementations of cc_ht_map_'s insert related functions,
|
| 45 |
+
* when the hash value is stored.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
PB_DS_CLASS_T_DEC
|
| 49 |
+
inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
|
| 50 |
+
PB_DS_CLASS_C_DEC::
|
| 51 |
+
insert_imp(const_reference r_val, true_type)
|
| 52 |
+
{
|
| 53 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 54 |
+
const_key_reference key = PB_DS_V2F(r_val);
|
| 55 |
+
comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(key);
|
| 56 |
+
entry_pointer p_e = m_entries[pos_hash_pair.first];
|
| 57 |
+
resize_base::notify_insert_search_start();
|
| 58 |
+
|
| 59 |
+
while (p_e != NULL && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
|
| 60 |
+
p_e->m_hash,
|
| 61 |
+
key, pos_hash_pair.second))
|
| 62 |
+
{
|
| 63 |
+
resize_base::notify_insert_search_collision();
|
| 64 |
+
p_e = p_e->m_p_next;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
resize_base::notify_insert_search_end();
|
| 68 |
+
if (p_e != NULL)
|
| 69 |
+
{
|
| 70 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);)
|
| 71 |
+
return std::make_pair(&p_e->m_value, false);
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
|
| 75 |
+
return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true);
|
| 76 |
+
}
|
| 77 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file iterators_fn_imps.hpp
|
| 44 |
+
* Contains implementations of cc_ht_map_'s iterators related functions, e.g.,
|
| 45 |
+
* begin().
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
PB_DS_CLASS_T_DEC
|
| 49 |
+
typename PB_DS_CLASS_C_DEC::iterator
|
| 50 |
+
PB_DS_CLASS_C_DEC::s_end_it;
|
| 51 |
+
|
| 52 |
+
PB_DS_CLASS_T_DEC
|
| 53 |
+
typename PB_DS_CLASS_C_DEC::const_iterator
|
| 54 |
+
PB_DS_CLASS_C_DEC::s_const_end_it;
|
| 55 |
+
|
| 56 |
+
PB_DS_CLASS_T_DEC
|
| 57 |
+
inline typename PB_DS_CLASS_C_DEC::iterator
|
| 58 |
+
PB_DS_CLASS_C_DEC::
|
| 59 |
+
begin()
|
| 60 |
+
{
|
| 61 |
+
pointer p_value;
|
| 62 |
+
std::pair<entry_pointer, size_type> pos;
|
| 63 |
+
get_start_it_state(p_value, pos);
|
| 64 |
+
return iterator(p_value, pos, this);
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
PB_DS_CLASS_T_DEC
|
| 68 |
+
inline typename PB_DS_CLASS_C_DEC::iterator
|
| 69 |
+
PB_DS_CLASS_C_DEC::
|
| 70 |
+
end()
|
| 71 |
+
{ return s_end_it; }
|
| 72 |
+
|
| 73 |
+
PB_DS_CLASS_T_DEC
|
| 74 |
+
inline typename PB_DS_CLASS_C_DEC::const_iterator
|
| 75 |
+
PB_DS_CLASS_C_DEC::
|
| 76 |
+
begin() const
|
| 77 |
+
{
|
| 78 |
+
pointer p_value;
|
| 79 |
+
std::pair<entry_pointer, size_type> pos;
|
| 80 |
+
get_start_it_state(p_value, pos);
|
| 81 |
+
return const_iterator(p_value, pos, this);
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
PB_DS_CLASS_T_DEC
|
| 85 |
+
inline typename PB_DS_CLASS_C_DEC::const_iterator
|
| 86 |
+
PB_DS_CLASS_C_DEC::
|
| 87 |
+
end() const
|
| 88 |
+
{ return s_const_end_it; }
|
| 89 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file policy_access_fn_imps.hpp
|
| 44 |
+
* Contains implementations of cc_ht_map_'s policy access
|
| 45 |
+
* functions.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
PB_DS_CLASS_T_DEC
|
| 49 |
+
Hash_Fn&
|
| 50 |
+
PB_DS_CLASS_C_DEC::
|
| 51 |
+
get_hash_fn()
|
| 52 |
+
{ return *this; }
|
| 53 |
+
|
| 54 |
+
PB_DS_CLASS_T_DEC
|
| 55 |
+
const Hash_Fn&
|
| 56 |
+
PB_DS_CLASS_C_DEC::
|
| 57 |
+
get_hash_fn() const
|
| 58 |
+
{ return *this; }
|
| 59 |
+
|
| 60 |
+
PB_DS_CLASS_T_DEC
|
| 61 |
+
Eq_Fn&
|
| 62 |
+
PB_DS_CLASS_C_DEC::
|
| 63 |
+
get_eq_fn()
|
| 64 |
+
{ return *this; }
|
| 65 |
+
|
| 66 |
+
PB_DS_CLASS_T_DEC
|
| 67 |
+
const Eq_Fn&
|
| 68 |
+
PB_DS_CLASS_C_DEC::
|
| 69 |
+
get_eq_fn() const
|
| 70 |
+
{ return *this; }
|
| 71 |
+
|
| 72 |
+
PB_DS_CLASS_T_DEC
|
| 73 |
+
Comb_Hash_Fn&
|
| 74 |
+
PB_DS_CLASS_C_DEC::
|
| 75 |
+
get_comb_hash_fn()
|
| 76 |
+
{ return *this; }
|
| 77 |
+
|
| 78 |
+
PB_DS_CLASS_T_DEC
|
| 79 |
+
const Comb_Hash_Fn&
|
| 80 |
+
PB_DS_CLASS_C_DEC::
|
| 81 |
+
get_comb_hash_fn() const
|
| 82 |
+
{ return *this; }
|
| 83 |
+
|
| 84 |
+
PB_DS_CLASS_T_DEC
|
| 85 |
+
Resize_Policy&
|
| 86 |
+
PB_DS_CLASS_C_DEC::
|
| 87 |
+
get_resize_policy()
|
| 88 |
+
{ return *this; }
|
| 89 |
+
|
| 90 |
+
PB_DS_CLASS_T_DEC
|
| 91 |
+
const Resize_Policy&
|
| 92 |
+
PB_DS_CLASS_C_DEC::
|
| 93 |
+
get_resize_policy() const
|
| 94 |
+
{ return *this; }
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file resize_fn_imps.hpp
|
| 44 |
+
* Contains implementations of cc_ht_map_'s resize related functions.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
PB_DS_CLASS_T_DEC
|
| 48 |
+
inline bool
|
| 49 |
+
PB_DS_CLASS_C_DEC::
|
| 50 |
+
do_resize_if_needed()
|
| 51 |
+
{
|
| 52 |
+
if (!resize_base::is_resize_needed())
|
| 53 |
+
return false;
|
| 54 |
+
resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));
|
| 55 |
+
return true;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
PB_DS_CLASS_T_DEC
|
| 59 |
+
void
|
| 60 |
+
PB_DS_CLASS_C_DEC::
|
| 61 |
+
do_resize(size_type len)
|
| 62 |
+
{ resize_imp(resize_base::get_nearest_larger_size(len)); }
|
| 63 |
+
|
| 64 |
+
PB_DS_CLASS_T_DEC
|
| 65 |
+
inline void
|
| 66 |
+
PB_DS_CLASS_C_DEC::
|
| 67 |
+
do_resize_if_needed_no_throw()
|
| 68 |
+
{
|
| 69 |
+
if (!resize_base::is_resize_needed())
|
| 70 |
+
return;
|
| 71 |
+
|
| 72 |
+
try
|
| 73 |
+
{
|
| 74 |
+
resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));
|
| 75 |
+
}
|
| 76 |
+
catch(...)
|
| 77 |
+
{ }
|
| 78 |
+
|
| 79 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
PB_DS_CLASS_T_DEC
|
| 83 |
+
void
|
| 84 |
+
PB_DS_CLASS_C_DEC::
|
| 85 |
+
resize_imp(size_type new_size)
|
| 86 |
+
{
|
| 87 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 88 |
+
if (new_size == m_num_e)
|
| 89 |
+
return;
|
| 90 |
+
|
| 91 |
+
const size_type old_size = m_num_e;
|
| 92 |
+
entry_pointer_array a_p_entries_resized;
|
| 93 |
+
|
| 94 |
+
// Following line might throw an exception.
|
| 95 |
+
ranged_hash_fn_base::notify_resized(new_size);
|
| 96 |
+
|
| 97 |
+
try
|
| 98 |
+
{
|
| 99 |
+
// Following line might throw an exception.
|
| 100 |
+
a_p_entries_resized = s_entry_pointer_allocator.allocate(new_size);
|
| 101 |
+
m_num_e = new_size;
|
| 102 |
+
}
|
| 103 |
+
catch(...)
|
| 104 |
+
{
|
| 105 |
+
ranged_hash_fn_base::notify_resized(old_size);
|
| 106 |
+
__throw_exception_again;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
// At this point no exceptions can be thrown.
|
| 110 |
+
resize_imp_no_exceptions(new_size, a_p_entries_resized, old_size);
|
| 111 |
+
Resize_Policy::notify_resized(new_size);
|
| 112 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
PB_DS_CLASS_T_DEC
|
| 116 |
+
void
|
| 117 |
+
PB_DS_CLASS_C_DEC::
|
| 118 |
+
resize_imp_no_exceptions(size_type new_size, entry_pointer_array a_p_entries_resized, size_type old_size)
|
| 119 |
+
{
|
| 120 |
+
std::fill(a_p_entries_resized, a_p_entries_resized + m_num_e,
|
| 121 |
+
entry_pointer(NULL));
|
| 122 |
+
|
| 123 |
+
for (size_type pos = 0; pos < old_size; ++pos)
|
| 124 |
+
{
|
| 125 |
+
entry_pointer p_e = m_entries[pos];
|
| 126 |
+
while (p_e != NULL)
|
| 127 |
+
p_e = resize_imp_no_exceptions_reassign_pointer(p_e, a_p_entries_resized, traits_base::m_store_extra_indicator);
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
m_num_e = new_size;
|
| 131 |
+
_GLIBCXX_DEBUG_ONLY(assert_entry_pointer_array_valid(a_p_entries_resized);)
|
| 132 |
+
s_entry_pointer_allocator.deallocate(m_entries, old_size);
|
| 133 |
+
m_entries = a_p_entries_resized;
|
| 134 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
#include <ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp>
|
| 138 |
+
#include <ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp>
|
| 139 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file resize_no_store_hash_fn_imps.hpp
|
| 44 |
+
* Contains implementations of cc_ht_map_'s resize related functions, when the
|
| 45 |
+
* hash value is not stored.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
PB_DS_CLASS_T_DEC
|
| 49 |
+
inline typename PB_DS_CLASS_C_DEC::entry_pointer
|
| 50 |
+
PB_DS_CLASS_C_DEC::
|
| 51 |
+
resize_imp_no_exceptions_reassign_pointer(entry_pointer p_e, entry_pointer_array a_p_entries_resized, false_type)
|
| 52 |
+
{
|
| 53 |
+
const size_type hash_pos =
|
| 54 |
+
ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value));
|
| 55 |
+
|
| 56 |
+
entry_pointer const p_next_e = p_e->m_p_next;
|
| 57 |
+
p_e->m_p_next = a_p_entries_resized[hash_pos];
|
| 58 |
+
a_p_entries_resized[hash_pos] = p_e;
|
| 59 |
+
return p_next_e;
|
| 60 |
+
}
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file resize_store_hash_fn_imps.hpp
|
| 44 |
+
* Contains implementations of cc_ht_map_'s resize related functions, when the
|
| 45 |
+
* hash value is stored.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
PB_DS_CLASS_T_DEC
|
| 49 |
+
inline typename PB_DS_CLASS_C_DEC::entry_pointer
|
| 50 |
+
PB_DS_CLASS_C_DEC::
|
| 51 |
+
resize_imp_no_exceptions_reassign_pointer(entry_pointer p_e, entry_pointer_array a_p_entries_resized, true_type)
|
| 52 |
+
{
|
| 53 |
+
const comp_hash pos_hash_pair =
|
| 54 |
+
ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash);
|
| 55 |
+
|
| 56 |
+
entry_pointer const p_next_e = p_e->m_p_next;
|
| 57 |
+
p_e->m_p_next = a_p_entries_resized[pos_hash_pair.first];
|
| 58 |
+
a_p_entries_resized[pos_hash_pair.first] = p_e;
|
| 59 |
+
return p_next_e;
|
| 60 |
+
}
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file size_fn_imps.hpp
|
| 44 |
+
* Contains implementations of cc_ht_map_'s entire container size related
|
| 45 |
+
* functions.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
PB_DS_CLASS_T_DEC
|
| 49 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 50 |
+
PB_DS_CLASS_C_DEC::
|
| 51 |
+
size() const
|
| 52 |
+
{ return m_num_used_e; }
|
| 53 |
+
|
| 54 |
+
PB_DS_CLASS_T_DEC
|
| 55 |
+
inline bool
|
| 56 |
+
PB_DS_CLASS_C_DEC::
|
| 57 |
+
empty() const
|
| 58 |
+
{ return (size() == 0); }
|
| 59 |
+
|
| 60 |
+
PB_DS_CLASS_T_DEC
|
| 61 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 62 |
+
PB_DS_CLASS_C_DEC::
|
| 63 |
+
max_size() const
|
| 64 |
+
{ return s_entry_allocator.max_size(); }
|
| 65 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file standard_policies.hpp
|
| 44 |
+
* Contains standard policies for cc_ht_map types.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#ifndef PB_DS_CC_HT_MAP_STANDARD_POLICIES_HPP
|
| 48 |
+
#define PB_DS_CC_HT_MAP_STANDARD_POLICIES_HPP
|
| 49 |
+
|
| 50 |
+
#include <ext/pb_ds/detail/standard_policies.hpp>
|
| 51 |
+
|
| 52 |
+
#endif // #ifndef PB_DS_CC_HT_MAP_STANDARD_POLICIES_HPP
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file trace_fn_imps.hpp
|
| 44 |
+
* Contains implementations of cc_ht_map_'s trace-mode functions.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#ifdef PB_DS_HT_MAP_TRACE_
|
| 48 |
+
|
| 49 |
+
PB_DS_CLASS_T_DEC
|
| 50 |
+
void
|
| 51 |
+
PB_DS_CLASS_C_DEC::
|
| 52 |
+
trace() const
|
| 53 |
+
{
|
| 54 |
+
std::cerr << static_cast<unsigned long>(m_num_e) << " "
|
| 55 |
+
<< static_cast<unsigned long>(m_num_used_e) << std::endl;
|
| 56 |
+
|
| 57 |
+
for (size_type i = 0; i < m_num_e; ++i)
|
| 58 |
+
{
|
| 59 |
+
std::cerr << static_cast<unsigned long>(i) << " ";
|
| 60 |
+
trace_list(m_entries[i]);
|
| 61 |
+
std::cerr << std::endl;
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
PB_DS_CLASS_T_DEC
|
| 66 |
+
void
|
| 67 |
+
PB_DS_CLASS_C_DEC::
|
| 68 |
+
trace_list(const_entry_pointer p_l) const
|
| 69 |
+
{
|
| 70 |
+
size_type iterated_num_used_e = 0;
|
| 71 |
+
while (p_l != NULL)
|
| 72 |
+
{
|
| 73 |
+
std::cerr << PB_DS_V2F(p_l->m_value) << " ";
|
| 74 |
+
p_l = p_l->m_p_next;
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
#endif
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file eq_by_less.hpp
|
| 44 |
+
* Contains an equivalence function.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#ifndef PB_DS_EQ_BY_LESS_HPP
|
| 48 |
+
#define PB_DS_EQ_BY_LESS_HPP
|
| 49 |
+
|
| 50 |
+
#include <utility>
|
| 51 |
+
#include <functional>
|
| 52 |
+
#include <vector>
|
| 53 |
+
#include <assert.h>
|
| 54 |
+
#include <ext/pb_ds/detail/types_traits.hpp>
|
| 55 |
+
|
| 56 |
+
namespace __gnu_pbds
|
| 57 |
+
{
|
| 58 |
+
namespace detail
|
| 59 |
+
{
|
| 60 |
+
template<typename Key, class Cmp_Fn>
|
| 61 |
+
struct eq_by_less : private Cmp_Fn
|
| 62 |
+
{
|
| 63 |
+
bool
|
| 64 |
+
operator()(const Key& r_lhs, const Key& r_rhs) const
|
| 65 |
+
{
|
| 66 |
+
const bool l = Cmp_Fn::operator()(r_lhs, r_rhs);
|
| 67 |
+
const bool g = Cmp_Fn::operator()(r_rhs, r_lhs);
|
| 68 |
+
return !(l || g);
|
| 69 |
+
}
|
| 70 |
+
};
|
| 71 |
+
} // namespace detail
|
| 72 |
+
} // namespace __gnu_pbds
|
| 73 |
+
|
| 74 |
+
#endif // #ifndef PB_DS_EQ_BY_LESS_HPP
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file hash_eq_fn.hpp
|
| 44 |
+
* Contains 2 eqivalence functions, one employing a hash value,
|
| 45 |
+
* and one ignoring it.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
#ifndef PB_DS_HASH_EQ_FN_HPP
|
| 49 |
+
#define PB_DS_HASH_EQ_FN_HPP
|
| 50 |
+
|
| 51 |
+
#include <utility>
|
| 52 |
+
#include <debug/debug.h>
|
| 53 |
+
|
| 54 |
+
namespace __gnu_pbds
|
| 55 |
+
{
|
| 56 |
+
namespace detail
|
| 57 |
+
{
|
| 58 |
+
template<typename Key, class Eq_Fn, class Allocator, bool Store_Hash>
|
| 59 |
+
struct hash_eq_fn;
|
| 60 |
+
|
| 61 |
+
#define PB_DS_CLASS_T_DEC \
|
| 62 |
+
template<typename Key, class Eq_Fn, class Allocator>
|
| 63 |
+
|
| 64 |
+
#define PB_DS_CLASS_C_DEC \
|
| 65 |
+
hash_eq_fn<Key, Eq_Fn, Allocator, false>
|
| 66 |
+
|
| 67 |
+
/**
|
| 68 |
+
* Specialization 1- The client requests that hash values not be stored.
|
| 69 |
+
**/
|
| 70 |
+
template<typename Key, class Eq_Fn, class Allocator>
|
| 71 |
+
struct hash_eq_fn<Key, Eq_Fn, Allocator, false> : public Eq_Fn
|
| 72 |
+
{
|
| 73 |
+
typedef Eq_Fn eq_fn_base;
|
| 74 |
+
|
| 75 |
+
typedef typename Allocator::template rebind<Key>::other key_allocator;
|
| 76 |
+
|
| 77 |
+
typedef typename key_allocator::const_reference const_key_reference;
|
| 78 |
+
|
| 79 |
+
hash_eq_fn();
|
| 80 |
+
|
| 81 |
+
hash_eq_fn(const Eq_Fn& r_eq_fn);
|
| 82 |
+
|
| 83 |
+
inline bool
|
| 84 |
+
operator()(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const;
|
| 85 |
+
|
| 86 |
+
inline void
|
| 87 |
+
swap(const PB_DS_CLASS_C_DEC& other);
|
| 88 |
+
};
|
| 89 |
+
|
| 90 |
+
PB_DS_CLASS_T_DEC
|
| 91 |
+
PB_DS_CLASS_C_DEC::
|
| 92 |
+
hash_eq_fn()
|
| 93 |
+
{ }
|
| 94 |
+
|
| 95 |
+
PB_DS_CLASS_T_DEC
|
| 96 |
+
inline void
|
| 97 |
+
PB_DS_CLASS_C_DEC::
|
| 98 |
+
swap(const PB_DS_CLASS_C_DEC& other)
|
| 99 |
+
{ std::swap((Eq_Fn& )(*this), (Eq_Fn& )other); }
|
| 100 |
+
|
| 101 |
+
PB_DS_CLASS_T_DEC
|
| 102 |
+
PB_DS_CLASS_C_DEC::
|
| 103 |
+
hash_eq_fn(const Eq_Fn& r_eq_fn) :
|
| 104 |
+
Eq_Fn(r_eq_fn)
|
| 105 |
+
{ }
|
| 106 |
+
|
| 107 |
+
PB_DS_CLASS_T_DEC
|
| 108 |
+
inline bool
|
| 109 |
+
PB_DS_CLASS_C_DEC::
|
| 110 |
+
operator()(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const
|
| 111 |
+
{ return (eq_fn_base::operator()(r_lhs_key, r_rhs_key)); }
|
| 112 |
+
|
| 113 |
+
#undef PB_DS_CLASS_T_DEC
|
| 114 |
+
#undef PB_DS_CLASS_C_DEC
|
| 115 |
+
|
| 116 |
+
#define PB_DS_CLASS_T_DEC \
|
| 117 |
+
template<typename Key, class Eq_Fn, class Allocator>
|
| 118 |
+
|
| 119 |
+
#define PB_DS_CLASS_C_DEC \
|
| 120 |
+
hash_eq_fn<Key, Eq_Fn, Allocator, true>
|
| 121 |
+
|
| 122 |
+
/**
|
| 123 |
+
* Specialization 2- The client requests that hash values be stored.
|
| 124 |
+
**/
|
| 125 |
+
template<typename Key, class Eq_Fn, class Allocator>
|
| 126 |
+
struct hash_eq_fn<Key, Eq_Fn, Allocator, true> :
|
| 127 |
+
public Eq_Fn
|
| 128 |
+
{
|
| 129 |
+
typedef typename Allocator::size_type size_type;
|
| 130 |
+
|
| 131 |
+
typedef Eq_Fn eq_fn_base;
|
| 132 |
+
|
| 133 |
+
typedef typename Allocator::template rebind<Key>::other key_allocator;
|
| 134 |
+
|
| 135 |
+
typedef typename key_allocator::const_reference const_key_reference;
|
| 136 |
+
|
| 137 |
+
hash_eq_fn();
|
| 138 |
+
|
| 139 |
+
hash_eq_fn(const Eq_Fn& r_eq_fn);
|
| 140 |
+
|
| 141 |
+
inline bool
|
| 142 |
+
operator()(const_key_reference r_lhs_key, size_type lhs_hash,
|
| 143 |
+
const_key_reference r_rhs_key, size_type rhs_hash) const;
|
| 144 |
+
|
| 145 |
+
inline void
|
| 146 |
+
swap(const PB_DS_CLASS_C_DEC& other);
|
| 147 |
+
};
|
| 148 |
+
|
| 149 |
+
PB_DS_CLASS_T_DEC
|
| 150 |
+
PB_DS_CLASS_C_DEC::
|
| 151 |
+
hash_eq_fn()
|
| 152 |
+
{ }
|
| 153 |
+
|
| 154 |
+
PB_DS_CLASS_T_DEC
|
| 155 |
+
PB_DS_CLASS_C_DEC::
|
| 156 |
+
hash_eq_fn(const Eq_Fn& r_eq_fn) :
|
| 157 |
+
Eq_Fn(r_eq_fn)
|
| 158 |
+
{ }
|
| 159 |
+
|
| 160 |
+
PB_DS_CLASS_T_DEC
|
| 161 |
+
inline bool
|
| 162 |
+
PB_DS_CLASS_C_DEC::
|
| 163 |
+
operator()(const_key_reference r_lhs_key, size_type lhs_hash,
|
| 164 |
+
const_key_reference r_rhs_key, size_type rhs_hash) const
|
| 165 |
+
{
|
| 166 |
+
_GLIBCXX_DEBUG_ASSERT(!eq_fn_base::operator()(r_lhs_key, r_rhs_key)
|
| 167 |
+
|| lhs_hash == rhs_hash);
|
| 168 |
+
|
| 169 |
+
return (lhs_hash == rhs_hash &&
|
| 170 |
+
eq_fn_base::operator()(r_lhs_key, r_rhs_key));
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
PB_DS_CLASS_T_DEC
|
| 174 |
+
inline void
|
| 175 |
+
PB_DS_CLASS_C_DEC::
|
| 176 |
+
swap(const PB_DS_CLASS_C_DEC& other)
|
| 177 |
+
{ std::swap((Eq_Fn& )(*this), (Eq_Fn& )(other)); }
|
| 178 |
+
|
| 179 |
+
#undef PB_DS_CLASS_T_DEC
|
| 180 |
+
#undef PB_DS_CLASS_C_DEC
|
| 181 |
+
|
| 182 |
+
} // namespace detail
|
| 183 |
+
} // namespace __gnu_pbds
|
| 184 |
+
|
| 185 |
+
#endif
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file find_no_store_hash_fn_imps.hpp
|
| 44 |
+
* Contains implementations of gp_ht_map_'s find related functions,
|
| 45 |
+
* when the hash value is not stored.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
PB_DS_CLASS_T_DEC
|
| 49 |
+
inline typename PB_DS_CLASS_C_DEC::pointer
|
| 50 |
+
PB_DS_CLASS_C_DEC::
|
| 51 |
+
find_key_pointer(const_key_reference r_key, false_type)
|
| 52 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file find_store_hash_fn_imps.hpp
|
| 44 |
+
* Contains implementations of gp_ht_map_'s insert related functions,
|
| 45 |
+
* when the hash value is stored.
|
| 46 |
+
*/
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
ADDED
|
@@ -0,0 +1,683 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file gp_ht_map_.hpp
|
| 44 |
+
* Contains an implementation class for gp_ht_map_.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#include <ext/pb_ds/tag_and_trait.hpp>
|
| 48 |
+
#include <ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp>
|
| 49 |
+
#include <ext/pb_ds/detail/types_traits.hpp>
|
| 50 |
+
#include <ext/pb_ds/exception.hpp>
|
| 51 |
+
#include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp>
|
| 52 |
+
#include <utility>
|
| 53 |
+
#ifdef PB_DS_HT_MAP_TRACE_
|
| 54 |
+
#include <iostream>
|
| 55 |
+
#endif
|
| 56 |
+
#ifdef _GLIBCXX_DEBUG
|
| 57 |
+
#include <ext/pb_ds/detail/debug_map_base.hpp>
|
| 58 |
+
#endif
|
| 59 |
+
#include <debug/debug.h>
|
| 60 |
+
|
| 61 |
+
namespace __gnu_pbds
|
| 62 |
+
{
|
| 63 |
+
namespace detail
|
| 64 |
+
{
|
| 65 |
+
#define PB_DS_CLASS_T_DEC \
|
| 66 |
+
template<typename Key, typename Mapped, typename Hash_Fn, typename Eq_Fn, \
|
| 67 |
+
typename Allocator, bool Store_Hash, typename Comb_Probe_Fn, \
|
| 68 |
+
typename Probe_Fn, typename Resize_Policy>
|
| 69 |
+
|
| 70 |
+
#ifdef PB_DS_DATA_TRUE_INDICATOR
|
| 71 |
+
#define PB_DS_CLASS_NAME gp_ht_map_data_
|
| 72 |
+
#endif
|
| 73 |
+
|
| 74 |
+
#ifdef PB_DS_DATA_FALSE_INDICATOR
|
| 75 |
+
#define PB_DS_CLASS_NAME gp_ht_map_no_data_
|
| 76 |
+
#endif
|
| 77 |
+
|
| 78 |
+
#define PB_DS_CLASS_C_DEC \
|
| 79 |
+
PB_DS_CLASS_NAME<Key, Mapped, Hash_Fn, Eq_Fn, Allocator, \
|
| 80 |
+
Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy>
|
| 81 |
+
|
| 82 |
+
#define PB_DS_HASH_EQ_FN_C_DEC \
|
| 83 |
+
hash_eq_fn<Key, Eq_Fn, Allocator, Store_Hash>
|
| 84 |
+
|
| 85 |
+
#define PB_DS_RANGED_PROBE_FN_C_DEC \
|
| 86 |
+
ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, Store_Hash>
|
| 87 |
+
|
| 88 |
+
#define PB_DS_TYPES_TRAITS_C_DEC \
|
| 89 |
+
types_traits<Key, Mapped, Allocator, Store_Hash>
|
| 90 |
+
|
| 91 |
+
#ifdef _GLIBCXX_DEBUG
|
| 92 |
+
#define PB_DS_DEBUG_MAP_BASE_C_DEC \
|
| 93 |
+
debug_map_base<Key, Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference>
|
| 94 |
+
#endif
|
| 95 |
+
|
| 96 |
+
#ifdef PB_DS_DATA_TRUE_INDICATOR
|
| 97 |
+
#define PB_DS_V2F(X) (X).first
|
| 98 |
+
#define PB_DS_V2S(X) (X).second
|
| 99 |
+
#endif
|
| 100 |
+
|
| 101 |
+
#ifdef PB_DS_DATA_FALSE_INDICATOR
|
| 102 |
+
#define PB_DS_V2F(X) (X)
|
| 103 |
+
#define PB_DS_V2S(X) Mapped()
|
| 104 |
+
#endif
|
| 105 |
+
|
| 106 |
+
template<typename Key,
|
| 107 |
+
typename Mapped,
|
| 108 |
+
typename Hash_Fn,
|
| 109 |
+
typename Eq_Fn,
|
| 110 |
+
typename Allocator,
|
| 111 |
+
bool Store_Hash,
|
| 112 |
+
typename Comb_Probe_Fn,
|
| 113 |
+
typename Probe_Fn,
|
| 114 |
+
typename Resize_Policy>
|
| 115 |
+
class PB_DS_CLASS_NAME :
|
| 116 |
+
#ifdef _GLIBCXX_DEBUG
|
| 117 |
+
protected PB_DS_DEBUG_MAP_BASE_C_DEC,
|
| 118 |
+
#endif
|
| 119 |
+
public PB_DS_HASH_EQ_FN_C_DEC,
|
| 120 |
+
public Resize_Policy,
|
| 121 |
+
public PB_DS_RANGED_PROBE_FN_C_DEC,
|
| 122 |
+
public PB_DS_TYPES_TRAITS_C_DEC
|
| 123 |
+
{
|
| 124 |
+
private:
|
| 125 |
+
typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
|
| 126 |
+
typedef typename traits_base::value_type value_type_;
|
| 127 |
+
typedef typename traits_base::pointer pointer_;
|
| 128 |
+
typedef typename traits_base::const_pointer const_pointer_;
|
| 129 |
+
typedef typename traits_base::reference reference_;
|
| 130 |
+
typedef typename traits_base::const_reference const_reference_;
|
| 131 |
+
typedef typename traits_base::comp_hash comp_hash;
|
| 132 |
+
|
| 133 |
+
enum entry_status
|
| 134 |
+
{
|
| 135 |
+
empty_entry_status,
|
| 136 |
+
valid_entry_status,
|
| 137 |
+
erased_entry_status
|
| 138 |
+
} __attribute__ ((packed));
|
| 139 |
+
|
| 140 |
+
struct entry : public traits_base::stored_value_type
|
| 141 |
+
{
|
| 142 |
+
entry_status m_stat;
|
| 143 |
+
};
|
| 144 |
+
|
| 145 |
+
typedef typename Allocator::template rebind<entry>::other entry_allocator;
|
| 146 |
+
typedef typename entry_allocator::pointer entry_pointer;
|
| 147 |
+
typedef typename entry_allocator::const_pointer const_entry_pointer;
|
| 148 |
+
typedef typename entry_allocator::reference entry_reference;
|
| 149 |
+
typedef typename entry_allocator::const_reference const_entry_reference;
|
| 150 |
+
typedef typename entry_allocator::pointer entry_array;
|
| 151 |
+
|
| 152 |
+
typedef PB_DS_RANGED_PROBE_FN_C_DEC ranged_probe_fn_base;
|
| 153 |
+
|
| 154 |
+
#ifdef _GLIBCXX_DEBUG
|
| 155 |
+
typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
|
| 156 |
+
#endif
|
| 157 |
+
|
| 158 |
+
typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base;
|
| 159 |
+
typedef Resize_Policy resize_base;
|
| 160 |
+
|
| 161 |
+
#define PB_DS_GEN_POS typename Allocator::size_type
|
| 162 |
+
|
| 163 |
+
#include <ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp>
|
| 164 |
+
#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>
|
| 165 |
+
#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>
|
| 166 |
+
#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>
|
| 167 |
+
|
| 168 |
+
#undef PB_DS_GEN_POS
|
| 169 |
+
|
| 170 |
+
public:
|
| 171 |
+
typedef Allocator allocator;
|
| 172 |
+
typedef typename Allocator::size_type size_type;
|
| 173 |
+
typedef typename Allocator::difference_type difference_type;
|
| 174 |
+
typedef Hash_Fn hash_fn;
|
| 175 |
+
typedef Eq_Fn eq_fn;
|
| 176 |
+
typedef Probe_Fn probe_fn;
|
| 177 |
+
typedef Comb_Probe_Fn comb_probe_fn;
|
| 178 |
+
typedef Resize_Policy resize_policy;
|
| 179 |
+
|
| 180 |
+
enum
|
| 181 |
+
{
|
| 182 |
+
store_hash = Store_Hash
|
| 183 |
+
};
|
| 184 |
+
|
| 185 |
+
typedef typename traits_base::key_type key_type;
|
| 186 |
+
typedef typename traits_base::key_pointer key_pointer;
|
| 187 |
+
typedef typename traits_base::const_key_pointer const_key_pointer;
|
| 188 |
+
typedef typename traits_base::key_reference key_reference;
|
| 189 |
+
typedef typename traits_base::const_key_reference const_key_reference;
|
| 190 |
+
typedef typename traits_base::mapped_type mapped_type;
|
| 191 |
+
typedef typename traits_base::mapped_pointer mapped_pointer;
|
| 192 |
+
typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
|
| 193 |
+
typedef typename traits_base::mapped_reference mapped_reference;
|
| 194 |
+
typedef typename traits_base::const_mapped_reference const_mapped_reference;
|
| 195 |
+
typedef typename traits_base::value_type value_type;
|
| 196 |
+
typedef typename traits_base::pointer pointer;
|
| 197 |
+
typedef typename traits_base::const_pointer const_pointer;
|
| 198 |
+
typedef typename traits_base::reference reference;
|
| 199 |
+
typedef typename traits_base::const_reference const_reference;
|
| 200 |
+
|
| 201 |
+
#ifdef PB_DS_DATA_TRUE_INDICATOR
|
| 202 |
+
typedef point_iterator_ point_iterator;
|
| 203 |
+
#endif
|
| 204 |
+
|
| 205 |
+
#ifdef PB_DS_DATA_FALSE_INDICATOR
|
| 206 |
+
typedef const_point_iterator_ point_iterator;
|
| 207 |
+
#endif
|
| 208 |
+
|
| 209 |
+
typedef const_point_iterator_ const_point_iterator;
|
| 210 |
+
|
| 211 |
+
#ifdef PB_DS_DATA_TRUE_INDICATOR
|
| 212 |
+
typedef iterator_ iterator;
|
| 213 |
+
#endif
|
| 214 |
+
|
| 215 |
+
#ifdef PB_DS_DATA_FALSE_INDICATOR
|
| 216 |
+
typedef const_iterator_ iterator;
|
| 217 |
+
#endif
|
| 218 |
+
|
| 219 |
+
typedef const_iterator_ const_iterator;
|
| 220 |
+
|
| 221 |
+
PB_DS_CLASS_NAME();
|
| 222 |
+
|
| 223 |
+
PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
|
| 224 |
+
|
| 225 |
+
PB_DS_CLASS_NAME(const Hash_Fn&);
|
| 226 |
+
|
| 227 |
+
PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&);
|
| 228 |
+
|
| 229 |
+
PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&);
|
| 230 |
+
|
| 231 |
+
PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,
|
| 232 |
+
const Probe_Fn&);
|
| 233 |
+
|
| 234 |
+
PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,
|
| 235 |
+
const Probe_Fn&, const Resize_Policy&);
|
| 236 |
+
|
| 237 |
+
template<typename It>
|
| 238 |
+
void
|
| 239 |
+
copy_from_range(It first_it, It last_it);
|
| 240 |
+
|
| 241 |
+
virtual
|
| 242 |
+
~PB_DS_CLASS_NAME();
|
| 243 |
+
|
| 244 |
+
void
|
| 245 |
+
swap(PB_DS_CLASS_C_DEC& other);
|
| 246 |
+
|
| 247 |
+
inline size_type
|
| 248 |
+
size() const;
|
| 249 |
+
|
| 250 |
+
inline size_type
|
| 251 |
+
max_size() const;
|
| 252 |
+
|
| 253 |
+
inline bool
|
| 254 |
+
empty() const;
|
| 255 |
+
|
| 256 |
+
Hash_Fn&
|
| 257 |
+
get_hash_fn();
|
| 258 |
+
|
| 259 |
+
const Hash_Fn&
|
| 260 |
+
get_hash_fn() const;
|
| 261 |
+
|
| 262 |
+
Eq_Fn&
|
| 263 |
+
get_eq_fn();
|
| 264 |
+
|
| 265 |
+
const Eq_Fn&
|
| 266 |
+
get_eq_fn() const;
|
| 267 |
+
|
| 268 |
+
Probe_Fn&
|
| 269 |
+
get_probe_fn();
|
| 270 |
+
|
| 271 |
+
const Probe_Fn&
|
| 272 |
+
get_probe_fn() const;
|
| 273 |
+
|
| 274 |
+
Comb_Probe_Fn&
|
| 275 |
+
get_comb_probe_fn();
|
| 276 |
+
|
| 277 |
+
const Comb_Probe_Fn&
|
| 278 |
+
get_comb_probe_fn() const;
|
| 279 |
+
|
| 280 |
+
Resize_Policy&
|
| 281 |
+
get_resize_policy();
|
| 282 |
+
|
| 283 |
+
const Resize_Policy&
|
| 284 |
+
get_resize_policy() const;
|
| 285 |
+
|
| 286 |
+
inline std::pair<point_iterator, bool>
|
| 287 |
+
insert(const_reference r_val)
|
| 288 |
+
{
|
| 289 |
+
_GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
|
| 290 |
+
return insert_imp(r_val, traits_base::m_store_extra_indicator);
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
inline mapped_reference
|
| 294 |
+
operator[](const_key_reference r_key)
|
| 295 |
+
{
|
| 296 |
+
#ifdef PB_DS_DATA_TRUE_INDICATOR
|
| 297 |
+
return subscript_imp(r_key, traits_base::m_store_extra_indicator);
|
| 298 |
+
#else
|
| 299 |
+
insert(r_key);
|
| 300 |
+
return traits_base::s_null_mapped;
|
| 301 |
+
#endif
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
inline point_iterator
|
| 305 |
+
find(const_key_reference r_key);
|
| 306 |
+
|
| 307 |
+
inline const_point_iterator
|
| 308 |
+
find(const_key_reference r_key) const;
|
| 309 |
+
|
| 310 |
+
inline point_iterator
|
| 311 |
+
find_end();
|
| 312 |
+
|
| 313 |
+
inline const_point_iterator
|
| 314 |
+
find_end() const;
|
| 315 |
+
|
| 316 |
+
inline bool
|
| 317 |
+
erase(const_key_reference r_key);
|
| 318 |
+
|
| 319 |
+
template<typename Pred>
|
| 320 |
+
inline size_type
|
| 321 |
+
erase_if(Pred prd);
|
| 322 |
+
|
| 323 |
+
void
|
| 324 |
+
clear();
|
| 325 |
+
|
| 326 |
+
inline iterator
|
| 327 |
+
begin();
|
| 328 |
+
|
| 329 |
+
inline const_iterator
|
| 330 |
+
begin() const;
|
| 331 |
+
|
| 332 |
+
inline iterator
|
| 333 |
+
end();
|
| 334 |
+
|
| 335 |
+
inline const_iterator
|
| 336 |
+
end() const;
|
| 337 |
+
|
| 338 |
+
#ifdef _GLIBCXX_DEBUG
|
| 339 |
+
void
|
| 340 |
+
assert_valid() const;
|
| 341 |
+
#endif
|
| 342 |
+
|
| 343 |
+
#ifdef PB_DS_HT_MAP_TRACE_
|
| 344 |
+
void
|
| 345 |
+
trace() const;
|
| 346 |
+
#endif
|
| 347 |
+
|
| 348 |
+
private:
|
| 349 |
+
#ifdef PB_DS_DATA_TRUE_INDICATOR
|
| 350 |
+
friend class iterator_;
|
| 351 |
+
#endif
|
| 352 |
+
|
| 353 |
+
friend class const_iterator_;
|
| 354 |
+
|
| 355 |
+
void
|
| 356 |
+
deallocate_all();
|
| 357 |
+
|
| 358 |
+
void
|
| 359 |
+
initialize();
|
| 360 |
+
|
| 361 |
+
void
|
| 362 |
+
erase_all_valid_entries(entry_array, size_type);
|
| 363 |
+
|
| 364 |
+
inline bool
|
| 365 |
+
do_resize_if_needed();
|
| 366 |
+
|
| 367 |
+
inline void
|
| 368 |
+
do_resize_if_needed_no_throw();
|
| 369 |
+
|
| 370 |
+
void
|
| 371 |
+
resize_imp(size_type);
|
| 372 |
+
|
| 373 |
+
virtual void
|
| 374 |
+
do_resize(size_type);
|
| 375 |
+
|
| 376 |
+
void
|
| 377 |
+
resize_imp(entry_array, size_type);
|
| 378 |
+
|
| 379 |
+
inline void
|
| 380 |
+
resize_imp_reassign(entry_pointer, entry_array, false_type);
|
| 381 |
+
|
| 382 |
+
inline void
|
| 383 |
+
resize_imp_reassign(entry_pointer, entry_array, true_type);
|
| 384 |
+
|
| 385 |
+
inline size_type
|
| 386 |
+
find_ins_pos(const_key_reference, false_type);
|
| 387 |
+
|
| 388 |
+
inline comp_hash
|
| 389 |
+
find_ins_pos(const_key_reference, true_type);
|
| 390 |
+
|
| 391 |
+
inline std::pair<point_iterator, bool>
|
| 392 |
+
insert_imp(const_reference, false_type);
|
| 393 |
+
|
| 394 |
+
inline std::pair<point_iterator, bool>
|
| 395 |
+
insert_imp(const_reference, true_type);
|
| 396 |
+
|
| 397 |
+
inline pointer
|
| 398 |
+
insert_new_imp(const_reference r_val, size_type pos)
|
| 399 |
+
{
|
| 400 |
+
_GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);
|
| 401 |
+
|
| 402 |
+
if (do_resize_if_needed())
|
| 403 |
+
pos = find_ins_pos(PB_DS_V2F(r_val),
|
| 404 |
+
traits_base::m_store_extra_indicator);
|
| 405 |
+
|
| 406 |
+
_GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);
|
| 407 |
+
|
| 408 |
+
entry* const p_e = m_entries + pos;
|
| 409 |
+
new (&p_e->m_value) value_type(r_val);
|
| 410 |
+
p_e->m_stat = valid_entry_status;
|
| 411 |
+
resize_base::notify_inserted(++m_num_used_e);
|
| 412 |
+
|
| 413 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));)
|
| 414 |
+
|
| 415 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 416 |
+
return &p_e->m_value;
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
inline pointer
|
| 420 |
+
insert_new_imp(const_reference r_val, comp_hash& r_pos_hash_pair)
|
| 421 |
+
{
|
| 422 |
+
_GLIBCXX_DEBUG_ASSERT(m_entries[r_pos_hash_pair.first].m_stat !=
|
| 423 |
+
valid_entry_status);
|
| 424 |
+
|
| 425 |
+
if (do_resize_if_needed())
|
| 426 |
+
r_pos_hash_pair = find_ins_pos(PB_DS_V2F(r_val),
|
| 427 |
+
traits_base::m_store_extra_indicator);
|
| 428 |
+
|
| 429 |
+
_GLIBCXX_DEBUG_ASSERT(m_entries[r_pos_hash_pair.first].m_stat !=
|
| 430 |
+
valid_entry_status);
|
| 431 |
+
|
| 432 |
+
entry* const p_e = m_entries + r_pos_hash_pair.first;
|
| 433 |
+
new (&p_e->m_value) value_type(r_val);
|
| 434 |
+
p_e->m_hash = r_pos_hash_pair.second;
|
| 435 |
+
p_e->m_stat = valid_entry_status;
|
| 436 |
+
|
| 437 |
+
resize_base::notify_inserted(++m_num_used_e);
|
| 438 |
+
|
| 439 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));)
|
| 440 |
+
|
| 441 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 442 |
+
return &p_e->m_value;
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
#ifdef PB_DS_DATA_TRUE_INDICATOR
|
| 446 |
+
inline mapped_reference
|
| 447 |
+
subscript_imp(const_key_reference key, false_type)
|
| 448 |
+
{
|
| 449 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 450 |
+
|
| 451 |
+
const size_type pos = find_ins_pos(key,
|
| 452 |
+
traits_base::m_store_extra_indicator);
|
| 453 |
+
|
| 454 |
+
entry_pointer p_e = &m_entries[pos];
|
| 455 |
+
if (p_e->m_stat != valid_entry_status)
|
| 456 |
+
return insert_new_imp(value_type(key, mapped_type()), pos)->second;
|
| 457 |
+
|
| 458 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);)
|
| 459 |
+
return p_e->m_value.second;
|
| 460 |
+
}
|
| 461 |
+
|
| 462 |
+
inline mapped_reference
|
| 463 |
+
subscript_imp(const_key_reference key, true_type)
|
| 464 |
+
{
|
| 465 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 466 |
+
|
| 467 |
+
comp_hash pos_hash_pair =
|
| 468 |
+
find_ins_pos(key, traits_base::m_store_extra_indicator);
|
| 469 |
+
|
| 470 |
+
if (m_entries[pos_hash_pair.first].m_stat != valid_entry_status)
|
| 471 |
+
return insert_new_imp(value_type(key, mapped_type()),
|
| 472 |
+
pos_hash_pair)->second;
|
| 473 |
+
|
| 474 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key));
|
| 475 |
+
return (m_entries + pos_hash_pair.first)->m_value.second;
|
| 476 |
+
}
|
| 477 |
+
#endif
|
| 478 |
+
|
| 479 |
+
inline pointer
|
| 480 |
+
find_key_pointer(const_key_reference key, false_type)
|
| 481 |
+
{
|
| 482 |
+
const size_type hash = ranged_probe_fn_base::operator()(key);
|
| 483 |
+
size_type i;
|
| 484 |
+
resize_base::notify_find_search_start();
|
| 485 |
+
|
| 486 |
+
// Loop until entry is found or until all possible entries accessed.
|
| 487 |
+
for (i = 0; i < m_num_e; ++i)
|
| 488 |
+
{
|
| 489 |
+
const size_type pos = ranged_probe_fn_base::operator()(key, hash, i);
|
| 490 |
+
|
| 491 |
+
entry* const p_e = m_entries + pos;
|
| 492 |
+
switch (p_e->m_stat)
|
| 493 |
+
{
|
| 494 |
+
case empty_entry_status:
|
| 495 |
+
{
|
| 496 |
+
resize_base::notify_find_search_end();
|
| 497 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
|
| 498 |
+
|
| 499 |
+
return NULL;
|
| 500 |
+
}
|
| 501 |
+
break;
|
| 502 |
+
case valid_entry_status:
|
| 503 |
+
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), key))
|
| 504 |
+
{
|
| 505 |
+
resize_base::notify_find_search_end();
|
| 506 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);)
|
| 507 |
+
|
| 508 |
+
return pointer(&p_e->m_value);
|
| 509 |
+
}
|
| 510 |
+
break;
|
| 511 |
+
case erased_entry_status:
|
| 512 |
+
break;
|
| 513 |
+
default:
|
| 514 |
+
_GLIBCXX_DEBUG_ASSERT(0);
|
| 515 |
+
};
|
| 516 |
+
|
| 517 |
+
resize_base::notify_find_search_collision();
|
| 518 |
+
}
|
| 519 |
+
|
| 520 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
|
| 521 |
+
resize_base::notify_find_search_end();
|
| 522 |
+
return NULL;
|
| 523 |
+
}
|
| 524 |
+
|
| 525 |
+
inline pointer
|
| 526 |
+
find_key_pointer(const_key_reference key, true_type)
|
| 527 |
+
{
|
| 528 |
+
comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(key);
|
| 529 |
+
size_type i;
|
| 530 |
+
resize_base::notify_find_search_start();
|
| 531 |
+
|
| 532 |
+
// Loop until entry is found or until all possible entries accessed.
|
| 533 |
+
for (i = 0; i < m_num_e; ++i)
|
| 534 |
+
{
|
| 535 |
+
const size_type pos =
|
| 536 |
+
ranged_probe_fn_base::operator()(key, pos_hash_pair.second, i);
|
| 537 |
+
|
| 538 |
+
entry* const p_e = m_entries + pos;
|
| 539 |
+
|
| 540 |
+
switch(p_e->m_stat)
|
| 541 |
+
{
|
| 542 |
+
case empty_entry_status:
|
| 543 |
+
{
|
| 544 |
+
resize_base::notify_find_search_end();
|
| 545 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
|
| 546 |
+
|
| 547 |
+
return NULL;
|
| 548 |
+
}
|
| 549 |
+
break;
|
| 550 |
+
case valid_entry_status:
|
| 551 |
+
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
|
| 552 |
+
p_e->m_hash,
|
| 553 |
+
key, pos_hash_pair.second))
|
| 554 |
+
{
|
| 555 |
+
resize_base::notify_find_search_end();
|
| 556 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);)
|
| 557 |
+
return pointer(&p_e->m_value);
|
| 558 |
+
}
|
| 559 |
+
break;
|
| 560 |
+
case erased_entry_status:
|
| 561 |
+
break;
|
| 562 |
+
default:
|
| 563 |
+
_GLIBCXX_DEBUG_ASSERT(0);
|
| 564 |
+
};
|
| 565 |
+
|
| 566 |
+
resize_base::notify_find_search_collision();
|
| 567 |
+
}
|
| 568 |
+
|
| 569 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
|
| 570 |
+
resize_base::notify_find_search_end();
|
| 571 |
+
return NULL;
|
| 572 |
+
}
|
| 573 |
+
|
| 574 |
+
inline bool
|
| 575 |
+
erase_imp(const_key_reference, true_type);
|
| 576 |
+
|
| 577 |
+
inline bool
|
| 578 |
+
erase_imp(const_key_reference, false_type);
|
| 579 |
+
|
| 580 |
+
inline void
|
| 581 |
+
erase_entry(entry_pointer p_e);
|
| 582 |
+
|
| 583 |
+
#ifdef PB_DS_DATA_TRUE_INDICATOR
|
| 584 |
+
void
|
| 585 |
+
inc_it_state(pointer& r_p_value, size_type& r_pos) const
|
| 586 |
+
{ inc_it_state((const_mapped_pointer& )r_p_value, r_pos); }
|
| 587 |
+
#endif
|
| 588 |
+
|
| 589 |
+
void
|
| 590 |
+
inc_it_state(const_pointer& r_p_value, size_type& r_pos) const
|
| 591 |
+
{
|
| 592 |
+
_GLIBCXX_DEBUG_ASSERT(r_p_value != NULL);
|
| 593 |
+
for (++r_pos; r_pos < m_num_e; ++r_pos)
|
| 594 |
+
{
|
| 595 |
+
const_entry_pointer p_e =& m_entries[r_pos];
|
| 596 |
+
if (p_e->m_stat == valid_entry_status)
|
| 597 |
+
{
|
| 598 |
+
r_p_value =& p_e->m_value;
|
| 599 |
+
return;
|
| 600 |
+
}
|
| 601 |
+
}
|
| 602 |
+
r_p_value = NULL;
|
| 603 |
+
}
|
| 604 |
+
|
| 605 |
+
void
|
| 606 |
+
get_start_it_state(const_pointer& r_p_value, size_type& r_pos) const
|
| 607 |
+
{
|
| 608 |
+
for (r_pos = 0; r_pos < m_num_e; ++r_pos)
|
| 609 |
+
{
|
| 610 |
+
const_entry_pointer p_e = &m_entries[r_pos];
|
| 611 |
+
if (p_e->m_stat == valid_entry_status)
|
| 612 |
+
{
|
| 613 |
+
r_p_value = &p_e->m_value;
|
| 614 |
+
return;
|
| 615 |
+
}
|
| 616 |
+
}
|
| 617 |
+
r_p_value = NULL;
|
| 618 |
+
}
|
| 619 |
+
|
| 620 |
+
void
|
| 621 |
+
get_start_it_state(pointer& r_p_value, size_type& r_pos)
|
| 622 |
+
{
|
| 623 |
+
for (r_pos = 0; r_pos < m_num_e; ++r_pos)
|
| 624 |
+
{
|
| 625 |
+
entry_pointer p_e = &m_entries[r_pos];
|
| 626 |
+
if (p_e->m_stat == valid_entry_status)
|
| 627 |
+
{
|
| 628 |
+
r_p_value = &p_e->m_value;
|
| 629 |
+
return;
|
| 630 |
+
}
|
| 631 |
+
}
|
| 632 |
+
r_p_value = NULL;
|
| 633 |
+
}
|
| 634 |
+
|
| 635 |
+
#ifdef _GLIBCXX_DEBUG
|
| 636 |
+
void
|
| 637 |
+
assert_entry_array_valid(const entry_array, false_type) const;
|
| 638 |
+
|
| 639 |
+
void
|
| 640 |
+
assert_entry_array_valid(const entry_array, true_type) const;
|
| 641 |
+
#endif
|
| 642 |
+
|
| 643 |
+
static entry_allocator s_entry_allocator;
|
| 644 |
+
static iterator s_end_it;
|
| 645 |
+
static const_iterator s_const_end_it;
|
| 646 |
+
|
| 647 |
+
size_type m_num_e;
|
| 648 |
+
size_type m_num_used_e;
|
| 649 |
+
entry_pointer m_entries;
|
| 650 |
+
|
| 651 |
+
enum
|
| 652 |
+
{
|
| 653 |
+
store_hash_ok = !Store_Hash
|
| 654 |
+
|| !is_same<Hash_Fn, __gnu_pbds::null_hash_fn>::value
|
| 655 |
+
};
|
| 656 |
+
|
| 657 |
+
PB_DS_STATIC_ASSERT(sth, store_hash_ok);
|
| 658 |
+
};
|
| 659 |
+
|
| 660 |
+
#include <ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp>
|
| 661 |
+
#include <ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp>
|
| 662 |
+
#include <ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp>
|
| 663 |
+
#include <ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp>
|
| 664 |
+
#include <ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp>
|
| 665 |
+
#include <ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp>
|
| 666 |
+
#include <ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp>
|
| 667 |
+
#include <ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp>
|
| 668 |
+
#include <ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp>
|
| 669 |
+
#include <ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp>
|
| 670 |
+
|
| 671 |
+
#undef PB_DS_CLASS_T_DEC
|
| 672 |
+
#undef PB_DS_CLASS_C_DEC
|
| 673 |
+
#undef PB_DS_HASH_EQ_FN_C_DEC
|
| 674 |
+
#undef PB_DS_RANGED_PROBE_FN_C_DEC
|
| 675 |
+
#undef PB_DS_TYPES_TRAITS_C_DEC
|
| 676 |
+
#undef PB_DS_DEBUG_MAP_BASE_C_DEC
|
| 677 |
+
#undef PB_DS_CLASS_NAME
|
| 678 |
+
#undef PB_DS_V2F
|
| 679 |
+
#undef PB_DS_V2S
|
| 680 |
+
|
| 681 |
+
} // namespace detail
|
| 682 |
+
} // namespace __gnu_pbds
|
| 683 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file info_fn_imps.hpp
|
| 44 |
+
* Contains implementations of gp_ht_map_'s entire container info related
|
| 45 |
+
* functions.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
PB_DS_CLASS_T_DEC
|
| 49 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 50 |
+
PB_DS_CLASS_C_DEC::
|
| 51 |
+
size() const
|
| 52 |
+
{ return m_num_used_e; }
|
| 53 |
+
|
| 54 |
+
PB_DS_CLASS_T_DEC
|
| 55 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 56 |
+
PB_DS_CLASS_C_DEC::
|
| 57 |
+
max_size() const
|
| 58 |
+
{ return s_entry_allocator.max_size(); }
|
| 59 |
+
|
| 60 |
+
PB_DS_CLASS_T_DEC
|
| 61 |
+
inline bool
|
| 62 |
+
PB_DS_CLASS_C_DEC::
|
| 63 |
+
empty() const
|
| 64 |
+
{ return (size() == 0); }
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file insert_fn_imps.hpp
|
| 44 |
+
* Contains implementations of gp_ht_map_'s insert related functions.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#include <ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp>
|
| 48 |
+
#include <ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp>
|
| 49 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file insert_no_store_hash_fn_imps.hpp
|
| 44 |
+
* Contains implementations of gp_ht_map_'s insert related functions,
|
| 45 |
+
* when the hash value is not stored.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
PB_DS_CLASS_T_DEC
|
| 49 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 50 |
+
PB_DS_CLASS_C_DEC::
|
| 51 |
+
find_ins_pos(const_key_reference r_key, false_type)
|
| 52 |
+
{
|
| 53 |
+
size_type hash = ranged_probe_fn_base::operator()(r_key);
|
| 54 |
+
size_type i;
|
| 55 |
+
|
| 56 |
+
/* The insertion position is initted to a non-legal value to indicate
|
| 57 |
+
* that it has not been initted yet.
|
| 58 |
+
*/
|
| 59 |
+
size_type ins_pos = m_num_e;
|
| 60 |
+
resize_base::notify_insert_search_start();
|
| 61 |
+
for (i = 0; i < m_num_e; ++i)
|
| 62 |
+
{
|
| 63 |
+
const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);
|
| 64 |
+
_GLIBCXX_DEBUG_ASSERT(pos < m_num_e);
|
| 65 |
+
entry* const p_e = m_entries + pos;
|
| 66 |
+
switch(p_e->m_stat)
|
| 67 |
+
{
|
| 68 |
+
case empty_entry_status:
|
| 69 |
+
{
|
| 70 |
+
resize_base::notify_insert_search_end();
|
| 71 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
|
| 72 |
+
return (ins_pos == m_num_e) ? pos : ins_pos;
|
| 73 |
+
}
|
| 74 |
+
break;
|
| 75 |
+
case erased_entry_status:
|
| 76 |
+
if (ins_pos == m_num_e)
|
| 77 |
+
ins_pos = pos;
|
| 78 |
+
break;
|
| 79 |
+
case valid_entry_status:
|
| 80 |
+
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
|
| 81 |
+
{
|
| 82 |
+
resize_base::notify_insert_search_end();
|
| 83 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
|
| 84 |
+
return pos;
|
| 85 |
+
}
|
| 86 |
+
break;
|
| 87 |
+
default:
|
| 88 |
+
_GLIBCXX_DEBUG_ASSERT(0);
|
| 89 |
+
};
|
| 90 |
+
|
| 91 |
+
resize_base::notify_insert_search_collision();
|
| 92 |
+
}
|
| 93 |
+
resize_base::notify_insert_search_end();
|
| 94 |
+
if (ins_pos == m_num_e)
|
| 95 |
+
__throw_insert_error();
|
| 96 |
+
return ins_pos;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
PB_DS_CLASS_T_DEC
|
| 100 |
+
inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
|
| 101 |
+
PB_DS_CLASS_C_DEC::
|
| 102 |
+
insert_imp(const_reference r_val, false_type)
|
| 103 |
+
{
|
| 104 |
+
const_key_reference r_key = PB_DS_V2F(r_val);
|
| 105 |
+
const size_type pos = find_ins_pos(r_key,
|
| 106 |
+
traits_base::m_store_extra_indicator);
|
| 107 |
+
|
| 108 |
+
if (m_entries[pos].m_stat == valid_entry_status)
|
| 109 |
+
{
|
| 110 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
|
| 111 |
+
return std::make_pair(&(m_entries + pos)->m_value, false);
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key));
|
| 115 |
+
return std::make_pair(insert_new_imp(r_val, pos), true);
|
| 116 |
+
}
|
| 117 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file insert_store_hash_fn_imps.hpp
|
| 44 |
+
* Contains implementations of gp_ht_map_'s find related functions,
|
| 45 |
+
* when the hash value is stored.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
PB_DS_CLASS_T_DEC
|
| 49 |
+
inline typename PB_DS_CLASS_C_DEC::comp_hash
|
| 50 |
+
PB_DS_CLASS_C_DEC::
|
| 51 |
+
find_ins_pos(const_key_reference r_key, true_type)
|
| 52 |
+
{
|
| 53 |
+
_GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
|
| 54 |
+
comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);
|
| 55 |
+
|
| 56 |
+
size_type i;
|
| 57 |
+
|
| 58 |
+
/* The insertion position is initted to a non-legal value to indicate
|
| 59 |
+
* that it has not been initted yet.
|
| 60 |
+
*/
|
| 61 |
+
size_type ins_pos = m_num_e;
|
| 62 |
+
resize_base::notify_insert_search_start();
|
| 63 |
+
for (i = 0; i < m_num_e; ++i)
|
| 64 |
+
{
|
| 65 |
+
const size_type pos = ranged_probe_fn_base::operator()(r_key, pos_hash_pair.second, i);
|
| 66 |
+
|
| 67 |
+
entry* const p_e = m_entries + pos;
|
| 68 |
+
switch(p_e->m_stat)
|
| 69 |
+
{
|
| 70 |
+
case empty_entry_status:
|
| 71 |
+
{
|
| 72 |
+
resize_base::notify_insert_search_end();
|
| 73 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
|
| 74 |
+
|
| 75 |
+
return ((ins_pos == m_num_e) ?
|
| 76 |
+
std::make_pair(pos, pos_hash_pair.second) :
|
| 77 |
+
std::make_pair(ins_pos, pos_hash_pair.second));
|
| 78 |
+
}
|
| 79 |
+
break;
|
| 80 |
+
case erased_entry_status:
|
| 81 |
+
if (ins_pos == m_num_e)
|
| 82 |
+
ins_pos = pos;
|
| 83 |
+
break;
|
| 84 |
+
case valid_entry_status:
|
| 85 |
+
if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash,
|
| 86 |
+
r_key, pos_hash_pair.second))
|
| 87 |
+
{
|
| 88 |
+
resize_base::notify_insert_search_end();
|
| 89 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
|
| 90 |
+
return std::make_pair(pos, pos_hash_pair.second);
|
| 91 |
+
}
|
| 92 |
+
break;
|
| 93 |
+
default:
|
| 94 |
+
_GLIBCXX_DEBUG_ASSERT(0);
|
| 95 |
+
};
|
| 96 |
+
resize_base::notify_insert_search_collision();
|
| 97 |
+
}
|
| 98 |
+
resize_base::notify_insert_search_end();
|
| 99 |
+
if (ins_pos == m_num_e)
|
| 100 |
+
__throw_insert_error();
|
| 101 |
+
return std::make_pair(ins_pos, pos_hash_pair.second);
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
PB_DS_CLASS_T_DEC
|
| 105 |
+
inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
|
| 106 |
+
PB_DS_CLASS_C_DEC::
|
| 107 |
+
insert_imp(const_reference r_val, true_type)
|
| 108 |
+
{
|
| 109 |
+
const_key_reference r_key = PB_DS_V2F(r_val);
|
| 110 |
+
comp_hash pos_hash_pair = find_ins_pos(r_key,
|
| 111 |
+
traits_base::m_store_extra_indicator);
|
| 112 |
+
|
| 113 |
+
_GLIBCXX_DEBUG_ASSERT(pos_hash_pair.first < m_num_e);
|
| 114 |
+
entry_pointer p_e =& m_entries[pos_hash_pair.first];
|
| 115 |
+
if (p_e->m_stat == valid_entry_status)
|
| 116 |
+
{
|
| 117 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
|
| 118 |
+
return std::make_pair(&p_e->m_value, false);
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
_GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key));
|
| 122 |
+
return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true);
|
| 123 |
+
}
|
| 124 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file iterator_fn_imps.hpp
|
| 44 |
+
* Contains implementations of gp_ht_map_'s iterators related functions, e.g.,
|
| 45 |
+
* begin().
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
PB_DS_CLASS_T_DEC
|
| 49 |
+
typename PB_DS_CLASS_C_DEC::iterator
|
| 50 |
+
PB_DS_CLASS_C_DEC::s_end_it;
|
| 51 |
+
|
| 52 |
+
PB_DS_CLASS_T_DEC
|
| 53 |
+
typename PB_DS_CLASS_C_DEC::const_iterator
|
| 54 |
+
PB_DS_CLASS_C_DEC::s_const_end_it;
|
| 55 |
+
|
| 56 |
+
PB_DS_CLASS_T_DEC
|
| 57 |
+
inline typename PB_DS_CLASS_C_DEC::iterator
|
| 58 |
+
PB_DS_CLASS_C_DEC::
|
| 59 |
+
begin()
|
| 60 |
+
{
|
| 61 |
+
pointer_ p_value;
|
| 62 |
+
size_type pos;
|
| 63 |
+
get_start_it_state(p_value, pos);
|
| 64 |
+
return iterator(p_value, pos, this);
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
PB_DS_CLASS_T_DEC
|
| 68 |
+
inline typename PB_DS_CLASS_C_DEC::iterator
|
| 69 |
+
PB_DS_CLASS_C_DEC::
|
| 70 |
+
end()
|
| 71 |
+
{ return s_end_it; }
|
| 72 |
+
|
| 73 |
+
PB_DS_CLASS_T_DEC
|
| 74 |
+
inline typename PB_DS_CLASS_C_DEC::const_iterator
|
| 75 |
+
PB_DS_CLASS_C_DEC::
|
| 76 |
+
begin() const
|
| 77 |
+
{
|
| 78 |
+
const_pointer_ p_value;
|
| 79 |
+
size_type pos;
|
| 80 |
+
get_start_it_state(p_value, pos);
|
| 81 |
+
return const_iterator(p_value, pos, this);
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
PB_DS_CLASS_T_DEC
|
| 85 |
+
inline typename PB_DS_CLASS_C_DEC::const_iterator
|
| 86 |
+
PB_DS_CLASS_C_DEC::
|
| 87 |
+
end() const
|
| 88 |
+
{ return s_const_end_it; }
|
| 89 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file policy_access_fn_imps.hpp
|
| 44 |
+
* Contains implementations of gp_ht_map_'s policy agpess
|
| 45 |
+
* functions.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
PB_DS_CLASS_T_DEC
|
| 49 |
+
Hash_Fn&
|
| 50 |
+
PB_DS_CLASS_C_DEC::
|
| 51 |
+
get_hash_fn()
|
| 52 |
+
{ return *this; }
|
| 53 |
+
|
| 54 |
+
PB_DS_CLASS_T_DEC
|
| 55 |
+
const Hash_Fn&
|
| 56 |
+
PB_DS_CLASS_C_DEC::
|
| 57 |
+
get_hash_fn() const
|
| 58 |
+
{ return *this; }
|
| 59 |
+
|
| 60 |
+
PB_DS_CLASS_T_DEC
|
| 61 |
+
Eq_Fn&
|
| 62 |
+
PB_DS_CLASS_C_DEC::
|
| 63 |
+
get_eq_fn()
|
| 64 |
+
{ return *this; }
|
| 65 |
+
|
| 66 |
+
PB_DS_CLASS_T_DEC
|
| 67 |
+
const Eq_Fn&
|
| 68 |
+
PB_DS_CLASS_C_DEC::
|
| 69 |
+
get_eq_fn() const
|
| 70 |
+
{ return *this; }
|
| 71 |
+
|
| 72 |
+
PB_DS_CLASS_T_DEC
|
| 73 |
+
Probe_Fn&
|
| 74 |
+
PB_DS_CLASS_C_DEC::
|
| 75 |
+
get_probe_fn()
|
| 76 |
+
{ return *this; }
|
| 77 |
+
|
| 78 |
+
PB_DS_CLASS_T_DEC
|
| 79 |
+
const Probe_Fn&
|
| 80 |
+
PB_DS_CLASS_C_DEC::
|
| 81 |
+
get_probe_fn() const
|
| 82 |
+
{ return *this; }
|
| 83 |
+
|
| 84 |
+
PB_DS_CLASS_T_DEC
|
| 85 |
+
Comb_Probe_Fn&
|
| 86 |
+
PB_DS_CLASS_C_DEC::
|
| 87 |
+
get_comb_probe_fn()
|
| 88 |
+
{ return *this; }
|
| 89 |
+
|
| 90 |
+
PB_DS_CLASS_T_DEC
|
| 91 |
+
const Comb_Probe_Fn&
|
| 92 |
+
PB_DS_CLASS_C_DEC::
|
| 93 |
+
get_comb_probe_fn() const
|
| 94 |
+
{ return *this; }
|
| 95 |
+
|
| 96 |
+
PB_DS_CLASS_T_DEC
|
| 97 |
+
Resize_Policy&
|
| 98 |
+
PB_DS_CLASS_C_DEC::
|
| 99 |
+
get_resize_policy()
|
| 100 |
+
{ return *this; }
|
| 101 |
+
|
| 102 |
+
PB_DS_CLASS_T_DEC
|
| 103 |
+
const Resize_Policy&
|
| 104 |
+
PB_DS_CLASS_C_DEC::
|
| 105 |
+
get_resize_policy() const
|
| 106 |
+
{ return *this; }
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file resize_fn_imps.hpp
|
| 44 |
+
* Contains implementations of gp_ht_map_'s resize related functions.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
PB_DS_CLASS_T_DEC
|
| 48 |
+
inline bool
|
| 49 |
+
PB_DS_CLASS_C_DEC::
|
| 50 |
+
do_resize_if_needed()
|
| 51 |
+
{
|
| 52 |
+
if (!resize_base::is_resize_needed())
|
| 53 |
+
return false;
|
| 54 |
+
resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));
|
| 55 |
+
return true;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
PB_DS_CLASS_T_DEC
|
| 59 |
+
void
|
| 60 |
+
PB_DS_CLASS_C_DEC::
|
| 61 |
+
do_resize(size_type n)
|
| 62 |
+
{ resize_imp(resize_base::get_nearest_larger_size(n)); }
|
| 63 |
+
|
| 64 |
+
PB_DS_CLASS_T_DEC
|
| 65 |
+
inline void
|
| 66 |
+
PB_DS_CLASS_C_DEC::
|
| 67 |
+
do_resize_if_needed_no_throw()
|
| 68 |
+
{
|
| 69 |
+
if (!resize_base::is_resize_needed())
|
| 70 |
+
return;
|
| 71 |
+
|
| 72 |
+
try
|
| 73 |
+
{
|
| 74 |
+
resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));
|
| 75 |
+
}
|
| 76 |
+
catch(...)
|
| 77 |
+
{ }
|
| 78 |
+
|
| 79 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
PB_DS_CLASS_T_DEC
|
| 83 |
+
void
|
| 84 |
+
PB_DS_CLASS_C_DEC::
|
| 85 |
+
resize_imp(size_type new_size)
|
| 86 |
+
{
|
| 87 |
+
#ifdef PB_DS_REGRESSION
|
| 88 |
+
typename Allocator::group_throw_prob_adjustor adjust(m_num_e);
|
| 89 |
+
#endif
|
| 90 |
+
|
| 91 |
+
if (new_size == m_num_e)
|
| 92 |
+
return;
|
| 93 |
+
|
| 94 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 95 |
+
const size_type old_size = m_num_e;
|
| 96 |
+
entry_array a_entries_resized = NULL;
|
| 97 |
+
|
| 98 |
+
// Following line might throw an exception.
|
| 99 |
+
a_entries_resized = s_entry_allocator.allocate(new_size);
|
| 100 |
+
|
| 101 |
+
ranged_probe_fn_base::notify_resized(new_size);
|
| 102 |
+
m_num_e = new_size;
|
| 103 |
+
|
| 104 |
+
for (size_type i = 0; i < m_num_e; ++i)
|
| 105 |
+
a_entries_resized[i].m_stat = empty_entry_status;
|
| 106 |
+
|
| 107 |
+
try
|
| 108 |
+
{
|
| 109 |
+
resize_imp(a_entries_resized, old_size);
|
| 110 |
+
}
|
| 111 |
+
catch(...)
|
| 112 |
+
{
|
| 113 |
+
erase_all_valid_entries(a_entries_resized, new_size);
|
| 114 |
+
m_num_e = old_size;
|
| 115 |
+
s_entry_allocator.deallocate(a_entries_resized, new_size);
|
| 116 |
+
ranged_probe_fn_base::notify_resized(old_size);
|
| 117 |
+
__throw_exception_again;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
// At this point no exceptions can be thrown.
|
| 121 |
+
_GLIBCXX_DEBUG_ONLY(assert_entry_array_valid(a_entries_resized, traits_base::m_store_extra_indicator);)
|
| 122 |
+
|
| 123 |
+
Resize_Policy::notify_resized(new_size);
|
| 124 |
+
erase_all_valid_entries(m_entries, old_size);
|
| 125 |
+
s_entry_allocator.deallocate(m_entries, old_size);
|
| 126 |
+
m_entries = a_entries_resized;
|
| 127 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
PB_DS_CLASS_T_DEC
|
| 131 |
+
void
|
| 132 |
+
PB_DS_CLASS_C_DEC::
|
| 133 |
+
resize_imp(entry_array a_entries_resized, size_type old_size)
|
| 134 |
+
{
|
| 135 |
+
for (size_type pos = 0; pos < old_size; ++pos)
|
| 136 |
+
if (m_entries[pos].m_stat == valid_entry_status)
|
| 137 |
+
resize_imp_reassign(m_entries + pos, a_entries_resized,
|
| 138 |
+
traits_base::m_store_extra_indicator);
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
#include <ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp>
|
| 142 |
+
#include <ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp>
|
| 143 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file resize_no_store_hash_fn_imps.hpp
|
| 44 |
+
* Contains implementations of gp_ht_map_'s resize related functions, when the
|
| 45 |
+
* hash value is not stored.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
PB_DS_CLASS_T_DEC
|
| 49 |
+
inline void
|
| 50 |
+
PB_DS_CLASS_C_DEC::
|
| 51 |
+
resize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized,
|
| 52 |
+
false_type)
|
| 53 |
+
{
|
| 54 |
+
const_key_reference r_key = PB_DS_V2F(p_e->m_value);
|
| 55 |
+
size_type hash = ranged_probe_fn_base::operator()(r_key);
|
| 56 |
+
size_type i;
|
| 57 |
+
for (i = 0; i < m_num_e; ++i)
|
| 58 |
+
{
|
| 59 |
+
const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);
|
| 60 |
+
entry_pointer p_new_e = a_entries_resized + pos;
|
| 61 |
+
switch(p_new_e->m_stat)
|
| 62 |
+
{
|
| 63 |
+
case empty_entry_status:
|
| 64 |
+
new (&p_new_e->m_value) value_type(p_e->m_value);
|
| 65 |
+
p_new_e->m_stat = valid_entry_status;
|
| 66 |
+
return;
|
| 67 |
+
case erased_entry_status:
|
| 68 |
+
_GLIBCXX_DEBUG_ASSERT(0);
|
| 69 |
+
break;
|
| 70 |
+
case valid_entry_status:
|
| 71 |
+
break;
|
| 72 |
+
default:
|
| 73 |
+
_GLIBCXX_DEBUG_ASSERT(0);
|
| 74 |
+
};
|
| 75 |
+
}
|
| 76 |
+
__throw_insert_error();
|
| 77 |
+
}
|
| 78 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file resize_store_hash_fn_imps.hpp
|
| 44 |
+
* Contains implementations of gp_ht_map_'s resize related functions, when the
|
| 45 |
+
* hash value is stored.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
PB_DS_CLASS_T_DEC
|
| 49 |
+
inline void
|
| 50 |
+
PB_DS_CLASS_C_DEC::
|
| 51 |
+
resize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized,
|
| 52 |
+
true_type)
|
| 53 |
+
{
|
| 54 |
+
const_key_reference r_key = PB_DS_V2F(p_e->m_value);
|
| 55 |
+
size_type hash = ranged_probe_fn_base::operator()(r_key, p_e->m_hash);
|
| 56 |
+
|
| 57 |
+
size_type i;
|
| 58 |
+
for (i = 0; i < m_num_e; ++i)
|
| 59 |
+
{
|
| 60 |
+
const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);
|
| 61 |
+
entry_pointer p_new_e = a_entries_resized + pos;
|
| 62 |
+
switch(p_new_e->m_stat)
|
| 63 |
+
{
|
| 64 |
+
case empty_entry_status:
|
| 65 |
+
new (&p_new_e->m_value) value_type(p_e->m_value);
|
| 66 |
+
p_new_e->m_hash = hash;
|
| 67 |
+
p_new_e->m_stat = valid_entry_status;
|
| 68 |
+
return;
|
| 69 |
+
case erased_entry_status:
|
| 70 |
+
_GLIBCXX_DEBUG_ASSERT(0);
|
| 71 |
+
break;
|
| 72 |
+
case valid_entry_status:
|
| 73 |
+
break;
|
| 74 |
+
default:
|
| 75 |
+
_GLIBCXX_DEBUG_ASSERT(0);
|
| 76 |
+
};
|
| 77 |
+
}
|
| 78 |
+
__throw_insert_error();
|
| 79 |
+
}
|
| 80 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file standard_policies.hpp
|
| 44 |
+
* Contains standard policies for gp_ht_map types.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#ifndef PB_DS_GP_HT_MAP_STANDARD_POLICIES_HPP
|
| 48 |
+
#define PB_DS_GP_HT_MAP_STANDARD_POLICIES_HPP
|
| 49 |
+
|
| 50 |
+
#include <ext/pb_ds/detail/standard_policies.hpp>
|
| 51 |
+
#include <ext/pb_ds/ht_load_check_resize_trigger.hpp>
|
| 52 |
+
#include <ext/pb_ds/linear_probe_fn.hpp>
|
| 53 |
+
#include <ext/pb_ds/quadratic_probe_fn.hpp>
|
| 54 |
+
|
| 55 |
+
namespace __gnu_pbds
|
| 56 |
+
{
|
| 57 |
+
namespace detail
|
| 58 |
+
{
|
| 59 |
+
template<typename Comb_Probe_Fn>
|
| 60 |
+
struct default_probe_fn
|
| 61 |
+
{
|
| 62 |
+
private:
|
| 63 |
+
typedef typename Comb_Probe_Fn::size_type size_type;
|
| 64 |
+
|
| 65 |
+
public:
|
| 66 |
+
typedef
|
| 67 |
+
typename __conditional_type<
|
| 68 |
+
is_same<
|
| 69 |
+
__gnu_pbds::direct_mask_range_hashing<size_t>,
|
| 70 |
+
Comb_Probe_Fn>::value,
|
| 71 |
+
__gnu_pbds::linear_probe_fn<size_type>,
|
| 72 |
+
__gnu_pbds::quadratic_probe_fn<size_type> >::__type
|
| 73 |
+
type;
|
| 74 |
+
};
|
| 75 |
+
|
| 76 |
+
} // namespace detail
|
| 77 |
+
} // namespace __gnu_pbds
|
| 78 |
+
|
| 79 |
+
#endif
|
| 80 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file trace_fn_imps.hpp
|
| 44 |
+
* Contains implementations of gp_ht_map_'s trace-mode functions.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#ifdef PB_DS_HT_MAP_TRACE_
|
| 48 |
+
|
| 49 |
+
PB_DS_CLASS_T_DEC
|
| 50 |
+
void
|
| 51 |
+
PB_DS_CLASS_C_DEC::
|
| 52 |
+
trace() const
|
| 53 |
+
{
|
| 54 |
+
std::cerr << static_cast<unsigned long>(m_num_e) << " " <<
|
| 55 |
+
static_cast<unsigned long>(m_num_used_e) << std::endl;
|
| 56 |
+
|
| 57 |
+
for (size_type i = 0; i < m_num_e; ++i)
|
| 58 |
+
{
|
| 59 |
+
std::cerr << static_cast<unsigned long>(i) << " ";
|
| 60 |
+
|
| 61 |
+
switch(m_entries[i].m_stat)
|
| 62 |
+
{
|
| 63 |
+
case empty_entry_status:
|
| 64 |
+
std::cerr << "<empty>";
|
| 65 |
+
break;
|
| 66 |
+
case erased_entry_status:
|
| 67 |
+
std::cerr << "<erased>";
|
| 68 |
+
break;
|
| 69 |
+
case valid_entry_status:
|
| 70 |
+
std::cerr << PB_DS_V2F(m_entries[i].m_value);
|
| 71 |
+
break;
|
| 72 |
+
default:
|
| 73 |
+
_GLIBCXX_DEBUG_ASSERT(0);
|
| 74 |
+
};
|
| 75 |
+
|
| 76 |
+
std::cerr << std::endl;
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
#endif // #ifdef PB_DS_HT_MAP_TRACE_
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file direct_mask_range_hashing_imp.hpp
|
| 44 |
+
* Contains a range-hashing policy implementation
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
PB_DS_CLASS_T_DEC
|
| 48 |
+
void
|
| 49 |
+
PB_DS_CLASS_C_DEC::
|
| 50 |
+
swap(PB_DS_CLASS_C_DEC& other)
|
| 51 |
+
{ mask_based_base::swap(other); }
|
| 52 |
+
|
| 53 |
+
PB_DS_CLASS_T_DEC
|
| 54 |
+
void
|
| 55 |
+
PB_DS_CLASS_C_DEC::
|
| 56 |
+
notify_resized(size_type size)
|
| 57 |
+
{ mask_based_base::notify_resized(size); }
|
| 58 |
+
|
| 59 |
+
PB_DS_CLASS_T_DEC
|
| 60 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 61 |
+
PB_DS_CLASS_C_DEC::
|
| 62 |
+
operator()(size_type hash) const
|
| 63 |
+
{ return mask_based_base::range_hash(hash); }
|
| 64 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file direct_mod_range_hashing_imp.hpp
|
| 44 |
+
* Contains a range-hashing policy implementation
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
PB_DS_CLASS_T_DEC
|
| 48 |
+
void
|
| 49 |
+
PB_DS_CLASS_C_DEC::
|
| 50 |
+
swap(PB_DS_CLASS_C_DEC& other)
|
| 51 |
+
{ mod_based_base::swap(other); }
|
| 52 |
+
|
| 53 |
+
PB_DS_CLASS_T_DEC
|
| 54 |
+
void
|
| 55 |
+
PB_DS_CLASS_C_DEC::
|
| 56 |
+
notify_resized(size_type n)
|
| 57 |
+
{ mod_based_base::notify_resized(n); }
|
| 58 |
+
|
| 59 |
+
PB_DS_CLASS_T_DEC
|
| 60 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 61 |
+
PB_DS_CLASS_C_DEC::
|
| 62 |
+
operator()(size_type hash) const
|
| 63 |
+
{ return mod_based_base::range_hash(hash); }
|
| 64 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file linear_probe_fn_imp.hpp
|
| 44 |
+
* Contains a probe policy implementation
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
PB_DS_CLASS_T_DEC
|
| 48 |
+
inline void
|
| 49 |
+
PB_DS_CLASS_C_DEC::
|
| 50 |
+
swap(PB_DS_CLASS_C_DEC& other)
|
| 51 |
+
{ }
|
| 52 |
+
|
| 53 |
+
PB_DS_CLASS_T_DEC
|
| 54 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 55 |
+
PB_DS_CLASS_C_DEC::
|
| 56 |
+
operator()(size_type i) const
|
| 57 |
+
{
|
| 58 |
+
return (i);
|
| 59 |
+
}
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file mask_based_range_hashing.hpp
|
| 44 |
+
* Contains a range hashing policy base.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#ifndef PB_DS_MASK_BASED_RANGE_HASHING_HPP
|
| 48 |
+
#define PB_DS_MASK_BASED_RANGE_HASHING_HPP
|
| 49 |
+
|
| 50 |
+
namespace __gnu_pbds
|
| 51 |
+
{
|
| 52 |
+
namespace detail
|
| 53 |
+
{
|
| 54 |
+
#define PB_DS_CLASS_T_DEC template<typename Size_Type>
|
| 55 |
+
#define PB_DS_CLASS_C_DEC mask_based_range_hashing<Size_Type>
|
| 56 |
+
|
| 57 |
+
template<typename Size_Type>
|
| 58 |
+
class mask_based_range_hashing
|
| 59 |
+
{
|
| 60 |
+
protected:
|
| 61 |
+
typedef Size_Type size_type;
|
| 62 |
+
|
| 63 |
+
void
|
| 64 |
+
swap(mask_based_range_hashing& other)
|
| 65 |
+
{ std::swap(m_mask, other.m_mask); }
|
| 66 |
+
|
| 67 |
+
void
|
| 68 |
+
notify_resized(size_type size);
|
| 69 |
+
|
| 70 |
+
inline size_type
|
| 71 |
+
range_hash(size_type hash) const
|
| 72 |
+
{ return size_type(hash & m_mask); }
|
| 73 |
+
|
| 74 |
+
private:
|
| 75 |
+
size_type m_mask;
|
| 76 |
+
const static size_type s_num_bits_in_size_type;
|
| 77 |
+
const static size_type s_highest_bit_1;
|
| 78 |
+
};
|
| 79 |
+
|
| 80 |
+
PB_DS_CLASS_T_DEC
|
| 81 |
+
const typename PB_DS_CLASS_C_DEC::size_type
|
| 82 |
+
PB_DS_CLASS_C_DEC::s_num_bits_in_size_type =
|
| 83 |
+
sizeof(typename PB_DS_CLASS_C_DEC::size_type) << 3;
|
| 84 |
+
|
| 85 |
+
PB_DS_CLASS_T_DEC
|
| 86 |
+
const typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC::s_highest_bit_1 = static_cast<typename PB_DS_CLASS_C_DEC::size_type>(1) << (s_num_bits_in_size_type - 1);
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
PB_DS_CLASS_T_DEC
|
| 90 |
+
void
|
| 91 |
+
PB_DS_CLASS_C_DEC::
|
| 92 |
+
notify_resized(size_type size)
|
| 93 |
+
{
|
| 94 |
+
size_type i = 0;
|
| 95 |
+
while (size ^ s_highest_bit_1)
|
| 96 |
+
{
|
| 97 |
+
size <<= 1;
|
| 98 |
+
++i;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
m_mask = 1;
|
| 102 |
+
i += 2;
|
| 103 |
+
while (i++ < s_num_bits_in_size_type)
|
| 104 |
+
m_mask = (m_mask << 1) ^ 1;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
#undef PB_DS_CLASS_T_DEC
|
| 108 |
+
#undef PB_DS_CLASS_C_DEC
|
| 109 |
+
|
| 110 |
+
} // namespace detail
|
| 111 |
+
} // namespace __gnu_pbds
|
| 112 |
+
|
| 113 |
+
#endif
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file mod_based_range_hashing.hpp
|
| 44 |
+
* Contains a range hashing policy base.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#ifndef PB_DS_MOD_BASED_RANGE_HASHING_HPP
|
| 48 |
+
#define PB_DS_MOD_BASED_RANGE_HASHING_HPP
|
| 49 |
+
|
| 50 |
+
namespace __gnu_pbds
|
| 51 |
+
{
|
| 52 |
+
|
| 53 |
+
namespace detail
|
| 54 |
+
{
|
| 55 |
+
|
| 56 |
+
#define PB_DS_CLASS_T_DEC \
|
| 57 |
+
template<typename Size_Type>
|
| 58 |
+
|
| 59 |
+
#define PB_DS_CLASS_C_DEC \
|
| 60 |
+
mod_based_range_hashing< \
|
| 61 |
+
Size_Type>
|
| 62 |
+
|
| 63 |
+
template<typename Size_Type>
|
| 64 |
+
class mod_based_range_hashing
|
| 65 |
+
{
|
| 66 |
+
protected:
|
| 67 |
+
typedef Size_Type size_type;
|
| 68 |
+
|
| 69 |
+
protected:
|
| 70 |
+
void
|
| 71 |
+
swap(PB_DS_CLASS_C_DEC& other);
|
| 72 |
+
|
| 73 |
+
void
|
| 74 |
+
notify_resized(size_type size);
|
| 75 |
+
|
| 76 |
+
inline size_type
|
| 77 |
+
range_hash(size_type hash) const;
|
| 78 |
+
|
| 79 |
+
private:
|
| 80 |
+
size_type m_size;
|
| 81 |
+
};
|
| 82 |
+
|
| 83 |
+
PB_DS_CLASS_T_DEC
|
| 84 |
+
void
|
| 85 |
+
PB_DS_CLASS_C_DEC::
|
| 86 |
+
swap(PB_DS_CLASS_C_DEC& other)
|
| 87 |
+
{
|
| 88 |
+
std::swap(m_size, other.m_size);
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
PB_DS_CLASS_T_DEC
|
| 92 |
+
void
|
| 93 |
+
PB_DS_CLASS_C_DEC::
|
| 94 |
+
notify_resized(size_type size)
|
| 95 |
+
{
|
| 96 |
+
m_size = size;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
PB_DS_CLASS_T_DEC
|
| 100 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 101 |
+
PB_DS_CLASS_C_DEC::
|
| 102 |
+
range_hash(size_type hash) const
|
| 103 |
+
{
|
| 104 |
+
return (hash % m_size);
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
#undef PB_DS_CLASS_T_DEC
|
| 108 |
+
#undef PB_DS_CLASS_C_DEC
|
| 109 |
+
|
| 110 |
+
} // namespace detail
|
| 111 |
+
|
| 112 |
+
} // namespace __gnu_pbds
|
| 113 |
+
|
| 114 |
+
#endif // #ifndef PB_DS_MOD_BASED_RANGE_HASHING_HPP
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file probe_fn_base.hpp
|
| 44 |
+
* Contains a probe policy base.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#ifndef PB_DS_PROBE_FN_BASE_HPP
|
| 48 |
+
#define PB_DS_PROBE_FN_BASE_HPP
|
| 49 |
+
|
| 50 |
+
#include <functional>
|
| 51 |
+
|
| 52 |
+
namespace __gnu_pbds
|
| 53 |
+
{
|
| 54 |
+
namespace detail
|
| 55 |
+
{
|
| 56 |
+
template<typename Allocator>
|
| 57 |
+
class probe_fn_base
|
| 58 |
+
{
|
| 59 |
+
protected:
|
| 60 |
+
~probe_fn_base() { }
|
| 61 |
+
};
|
| 62 |
+
} // namespace detail
|
| 63 |
+
} // namespace __gnu_pbds
|
| 64 |
+
|
| 65 |
+
#endif
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file quadratic_probe_fn_imp.hpp
|
| 44 |
+
* Contains a probe policy implementation
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
PB_DS_CLASS_T_DEC
|
| 48 |
+
inline void
|
| 49 |
+
PB_DS_CLASS_C_DEC::
|
| 50 |
+
swap(PB_DS_CLASS_C_DEC& other)
|
| 51 |
+
{ }
|
| 52 |
+
|
| 53 |
+
PB_DS_CLASS_T_DEC
|
| 54 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 55 |
+
PB_DS_CLASS_C_DEC::
|
| 56 |
+
operator()(size_type i) const
|
| 57 |
+
{
|
| 58 |
+
return (i* i);
|
| 59 |
+
}
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file ranged_hash_fn.hpp
|
| 44 |
+
* Contains a unified ranged hash functor, allowing the hash tables
|
| 45 |
+
* to deal with a single class for ranged hashing.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
#ifndef PB_DS_RANGED_HASH_FN_HPP
|
| 49 |
+
#define PB_DS_RANGED_HASH_FN_HPP
|
| 50 |
+
|
| 51 |
+
#include <ext/pb_ds/detail/basic_types.hpp>
|
| 52 |
+
#include <utility>
|
| 53 |
+
#include <debug/debug.h>
|
| 54 |
+
|
| 55 |
+
namespace __gnu_pbds
|
| 56 |
+
{
|
| 57 |
+
namespace detail
|
| 58 |
+
{
|
| 59 |
+
template<typename Key, typename Hash_Fn, typename Allocator,
|
| 60 |
+
typename Comb_Hash_Fn, bool Store_Hash>
|
| 61 |
+
class ranged_hash_fn;
|
| 62 |
+
|
| 63 |
+
#define PB_DS_CLASS_T_DEC \
|
| 64 |
+
template<typename Key, typename Hash_Fn, typename Allocator, \
|
| 65 |
+
typename Comb_Hash_Fn>
|
| 66 |
+
|
| 67 |
+
#define PB_DS_CLASS_C_DEC \
|
| 68 |
+
ranged_hash_fn<Key, Hash_Fn, Allocator, Comb_Hash_Fn, false>
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* Specialization 1
|
| 72 |
+
* The client supplies a hash function and a ranged hash function,
|
| 73 |
+
* and requests that hash values not be stored.
|
| 74 |
+
**/
|
| 75 |
+
template<typename Key, typename Hash_Fn, typename Allocator,
|
| 76 |
+
typename Comb_Hash_Fn>
|
| 77 |
+
class ranged_hash_fn< Key, Hash_Fn, Allocator, Comb_Hash_Fn, false>
|
| 78 |
+
: public Hash_Fn, public Comb_Hash_Fn
|
| 79 |
+
{
|
| 80 |
+
protected:
|
| 81 |
+
typedef typename Allocator::size_type size_type;
|
| 82 |
+
typedef Hash_Fn hash_fn_base;
|
| 83 |
+
typedef Comb_Hash_Fn comb_hash_fn_base;
|
| 84 |
+
typedef typename Allocator::template rebind< Key>::other key_allocator;
|
| 85 |
+
typedef typename key_allocator::const_reference const_key_reference;
|
| 86 |
+
|
| 87 |
+
ranged_hash_fn(size_type);
|
| 88 |
+
|
| 89 |
+
ranged_hash_fn(size_type, const Hash_Fn&);
|
| 90 |
+
|
| 91 |
+
ranged_hash_fn(size_type, const Hash_Fn&, const Comb_Hash_Fn&);
|
| 92 |
+
|
| 93 |
+
void
|
| 94 |
+
swap(PB_DS_CLASS_C_DEC&);
|
| 95 |
+
|
| 96 |
+
void
|
| 97 |
+
notify_resized(size_type);
|
| 98 |
+
|
| 99 |
+
inline size_type
|
| 100 |
+
operator()(const_key_reference) const;
|
| 101 |
+
};
|
| 102 |
+
|
| 103 |
+
PB_DS_CLASS_T_DEC
|
| 104 |
+
PB_DS_CLASS_C_DEC::
|
| 105 |
+
ranged_hash_fn(size_type size)
|
| 106 |
+
{ Comb_Hash_Fn::notify_resized(size); }
|
| 107 |
+
|
| 108 |
+
PB_DS_CLASS_T_DEC
|
| 109 |
+
PB_DS_CLASS_C_DEC::
|
| 110 |
+
ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn)
|
| 111 |
+
: Hash_Fn(r_hash_fn)
|
| 112 |
+
{ Comb_Hash_Fn::notify_resized(size); }
|
| 113 |
+
|
| 114 |
+
PB_DS_CLASS_T_DEC
|
| 115 |
+
PB_DS_CLASS_C_DEC::
|
| 116 |
+
ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn,
|
| 117 |
+
const Comb_Hash_Fn& r_comb_hash_fn)
|
| 118 |
+
: Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn)
|
| 119 |
+
{ comb_hash_fn_base::notify_resized(size); }
|
| 120 |
+
|
| 121 |
+
PB_DS_CLASS_T_DEC
|
| 122 |
+
void
|
| 123 |
+
PB_DS_CLASS_C_DEC::
|
| 124 |
+
swap(PB_DS_CLASS_C_DEC& other)
|
| 125 |
+
{
|
| 126 |
+
comb_hash_fn_base::swap(other);
|
| 127 |
+
std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
PB_DS_CLASS_T_DEC
|
| 131 |
+
void
|
| 132 |
+
PB_DS_CLASS_C_DEC::
|
| 133 |
+
notify_resized(size_type size)
|
| 134 |
+
{ comb_hash_fn_base::notify_resized(size); }
|
| 135 |
+
|
| 136 |
+
PB_DS_CLASS_T_DEC
|
| 137 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 138 |
+
PB_DS_CLASS_C_DEC::
|
| 139 |
+
operator()(const_key_reference r_key) const
|
| 140 |
+
{ return (comb_hash_fn_base::operator()(hash_fn_base::operator()(r_key)));}
|
| 141 |
+
|
| 142 |
+
#undef PB_DS_CLASS_T_DEC
|
| 143 |
+
#undef PB_DS_CLASS_C_DEC
|
| 144 |
+
|
| 145 |
+
#define PB_DS_CLASS_T_DEC \
|
| 146 |
+
template<typename Key, typename Hash_Fn, typename Allocator, \
|
| 147 |
+
typename Comb_Hash_Fn>
|
| 148 |
+
|
| 149 |
+
#define PB_DS_CLASS_C_DEC \
|
| 150 |
+
ranged_hash_fn<Key,Hash_Fn, Allocator, Comb_Hash_Fn, true>
|
| 151 |
+
|
| 152 |
+
/**
|
| 153 |
+
* Specialization 2
|
| 154 |
+
* The client supplies a hash function and a ranged hash function,
|
| 155 |
+
* and requests that hash values be stored.
|
| 156 |
+
**/
|
| 157 |
+
template<typename Key, typename Hash_Fn, typename Allocator,
|
| 158 |
+
typename Comb_Hash_Fn>
|
| 159 |
+
class ranged_hash_fn<Key, Hash_Fn, Allocator, Comb_Hash_Fn, true>
|
| 160 |
+
: public Hash_Fn, public Comb_Hash_Fn
|
| 161 |
+
{
|
| 162 |
+
protected:
|
| 163 |
+
typedef typename Allocator::size_type size_type;
|
| 164 |
+
typedef std::pair<size_type, size_type> comp_hash;
|
| 165 |
+
typedef Hash_Fn hash_fn_base;
|
| 166 |
+
typedef Comb_Hash_Fn comb_hash_fn_base;
|
| 167 |
+
typedef typename Allocator::template rebind<Key>::other key_allocator;
|
| 168 |
+
typedef typename key_allocator::const_reference const_key_reference;
|
| 169 |
+
|
| 170 |
+
ranged_hash_fn(size_type);
|
| 171 |
+
|
| 172 |
+
ranged_hash_fn(size_type, const Hash_Fn&);
|
| 173 |
+
|
| 174 |
+
ranged_hash_fn(size_type, const Hash_Fn&, const Comb_Hash_Fn&);
|
| 175 |
+
|
| 176 |
+
void
|
| 177 |
+
swap(PB_DS_CLASS_C_DEC&);
|
| 178 |
+
|
| 179 |
+
void
|
| 180 |
+
notify_resized(size_type);
|
| 181 |
+
|
| 182 |
+
inline comp_hash
|
| 183 |
+
operator()(const_key_reference) const;
|
| 184 |
+
|
| 185 |
+
inline comp_hash
|
| 186 |
+
operator()(const_key_reference, size_type) const;
|
| 187 |
+
};
|
| 188 |
+
|
| 189 |
+
PB_DS_CLASS_T_DEC
|
| 190 |
+
PB_DS_CLASS_C_DEC::
|
| 191 |
+
ranged_hash_fn(size_type size)
|
| 192 |
+
{ Comb_Hash_Fn::notify_resized(size); }
|
| 193 |
+
|
| 194 |
+
PB_DS_CLASS_T_DEC
|
| 195 |
+
PB_DS_CLASS_C_DEC::
|
| 196 |
+
ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn) :
|
| 197 |
+
Hash_Fn(r_hash_fn)
|
| 198 |
+
{ Comb_Hash_Fn::notify_resized(size); }
|
| 199 |
+
|
| 200 |
+
PB_DS_CLASS_T_DEC
|
| 201 |
+
PB_DS_CLASS_C_DEC::
|
| 202 |
+
ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn,
|
| 203 |
+
const Comb_Hash_Fn& r_comb_hash_fn)
|
| 204 |
+
: Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn)
|
| 205 |
+
{ comb_hash_fn_base::notify_resized(size); }
|
| 206 |
+
|
| 207 |
+
PB_DS_CLASS_T_DEC
|
| 208 |
+
void
|
| 209 |
+
PB_DS_CLASS_C_DEC::
|
| 210 |
+
swap(PB_DS_CLASS_C_DEC& other)
|
| 211 |
+
{
|
| 212 |
+
comb_hash_fn_base::swap(other);
|
| 213 |
+
std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
PB_DS_CLASS_T_DEC
|
| 217 |
+
void
|
| 218 |
+
PB_DS_CLASS_C_DEC::
|
| 219 |
+
notify_resized(size_type size)
|
| 220 |
+
{ comb_hash_fn_base::notify_resized(size); }
|
| 221 |
+
|
| 222 |
+
PB_DS_CLASS_T_DEC
|
| 223 |
+
inline typename PB_DS_CLASS_C_DEC::comp_hash
|
| 224 |
+
PB_DS_CLASS_C_DEC::
|
| 225 |
+
operator()(const_key_reference r_key) const
|
| 226 |
+
{
|
| 227 |
+
const size_type hash = hash_fn_base::operator()(r_key);
|
| 228 |
+
return std::make_pair(comb_hash_fn_base::operator()(hash), hash);
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
PB_DS_CLASS_T_DEC
|
| 232 |
+
inline typename PB_DS_CLASS_C_DEC::comp_hash
|
| 233 |
+
PB_DS_CLASS_C_DEC::
|
| 234 |
+
operator()
|
| 235 |
+
#ifdef _GLIBCXX_DEBUG
|
| 236 |
+
(const_key_reference r_key, size_type hash) const
|
| 237 |
+
#else
|
| 238 |
+
(const_key_reference /*r_key*/, size_type hash) const
|
| 239 |
+
#endif
|
| 240 |
+
{
|
| 241 |
+
_GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));
|
| 242 |
+
return std::make_pair(comb_hash_fn_base::operator()(hash), hash);
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
#undef PB_DS_CLASS_T_DEC
|
| 246 |
+
#undef PB_DS_CLASS_C_DEC
|
| 247 |
+
|
| 248 |
+
#define PB_DS_CLASS_T_DEC \
|
| 249 |
+
template<typename Key, typename Allocator, typename Comb_Hash_Fn>
|
| 250 |
+
|
| 251 |
+
#define PB_DS_CLASS_C_DEC \
|
| 252 |
+
ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, false>
|
| 253 |
+
|
| 254 |
+
/**
|
| 255 |
+
* Specialization 3
|
| 256 |
+
* The client does not supply a hash function (by specifying
|
| 257 |
+
* null_hash_fn as the Hash_Fn parameter), and requests that hash
|
| 258 |
+
* values not be stored.
|
| 259 |
+
**/
|
| 260 |
+
template<typename Key, typename Allocator, typename Comb_Hash_Fn>
|
| 261 |
+
class ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, false>
|
| 262 |
+
: public null_hash_fn, public Comb_Hash_Fn
|
| 263 |
+
{
|
| 264 |
+
protected:
|
| 265 |
+
typedef typename Allocator::size_type size_type;
|
| 266 |
+
typedef Comb_Hash_Fn comb_hash_fn_base;
|
| 267 |
+
|
| 268 |
+
ranged_hash_fn(size_type);
|
| 269 |
+
|
| 270 |
+
ranged_hash_fn(size_type, const Comb_Hash_Fn&);
|
| 271 |
+
|
| 272 |
+
ranged_hash_fn(size_type, const null_hash_fn&, const Comb_Hash_Fn&);
|
| 273 |
+
|
| 274 |
+
void
|
| 275 |
+
swap(PB_DS_CLASS_C_DEC&);
|
| 276 |
+
};
|
| 277 |
+
|
| 278 |
+
PB_DS_CLASS_T_DEC
|
| 279 |
+
PB_DS_CLASS_C_DEC::
|
| 280 |
+
ranged_hash_fn(size_type size)
|
| 281 |
+
{ Comb_Hash_Fn::notify_resized(size); }
|
| 282 |
+
|
| 283 |
+
PB_DS_CLASS_T_DEC
|
| 284 |
+
PB_DS_CLASS_C_DEC::
|
| 285 |
+
ranged_hash_fn(size_type size, const Comb_Hash_Fn& r_comb_hash_fn) :
|
| 286 |
+
Comb_Hash_Fn(r_comb_hash_fn)
|
| 287 |
+
{ }
|
| 288 |
+
|
| 289 |
+
PB_DS_CLASS_T_DEC
|
| 290 |
+
PB_DS_CLASS_C_DEC::
|
| 291 |
+
ranged_hash_fn(size_type size, const null_hash_fn& r_null_hash_fn,
|
| 292 |
+
const Comb_Hash_Fn& r_comb_hash_fn)
|
| 293 |
+
: Comb_Hash_Fn(r_comb_hash_fn)
|
| 294 |
+
{ }
|
| 295 |
+
|
| 296 |
+
PB_DS_CLASS_T_DEC
|
| 297 |
+
void
|
| 298 |
+
PB_DS_CLASS_C_DEC::
|
| 299 |
+
swap(PB_DS_CLASS_C_DEC& other)
|
| 300 |
+
{ comb_hash_fn_base::swap(other); }
|
| 301 |
+
|
| 302 |
+
#undef PB_DS_CLASS_T_DEC
|
| 303 |
+
#undef PB_DS_CLASS_C_DEC
|
| 304 |
+
|
| 305 |
+
#define PB_DS_CLASS_T_DEC \
|
| 306 |
+
template<typename Key, typename Allocator, typename Comb_Hash_Fn>
|
| 307 |
+
|
| 308 |
+
#define PB_DS_CLASS_C_DEC \
|
| 309 |
+
ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, true>
|
| 310 |
+
|
| 311 |
+
/**
|
| 312 |
+
* Specialization 4
|
| 313 |
+
* The client does not supply a hash function (by specifying
|
| 314 |
+
* null_hash_fn as the Hash_Fn parameter), and requests that hash
|
| 315 |
+
* values be stored.
|
| 316 |
+
**/
|
| 317 |
+
template<typename Key, typename Allocator, typename Comb_Hash_Fn>
|
| 318 |
+
class ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, true>
|
| 319 |
+
: public null_hash_fn, public Comb_Hash_Fn
|
| 320 |
+
{
|
| 321 |
+
protected:
|
| 322 |
+
typedef typename Allocator::size_type size_type;
|
| 323 |
+
typedef Comb_Hash_Fn comb_hash_fn_base;
|
| 324 |
+
|
| 325 |
+
ranged_hash_fn(size_type);
|
| 326 |
+
|
| 327 |
+
ranged_hash_fn(size_type, const Comb_Hash_Fn&);
|
| 328 |
+
|
| 329 |
+
ranged_hash_fn(size_type, const null_hash_fn&, const Comb_Hash_Fn&);
|
| 330 |
+
|
| 331 |
+
void
|
| 332 |
+
swap(PB_DS_CLASS_C_DEC&);
|
| 333 |
+
};
|
| 334 |
+
|
| 335 |
+
PB_DS_CLASS_T_DEC
|
| 336 |
+
PB_DS_CLASS_C_DEC::
|
| 337 |
+
ranged_hash_fn(size_type size)
|
| 338 |
+
{ Comb_Hash_Fn::notify_resized(size); }
|
| 339 |
+
|
| 340 |
+
PB_DS_CLASS_T_DEC
|
| 341 |
+
PB_DS_CLASS_C_DEC::
|
| 342 |
+
ranged_hash_fn(size_type size, const Comb_Hash_Fn& r_comb_hash_fn)
|
| 343 |
+
: Comb_Hash_Fn(r_comb_hash_fn)
|
| 344 |
+
{ }
|
| 345 |
+
|
| 346 |
+
PB_DS_CLASS_T_DEC
|
| 347 |
+
PB_DS_CLASS_C_DEC::
|
| 348 |
+
ranged_hash_fn(size_type size, const null_hash_fn& r_null_hash_fn,
|
| 349 |
+
const Comb_Hash_Fn& r_comb_hash_fn)
|
| 350 |
+
: Comb_Hash_Fn(r_comb_hash_fn)
|
| 351 |
+
{ }
|
| 352 |
+
|
| 353 |
+
PB_DS_CLASS_T_DEC
|
| 354 |
+
void
|
| 355 |
+
PB_DS_CLASS_C_DEC::
|
| 356 |
+
swap(PB_DS_CLASS_C_DEC& other)
|
| 357 |
+
{ comb_hash_fn_base::swap(other); }
|
| 358 |
+
|
| 359 |
+
#undef PB_DS_CLASS_T_DEC
|
| 360 |
+
#undef PB_DS_CLASS_C_DEC
|
| 361 |
+
|
| 362 |
+
} // namespace detail
|
| 363 |
+
} // namespace __gnu_pbds
|
| 364 |
+
|
| 365 |
+
#endif
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file ranged_probe_fn.hpp
|
| 44 |
+
* Contains a unified ranged probe functor, allowing the probe tables to deal with
|
| 45 |
+
* a single class for ranged probeing.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
#ifndef PB_DS_RANGED_PROBE_FN_HPP
|
| 49 |
+
#define PB_DS_RANGED_PROBE_FN_HPP
|
| 50 |
+
|
| 51 |
+
#include <ext/pb_ds/detail/basic_types.hpp>
|
| 52 |
+
#include <utility>
|
| 53 |
+
#include <debug/debug.h>
|
| 54 |
+
|
| 55 |
+
namespace __gnu_pbds
|
| 56 |
+
{
|
| 57 |
+
namespace detail
|
| 58 |
+
{
|
| 59 |
+
template<typename Key, typename Hash_Fn, typename Allocator,
|
| 60 |
+
typename Comb_Probe_Fn, typename Probe_Fn, bool Store_Hash>
|
| 61 |
+
class ranged_probe_fn;
|
| 62 |
+
|
| 63 |
+
#define PB_DS_CLASS_T_DEC \
|
| 64 |
+
template<typename Key, typename Hash_Fn, typename Allocator, \
|
| 65 |
+
typename Comb_Probe_Fn, typename Probe_Fn>
|
| 66 |
+
|
| 67 |
+
#define PB_DS_CLASS_C_DEC \
|
| 68 |
+
ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, false>
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* Specialization 1
|
| 72 |
+
* The client supplies a probe function and a ranged probe
|
| 73 |
+
* function, and requests that hash values not be stored.
|
| 74 |
+
**/
|
| 75 |
+
template<typename Key, typename Hash_Fn, typename Allocator,
|
| 76 |
+
typename Comb_Probe_Fn, typename Probe_Fn>
|
| 77 |
+
class ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn,
|
| 78 |
+
Probe_Fn, false>
|
| 79 |
+
: public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn
|
| 80 |
+
{
|
| 81 |
+
protected:
|
| 82 |
+
typedef typename Allocator::size_type size_type;
|
| 83 |
+
typedef Comb_Probe_Fn comb_probe_fn_base;
|
| 84 |
+
typedef Hash_Fn hash_fn_base;
|
| 85 |
+
typedef Probe_Fn probe_fn_base;
|
| 86 |
+
typedef typename Allocator::template rebind<Key>::other key_allocator;
|
| 87 |
+
typedef typename key_allocator::const_reference const_key_reference;
|
| 88 |
+
|
| 89 |
+
ranged_probe_fn(size_type);
|
| 90 |
+
|
| 91 |
+
ranged_probe_fn(size_type, const Hash_Fn&);
|
| 92 |
+
|
| 93 |
+
ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&);
|
| 94 |
+
|
| 95 |
+
ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&,
|
| 96 |
+
const Probe_Fn&);
|
| 97 |
+
|
| 98 |
+
void
|
| 99 |
+
swap(PB_DS_CLASS_C_DEC&);
|
| 100 |
+
|
| 101 |
+
void
|
| 102 |
+
notify_resized(size_type);
|
| 103 |
+
|
| 104 |
+
inline size_type
|
| 105 |
+
operator()(const_key_reference) const;
|
| 106 |
+
|
| 107 |
+
inline size_type
|
| 108 |
+
operator()(const_key_reference, size_type, size_type) const;
|
| 109 |
+
};
|
| 110 |
+
|
| 111 |
+
PB_DS_CLASS_T_DEC
|
| 112 |
+
PB_DS_CLASS_C_DEC::
|
| 113 |
+
ranged_probe_fn(size_type size)
|
| 114 |
+
{ Comb_Probe_Fn::notify_resized(size); }
|
| 115 |
+
|
| 116 |
+
PB_DS_CLASS_T_DEC
|
| 117 |
+
PB_DS_CLASS_C_DEC::
|
| 118 |
+
ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn)
|
| 119 |
+
: Hash_Fn(r_hash_fn)
|
| 120 |
+
{ Comb_Probe_Fn::notify_resized(size); }
|
| 121 |
+
|
| 122 |
+
PB_DS_CLASS_T_DEC
|
| 123 |
+
PB_DS_CLASS_C_DEC::
|
| 124 |
+
ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
|
| 125 |
+
const Comb_Probe_Fn& r_comb_probe_fn)
|
| 126 |
+
: Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn)
|
| 127 |
+
{ comb_probe_fn_base::notify_resized(size); }
|
| 128 |
+
|
| 129 |
+
PB_DS_CLASS_T_DEC
|
| 130 |
+
PB_DS_CLASS_C_DEC::
|
| 131 |
+
ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
|
| 132 |
+
const Comb_Probe_Fn& r_comb_probe_fn,
|
| 133 |
+
const Probe_Fn& r_probe_fn)
|
| 134 |
+
: Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn)
|
| 135 |
+
{ comb_probe_fn_base::notify_resized(size); }
|
| 136 |
+
|
| 137 |
+
PB_DS_CLASS_T_DEC
|
| 138 |
+
void
|
| 139 |
+
PB_DS_CLASS_C_DEC::
|
| 140 |
+
swap(PB_DS_CLASS_C_DEC& other)
|
| 141 |
+
{
|
| 142 |
+
comb_probe_fn_base::swap(other);
|
| 143 |
+
std::swap((Hash_Fn& )(*this), (Hash_Fn&)other);
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
PB_DS_CLASS_T_DEC
|
| 147 |
+
void
|
| 148 |
+
PB_DS_CLASS_C_DEC::
|
| 149 |
+
notify_resized(size_type size)
|
| 150 |
+
{ comb_probe_fn_base::notify_resized(size); }
|
| 151 |
+
|
| 152 |
+
PB_DS_CLASS_T_DEC
|
| 153 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 154 |
+
PB_DS_CLASS_C_DEC::
|
| 155 |
+
operator()(const_key_reference r_key) const
|
| 156 |
+
{ return comb_probe_fn_base::operator()(hash_fn_base::operator()(r_key)); }
|
| 157 |
+
|
| 158 |
+
PB_DS_CLASS_T_DEC
|
| 159 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 160 |
+
PB_DS_CLASS_C_DEC::
|
| 161 |
+
operator()(const_key_reference, size_type hash, size_type i) const
|
| 162 |
+
{
|
| 163 |
+
return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
#undef PB_DS_CLASS_T_DEC
|
| 167 |
+
#undef PB_DS_CLASS_C_DEC
|
| 168 |
+
|
| 169 |
+
#define PB_DS_CLASS_T_DEC \
|
| 170 |
+
template<typename Key, typename Hash_Fn, typename Allocator, \
|
| 171 |
+
typename Comb_Probe_Fn, typename Probe_Fn>
|
| 172 |
+
|
| 173 |
+
#define PB_DS_CLASS_C_DEC \
|
| 174 |
+
ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, true>
|
| 175 |
+
|
| 176 |
+
/**
|
| 177 |
+
* Specialization 2- The client supplies a probe function and a ranged
|
| 178 |
+
* probe function, and requests that hash values not be stored.
|
| 179 |
+
**/
|
| 180 |
+
template<typename Key, typename Hash_Fn, typename Allocator,
|
| 181 |
+
typename Comb_Probe_Fn, typename Probe_Fn>
|
| 182 |
+
class ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn,
|
| 183 |
+
Probe_Fn, true>
|
| 184 |
+
: public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn
|
| 185 |
+
{
|
| 186 |
+
protected:
|
| 187 |
+
typedef typename Allocator::size_type size_type;
|
| 188 |
+
typedef std::pair<size_type, size_type> comp_hash;
|
| 189 |
+
typedef Comb_Probe_Fn comb_probe_fn_base;
|
| 190 |
+
typedef Hash_Fn hash_fn_base;
|
| 191 |
+
typedef Probe_Fn probe_fn_base;
|
| 192 |
+
typedef typename Allocator::template rebind<Key>::other key_allocator;
|
| 193 |
+
typedef typename key_allocator::const_reference const_key_reference;
|
| 194 |
+
|
| 195 |
+
ranged_probe_fn(size_type);
|
| 196 |
+
|
| 197 |
+
ranged_probe_fn(size_type, const Hash_Fn&);
|
| 198 |
+
|
| 199 |
+
ranged_probe_fn(size_type, const Hash_Fn&,
|
| 200 |
+
const Comb_Probe_Fn&);
|
| 201 |
+
|
| 202 |
+
ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&,
|
| 203 |
+
const Probe_Fn&);
|
| 204 |
+
|
| 205 |
+
void
|
| 206 |
+
swap(PB_DS_CLASS_C_DEC&);
|
| 207 |
+
|
| 208 |
+
void
|
| 209 |
+
notify_resized(size_type);
|
| 210 |
+
|
| 211 |
+
inline comp_hash
|
| 212 |
+
operator()(const_key_reference) const;
|
| 213 |
+
|
| 214 |
+
inline size_type
|
| 215 |
+
operator()(const_key_reference, size_type, size_type) const;
|
| 216 |
+
|
| 217 |
+
inline size_type
|
| 218 |
+
operator()(const_key_reference, size_type) const;
|
| 219 |
+
};
|
| 220 |
+
|
| 221 |
+
PB_DS_CLASS_T_DEC
|
| 222 |
+
PB_DS_CLASS_C_DEC::
|
| 223 |
+
ranged_probe_fn(size_type size)
|
| 224 |
+
{ Comb_Probe_Fn::notify_resized(size); }
|
| 225 |
+
|
| 226 |
+
PB_DS_CLASS_T_DEC
|
| 227 |
+
PB_DS_CLASS_C_DEC::
|
| 228 |
+
ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn)
|
| 229 |
+
: Hash_Fn(r_hash_fn)
|
| 230 |
+
{ Comb_Probe_Fn::notify_resized(size); }
|
| 231 |
+
|
| 232 |
+
PB_DS_CLASS_T_DEC
|
| 233 |
+
PB_DS_CLASS_C_DEC::
|
| 234 |
+
ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
|
| 235 |
+
const Comb_Probe_Fn& r_comb_probe_fn)
|
| 236 |
+
: Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn)
|
| 237 |
+
{ comb_probe_fn_base::notify_resized(size); }
|
| 238 |
+
|
| 239 |
+
PB_DS_CLASS_T_DEC
|
| 240 |
+
PB_DS_CLASS_C_DEC::
|
| 241 |
+
ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
|
| 242 |
+
const Comb_Probe_Fn& r_comb_probe_fn,
|
| 243 |
+
const Probe_Fn& r_probe_fn)
|
| 244 |
+
: Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn)
|
| 245 |
+
{ comb_probe_fn_base::notify_resized(size); }
|
| 246 |
+
|
| 247 |
+
PB_DS_CLASS_T_DEC
|
| 248 |
+
void
|
| 249 |
+
PB_DS_CLASS_C_DEC::
|
| 250 |
+
swap(PB_DS_CLASS_C_DEC& other)
|
| 251 |
+
{
|
| 252 |
+
comb_probe_fn_base::swap(other);
|
| 253 |
+
std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
PB_DS_CLASS_T_DEC
|
| 257 |
+
void
|
| 258 |
+
PB_DS_CLASS_C_DEC::
|
| 259 |
+
notify_resized(size_type size)
|
| 260 |
+
{ comb_probe_fn_base::notify_resized(size); }
|
| 261 |
+
|
| 262 |
+
PB_DS_CLASS_T_DEC
|
| 263 |
+
inline typename PB_DS_CLASS_C_DEC::comp_hash
|
| 264 |
+
PB_DS_CLASS_C_DEC::
|
| 265 |
+
operator()(const_key_reference r_key) const
|
| 266 |
+
{
|
| 267 |
+
const size_type hash = hash_fn_base::operator()(r_key);
|
| 268 |
+
return std::make_pair(comb_probe_fn_base::operator()(hash), hash);
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
PB_DS_CLASS_T_DEC
|
| 272 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 273 |
+
PB_DS_CLASS_C_DEC::
|
| 274 |
+
operator()(const_key_reference, size_type hash, size_type i) const
|
| 275 |
+
{
|
| 276 |
+
return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
PB_DS_CLASS_T_DEC
|
| 280 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 281 |
+
PB_DS_CLASS_C_DEC::
|
| 282 |
+
operator()
|
| 283 |
+
#ifdef _GLIBCXX_DEBUG
|
| 284 |
+
(const_key_reference r_key, size_type hash) const
|
| 285 |
+
#else
|
| 286 |
+
(const_key_reference /*r_key*/, size_type hash) const
|
| 287 |
+
#endif
|
| 288 |
+
{
|
| 289 |
+
_GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));
|
| 290 |
+
return hash;
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
#undef PB_DS_CLASS_T_DEC
|
| 294 |
+
#undef PB_DS_CLASS_C_DEC
|
| 295 |
+
|
| 296 |
+
/**
|
| 297 |
+
* Specialization 3 and 4
|
| 298 |
+
* The client does not supply a hash function or probe function,
|
| 299 |
+
* and requests that hash values not be stored.
|
| 300 |
+
**/
|
| 301 |
+
template<typename Key, typename Allocator, typename Comb_Probe_Fn>
|
| 302 |
+
class ranged_probe_fn<Key, null_hash_fn, Allocator, Comb_Probe_Fn,
|
| 303 |
+
null_probe_fn, false>
|
| 304 |
+
: public Comb_Probe_Fn, public null_hash_fn, public null_probe_fn
|
| 305 |
+
{
|
| 306 |
+
protected:
|
| 307 |
+
typedef typename Allocator::size_type size_type;
|
| 308 |
+
typedef Comb_Probe_Fn comb_probe_fn_base;
|
| 309 |
+
typedef typename Allocator::template rebind<Key>::other key_allocator;
|
| 310 |
+
typedef typename key_allocator::const_reference const_key_reference;
|
| 311 |
+
|
| 312 |
+
ranged_probe_fn(size_type size)
|
| 313 |
+
{ Comb_Probe_Fn::notify_resized(size); }
|
| 314 |
+
|
| 315 |
+
ranged_probe_fn(size_type, const Comb_Probe_Fn& r_comb_probe_fn)
|
| 316 |
+
: Comb_Probe_Fn(r_comb_probe_fn)
|
| 317 |
+
{ }
|
| 318 |
+
|
| 319 |
+
ranged_probe_fn(size_type, const null_hash_fn&,
|
| 320 |
+
const Comb_Probe_Fn& r_comb_probe_fn,
|
| 321 |
+
const null_probe_fn&)
|
| 322 |
+
: Comb_Probe_Fn(r_comb_probe_fn)
|
| 323 |
+
{ }
|
| 324 |
+
|
| 325 |
+
void
|
| 326 |
+
swap(ranged_probe_fn& other)
|
| 327 |
+
{ comb_probe_fn_base::swap(other); }
|
| 328 |
+
};
|
| 329 |
+
} // namespace detail
|
| 330 |
+
} // namespace __gnu_pbds
|
| 331 |
+
|
| 332 |
+
#endif
|
| 333 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file sample_probe_fn.hpp
|
| 44 |
+
* Contains a sample probe policy.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#ifndef PB_DS_SAMPLE_PROBE_FN_HPP
|
| 48 |
+
#define PB_DS_SAMPLE_PROBE_FN_HPP
|
| 49 |
+
|
| 50 |
+
// A sample probe policy.
|
| 51 |
+
class sample_probe_fn
|
| 52 |
+
{
|
| 53 |
+
|
| 54 |
+
public:
|
| 55 |
+
|
| 56 |
+
// Size type.
|
| 57 |
+
typedef size_t size_type;
|
| 58 |
+
|
| 59 |
+
public:
|
| 60 |
+
|
| 61 |
+
// Default constructor.
|
| 62 |
+
sample_probe_fn();
|
| 63 |
+
|
| 64 |
+
// Copy constructor.
|
| 65 |
+
sample_probe_fn(const sample_probe_fn& other);
|
| 66 |
+
|
| 67 |
+
// Swaps content.
|
| 68 |
+
inline void
|
| 69 |
+
swap(sample_probe_fn& other);
|
| 70 |
+
|
| 71 |
+
protected:
|
| 72 |
+
|
| 73 |
+
// Returns the i-th offset from the hash value of some key r_key.
|
| 74 |
+
inline size_type
|
| 75 |
+
operator()(const_key_reference r_key, size_type i) const;
|
| 76 |
+
|
| 77 |
+
};
|
| 78 |
+
|
| 79 |
+
#endif // #ifndef PB_DS_SAMPLE_PROBE_FN_HPP
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file sample_range_hashing.hpp
|
| 44 |
+
* Contains a range hashing policy.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP
|
| 48 |
+
#define PB_DS_SAMPLE_RANGE_HASHING_HPP
|
| 49 |
+
|
| 50 |
+
// A sample range-hashing functor.
|
| 51 |
+
class sample_range_hashing
|
| 52 |
+
{
|
| 53 |
+
|
| 54 |
+
public:
|
| 55 |
+
|
| 56 |
+
// Size type.
|
| 57 |
+
typedef size_t size_type;
|
| 58 |
+
|
| 59 |
+
public:
|
| 60 |
+
|
| 61 |
+
// Default constructor.
|
| 62 |
+
sample_range_hashing();
|
| 63 |
+
|
| 64 |
+
// Copy constructor.
|
| 65 |
+
sample_range_hashing(const sample_range_hashing& other);
|
| 66 |
+
|
| 67 |
+
// Swaps content.
|
| 68 |
+
inline void
|
| 69 |
+
swap(sample_range_hashing& other);
|
| 70 |
+
|
| 71 |
+
protected:
|
| 72 |
+
|
| 73 |
+
// Notifies the policy object that the container's __size has changed to size.
|
| 74 |
+
void
|
| 75 |
+
notify_resized(size_type size);
|
| 76 |
+
|
| 77 |
+
// Transforms the __hash value hash into a ranged-hash value.
|
| 78 |
+
inline size_type
|
| 79 |
+
operator()(size_type hash) const;
|
| 80 |
+
|
| 81 |
+
};
|
| 82 |
+
|
| 83 |
+
#endif // #ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file sample_ranged_hash_fn.hpp
|
| 44 |
+
* Contains a ranged hash policy.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP
|
| 48 |
+
#define PB_DS_SAMPLE_RANGED_HASH_FN_HPP
|
| 49 |
+
|
| 50 |
+
// A sample ranged-hash functor.
|
| 51 |
+
class sample_ranged_hash_fn
|
| 52 |
+
{
|
| 53 |
+
|
| 54 |
+
public:
|
| 55 |
+
|
| 56 |
+
// Size type.
|
| 57 |
+
typedef size_t size_type;
|
| 58 |
+
|
| 59 |
+
public:
|
| 60 |
+
|
| 61 |
+
// Default constructor.
|
| 62 |
+
sample_ranged_hash_fn();
|
| 63 |
+
|
| 64 |
+
// Copy constructor.
|
| 65 |
+
sample_ranged_hash_fn(const sample_ranged_hash_fn& other);
|
| 66 |
+
|
| 67 |
+
// Swaps content.
|
| 68 |
+
inline void
|
| 69 |
+
swap(sample_ranged_hash_fn& other);
|
| 70 |
+
|
| 71 |
+
protected:
|
| 72 |
+
|
| 73 |
+
// Notifies the policy object that the container's __size has changed to size.
|
| 74 |
+
void
|
| 75 |
+
notify_resized(size_type size);
|
| 76 |
+
|
| 77 |
+
// Transforms r_key into a position within the table.
|
| 78 |
+
inline size_type
|
| 79 |
+
operator()(const_key_reference r_key) const;
|
| 80 |
+
|
| 81 |
+
};
|
| 82 |
+
|
| 83 |
+
#endif // #ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file sample_ranged_probe_fn.hpp
|
| 44 |
+
* Contains a ranged probe policy.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP
|
| 48 |
+
#define PB_DS_SAMPLE_RANGED_PROBE_FN_HPP
|
| 49 |
+
|
| 50 |
+
// A sample ranged-probe functor.
|
| 51 |
+
class sample_ranged_probe_fn
|
| 52 |
+
{
|
| 53 |
+
|
| 54 |
+
public:
|
| 55 |
+
|
| 56 |
+
// Size type.
|
| 57 |
+
typedef size_t size_type;
|
| 58 |
+
|
| 59 |
+
public:
|
| 60 |
+
|
| 61 |
+
// Default constructor.
|
| 62 |
+
sample_ranged_probe_fn();
|
| 63 |
+
|
| 64 |
+
// Copy constructor.
|
| 65 |
+
sample_ranged_probe_fn(const sample_ranged_probe_fn& other);
|
| 66 |
+
|
| 67 |
+
// Swaps content.
|
| 68 |
+
inline void
|
| 69 |
+
swap(sample_ranged_probe_fn& other);
|
| 70 |
+
|
| 71 |
+
protected:
|
| 72 |
+
|
| 73 |
+
// Notifies the policy object that the container's __size has changed to size.
|
| 74 |
+
void
|
| 75 |
+
notify_resized(size_type size);
|
| 76 |
+
|
| 77 |
+
// 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.
|
| 78 |
+
inline size_type
|
| 79 |
+
operator()(const_key_reference r_key, size_t hash, size_type i) const;
|
| 80 |
+
|
| 81 |
+
};
|
| 82 |
+
|
| 83 |
+
#endif // #ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file const_iterator.hpp
|
| 44 |
+
* Contains an iterator class returned by the table's const find and insert
|
| 45 |
+
* methods.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP
|
| 49 |
+
#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP
|
| 50 |
+
|
| 51 |
+
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp>
|
| 52 |
+
#include <debug/debug.h>
|
| 53 |
+
|
| 54 |
+
namespace __gnu_pbds
|
| 55 |
+
{
|
| 56 |
+
namespace detail
|
| 57 |
+
{
|
| 58 |
+
|
| 59 |
+
#define PB_DS_CLASS_C_DEC \
|
| 60 |
+
left_child_next_sibling_heap_const_iterator_<Node, Allocator>
|
| 61 |
+
|
| 62 |
+
#define PB_DS_BASE_C_DEC \
|
| 63 |
+
left_child_next_sibling_heap_node_const_point_iterator_<Node, Allocator>
|
| 64 |
+
|
| 65 |
+
// Const point-type iterator.
|
| 66 |
+
template<typename Node, class Allocator>
|
| 67 |
+
class left_child_next_sibling_heap_const_iterator_ : public PB_DS_BASE_C_DEC
|
| 68 |
+
{
|
| 69 |
+
|
| 70 |
+
private:
|
| 71 |
+
typedef typename PB_DS_BASE_C_DEC::node_pointer node_pointer;
|
| 72 |
+
|
| 73 |
+
typedef PB_DS_BASE_C_DEC base_type;
|
| 74 |
+
|
| 75 |
+
public:
|
| 76 |
+
|
| 77 |
+
// Category.
|
| 78 |
+
typedef std::forward_iterator_tag iterator_category;
|
| 79 |
+
|
| 80 |
+
// Difference type.
|
| 81 |
+
typedef typename Allocator::difference_type difference_type;
|
| 82 |
+
|
| 83 |
+
// Iterator's value type.
|
| 84 |
+
typedef typename base_type::value_type value_type;
|
| 85 |
+
|
| 86 |
+
// Iterator's pointer type.
|
| 87 |
+
typedef typename base_type::pointer pointer;
|
| 88 |
+
|
| 89 |
+
// Iterator's const pointer type.
|
| 90 |
+
typedef typename base_type::const_pointer const_pointer;
|
| 91 |
+
|
| 92 |
+
// Iterator's reference type.
|
| 93 |
+
typedef typename base_type::reference reference;
|
| 94 |
+
|
| 95 |
+
// Iterator's const reference type.
|
| 96 |
+
typedef typename base_type::const_reference const_reference;
|
| 97 |
+
|
| 98 |
+
public:
|
| 99 |
+
|
| 100 |
+
inline
|
| 101 |
+
left_child_next_sibling_heap_const_iterator_(node_pointer p_nd) : base_type(p_nd)
|
| 102 |
+
{ }
|
| 103 |
+
|
| 104 |
+
// Default constructor.
|
| 105 |
+
inline
|
| 106 |
+
left_child_next_sibling_heap_const_iterator_()
|
| 107 |
+
{ }
|
| 108 |
+
|
| 109 |
+
// Copy constructor.
|
| 110 |
+
inline
|
| 111 |
+
left_child_next_sibling_heap_const_iterator_(const PB_DS_CLASS_C_DEC& other) : base_type(other)
|
| 112 |
+
{ }
|
| 113 |
+
|
| 114 |
+
// Compares content to a different iterator object.
|
| 115 |
+
inline bool
|
| 116 |
+
operator==(const PB_DS_CLASS_C_DEC& other) const
|
| 117 |
+
{ return (base_type::m_p_nd == other.m_p_nd); }
|
| 118 |
+
|
| 119 |
+
// Compares content (negatively) to a different iterator object.
|
| 120 |
+
inline bool
|
| 121 |
+
operator!=(const PB_DS_CLASS_C_DEC& other) const
|
| 122 |
+
{ return (base_type::m_p_nd != other.m_p_nd); }
|
| 123 |
+
|
| 124 |
+
inline PB_DS_CLASS_C_DEC&
|
| 125 |
+
operator++()
|
| 126 |
+
{
|
| 127 |
+
_GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd != NULL);
|
| 128 |
+
inc();
|
| 129 |
+
return (*this);
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
inline PB_DS_CLASS_C_DEC
|
| 133 |
+
operator++(int)
|
| 134 |
+
{
|
| 135 |
+
PB_DS_CLASS_C_DEC ret_it(base_type::m_p_nd);
|
| 136 |
+
operator++();
|
| 137 |
+
return (ret_it);
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
private:
|
| 141 |
+
void
|
| 142 |
+
inc()
|
| 143 |
+
{
|
| 144 |
+
if (base_type::m_p_nd->m_p_next_sibling != NULL)
|
| 145 |
+
{
|
| 146 |
+
base_type::m_p_nd = base_type::m_p_nd->m_p_next_sibling;
|
| 147 |
+
while (base_type::m_p_nd->m_p_l_child != NULL)
|
| 148 |
+
base_type::m_p_nd = base_type::m_p_nd->m_p_l_child;
|
| 149 |
+
return;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
while (true)
|
| 153 |
+
{
|
| 154 |
+
node_pointer p_next = base_type::m_p_nd;
|
| 155 |
+
base_type::m_p_nd = base_type::m_p_nd->m_p_prev_or_parent;
|
| 156 |
+
if (base_type::m_p_nd == NULL || base_type::m_p_nd->m_p_l_child == p_next)
|
| 157 |
+
return;
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
};
|
| 161 |
+
|
| 162 |
+
#undef PB_DS_CLASS_C_DEC
|
| 163 |
+
#undef PB_DS_BASE_C_DEC
|
| 164 |
+
|
| 165 |
+
} // namespace detail
|
| 166 |
+
} // namespace __gnu_pbds
|
| 167 |
+
|
| 168 |
+
#endif
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file const_point_iterator.hpp
|
| 44 |
+
* Contains an iterator class returned by the table's const find and insert
|
| 45 |
+
* methods.
|
| 46 |
+
*/
|
| 47 |
+
|
| 48 |
+
#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP
|
| 49 |
+
#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP
|
| 50 |
+
|
| 51 |
+
#include <ext/pb_ds/tag_and_trait.hpp>
|
| 52 |
+
#include <debug/debug.h>
|
| 53 |
+
|
| 54 |
+
namespace __gnu_pbds
|
| 55 |
+
{
|
| 56 |
+
namespace detail
|
| 57 |
+
{
|
| 58 |
+
|
| 59 |
+
#define PB_DS_CLASS_T_DEC \
|
| 60 |
+
template<typename Node, class Allocator>
|
| 61 |
+
|
| 62 |
+
#define PB_DS_CLASS_C_DEC \
|
| 63 |
+
left_child_next_sibling_heap_node_const_point_iterator_<Node, Allocator>
|
| 64 |
+
|
| 65 |
+
// Const point-type iterator.
|
| 66 |
+
template<typename Node, class Allocator>
|
| 67 |
+
class left_child_next_sibling_heap_node_const_point_iterator_
|
| 68 |
+
{
|
| 69 |
+
|
| 70 |
+
protected:
|
| 71 |
+
typedef typename Allocator::template rebind<Node>::other::pointer node_pointer;
|
| 72 |
+
|
| 73 |
+
public:
|
| 74 |
+
|
| 75 |
+
// Category.
|
| 76 |
+
typedef trivial_iterator_tag iterator_category;
|
| 77 |
+
|
| 78 |
+
// Difference type.
|
| 79 |
+
typedef trivial_iterator_difference_type difference_type;
|
| 80 |
+
|
| 81 |
+
// Iterator's value type.
|
| 82 |
+
typedef typename Node::value_type value_type;
|
| 83 |
+
|
| 84 |
+
// Iterator's pointer type.
|
| 85 |
+
typedef
|
| 86 |
+
typename Allocator::template rebind<
|
| 87 |
+
value_type>::other::pointer
|
| 88 |
+
pointer;
|
| 89 |
+
|
| 90 |
+
// Iterator's const pointer type.
|
| 91 |
+
typedef
|
| 92 |
+
typename Allocator::template rebind<
|
| 93 |
+
value_type>::other::const_pointer
|
| 94 |
+
const_pointer;
|
| 95 |
+
|
| 96 |
+
// Iterator's reference type.
|
| 97 |
+
typedef
|
| 98 |
+
typename Allocator::template rebind<
|
| 99 |
+
value_type>::other::reference
|
| 100 |
+
reference;
|
| 101 |
+
|
| 102 |
+
// Iterator's const reference type.
|
| 103 |
+
typedef
|
| 104 |
+
typename Allocator::template rebind<
|
| 105 |
+
value_type>::other::const_reference
|
| 106 |
+
const_reference;
|
| 107 |
+
|
| 108 |
+
public:
|
| 109 |
+
|
| 110 |
+
inline
|
| 111 |
+
left_child_next_sibling_heap_node_const_point_iterator_(node_pointer p_nd) : m_p_nd(p_nd)
|
| 112 |
+
{ }
|
| 113 |
+
|
| 114 |
+
// Default constructor.
|
| 115 |
+
inline
|
| 116 |
+
left_child_next_sibling_heap_node_const_point_iterator_() : m_p_nd(NULL)
|
| 117 |
+
{ }
|
| 118 |
+
|
| 119 |
+
// Copy constructor.
|
| 120 |
+
inline
|
| 121 |
+
left_child_next_sibling_heap_node_const_point_iterator_(const PB_DS_CLASS_C_DEC& other) : m_p_nd(other.m_p_nd)
|
| 122 |
+
{ }
|
| 123 |
+
|
| 124 |
+
// Access.
|
| 125 |
+
inline const_pointer
|
| 126 |
+
operator->() const
|
| 127 |
+
{
|
| 128 |
+
_GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);
|
| 129 |
+
return &m_p_nd->m_value;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
// Access.
|
| 133 |
+
inline const_reference
|
| 134 |
+
operator*() const
|
| 135 |
+
{
|
| 136 |
+
_GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);
|
| 137 |
+
return m_p_nd->m_value;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
// Compares content to a different iterator object.
|
| 141 |
+
inline bool
|
| 142 |
+
operator==(const PB_DS_CLASS_C_DEC& other) const
|
| 143 |
+
{ return m_p_nd == other.m_p_nd; }
|
| 144 |
+
|
| 145 |
+
// Compares content (negatively) to a different iterator object.
|
| 146 |
+
inline bool
|
| 147 |
+
operator!=(const PB_DS_CLASS_C_DEC& other) const
|
| 148 |
+
{ return m_p_nd != other.m_p_nd; }
|
| 149 |
+
|
| 150 |
+
public:
|
| 151 |
+
node_pointer m_p_nd;
|
| 152 |
+
};
|
| 153 |
+
|
| 154 |
+
#undef PB_DS_CLASS_T_DEC
|
| 155 |
+
#undef PB_DS_CLASS_C_DEC
|
| 156 |
+
|
| 157 |
+
} // namespace detail
|
| 158 |
+
} // namespace __gnu_pbds
|
| 159 |
+
|
| 160 |
+
#endif
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file constructors_destructor_fn_imps.hpp
|
| 44 |
+
* Contains an implementation class for left_child_next_sibling_heap_.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
PB_DS_CLASS_T_DEC
|
| 48 |
+
typename PB_DS_CLASS_C_DEC::node_allocator
|
| 49 |
+
PB_DS_CLASS_C_DEC::s_node_allocator;
|
| 50 |
+
|
| 51 |
+
PB_DS_CLASS_T_DEC
|
| 52 |
+
typename PB_DS_CLASS_C_DEC::no_throw_copies_t
|
| 53 |
+
PB_DS_CLASS_C_DEC::s_no_throw_copies_ind;
|
| 54 |
+
|
| 55 |
+
PB_DS_CLASS_T_DEC
|
| 56 |
+
PB_DS_CLASS_C_DEC::
|
| 57 |
+
left_child_next_sibling_heap_() :
|
| 58 |
+
m_p_root(NULL),
|
| 59 |
+
m_size(0)
|
| 60 |
+
{
|
| 61 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
PB_DS_CLASS_T_DEC
|
| 65 |
+
PB_DS_CLASS_C_DEC::
|
| 66 |
+
left_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn) :
|
| 67 |
+
Cmp_Fn(r_cmp_fn),
|
| 68 |
+
m_p_root(NULL),
|
| 69 |
+
m_size(0)
|
| 70 |
+
{
|
| 71 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
PB_DS_CLASS_T_DEC
|
| 75 |
+
PB_DS_CLASS_C_DEC::
|
| 76 |
+
left_child_next_sibling_heap_(const PB_DS_CLASS_C_DEC& other)
|
| 77 |
+
: Cmp_Fn(other), m_p_root(NULL), m_size(0)
|
| 78 |
+
{
|
| 79 |
+
m_size = other.m_size;
|
| 80 |
+
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
|
| 81 |
+
m_p_root = recursive_copy_node(other.m_p_root);
|
| 82 |
+
m_size = other.m_size;
|
| 83 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
PB_DS_CLASS_T_DEC
|
| 87 |
+
void
|
| 88 |
+
PB_DS_CLASS_C_DEC::
|
| 89 |
+
swap(PB_DS_CLASS_C_DEC& other)
|
| 90 |
+
{
|
| 91 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 92 |
+
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
|
| 93 |
+
value_swap(other);
|
| 94 |
+
std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other);
|
| 95 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 96 |
+
_GLIBCXX_DEBUG_ONLY(other.assert_valid();)
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
PB_DS_CLASS_T_DEC
|
| 100 |
+
void
|
| 101 |
+
PB_DS_CLASS_C_DEC::
|
| 102 |
+
value_swap(PB_DS_CLASS_C_DEC& other)
|
| 103 |
+
{
|
| 104 |
+
std::swap(m_p_root, other.m_p_root);
|
| 105 |
+
std::swap(m_size, other.m_size);
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
PB_DS_CLASS_T_DEC
|
| 109 |
+
PB_DS_CLASS_C_DEC::
|
| 110 |
+
~left_child_next_sibling_heap_()
|
| 111 |
+
{
|
| 112 |
+
clear();
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
PB_DS_CLASS_T_DEC
|
| 116 |
+
typename PB_DS_CLASS_C_DEC::node_pointer
|
| 117 |
+
PB_DS_CLASS_C_DEC::
|
| 118 |
+
recursive_copy_node(const_node_pointer p_nd)
|
| 119 |
+
{
|
| 120 |
+
if (p_nd == NULL)
|
| 121 |
+
return (NULL);
|
| 122 |
+
|
| 123 |
+
node_pointer p_ret = s_node_allocator.allocate(1);
|
| 124 |
+
|
| 125 |
+
try
|
| 126 |
+
{
|
| 127 |
+
new (p_ret) node(*p_nd);
|
| 128 |
+
}
|
| 129 |
+
catch(...)
|
| 130 |
+
{
|
| 131 |
+
s_node_allocator.deallocate(p_ret, 1);
|
| 132 |
+
__throw_exception_again;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
p_ret->m_p_l_child = p_ret->m_p_next_sibling =
|
| 136 |
+
p_ret->m_p_prev_or_parent = NULL;
|
| 137 |
+
|
| 138 |
+
try
|
| 139 |
+
{
|
| 140 |
+
p_ret->m_p_l_child = recursive_copy_node(p_nd->m_p_l_child);
|
| 141 |
+
p_ret->m_p_next_sibling = recursive_copy_node(p_nd->m_p_next_sibling);
|
| 142 |
+
}
|
| 143 |
+
catch(...)
|
| 144 |
+
{
|
| 145 |
+
clear_imp(p_ret);
|
| 146 |
+
__throw_exception_again;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
if (p_ret->m_p_l_child != NULL)
|
| 150 |
+
p_ret->m_p_l_child->m_p_prev_or_parent = p_ret;
|
| 151 |
+
|
| 152 |
+
if (p_ret->m_p_next_sibling != NULL)
|
| 153 |
+
p_ret->m_p_next_sibling->m_p_prev_or_parent =
|
| 154 |
+
p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd ? p_ret : NULL;
|
| 155 |
+
|
| 156 |
+
return p_ret;
|
| 157 |
+
}
|
| 158 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file debug_fn_imps.hpp
|
| 44 |
+
* Contains an implementation class for left_child_next_sibling_heap_.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#ifdef _GLIBCXX_DEBUG
|
| 48 |
+
|
| 49 |
+
PB_DS_CLASS_T_DEC
|
| 50 |
+
void
|
| 51 |
+
PB_DS_CLASS_C_DEC::
|
| 52 |
+
assert_valid() const
|
| 53 |
+
{
|
| 54 |
+
_GLIBCXX_DEBUG_ASSERT(m_p_root == NULL || m_p_root->m_p_prev_or_parent == NULL);
|
| 55 |
+
|
| 56 |
+
if (m_p_root != NULL)
|
| 57 |
+
assert_node_consistent(m_p_root, Single_Link_Roots);
|
| 58 |
+
assert_size();
|
| 59 |
+
assert_iterators();
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
PB_DS_CLASS_T_DEC
|
| 63 |
+
void
|
| 64 |
+
PB_DS_CLASS_C_DEC::
|
| 65 |
+
assert_node_consistent(const_node_pointer p_nd, bool single_link) const
|
| 66 |
+
{
|
| 67 |
+
if (p_nd == NULL)
|
| 68 |
+
return;
|
| 69 |
+
|
| 70 |
+
assert_node_consistent(p_nd->m_p_l_child, false);
|
| 71 |
+
assert_node_consistent(p_nd->m_p_next_sibling, single_link);
|
| 72 |
+
|
| 73 |
+
if (single_link)
|
| 74 |
+
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_prev_or_parent == NULL);
|
| 75 |
+
else if (p_nd->m_p_next_sibling != NULL)
|
| 76 |
+
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd);
|
| 77 |
+
|
| 78 |
+
if (p_nd->m_p_l_child == NULL)
|
| 79 |
+
return;
|
| 80 |
+
|
| 81 |
+
const_node_pointer p_child = p_nd->m_p_l_child;
|
| 82 |
+
while (p_child != NULL)
|
| 83 |
+
{
|
| 84 |
+
const_node_pointer p_next_child = p_child->m_p_next_sibling;
|
| 85 |
+
_GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(p_nd->m_value, p_child->m_value));
|
| 86 |
+
p_child = p_next_child;
|
| 87 |
+
}
|
| 88 |
+
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child->m_p_prev_or_parent == p_nd);
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
PB_DS_CLASS_T_DEC
|
| 92 |
+
void
|
| 93 |
+
PB_DS_CLASS_C_DEC::
|
| 94 |
+
assert_iterators() const
|
| 95 |
+
{
|
| 96 |
+
const size_type calc_size = std::distance(begin(), end());
|
| 97 |
+
if (calc_size == size())
|
| 98 |
+
return;
|
| 99 |
+
_GLIBCXX_DEBUG_ASSERT(0);
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
PB_DS_CLASS_T_DEC
|
| 103 |
+
void
|
| 104 |
+
PB_DS_CLASS_C_DEC::
|
| 105 |
+
assert_size() const
|
| 106 |
+
{
|
| 107 |
+
if (size_from_node(m_p_root) == m_size)
|
| 108 |
+
return;
|
| 109 |
+
_GLIBCXX_DEBUG_ASSERT(0);
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
PB_DS_CLASS_T_DEC
|
| 113 |
+
typename PB_DS_CLASS_C_DEC::size_type
|
| 114 |
+
PB_DS_CLASS_C_DEC::
|
| 115 |
+
size_under_node(const_node_pointer p_nd)
|
| 116 |
+
{ return 1 + size_from_node(p_nd->m_p_l_child); }
|
| 117 |
+
|
| 118 |
+
PB_DS_CLASS_T_DEC
|
| 119 |
+
typename PB_DS_CLASS_C_DEC::size_type
|
| 120 |
+
PB_DS_CLASS_C_DEC::
|
| 121 |
+
size_from_node(const_node_pointer p_nd)
|
| 122 |
+
{
|
| 123 |
+
size_type ret = 0;
|
| 124 |
+
while (p_nd != NULL)
|
| 125 |
+
{
|
| 126 |
+
ret += 1 + size_from_node(p_nd->m_p_l_child);
|
| 127 |
+
p_nd = p_nd->m_p_next_sibling;
|
| 128 |
+
}
|
| 129 |
+
return ret;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
PB_DS_CLASS_T_DEC
|
| 133 |
+
typename PB_DS_CLASS_C_DEC::size_type
|
| 134 |
+
PB_DS_CLASS_C_DEC::
|
| 135 |
+
degree(const_node_pointer p_nd)
|
| 136 |
+
{
|
| 137 |
+
size_type ret = 0;
|
| 138 |
+
const_node_pointer p_child = p_nd->m_p_l_child;
|
| 139 |
+
while (p_child != NULL)
|
| 140 |
+
{
|
| 141 |
+
++ret;
|
| 142 |
+
p_child = p_child->m_p_next_sibling;
|
| 143 |
+
}
|
| 144 |
+
return ret;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
#endif
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file erase_fn_imps.hpp
|
| 44 |
+
* Contains an implementation class for left_child_next_sibling_heap_.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
PB_DS_CLASS_T_DEC
|
| 48 |
+
void
|
| 49 |
+
PB_DS_CLASS_C_DEC::
|
| 50 |
+
clear()
|
| 51 |
+
{
|
| 52 |
+
clear_imp(m_p_root);
|
| 53 |
+
_GLIBCXX_DEBUG_ASSERT(m_size == 0);
|
| 54 |
+
m_p_root = NULL;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
PB_DS_CLASS_T_DEC
|
| 58 |
+
inline void
|
| 59 |
+
PB_DS_CLASS_C_DEC::
|
| 60 |
+
actual_erase_node(node_pointer p_nd)
|
| 61 |
+
{
|
| 62 |
+
_GLIBCXX_DEBUG_ASSERT(m_size > 0);
|
| 63 |
+
--m_size;
|
| 64 |
+
p_nd->~node();
|
| 65 |
+
s_node_allocator.deallocate(p_nd, 1);
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
PB_DS_CLASS_T_DEC
|
| 69 |
+
void
|
| 70 |
+
PB_DS_CLASS_C_DEC::
|
| 71 |
+
clear_imp(node_pointer p_nd)
|
| 72 |
+
{
|
| 73 |
+
while (p_nd != NULL)
|
| 74 |
+
{
|
| 75 |
+
clear_imp(p_nd->m_p_l_child);
|
| 76 |
+
node_pointer p_next = p_nd->m_p_next_sibling;
|
| 77 |
+
actual_erase_node(p_nd);
|
| 78 |
+
p_nd = p_next;
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
PB_DS_CLASS_T_DEC
|
| 83 |
+
void
|
| 84 |
+
PB_DS_CLASS_C_DEC::
|
| 85 |
+
to_linked_list()
|
| 86 |
+
{
|
| 87 |
+
_GLIBCXX_DEBUG_ONLY(assert_valid();)
|
| 88 |
+
node_pointer p_cur = m_p_root;
|
| 89 |
+
while (p_cur != NULL)
|
| 90 |
+
if (p_cur->m_p_l_child != NULL)
|
| 91 |
+
{
|
| 92 |
+
node_pointer p_child_next = p_cur->m_p_l_child->m_p_next_sibling;
|
| 93 |
+
p_cur->m_p_l_child->m_p_next_sibling = p_cur->m_p_next_sibling;
|
| 94 |
+
p_cur->m_p_next_sibling = p_cur->m_p_l_child;
|
| 95 |
+
p_cur->m_p_l_child = p_child_next;
|
| 96 |
+
}
|
| 97 |
+
else
|
| 98 |
+
p_cur = p_cur->m_p_next_sibling;
|
| 99 |
+
|
| 100 |
+
#ifdef _GLIBCXX_DEBUG
|
| 101 |
+
const_node_pointer p_counter = m_p_root;
|
| 102 |
+
size_type count = 0;
|
| 103 |
+
while (p_counter != NULL)
|
| 104 |
+
{
|
| 105 |
+
++count;
|
| 106 |
+
_GLIBCXX_DEBUG_ASSERT(p_counter->m_p_l_child == NULL);
|
| 107 |
+
p_counter = p_counter->m_p_next_sibling;
|
| 108 |
+
}
|
| 109 |
+
_GLIBCXX_DEBUG_ASSERT(count == m_size);
|
| 110 |
+
#endif
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
PB_DS_CLASS_T_DEC
|
| 114 |
+
template<typename Pred>
|
| 115 |
+
typename PB_DS_CLASS_C_DEC::node_pointer
|
| 116 |
+
PB_DS_CLASS_C_DEC::
|
| 117 |
+
prune(Pred pred)
|
| 118 |
+
{
|
| 119 |
+
node_pointer p_cur = m_p_root;
|
| 120 |
+
m_p_root = NULL;
|
| 121 |
+
node_pointer p_out = NULL;
|
| 122 |
+
while (p_cur != NULL)
|
| 123 |
+
{
|
| 124 |
+
node_pointer p_next = p_cur->m_p_next_sibling;
|
| 125 |
+
if (pred(p_cur->m_value))
|
| 126 |
+
{
|
| 127 |
+
p_cur->m_p_next_sibling = p_out;
|
| 128 |
+
if (p_out != NULL)
|
| 129 |
+
p_out->m_p_prev_or_parent = p_cur;
|
| 130 |
+
p_out = p_cur;
|
| 131 |
+
}
|
| 132 |
+
else
|
| 133 |
+
{
|
| 134 |
+
p_cur->m_p_next_sibling = m_p_root;
|
| 135 |
+
if (m_p_root != NULL)
|
| 136 |
+
m_p_root->m_p_prev_or_parent = p_cur;
|
| 137 |
+
m_p_root = p_cur;
|
| 138 |
+
}
|
| 139 |
+
p_cur = p_next;
|
| 140 |
+
}
|
| 141 |
+
return p_out;
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
PB_DS_CLASS_T_DEC
|
| 145 |
+
void
|
| 146 |
+
PB_DS_CLASS_C_DEC::
|
| 147 |
+
bubble_to_top(node_pointer p_nd)
|
| 148 |
+
{
|
| 149 |
+
node_pointer p_parent = parent(p_nd);
|
| 150 |
+
while (p_parent != NULL)
|
| 151 |
+
{
|
| 152 |
+
swap_with_parent(p_nd, p_parent);
|
| 153 |
+
p_parent = parent(p_nd);
|
| 154 |
+
}
|
| 155 |
+
}
|
| 156 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file info_fn_imps.hpp
|
| 44 |
+
* Contains an implementation class for left_child_next_sibling_heap_.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
PB_DS_CLASS_T_DEC
|
| 48 |
+
inline bool
|
| 49 |
+
PB_DS_CLASS_C_DEC::
|
| 50 |
+
empty() const
|
| 51 |
+
{
|
| 52 |
+
return (m_size == 0);
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
PB_DS_CLASS_T_DEC
|
| 56 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 57 |
+
PB_DS_CLASS_C_DEC::
|
| 58 |
+
size() const
|
| 59 |
+
{
|
| 60 |
+
return (m_size);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
PB_DS_CLASS_T_DEC
|
| 64 |
+
inline typename PB_DS_CLASS_C_DEC::size_type
|
| 65 |
+
PB_DS_CLASS_C_DEC::
|
| 66 |
+
max_size() const
|
| 67 |
+
{
|
| 68 |
+
return (s_node_allocator.max_size());
|
| 69 |
+
}
|
| 70 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file insert_fn_imps.hpp
|
| 44 |
+
* Contains an implementation class for left_child_next_sibling_heap_.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
PB_DS_CLASS_T_DEC
|
| 48 |
+
inline typename PB_DS_CLASS_C_DEC::node_pointer
|
| 49 |
+
PB_DS_CLASS_C_DEC::
|
| 50 |
+
get_new_node_for_insert(const_reference r_val)
|
| 51 |
+
{
|
| 52 |
+
return get_new_node_for_insert(r_val, s_no_throw_copies_ind);
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
PB_DS_CLASS_T_DEC
|
| 56 |
+
inline typename PB_DS_CLASS_C_DEC::node_pointer
|
| 57 |
+
PB_DS_CLASS_C_DEC::
|
| 58 |
+
get_new_node_for_insert(const_reference r_val, false_type)
|
| 59 |
+
{
|
| 60 |
+
node_pointer p_new_nd = s_node_allocator.allocate(1);
|
| 61 |
+
|
| 62 |
+
cond_dealtor_t cond(p_new_nd);
|
| 63 |
+
|
| 64 |
+
new (const_cast<void* >(
|
| 65 |
+
static_cast<const void* >(&p_new_nd->m_value)))
|
| 66 |
+
typename node::value_type(r_val);
|
| 67 |
+
|
| 68 |
+
cond.set_no_action();
|
| 69 |
+
|
| 70 |
+
++m_size;
|
| 71 |
+
|
| 72 |
+
return (p_new_nd);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
PB_DS_CLASS_T_DEC
|
| 76 |
+
inline typename PB_DS_CLASS_C_DEC::node_pointer
|
| 77 |
+
PB_DS_CLASS_C_DEC::
|
| 78 |
+
get_new_node_for_insert(const_reference r_val, true_type)
|
| 79 |
+
{
|
| 80 |
+
node_pointer p_new_nd = s_node_allocator.allocate(1);
|
| 81 |
+
|
| 82 |
+
new (const_cast<void* >(
|
| 83 |
+
static_cast<const void* >(&p_new_nd->m_value)))
|
| 84 |
+
typename node::value_type(r_val);
|
| 85 |
+
|
| 86 |
+
++m_size;
|
| 87 |
+
|
| 88 |
+
return (p_new_nd);
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
PB_DS_CLASS_T_DEC
|
| 92 |
+
inline void
|
| 93 |
+
PB_DS_CLASS_C_DEC::
|
| 94 |
+
make_child_of(node_pointer p_nd, node_pointer p_new_parent)
|
| 95 |
+
{
|
| 96 |
+
_GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
|
| 97 |
+
_GLIBCXX_DEBUG_ASSERT(p_new_parent != NULL);
|
| 98 |
+
|
| 99 |
+
p_nd->m_p_next_sibling = p_new_parent->m_p_l_child;
|
| 100 |
+
|
| 101 |
+
if (p_new_parent->m_p_l_child != NULL)
|
| 102 |
+
p_new_parent->m_p_l_child->m_p_prev_or_parent = p_nd;
|
| 103 |
+
|
| 104 |
+
p_nd->m_p_prev_or_parent = p_new_parent;
|
| 105 |
+
|
| 106 |
+
p_new_parent->m_p_l_child = p_nd;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
PB_DS_CLASS_T_DEC
|
| 110 |
+
inline typename PB_DS_CLASS_C_DEC::node_pointer
|
| 111 |
+
PB_DS_CLASS_C_DEC::
|
| 112 |
+
parent(node_pointer p_nd)
|
| 113 |
+
{
|
| 114 |
+
while (true)
|
| 115 |
+
{
|
| 116 |
+
node_pointer p_pot = p_nd->m_p_prev_or_parent;
|
| 117 |
+
|
| 118 |
+
if (p_pot == NULL || p_pot->m_p_l_child == p_nd)
|
| 119 |
+
return p_pot;
|
| 120 |
+
|
| 121 |
+
p_nd = p_pot;
|
| 122 |
+
}
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
PB_DS_CLASS_T_DEC
|
| 126 |
+
inline void
|
| 127 |
+
PB_DS_CLASS_C_DEC::
|
| 128 |
+
swap_with_parent(node_pointer p_nd, node_pointer p_parent)
|
| 129 |
+
{
|
| 130 |
+
if (p_parent == m_p_root)
|
| 131 |
+
m_p_root = p_nd;
|
| 132 |
+
|
| 133 |
+
_GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
|
| 134 |
+
_GLIBCXX_DEBUG_ASSERT(p_parent != NULL);
|
| 135 |
+
_GLIBCXX_DEBUG_ASSERT(parent(p_nd) == p_parent);
|
| 136 |
+
|
| 137 |
+
const bool nd_direct_child = p_parent->m_p_l_child == p_nd;
|
| 138 |
+
const bool parent_root = p_parent->m_p_prev_or_parent == NULL;
|
| 139 |
+
const bool parent_direct_child =
|
| 140 |
+
!parent_root&& p_parent->m_p_prev_or_parent->m_p_l_child == p_parent;
|
| 141 |
+
|
| 142 |
+
std::swap(p_parent->m_p_prev_or_parent, p_nd->m_p_prev_or_parent);
|
| 143 |
+
std::swap(p_parent->m_p_next_sibling, p_nd->m_p_next_sibling);
|
| 144 |
+
std::swap(p_parent->m_p_l_child, p_nd->m_p_l_child);
|
| 145 |
+
std::swap(p_parent->m_metadata, p_nd->m_metadata);
|
| 146 |
+
|
| 147 |
+
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child != NULL);
|
| 148 |
+
_GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent != NULL);
|
| 149 |
+
|
| 150 |
+
if (p_nd->m_p_next_sibling != NULL)
|
| 151 |
+
p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;
|
| 152 |
+
|
| 153 |
+
if (p_parent->m_p_next_sibling != NULL)
|
| 154 |
+
p_parent->m_p_next_sibling->m_p_prev_or_parent = p_parent;
|
| 155 |
+
|
| 156 |
+
if (p_parent->m_p_l_child != NULL)
|
| 157 |
+
p_parent->m_p_l_child->m_p_prev_or_parent = p_parent;
|
| 158 |
+
|
| 159 |
+
if (parent_direct_child)
|
| 160 |
+
p_nd->m_p_prev_or_parent->m_p_l_child = p_nd;
|
| 161 |
+
else if (!parent_root)
|
| 162 |
+
p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd;
|
| 163 |
+
|
| 164 |
+
if (!nd_direct_child)
|
| 165 |
+
{
|
| 166 |
+
p_nd->m_p_l_child->m_p_prev_or_parent = p_nd;
|
| 167 |
+
|
| 168 |
+
p_parent->m_p_prev_or_parent->m_p_next_sibling = p_parent;
|
| 169 |
+
}
|
| 170 |
+
else
|
| 171 |
+
{
|
| 172 |
+
_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child == p_nd);
|
| 173 |
+
_GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent == p_parent);
|
| 174 |
+
|
| 175 |
+
p_nd->m_p_l_child = p_parent;
|
| 176 |
+
p_parent->m_p_prev_or_parent = p_nd;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
_GLIBCXX_DEBUG_ASSERT(parent(p_parent) == p_nd);
|
| 180 |
+
}
|
| 181 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file iterators_fn_imps.hpp
|
| 44 |
+
* Contains an implementation class for left_child_next_sibling_heap_.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
PB_DS_CLASS_T_DEC
|
| 48 |
+
inline typename PB_DS_CLASS_C_DEC::iterator
|
| 49 |
+
PB_DS_CLASS_C_DEC::
|
| 50 |
+
begin()
|
| 51 |
+
{
|
| 52 |
+
node_pointer p_nd = m_p_root;
|
| 53 |
+
|
| 54 |
+
if (p_nd == NULL)
|
| 55 |
+
return (iterator(NULL));
|
| 56 |
+
|
| 57 |
+
while (p_nd->m_p_l_child != NULL)
|
| 58 |
+
p_nd = p_nd->m_p_l_child;
|
| 59 |
+
|
| 60 |
+
return (iterator(p_nd));
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
PB_DS_CLASS_T_DEC
|
| 64 |
+
inline typename PB_DS_CLASS_C_DEC::const_iterator
|
| 65 |
+
PB_DS_CLASS_C_DEC::
|
| 66 |
+
begin() const
|
| 67 |
+
{
|
| 68 |
+
node_pointer p_nd = m_p_root;
|
| 69 |
+
|
| 70 |
+
if (p_nd == NULL)
|
| 71 |
+
return (const_iterator(NULL));
|
| 72 |
+
|
| 73 |
+
while (p_nd->m_p_l_child != NULL)
|
| 74 |
+
p_nd = p_nd->m_p_l_child;
|
| 75 |
+
|
| 76 |
+
return (const_iterator(p_nd));
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
PB_DS_CLASS_T_DEC
|
| 80 |
+
inline typename PB_DS_CLASS_C_DEC::iterator
|
| 81 |
+
PB_DS_CLASS_C_DEC::
|
| 82 |
+
end()
|
| 83 |
+
{
|
| 84 |
+
return (iterator(NULL));
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
PB_DS_CLASS_T_DEC
|
| 88 |
+
inline typename PB_DS_CLASS_C_DEC::const_iterator
|
| 89 |
+
PB_DS_CLASS_C_DEC::
|
| 90 |
+
end() const
|
| 91 |
+
{
|
| 92 |
+
return (const_iterator(NULL));
|
| 93 |
+
}
|
| 94 |
+
|
mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// -*- C++ -*-
|
| 2 |
+
|
| 3 |
+
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
| 4 |
+
//
|
| 5 |
+
// This file is part of the GNU ISO C++ Library. This library is free
|
| 6 |
+
// software; you can redistribute it and/or modify it under the terms
|
| 7 |
+
// of the GNU General Public License as published by the Free Software
|
| 8 |
+
// Foundation; either version 2, or (at your option) any later
|
| 9 |
+
// version.
|
| 10 |
+
|
| 11 |
+
// This library is distributed in the hope that it will be useful, but
|
| 12 |
+
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
+
// General Public License for more details.
|
| 15 |
+
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this library; see the file COPYING. If not, write to
|
| 18 |
+
// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
| 19 |
+
// MA 02111-1307, USA.
|
| 20 |
+
|
| 21 |
+
// As a special exception, you may use this file as part of a free
|
| 22 |
+
// software library without restriction. Specifically, if other files
|
| 23 |
+
// instantiate templates or use macros or inline functions from this
|
| 24 |
+
// file, or you compile this file and link it with other files to
|
| 25 |
+
// produce an executable, this file does not by itself cause the
|
| 26 |
+
// resulting executable to be covered by the GNU General Public
|
| 27 |
+
// License. This exception does not however invalidate any other
|
| 28 |
+
// reasons why the executable file might be covered by the GNU General
|
| 29 |
+
// Public License.
|
| 30 |
+
|
| 31 |
+
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
|
| 32 |
+
|
| 33 |
+
// Permission to use, copy, modify, sell, and distribute this software
|
| 34 |
+
// is hereby granted without fee, provided that the above copyright
|
| 35 |
+
// notice appears in all copies, and that both that copyright notice
|
| 36 |
+
// and this permission notice appear in supporting documentation. None
|
| 37 |
+
// of the above authors, nor IBM Haifa Research Laboratories, make any
|
| 38 |
+
// representation about the suitability of this software for any
|
| 39 |
+
// purpose. It is provided "as is" without express or implied
|
| 40 |
+
// warranty.
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* @file left_child_next_sibling_heap_.hpp
|
| 44 |
+
* Contains an implementation class for a basic heap.
|
| 45 |
+
*/
|
| 46 |
+
|
| 47 |
+
#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_HPP
|
| 48 |
+
#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_HPP
|
| 49 |
+
|
| 50 |
+
/*
|
| 51 |
+
* Based on CLRS.
|
| 52 |
+
*/
|
| 53 |
+
|
| 54 |
+
#include <iterator>
|
| 55 |
+
#include <ext/pb_ds/detail/cond_dealtor.hpp>
|
| 56 |
+
#include <ext/pb_ds/detail/type_utils.hpp>
|
| 57 |
+
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp>
|
| 58 |
+
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp>
|
| 59 |
+
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp>
|
| 60 |
+
#ifdef PB_DS_LC_NS_HEAP_TRACE_
|
| 61 |
+
#include <iostream>
|
| 62 |
+
#endif
|
| 63 |
+
#include <debug/debug.h>
|
| 64 |
+
|
| 65 |
+
namespace __gnu_pbds
|
| 66 |
+
{
|
| 67 |
+
namespace detail
|
| 68 |
+
{
|
| 69 |
+
|
| 70 |
+
#ifdef _GLIBCXX_DEBUG
|
| 71 |
+
#define PB_DS_CLASS_T_DEC \
|
| 72 |
+
template< \
|
| 73 |
+
typename Value_Type, \
|
| 74 |
+
class Cmp_Fn, \
|
| 75 |
+
typename Node_Metadata, \
|
| 76 |
+
class Allocator, \
|
| 77 |
+
bool Single_Link_Roots>
|
| 78 |
+
#else
|
| 79 |
+
#define PB_DS_CLASS_T_DEC \
|
| 80 |
+
template< \
|
| 81 |
+
typename Value_Type, \
|
| 82 |
+
class Cmp_Fn, \
|
| 83 |
+
typename Node_Metadata, \
|
| 84 |
+
class Allocator>
|
| 85 |
+
#endif
|
| 86 |
+
|
| 87 |
+
#ifdef _GLIBCXX_DEBUG
|
| 88 |
+
#define PB_DS_CLASS_C_DEC \
|
| 89 |
+
left_child_next_sibling_heap_< \
|
| 90 |
+
Value_Type, \
|
| 91 |
+
Cmp_Fn, \
|
| 92 |
+
Node_Metadata, \
|
| 93 |
+
Allocator, \
|
| 94 |
+
Single_Link_Roots>
|
| 95 |
+
#else
|
| 96 |
+
#define PB_DS_CLASS_C_DEC \
|
| 97 |
+
left_child_next_sibling_heap_< \
|
| 98 |
+
Value_Type, \
|
| 99 |
+
Cmp_Fn, \
|
| 100 |
+
Node_Metadata, \
|
| 101 |
+
Allocator>
|
| 102 |
+
#endif
|
| 103 |
+
|
| 104 |
+
/**
|
| 105 |
+
* class description = "Base class for some types of h3ap$">
|
| 106 |
+
**/
|
| 107 |
+
#ifdef _GLIBCXX_DEBUG
|
| 108 |
+
template<typename Value_Type,
|
| 109 |
+
class Cmp_Fn,
|
| 110 |
+
typename Node_Metadata,
|
| 111 |
+
class Allocator,
|
| 112 |
+
bool Single_Link_Roots>
|
| 113 |
+
#else
|
| 114 |
+
template<typename Value_Type,
|
| 115 |
+
class Cmp_Fn,
|
| 116 |
+
typename Node_Metadata,
|
| 117 |
+
class Allocator>
|
| 118 |
+
#endif
|
| 119 |
+
class left_child_next_sibling_heap_ : public Cmp_Fn
|
| 120 |
+
{
|
| 121 |
+
|
| 122 |
+
protected:
|
| 123 |
+
typedef
|
| 124 |
+
typename Allocator::template rebind<
|
| 125 |
+
left_child_next_sibling_heap_node_<
|
| 126 |
+
Value_Type,
|
| 127 |
+
Node_Metadata,
|
| 128 |
+
Allocator> >::other
|
| 129 |
+
node_allocator;
|
| 130 |
+
|
| 131 |
+
typedef typename node_allocator::value_type node;
|
| 132 |
+
|
| 133 |
+
typedef typename node_allocator::pointer node_pointer;
|
| 134 |
+
|
| 135 |
+
typedef typename node_allocator::const_pointer const_node_pointer;
|
| 136 |
+
|
| 137 |
+
typedef Node_Metadata node_metadata;
|
| 138 |
+
|
| 139 |
+
typedef std::pair< node_pointer, node_pointer> node_pointer_pair;
|
| 140 |
+
|
| 141 |
+
private:
|
| 142 |
+
typedef cond_dealtor< node, Allocator> cond_dealtor_t;
|
| 143 |
+
|
| 144 |
+
enum
|
| 145 |
+
{
|
| 146 |
+
simple_value = is_simple<Value_Type>::value
|
| 147 |
+
};
|
| 148 |
+
|
| 149 |
+
typedef integral_constant<int, simple_value> no_throw_copies_t;
|
| 150 |
+
|
| 151 |
+
public:
|
| 152 |
+
|
| 153 |
+
typedef typename Allocator::size_type size_type;
|
| 154 |
+
|
| 155 |
+
typedef typename Allocator::difference_type difference_type;
|
| 156 |
+
|
| 157 |
+
typedef Value_Type value_type;
|
| 158 |
+
|
| 159 |
+
typedef
|
| 160 |
+
typename Allocator::template rebind<
|
| 161 |
+
value_type>::other::pointer
|
| 162 |
+
pointer;
|
| 163 |
+
|
| 164 |
+
typedef
|
| 165 |
+
typename Allocator::template rebind<
|
| 166 |
+
value_type>::other::const_pointer
|
| 167 |
+
const_pointer;
|
| 168 |
+
|
| 169 |
+
typedef
|
| 170 |
+
typename Allocator::template rebind<
|
| 171 |
+
value_type>::other::reference
|
| 172 |
+
reference;
|
| 173 |
+
|
| 174 |
+
typedef
|
| 175 |
+
typename Allocator::template rebind<
|
| 176 |
+
value_type>::other::const_reference
|
| 177 |
+
const_reference;
|
| 178 |
+
|
| 179 |
+
typedef
|
| 180 |
+
left_child_next_sibling_heap_node_const_point_iterator_<
|
| 181 |
+
node,
|
| 182 |
+
Allocator>
|
| 183 |
+
const_point_iterator;
|
| 184 |
+
|
| 185 |
+
typedef const_point_iterator point_iterator;
|
| 186 |
+
|
| 187 |
+
typedef
|
| 188 |
+
left_child_next_sibling_heap_const_iterator_<
|
| 189 |
+
node,
|
| 190 |
+
Allocator>
|
| 191 |
+
const_iterator;
|
| 192 |
+
|
| 193 |
+
typedef const_iterator iterator;
|
| 194 |
+
|
| 195 |
+
typedef Cmp_Fn cmp_fn;
|
| 196 |
+
|
| 197 |
+
typedef Allocator allocator;
|
| 198 |
+
|
| 199 |
+
public:
|
| 200 |
+
|
| 201 |
+
left_child_next_sibling_heap_();
|
| 202 |
+
|
| 203 |
+
left_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn);
|
| 204 |
+
|
| 205 |
+
left_child_next_sibling_heap_(const PB_DS_CLASS_C_DEC& other);
|
| 206 |
+
|
| 207 |
+
void
|
| 208 |
+
swap(PB_DS_CLASS_C_DEC& other);
|
| 209 |
+
|
| 210 |
+
~left_child_next_sibling_heap_();
|
| 211 |
+
|
| 212 |
+
inline bool
|
| 213 |
+
empty() const;
|
| 214 |
+
|
| 215 |
+
inline size_type
|
| 216 |
+
size() const;
|
| 217 |
+
|
| 218 |
+
inline size_type
|
| 219 |
+
max_size() const;
|
| 220 |
+
|
| 221 |
+
Cmp_Fn&
|
| 222 |
+
get_cmp_fn();
|
| 223 |
+
|
| 224 |
+
const Cmp_Fn&
|
| 225 |
+
get_cmp_fn() const;
|
| 226 |
+
|
| 227 |
+
inline iterator
|
| 228 |
+
begin();
|
| 229 |
+
|
| 230 |
+
inline const_iterator
|
| 231 |
+
begin() const;
|
| 232 |
+
|
| 233 |
+
inline iterator
|
| 234 |
+
end();
|
| 235 |
+
|
| 236 |
+
inline const_iterator
|
| 237 |
+
end() const;
|
| 238 |
+
|
| 239 |
+
void
|
| 240 |
+
clear();
|
| 241 |
+
|
| 242 |
+
#ifdef PB_DS_LC_NS_HEAP_TRACE_
|
| 243 |
+
void
|
| 244 |
+
trace() const;
|
| 245 |
+
#endif
|
| 246 |
+
|
| 247 |
+
protected:
|
| 248 |
+
|
| 249 |
+
inline node_pointer
|
| 250 |
+
get_new_node_for_insert(const_reference r_val);
|
| 251 |
+
|
| 252 |
+
inline static void
|
| 253 |
+
make_child_of(node_pointer p_nd, node_pointer p_new_parent);
|
| 254 |
+
|
| 255 |
+
void
|
| 256 |
+
value_swap(PB_DS_CLASS_C_DEC& other);
|
| 257 |
+
|
| 258 |
+
inline static node_pointer
|
| 259 |
+
parent(node_pointer p_nd);
|
| 260 |
+
|
| 261 |
+
inline void
|
| 262 |
+
swap_with_parent(node_pointer p_nd, node_pointer p_parent);
|
| 263 |
+
|
| 264 |
+
void
|
| 265 |
+
bubble_to_top(node_pointer p_nd);
|
| 266 |
+
|
| 267 |
+
inline void
|
| 268 |
+
actual_erase_node(node_pointer p_nd);
|
| 269 |
+
|
| 270 |
+
void
|
| 271 |
+
clear_imp(node_pointer p_nd);
|
| 272 |
+
|
| 273 |
+
void
|
| 274 |
+
to_linked_list();
|
| 275 |
+
|
| 276 |
+
template<typename Pred>
|
| 277 |
+
node_pointer
|
| 278 |
+
prune(Pred pred);
|
| 279 |
+
|
| 280 |
+
#ifdef _GLIBCXX_DEBUG
|
| 281 |
+
void
|
| 282 |
+
assert_valid() const;
|
| 283 |
+
|
| 284 |
+
void
|
| 285 |
+
assert_node_consistent(const_node_pointer p_nd, bool single_link) const;
|
| 286 |
+
|
| 287 |
+
static size_type
|
| 288 |
+
size_under_node(const_node_pointer p_nd);
|
| 289 |
+
|
| 290 |
+
static size_type
|
| 291 |
+
degree(const_node_pointer p_nd);
|
| 292 |
+
#endif
|
| 293 |
+
|
| 294 |
+
#ifdef PB_DS_LC_NS_HEAP_TRACE_
|
| 295 |
+
static void
|
| 296 |
+
trace_node(const_node_pointer, size_type level);
|
| 297 |
+
#endif
|
| 298 |
+
|
| 299 |
+
protected:
|
| 300 |
+
node_pointer m_p_root;
|
| 301 |
+
|
| 302 |
+
size_type m_size;
|
| 303 |
+
|
| 304 |
+
private:
|
| 305 |
+
#ifdef _GLIBCXX_DEBUG
|
| 306 |
+
void
|
| 307 |
+
assert_iterators() const;
|
| 308 |
+
|
| 309 |
+
void
|
| 310 |
+
assert_size() const;
|
| 311 |
+
|
| 312 |
+
static size_type
|
| 313 |
+
size_from_node(const_node_pointer p_nd);
|
| 314 |
+
#endif
|
| 315 |
+
|
| 316 |
+
node_pointer
|
| 317 |
+
recursive_copy_node(const_node_pointer p_nd);
|
| 318 |
+
|
| 319 |
+
inline node_pointer
|
| 320 |
+
get_new_node_for_insert(const_reference r_val, false_type);
|
| 321 |
+
|
| 322 |
+
inline node_pointer
|
| 323 |
+
get_new_node_for_insert(const_reference r_val, true_type);
|
| 324 |
+
|
| 325 |
+
#ifdef PB_DS_LC_NS_HEAP_TRACE_
|
| 326 |
+
template<typename Metadata_>
|
| 327 |
+
static void
|
| 328 |
+
trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>);
|
| 329 |
+
|
| 330 |
+
static void
|
| 331 |
+
trace_node_metadata(const_node_pointer, type_to_type<null_left_child_next_sibling_heap_node_metadata>);
|
| 332 |
+
#endif
|
| 333 |
+
|
| 334 |
+
private:
|
| 335 |
+
static node_allocator s_node_allocator;
|
| 336 |
+
|
| 337 |
+
static no_throw_copies_t s_no_throw_copies_ind;
|
| 338 |
+
};
|
| 339 |
+
|
| 340 |
+
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp>
|
| 341 |
+
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp>
|
| 342 |
+
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp>
|
| 343 |
+
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp>
|
| 344 |
+
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp>
|
| 345 |
+
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp>
|
| 346 |
+
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp>
|
| 347 |
+
#include <ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp>
|
| 348 |
+
|
| 349 |
+
#undef PB_DS_CLASS_C_DEC
|
| 350 |
+
#undef PB_DS_CLASS_T_DEC
|
| 351 |
+
|
| 352 |
+
} // namespace detail
|
| 353 |
+
} // namespace __gnu_pbds
|
| 354 |
+
|
| 355 |
+
#endif
|