diff --git a/.gitattributes b/.gitattributes index 2e95eb23b23e52630eff199a77dd64ac7fd29895..c5d4bdf1038b11a0788cfe48973e4fb9ab47658e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -75,3 +75,5 @@ mingw/bin/gprof.exe filter=lfs diff=lfs merge=lfs -text cmake/bin/cmake-gui.exe filter=lfs diff=lfs merge=lfs -text ffmpeg/bin/avformat-61.dll filter=lfs diff=lfs merge=lfs -text mingw/bin/strip.exe filter=lfs diff=lfs merge=lfs -text +mingw/lib/gcc/mingw32/4.3.3/libstdc++.a filter=lfs diff=lfs merge=lfs -text +mingw/bin/windres.exe filter=lfs diff=lfs merge=lfs -text diff --git a/mingw/bin/windres.exe b/mingw/bin/windres.exe new file mode 100644 index 0000000000000000000000000000000000000000..32ad1f5615a752ebcffcf1916819d71db14a75c5 --- /dev/null +++ b/mingw/bin/windres.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb1163e5e5259607994722d43703c698a2cd8b7a8f07bb94540ff4dff211bf9c +size 1080334 diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9e4b7033992ae06fde04b4a3a5b1735b6ff2b5dd --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp @@ -0,0 +1,76 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file insert_no_store_hash_fn_imps.hpp + * Contains implementations of cc_ht_map_'s insert related functions, + * when the hash value is not stored. + */ + +PB_DS_CLASS_T_DEC +inline std::pair +PB_DS_CLASS_C_DEC:: +insert_imp(const_reference r_val, false_type) +{ + _GLIBCXX_DEBUG_ONLY(assert_valid();) + const_key_reference r_key = PB_DS_V2F(r_val); + const size_type pos = ranged_hash_fn_base::operator()(r_key); + entry_pointer p_e = m_entries[pos]; + resize_base::notify_insert_search_start(); + + while (p_e != NULL && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), + r_key)) + { + resize_base::notify_insert_search_collision(); + p_e = p_e->m_p_next; + } + + resize_base::notify_insert_search_end(); + if (p_e != NULL) + { + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);) + return std::make_pair(&p_e->m_value, false); + } + + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);) + return std::make_pair(insert_new_imp(r_val, pos), true); +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..975f964d856c77fefc28f7ac4c9756ef26f68585 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp @@ -0,0 +1,77 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file insert_store_hash_fn_imps.hpp + * Contains implementations of cc_ht_map_'s insert related functions, + * when the hash value is stored. + */ + +PB_DS_CLASS_T_DEC +inline std::pair +PB_DS_CLASS_C_DEC:: +insert_imp(const_reference r_val, true_type) +{ + _GLIBCXX_DEBUG_ONLY(assert_valid();) + const_key_reference key = PB_DS_V2F(r_val); + comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(key); + entry_pointer p_e = m_entries[pos_hash_pair.first]; + resize_base::notify_insert_search_start(); + + while (p_e != NULL && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), + p_e->m_hash, + key, pos_hash_pair.second)) + { + resize_base::notify_insert_search_collision(); + p_e = p_e->m_p_next; + } + + resize_base::notify_insert_search_end(); + if (p_e != NULL) + { + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);) + return std::make_pair(&p_e->m_value, false); + } + + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);) + return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true); +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..be0a9a271498b5a48e0abab7a2b37d05122c9da3 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp @@ -0,0 +1,89 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file iterators_fn_imps.hpp + * Contains implementations of cc_ht_map_'s iterators related functions, e.g., + * begin(). + */ + +PB_DS_CLASS_T_DEC +typename PB_DS_CLASS_C_DEC::iterator +PB_DS_CLASS_C_DEC::s_end_it; + +PB_DS_CLASS_T_DEC +typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC::s_const_end_it; + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::iterator +PB_DS_CLASS_C_DEC:: +begin() +{ + pointer p_value; + std::pair pos; + get_start_it_state(p_value, pos); + return iterator(p_value, pos, this); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::iterator +PB_DS_CLASS_C_DEC:: +end() +{ return s_end_it; } + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +begin() const +{ + pointer p_value; + std::pair pos; + get_start_it_state(p_value, pos); + return const_iterator(p_value, pos, this); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +end() const +{ return s_const_end_it; } + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..067a79b58d41f5897bfabaa337cf117eba71ccde --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp @@ -0,0 +1,94 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file policy_access_fn_imps.hpp + * Contains implementations of cc_ht_map_'s policy access + * functions. + */ + +PB_DS_CLASS_T_DEC +Hash_Fn& +PB_DS_CLASS_C_DEC:: +get_hash_fn() +{ return *this; } + +PB_DS_CLASS_T_DEC +const Hash_Fn& +PB_DS_CLASS_C_DEC:: +get_hash_fn() const +{ return *this; } + +PB_DS_CLASS_T_DEC +Eq_Fn& +PB_DS_CLASS_C_DEC:: +get_eq_fn() +{ return *this; } + +PB_DS_CLASS_T_DEC +const Eq_Fn& +PB_DS_CLASS_C_DEC:: +get_eq_fn() const +{ return *this; } + +PB_DS_CLASS_T_DEC +Comb_Hash_Fn& +PB_DS_CLASS_C_DEC:: +get_comb_hash_fn() +{ return *this; } + +PB_DS_CLASS_T_DEC +const Comb_Hash_Fn& +PB_DS_CLASS_C_DEC:: +get_comb_hash_fn() const +{ return *this; } + +PB_DS_CLASS_T_DEC +Resize_Policy& +PB_DS_CLASS_C_DEC:: +get_resize_policy() +{ return *this; } + +PB_DS_CLASS_T_DEC +const Resize_Policy& +PB_DS_CLASS_C_DEC:: +get_resize_policy() const +{ return *this; } diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1146ebba9f2563e237fb6ede2bd5097800958b92 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp @@ -0,0 +1,139 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file resize_fn_imps.hpp + * Contains implementations of cc_ht_map_'s resize related functions. + */ + +PB_DS_CLASS_T_DEC +inline bool +PB_DS_CLASS_C_DEC:: +do_resize_if_needed() +{ + if (!resize_base::is_resize_needed()) + return false; + resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e)); + return true; +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +do_resize(size_type len) +{ resize_imp(resize_base::get_nearest_larger_size(len)); } + +PB_DS_CLASS_T_DEC +inline void +PB_DS_CLASS_C_DEC:: +do_resize_if_needed_no_throw() +{ + if (!resize_base::is_resize_needed()) + return; + + try + { + resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e)); + } + catch(...) + { } + + _GLIBCXX_DEBUG_ONLY(assert_valid();) +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +resize_imp(size_type new_size) +{ + _GLIBCXX_DEBUG_ONLY(assert_valid();) + if (new_size == m_num_e) + return; + + const size_type old_size = m_num_e; + entry_pointer_array a_p_entries_resized; + + // Following line might throw an exception. + ranged_hash_fn_base::notify_resized(new_size); + + try + { + // Following line might throw an exception. + a_p_entries_resized = s_entry_pointer_allocator.allocate(new_size); + m_num_e = new_size; + } + catch(...) + { + ranged_hash_fn_base::notify_resized(old_size); + __throw_exception_again; + } + + // At this point no exceptions can be thrown. + resize_imp_no_exceptions(new_size, a_p_entries_resized, old_size); + Resize_Policy::notify_resized(new_size); + _GLIBCXX_DEBUG_ONLY(assert_valid();) +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +resize_imp_no_exceptions(size_type new_size, entry_pointer_array a_p_entries_resized, size_type old_size) +{ + std::fill(a_p_entries_resized, a_p_entries_resized + m_num_e, + entry_pointer(NULL)); + + for (size_type pos = 0; pos < old_size; ++pos) + { + entry_pointer p_e = m_entries[pos]; + while (p_e != NULL) + p_e = resize_imp_no_exceptions_reassign_pointer(p_e, a_p_entries_resized, traits_base::m_store_extra_indicator); + } + + m_num_e = new_size; + _GLIBCXX_DEBUG_ONLY(assert_entry_pointer_array_valid(a_p_entries_resized);) + s_entry_pointer_allocator.deallocate(m_entries, old_size); + m_entries = a_p_entries_resized; + _GLIBCXX_DEBUG_ONLY(assert_valid();) +} + +#include +#include + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6188b2785d790ecd3740808203bd208a9cdd6deb --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp @@ -0,0 +1,60 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file resize_no_store_hash_fn_imps.hpp + * Contains implementations of cc_ht_map_'s resize related functions, when the + * hash value is not stored. + */ + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::entry_pointer +PB_DS_CLASS_C_DEC:: +resize_imp_no_exceptions_reassign_pointer(entry_pointer p_e, entry_pointer_array a_p_entries_resized, false_type) +{ + const size_type hash_pos = + ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value)); + + entry_pointer const p_next_e = p_e->m_p_next; + p_e->m_p_next = a_p_entries_resized[hash_pos]; + a_p_entries_resized[hash_pos] = p_e; + return p_next_e; +} diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b6592d4bc090a58b41e9c6782b9e0d33ee0a9622 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp @@ -0,0 +1,60 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file resize_store_hash_fn_imps.hpp + * Contains implementations of cc_ht_map_'s resize related functions, when the + * hash value is stored. + */ + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::entry_pointer +PB_DS_CLASS_C_DEC:: +resize_imp_no_exceptions_reassign_pointer(entry_pointer p_e, entry_pointer_array a_p_entries_resized, true_type) +{ + const comp_hash pos_hash_pair = + ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash); + + entry_pointer const p_next_e = p_e->m_p_next; + p_e->m_p_next = a_p_entries_resized[pos_hash_pair.first]; + a_p_entries_resized[pos_hash_pair.first] = p_e; + return p_next_e; +} diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0afd61ba829b0850ebf74b3fdf078f114f39bf0f --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp @@ -0,0 +1,65 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file size_fn_imps.hpp + * Contains implementations of cc_ht_map_'s entire container size related + * functions. + */ + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +size() const +{ return m_num_used_e; } + +PB_DS_CLASS_T_DEC +inline bool +PB_DS_CLASS_C_DEC:: +empty() const +{ return (size() == 0); } + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +max_size() const +{ return s_entry_allocator.max_size(); } + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp new file mode 100644 index 0000000000000000000000000000000000000000..10a9cbc0bb82dea6c8c96556b0372aadc4027ae7 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp @@ -0,0 +1,52 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file standard_policies.hpp + * Contains standard policies for cc_ht_map types. + */ + +#ifndef PB_DS_CC_HT_MAP_STANDARD_POLICIES_HPP +#define PB_DS_CC_HT_MAP_STANDARD_POLICIES_HPP + +#include + +#endif // #ifndef PB_DS_CC_HT_MAP_STANDARD_POLICIES_HPP diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..25a010623e64aba5375a02ad47b7a20699cedfaa --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp @@ -0,0 +1,78 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file trace_fn_imps.hpp + * Contains implementations of cc_ht_map_'s trace-mode functions. + */ + +#ifdef PB_DS_HT_MAP_TRACE_ + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +trace() const +{ + std::cerr << static_cast(m_num_e) << " " + << static_cast(m_num_used_e) << std::endl; + + for (size_type i = 0; i < m_num_e; ++i) + { + std::cerr << static_cast(i) << " "; + trace_list(m_entries[i]); + std::cerr << std::endl; + } +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +trace_list(const_entry_pointer p_l) const +{ + size_type iterated_num_used_e = 0; + while (p_l != NULL) + { + std::cerr << PB_DS_V2F(p_l->m_value) << " "; + p_l = p_l->m_p_next; + } +} + +#endif diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/eq_fn/eq_by_less.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/eq_fn/eq_by_less.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5b123bfa7c0d50163aec6f3f1e290d8398a4efb8 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/eq_fn/eq_by_less.hpp @@ -0,0 +1,74 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file eq_by_less.hpp + * Contains an equivalence function. + */ + +#ifndef PB_DS_EQ_BY_LESS_HPP +#define PB_DS_EQ_BY_LESS_HPP + +#include +#include +#include +#include +#include + +namespace __gnu_pbds +{ + namespace detail + { + template + struct eq_by_less : private Cmp_Fn + { + bool + operator()(const Key& r_lhs, const Key& r_rhs) const + { + const bool l = Cmp_Fn::operator()(r_lhs, r_rhs); + const bool g = Cmp_Fn::operator()(r_rhs, r_lhs); + return !(l || g); + } + }; + } // namespace detail +} // namespace __gnu_pbds + +#endif // #ifndef PB_DS_EQ_BY_LESS_HPP diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f4e4c7e79dd9a03a730d3f3a5cb95a2323384430 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp @@ -0,0 +1,185 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file hash_eq_fn.hpp + * Contains 2 eqivalence functions, one employing a hash value, + * and one ignoring it. + */ + +#ifndef PB_DS_HASH_EQ_FN_HPP +#define PB_DS_HASH_EQ_FN_HPP + +#include +#include + +namespace __gnu_pbds +{ + namespace detail + { + template + struct hash_eq_fn; + +#define PB_DS_CLASS_T_DEC \ + template + +#define PB_DS_CLASS_C_DEC \ + hash_eq_fn + + /** + * Specialization 1- The client requests that hash values not be stored. + **/ + template + struct hash_eq_fn : public Eq_Fn + { + typedef Eq_Fn eq_fn_base; + + typedef typename Allocator::template rebind::other key_allocator; + + typedef typename key_allocator::const_reference const_key_reference; + + hash_eq_fn(); + + hash_eq_fn(const Eq_Fn& r_eq_fn); + + inline bool + operator()(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const; + + inline void + swap(const PB_DS_CLASS_C_DEC& other); + }; + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + hash_eq_fn() + { } + + PB_DS_CLASS_T_DEC + inline void + PB_DS_CLASS_C_DEC:: + swap(const PB_DS_CLASS_C_DEC& other) + { std::swap((Eq_Fn& )(*this), (Eq_Fn& )other); } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + hash_eq_fn(const Eq_Fn& r_eq_fn) : + Eq_Fn(r_eq_fn) + { } + + PB_DS_CLASS_T_DEC + inline bool + PB_DS_CLASS_C_DEC:: + operator()(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const + { return (eq_fn_base::operator()(r_lhs_key, r_rhs_key)); } + +#undef PB_DS_CLASS_T_DEC +#undef PB_DS_CLASS_C_DEC + +#define PB_DS_CLASS_T_DEC \ + template + +#define PB_DS_CLASS_C_DEC \ + hash_eq_fn + + /** + * Specialization 2- The client requests that hash values be stored. + **/ + template + struct hash_eq_fn : + public Eq_Fn + { + typedef typename Allocator::size_type size_type; + + typedef Eq_Fn eq_fn_base; + + typedef typename Allocator::template rebind::other key_allocator; + + typedef typename key_allocator::const_reference const_key_reference; + + hash_eq_fn(); + + hash_eq_fn(const Eq_Fn& r_eq_fn); + + inline bool + operator()(const_key_reference r_lhs_key, size_type lhs_hash, + const_key_reference r_rhs_key, size_type rhs_hash) const; + + inline void + swap(const PB_DS_CLASS_C_DEC& other); + }; + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + hash_eq_fn() + { } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + hash_eq_fn(const Eq_Fn& r_eq_fn) : + Eq_Fn(r_eq_fn) + { } + + PB_DS_CLASS_T_DEC + inline bool + PB_DS_CLASS_C_DEC:: + operator()(const_key_reference r_lhs_key, size_type lhs_hash, + const_key_reference r_rhs_key, size_type rhs_hash) const + { + _GLIBCXX_DEBUG_ASSERT(!eq_fn_base::operator()(r_lhs_key, r_rhs_key) + || lhs_hash == rhs_hash); + + return (lhs_hash == rhs_hash && + eq_fn_base::operator()(r_lhs_key, r_rhs_key)); + } + + PB_DS_CLASS_T_DEC + inline void + PB_DS_CLASS_C_DEC:: + swap(const PB_DS_CLASS_C_DEC& other) + { std::swap((Eq_Fn& )(*this), (Eq_Fn& )(other)); } + +#undef PB_DS_CLASS_T_DEC +#undef PB_DS_CLASS_C_DEC + + } // namespace detail +} // namespace __gnu_pbds + +#endif diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b9cb0a19ca23287fc3377110f427584a2878a27b --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp @@ -0,0 +1,52 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file find_no_store_hash_fn_imps.hpp + * Contains implementations of gp_ht_map_'s find related functions, + * when the hash value is not stored. + */ + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::pointer +PB_DS_CLASS_C_DEC:: +find_key_pointer(const_key_reference r_key, false_type) + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..26ee8f2116dd7a76e4e22608ea4be8d900c98c67 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp @@ -0,0 +1,46 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file find_store_hash_fn_imps.hpp + * Contains implementations of gp_ht_map_'s insert related functions, + * when the hash value is stored. + */ diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8f812d9bcfed184e4bc78e2b31727747a0dd16b1 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp @@ -0,0 +1,683 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file gp_ht_map_.hpp + * Contains an implementation class for gp_ht_map_. + */ + +#include +#include +#include +#include +#include +#include +#ifdef PB_DS_HT_MAP_TRACE_ +#include +#endif +#ifdef _GLIBCXX_DEBUG +#include +#endif +#include + +namespace __gnu_pbds +{ + namespace detail + { +#define PB_DS_CLASS_T_DEC \ + template + +#ifdef PB_DS_DATA_TRUE_INDICATOR +#define PB_DS_CLASS_NAME gp_ht_map_data_ +#endif + +#ifdef PB_DS_DATA_FALSE_INDICATOR +#define PB_DS_CLASS_NAME gp_ht_map_no_data_ +#endif + +#define PB_DS_CLASS_C_DEC \ + PB_DS_CLASS_NAME + +#define PB_DS_HASH_EQ_FN_C_DEC \ + hash_eq_fn + +#define PB_DS_RANGED_PROBE_FN_C_DEC \ + ranged_probe_fn + +#define PB_DS_TYPES_TRAITS_C_DEC \ + types_traits + +#ifdef _GLIBCXX_DEBUG +#define PB_DS_DEBUG_MAP_BASE_C_DEC \ + debug_map_base::other::const_reference> +#endif + +#ifdef PB_DS_DATA_TRUE_INDICATOR +#define PB_DS_V2F(X) (X).first +#define PB_DS_V2S(X) (X).second +#endif + +#ifdef PB_DS_DATA_FALSE_INDICATOR +#define PB_DS_V2F(X) (X) +#define PB_DS_V2S(X) Mapped() +#endif + + template + class PB_DS_CLASS_NAME : +#ifdef _GLIBCXX_DEBUG + protected PB_DS_DEBUG_MAP_BASE_C_DEC, +#endif + public PB_DS_HASH_EQ_FN_C_DEC, + public Resize_Policy, + public PB_DS_RANGED_PROBE_FN_C_DEC, + public PB_DS_TYPES_TRAITS_C_DEC + { + private: + typedef PB_DS_TYPES_TRAITS_C_DEC traits_base; + typedef typename traits_base::value_type value_type_; + typedef typename traits_base::pointer pointer_; + typedef typename traits_base::const_pointer const_pointer_; + typedef typename traits_base::reference reference_; + typedef typename traits_base::const_reference const_reference_; + typedef typename traits_base::comp_hash comp_hash; + + enum entry_status + { + empty_entry_status, + valid_entry_status, + erased_entry_status + } __attribute__ ((packed)); + + struct entry : public traits_base::stored_value_type + { + entry_status m_stat; + }; + + typedef typename Allocator::template rebind::other entry_allocator; + typedef typename entry_allocator::pointer entry_pointer; + typedef typename entry_allocator::const_pointer const_entry_pointer; + typedef typename entry_allocator::reference entry_reference; + typedef typename entry_allocator::const_reference const_entry_reference; + typedef typename entry_allocator::pointer entry_array; + + typedef PB_DS_RANGED_PROBE_FN_C_DEC ranged_probe_fn_base; + +#ifdef _GLIBCXX_DEBUG + typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base; +#endif + + typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base; + typedef Resize_Policy resize_base; + +#define PB_DS_GEN_POS typename Allocator::size_type + +#include +#include +#include +#include + +#undef PB_DS_GEN_POS + + public: + typedef Allocator allocator; + typedef typename Allocator::size_type size_type; + typedef typename Allocator::difference_type difference_type; + typedef Hash_Fn hash_fn; + typedef Eq_Fn eq_fn; + typedef Probe_Fn probe_fn; + typedef Comb_Probe_Fn comb_probe_fn; + typedef Resize_Policy resize_policy; + + enum + { + store_hash = Store_Hash + }; + + typedef typename traits_base::key_type key_type; + typedef typename traits_base::key_pointer key_pointer; + typedef typename traits_base::const_key_pointer const_key_pointer; + typedef typename traits_base::key_reference key_reference; + typedef typename traits_base::const_key_reference const_key_reference; + typedef typename traits_base::mapped_type mapped_type; + typedef typename traits_base::mapped_pointer mapped_pointer; + typedef typename traits_base::const_mapped_pointer const_mapped_pointer; + typedef typename traits_base::mapped_reference mapped_reference; + typedef typename traits_base::const_mapped_reference const_mapped_reference; + typedef typename traits_base::value_type value_type; + typedef typename traits_base::pointer pointer; + typedef typename traits_base::const_pointer const_pointer; + typedef typename traits_base::reference reference; + typedef typename traits_base::const_reference const_reference; + +#ifdef PB_DS_DATA_TRUE_INDICATOR + typedef point_iterator_ point_iterator; +#endif + +#ifdef PB_DS_DATA_FALSE_INDICATOR + typedef const_point_iterator_ point_iterator; +#endif + + typedef const_point_iterator_ const_point_iterator; + +#ifdef PB_DS_DATA_TRUE_INDICATOR + typedef iterator_ iterator; +#endif + +#ifdef PB_DS_DATA_FALSE_INDICATOR + typedef const_iterator_ iterator; +#endif + + typedef const_iterator_ const_iterator; + + PB_DS_CLASS_NAME(); + + PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&); + + PB_DS_CLASS_NAME(const Hash_Fn&); + + PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&); + + PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&); + + PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&, + const Probe_Fn&); + + PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&, + const Probe_Fn&, const Resize_Policy&); + + template + void + copy_from_range(It first_it, It last_it); + + virtual + ~PB_DS_CLASS_NAME(); + + void + swap(PB_DS_CLASS_C_DEC& other); + + inline size_type + size() const; + + inline size_type + max_size() const; + + inline bool + empty() const; + + Hash_Fn& + get_hash_fn(); + + const Hash_Fn& + get_hash_fn() const; + + Eq_Fn& + get_eq_fn(); + + const Eq_Fn& + get_eq_fn() const; + + Probe_Fn& + get_probe_fn(); + + const Probe_Fn& + get_probe_fn() const; + + Comb_Probe_Fn& + get_comb_probe_fn(); + + const Comb_Probe_Fn& + get_comb_probe_fn() const; + + Resize_Policy& + get_resize_policy(); + + const Resize_Policy& + get_resize_policy() const; + + inline std::pair + insert(const_reference r_val) + { + _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) + return insert_imp(r_val, traits_base::m_store_extra_indicator); + } + + inline mapped_reference + operator[](const_key_reference r_key) + { +#ifdef PB_DS_DATA_TRUE_INDICATOR + return subscript_imp(r_key, traits_base::m_store_extra_indicator); +#else + insert(r_key); + return traits_base::s_null_mapped; +#endif + } + + inline point_iterator + find(const_key_reference r_key); + + inline const_point_iterator + find(const_key_reference r_key) const; + + inline point_iterator + find_end(); + + inline const_point_iterator + find_end() const; + + inline bool + erase(const_key_reference r_key); + + template + inline size_type + erase_if(Pred prd); + + void + clear(); + + inline iterator + begin(); + + inline const_iterator + begin() const; + + inline iterator + end(); + + inline const_iterator + end() const; + +#ifdef _GLIBCXX_DEBUG + void + assert_valid() const; +#endif + +#ifdef PB_DS_HT_MAP_TRACE_ + void + trace() const; +#endif + + private: +#ifdef PB_DS_DATA_TRUE_INDICATOR + friend class iterator_; +#endif + + friend class const_iterator_; + + void + deallocate_all(); + + void + initialize(); + + void + erase_all_valid_entries(entry_array, size_type); + + inline bool + do_resize_if_needed(); + + inline void + do_resize_if_needed_no_throw(); + + void + resize_imp(size_type); + + virtual void + do_resize(size_type); + + void + resize_imp(entry_array, size_type); + + inline void + resize_imp_reassign(entry_pointer, entry_array, false_type); + + inline void + resize_imp_reassign(entry_pointer, entry_array, true_type); + + inline size_type + find_ins_pos(const_key_reference, false_type); + + inline comp_hash + find_ins_pos(const_key_reference, true_type); + + inline std::pair + insert_imp(const_reference, false_type); + + inline std::pair + insert_imp(const_reference, true_type); + + inline pointer + insert_new_imp(const_reference r_val, size_type pos) + { + _GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status); + + if (do_resize_if_needed()) + pos = find_ins_pos(PB_DS_V2F(r_val), + traits_base::m_store_extra_indicator); + + _GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status); + + entry* const p_e = m_entries + pos; + new (&p_e->m_value) value_type(r_val); + p_e->m_stat = valid_entry_status; + resize_base::notify_inserted(++m_num_used_e); + + _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));) + + _GLIBCXX_DEBUG_ONLY(assert_valid();) + return &p_e->m_value; + } + + inline pointer + insert_new_imp(const_reference r_val, comp_hash& r_pos_hash_pair) + { + _GLIBCXX_DEBUG_ASSERT(m_entries[r_pos_hash_pair.first].m_stat != + valid_entry_status); + + if (do_resize_if_needed()) + r_pos_hash_pair = find_ins_pos(PB_DS_V2F(r_val), + traits_base::m_store_extra_indicator); + + _GLIBCXX_DEBUG_ASSERT(m_entries[r_pos_hash_pair.first].m_stat != + valid_entry_status); + + entry* const p_e = m_entries + r_pos_hash_pair.first; + new (&p_e->m_value) value_type(r_val); + p_e->m_hash = r_pos_hash_pair.second; + p_e->m_stat = valid_entry_status; + + resize_base::notify_inserted(++m_num_used_e); + + _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));) + + _GLIBCXX_DEBUG_ONLY(assert_valid();) + return &p_e->m_value; + } + +#ifdef PB_DS_DATA_TRUE_INDICATOR + inline mapped_reference + subscript_imp(const_key_reference key, false_type) + { + _GLIBCXX_DEBUG_ONLY(assert_valid();) + + const size_type pos = find_ins_pos(key, + traits_base::m_store_extra_indicator); + + entry_pointer p_e = &m_entries[pos]; + if (p_e->m_stat != valid_entry_status) + return insert_new_imp(value_type(key, mapped_type()), pos)->second; + + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);) + return p_e->m_value.second; + } + + inline mapped_reference + subscript_imp(const_key_reference key, true_type) + { + _GLIBCXX_DEBUG_ONLY(assert_valid();) + + comp_hash pos_hash_pair = + find_ins_pos(key, traits_base::m_store_extra_indicator); + + if (m_entries[pos_hash_pair.first].m_stat != valid_entry_status) + return insert_new_imp(value_type(key, mapped_type()), + pos_hash_pair)->second; + + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key)); + return (m_entries + pos_hash_pair.first)->m_value.second; + } +#endif + + inline pointer + find_key_pointer(const_key_reference key, false_type) + { + const size_type hash = ranged_probe_fn_base::operator()(key); + size_type i; + resize_base::notify_find_search_start(); + + // Loop until entry is found or until all possible entries accessed. + for (i = 0; i < m_num_e; ++i) + { + const size_type pos = ranged_probe_fn_base::operator()(key, hash, i); + + entry* const p_e = m_entries + pos; + switch (p_e->m_stat) + { + case empty_entry_status: + { + resize_base::notify_find_search_end(); + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);) + + return NULL; + } + break; + case valid_entry_status: + if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), key)) + { + resize_base::notify_find_search_end(); + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);) + + return pointer(&p_e->m_value); + } + break; + case erased_entry_status: + break; + default: + _GLIBCXX_DEBUG_ASSERT(0); + }; + + resize_base::notify_find_search_collision(); + } + + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);) + resize_base::notify_find_search_end(); + return NULL; + } + + inline pointer + find_key_pointer(const_key_reference key, true_type) + { + comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(key); + size_type i; + resize_base::notify_find_search_start(); + + // Loop until entry is found or until all possible entries accessed. + for (i = 0; i < m_num_e; ++i) + { + const size_type pos = + ranged_probe_fn_base::operator()(key, pos_hash_pair.second, i); + + entry* const p_e = m_entries + pos; + + switch(p_e->m_stat) + { + case empty_entry_status: + { + resize_base::notify_find_search_end(); + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);) + + return NULL; + } + break; + case valid_entry_status: + if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), + p_e->m_hash, + key, pos_hash_pair.second)) + { + resize_base::notify_find_search_end(); + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);) + return pointer(&p_e->m_value); + } + break; + case erased_entry_status: + break; + default: + _GLIBCXX_DEBUG_ASSERT(0); + }; + + resize_base::notify_find_search_collision(); + } + + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);) + resize_base::notify_find_search_end(); + return NULL; + } + + inline bool + erase_imp(const_key_reference, true_type); + + inline bool + erase_imp(const_key_reference, false_type); + + inline void + erase_entry(entry_pointer p_e); + +#ifdef PB_DS_DATA_TRUE_INDICATOR + void + inc_it_state(pointer& r_p_value, size_type& r_pos) const + { inc_it_state((const_mapped_pointer& )r_p_value, r_pos); } +#endif + + void + inc_it_state(const_pointer& r_p_value, size_type& r_pos) const + { + _GLIBCXX_DEBUG_ASSERT(r_p_value != NULL); + for (++r_pos; r_pos < m_num_e; ++r_pos) + { + const_entry_pointer p_e =& m_entries[r_pos]; + if (p_e->m_stat == valid_entry_status) + { + r_p_value =& p_e->m_value; + return; + } + } + r_p_value = NULL; + } + + void + get_start_it_state(const_pointer& r_p_value, size_type& r_pos) const + { + for (r_pos = 0; r_pos < m_num_e; ++r_pos) + { + const_entry_pointer p_e = &m_entries[r_pos]; + if (p_e->m_stat == valid_entry_status) + { + r_p_value = &p_e->m_value; + return; + } + } + r_p_value = NULL; + } + + void + get_start_it_state(pointer& r_p_value, size_type& r_pos) + { + for (r_pos = 0; r_pos < m_num_e; ++r_pos) + { + entry_pointer p_e = &m_entries[r_pos]; + if (p_e->m_stat == valid_entry_status) + { + r_p_value = &p_e->m_value; + return; + } + } + r_p_value = NULL; + } + +#ifdef _GLIBCXX_DEBUG + void + assert_entry_array_valid(const entry_array, false_type) const; + + void + assert_entry_array_valid(const entry_array, true_type) const; +#endif + + static entry_allocator s_entry_allocator; + static iterator s_end_it; + static const_iterator s_const_end_it; + + size_type m_num_e; + size_type m_num_used_e; + entry_pointer m_entries; + + enum + { + store_hash_ok = !Store_Hash + || !is_same::value + }; + + PB_DS_STATIC_ASSERT(sth, store_hash_ok); + }; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#undef PB_DS_CLASS_T_DEC +#undef PB_DS_CLASS_C_DEC +#undef PB_DS_HASH_EQ_FN_C_DEC +#undef PB_DS_RANGED_PROBE_FN_C_DEC +#undef PB_DS_TYPES_TRAITS_C_DEC +#undef PB_DS_DEBUG_MAP_BASE_C_DEC +#undef PB_DS_CLASS_NAME +#undef PB_DS_V2F +#undef PB_DS_V2S + + } // namespace detail +} // namespace __gnu_pbds + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ae88520bf09179fb9698516062d2c3914b7e2b3a --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp @@ -0,0 +1,64 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file info_fn_imps.hpp + * Contains implementations of gp_ht_map_'s entire container info related + * functions. + */ + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +size() const +{ return m_num_used_e; } + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +max_size() const +{ return s_entry_allocator.max_size(); } + +PB_DS_CLASS_T_DEC +inline bool +PB_DS_CLASS_C_DEC:: +empty() const +{ return (size() == 0); } diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ccf54b6cb86232953ec45f96116ae81ec7eb0a19 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp @@ -0,0 +1,49 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file insert_fn_imps.hpp + * Contains implementations of gp_ht_map_'s insert related functions. + */ + +#include +#include + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e5b56500b42c559b15e3d62fe765f00ed8d13173 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp @@ -0,0 +1,117 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file insert_no_store_hash_fn_imps.hpp + * Contains implementations of gp_ht_map_'s insert related functions, + * when the hash value is not stored. + */ + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +find_ins_pos(const_key_reference r_key, false_type) +{ + size_type hash = ranged_probe_fn_base::operator()(r_key); + size_type i; + + /* The insertion position is initted to a non-legal value to indicate + * that it has not been initted yet. + */ + size_type ins_pos = m_num_e; + resize_base::notify_insert_search_start(); + for (i = 0; i < m_num_e; ++i) + { + const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i); + _GLIBCXX_DEBUG_ASSERT(pos < m_num_e); + entry* const p_e = m_entries + pos; + switch(p_e->m_stat) + { + case empty_entry_status: + { + resize_base::notify_insert_search_end(); + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);) + return (ins_pos == m_num_e) ? pos : ins_pos; + } + break; + case erased_entry_status: + if (ins_pos == m_num_e) + ins_pos = pos; + break; + case valid_entry_status: + if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key)) + { + resize_base::notify_insert_search_end(); + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);) + return pos; + } + break; + default: + _GLIBCXX_DEBUG_ASSERT(0); + }; + + resize_base::notify_insert_search_collision(); + } + resize_base::notify_insert_search_end(); + if (ins_pos == m_num_e) + __throw_insert_error(); + return ins_pos; +} + +PB_DS_CLASS_T_DEC +inline std::pair +PB_DS_CLASS_C_DEC:: +insert_imp(const_reference r_val, false_type) +{ + const_key_reference r_key = PB_DS_V2F(r_val); + const size_type pos = find_ins_pos(r_key, + traits_base::m_store_extra_indicator); + + if (m_entries[pos].m_stat == valid_entry_status) + { + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);) + return std::make_pair(&(m_entries + pos)->m_value, false); + } + + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key)); + return std::make_pair(insert_new_imp(r_val, pos), true); +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8dfce3097e26f8240ef853baaa5de438b06b647b --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp @@ -0,0 +1,124 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file insert_store_hash_fn_imps.hpp + * Contains implementations of gp_ht_map_'s find related functions, + * when the hash value is stored. + */ + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::comp_hash +PB_DS_CLASS_C_DEC:: +find_ins_pos(const_key_reference r_key, true_type) +{ + _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) + comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key); + + size_type i; + + /* The insertion position is initted to a non-legal value to indicate + * that it has not been initted yet. + */ + size_type ins_pos = m_num_e; + resize_base::notify_insert_search_start(); + for (i = 0; i < m_num_e; ++i) + { + const size_type pos = ranged_probe_fn_base::operator()(r_key, pos_hash_pair.second, i); + + entry* const p_e = m_entries + pos; + switch(p_e->m_stat) + { + case empty_entry_status: + { + resize_base::notify_insert_search_end(); + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);) + + return ((ins_pos == m_num_e) ? + std::make_pair(pos, pos_hash_pair.second) : + std::make_pair(ins_pos, pos_hash_pair.second)); + } + break; + case erased_entry_status: + if (ins_pos == m_num_e) + ins_pos = pos; + break; + case valid_entry_status: + if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash, + r_key, pos_hash_pair.second)) + { + resize_base::notify_insert_search_end(); + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);) + return std::make_pair(pos, pos_hash_pair.second); + } + break; + default: + _GLIBCXX_DEBUG_ASSERT(0); + }; + resize_base::notify_insert_search_collision(); + } + resize_base::notify_insert_search_end(); + if (ins_pos == m_num_e) + __throw_insert_error(); + return std::make_pair(ins_pos, pos_hash_pair.second); +} + +PB_DS_CLASS_T_DEC +inline std::pair +PB_DS_CLASS_C_DEC:: +insert_imp(const_reference r_val, true_type) +{ + const_key_reference r_key = PB_DS_V2F(r_val); + comp_hash pos_hash_pair = find_ins_pos(r_key, + traits_base::m_store_extra_indicator); + + _GLIBCXX_DEBUG_ASSERT(pos_hash_pair.first < m_num_e); + entry_pointer p_e =& m_entries[pos_hash_pair.first]; + if (p_e->m_stat == valid_entry_status) + { + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key)); + return std::make_pair(&p_e->m_value, false); + } + + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key)); + return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true); +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..99326ef3f509f59401d82a733bd14a13ce2c0e01 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp @@ -0,0 +1,89 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file iterator_fn_imps.hpp + * Contains implementations of gp_ht_map_'s iterators related functions, e.g., + * begin(). + */ + +PB_DS_CLASS_T_DEC +typename PB_DS_CLASS_C_DEC::iterator +PB_DS_CLASS_C_DEC::s_end_it; + +PB_DS_CLASS_T_DEC +typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC::s_const_end_it; + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::iterator +PB_DS_CLASS_C_DEC:: +begin() +{ + pointer_ p_value; + size_type pos; + get_start_it_state(p_value, pos); + return iterator(p_value, pos, this); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::iterator +PB_DS_CLASS_C_DEC:: +end() +{ return s_end_it; } + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +begin() const +{ + const_pointer_ p_value; + size_type pos; + get_start_it_state(p_value, pos); + return const_iterator(p_value, pos, this); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +end() const +{ return s_const_end_it; } + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9b615ae05e6f73fcd8625952d70496400476cadf --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp @@ -0,0 +1,106 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file policy_access_fn_imps.hpp + * Contains implementations of gp_ht_map_'s policy agpess + * functions. + */ + +PB_DS_CLASS_T_DEC +Hash_Fn& +PB_DS_CLASS_C_DEC:: +get_hash_fn() +{ return *this; } + +PB_DS_CLASS_T_DEC +const Hash_Fn& +PB_DS_CLASS_C_DEC:: +get_hash_fn() const +{ return *this; } + +PB_DS_CLASS_T_DEC +Eq_Fn& +PB_DS_CLASS_C_DEC:: +get_eq_fn() +{ return *this; } + +PB_DS_CLASS_T_DEC +const Eq_Fn& +PB_DS_CLASS_C_DEC:: +get_eq_fn() const +{ return *this; } + +PB_DS_CLASS_T_DEC +Probe_Fn& +PB_DS_CLASS_C_DEC:: +get_probe_fn() +{ return *this; } + +PB_DS_CLASS_T_DEC +const Probe_Fn& +PB_DS_CLASS_C_DEC:: +get_probe_fn() const +{ return *this; } + +PB_DS_CLASS_T_DEC +Comb_Probe_Fn& +PB_DS_CLASS_C_DEC:: +get_comb_probe_fn() +{ return *this; } + +PB_DS_CLASS_T_DEC +const Comb_Probe_Fn& +PB_DS_CLASS_C_DEC:: +get_comb_probe_fn() const +{ return *this; } + +PB_DS_CLASS_T_DEC +Resize_Policy& +PB_DS_CLASS_C_DEC:: +get_resize_policy() +{ return *this; } + +PB_DS_CLASS_T_DEC +const Resize_Policy& +PB_DS_CLASS_C_DEC:: +get_resize_policy() const +{ return *this; } diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..703552daf0d6edb04a712276b5e4ce4499fd9304 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp @@ -0,0 +1,143 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file resize_fn_imps.hpp + * Contains implementations of gp_ht_map_'s resize related functions. + */ + +PB_DS_CLASS_T_DEC +inline bool +PB_DS_CLASS_C_DEC:: +do_resize_if_needed() +{ + if (!resize_base::is_resize_needed()) + return false; + resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e)); + return true; +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +do_resize(size_type n) +{ resize_imp(resize_base::get_nearest_larger_size(n)); } + +PB_DS_CLASS_T_DEC +inline void +PB_DS_CLASS_C_DEC:: +do_resize_if_needed_no_throw() +{ + if (!resize_base::is_resize_needed()) + return; + + try + { + resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e)); + } + catch(...) + { } + + _GLIBCXX_DEBUG_ONLY(assert_valid();) +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +resize_imp(size_type new_size) +{ +#ifdef PB_DS_REGRESSION + typename Allocator::group_throw_prob_adjustor adjust(m_num_e); +#endif + + if (new_size == m_num_e) + return; + + _GLIBCXX_DEBUG_ONLY(assert_valid();) + const size_type old_size = m_num_e; + entry_array a_entries_resized = NULL; + + // Following line might throw an exception. + a_entries_resized = s_entry_allocator.allocate(new_size); + + ranged_probe_fn_base::notify_resized(new_size); + m_num_e = new_size; + + for (size_type i = 0; i < m_num_e; ++i) + a_entries_resized[i].m_stat = empty_entry_status; + + try + { + resize_imp(a_entries_resized, old_size); + } + catch(...) + { + erase_all_valid_entries(a_entries_resized, new_size); + m_num_e = old_size; + s_entry_allocator.deallocate(a_entries_resized, new_size); + ranged_probe_fn_base::notify_resized(old_size); + __throw_exception_again; + } + + // At this point no exceptions can be thrown. + _GLIBCXX_DEBUG_ONLY(assert_entry_array_valid(a_entries_resized, traits_base::m_store_extra_indicator);) + + Resize_Policy::notify_resized(new_size); + erase_all_valid_entries(m_entries, old_size); + s_entry_allocator.deallocate(m_entries, old_size); + m_entries = a_entries_resized; + _GLIBCXX_DEBUG_ONLY(assert_valid();) +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +resize_imp(entry_array a_entries_resized, size_type old_size) +{ + for (size_type pos = 0; pos < old_size; ++pos) + if (m_entries[pos].m_stat == valid_entry_status) + resize_imp_reassign(m_entries + pos, a_entries_resized, + traits_base::m_store_extra_indicator); +} + +#include +#include + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1c60fc80b5cb42ad47ebdbf43386c3da0617d587 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp @@ -0,0 +1,78 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file resize_no_store_hash_fn_imps.hpp + * Contains implementations of gp_ht_map_'s resize related functions, when the + * hash value is not stored. + */ + +PB_DS_CLASS_T_DEC +inline void +PB_DS_CLASS_C_DEC:: +resize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized, + false_type) +{ + const_key_reference r_key = PB_DS_V2F(p_e->m_value); + size_type hash = ranged_probe_fn_base::operator()(r_key); + size_type i; + for (i = 0; i < m_num_e; ++i) + { + const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i); + entry_pointer p_new_e = a_entries_resized + pos; + switch(p_new_e->m_stat) + { + case empty_entry_status: + new (&p_new_e->m_value) value_type(p_e->m_value); + p_new_e->m_stat = valid_entry_status; + return; + case erased_entry_status: + _GLIBCXX_DEBUG_ASSERT(0); + break; + case valid_entry_status: + break; + default: + _GLIBCXX_DEBUG_ASSERT(0); + }; + } + __throw_insert_error(); +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b73f655bf711c55b4a99f8726dceb0d6e60899ff --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp @@ -0,0 +1,80 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file resize_store_hash_fn_imps.hpp + * Contains implementations of gp_ht_map_'s resize related functions, when the + * hash value is stored. + */ + +PB_DS_CLASS_T_DEC +inline void +PB_DS_CLASS_C_DEC:: +resize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized, + true_type) +{ + const_key_reference r_key = PB_DS_V2F(p_e->m_value); + size_type hash = ranged_probe_fn_base::operator()(r_key, p_e->m_hash); + + size_type i; + for (i = 0; i < m_num_e; ++i) + { + const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i); + entry_pointer p_new_e = a_entries_resized + pos; + switch(p_new_e->m_stat) + { + case empty_entry_status: + new (&p_new_e->m_value) value_type(p_e->m_value); + p_new_e->m_hash = hash; + p_new_e->m_stat = valid_entry_status; + return; + case erased_entry_status: + _GLIBCXX_DEBUG_ASSERT(0); + break; + case valid_entry_status: + break; + default: + _GLIBCXX_DEBUG_ASSERT(0); + }; + } + __throw_insert_error(); +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp new file mode 100644 index 0000000000000000000000000000000000000000..78a1c2c66df3a5a1314a659537ea1ed0095db8e3 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp @@ -0,0 +1,80 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file standard_policies.hpp + * Contains standard policies for gp_ht_map types. + */ + +#ifndef PB_DS_GP_HT_MAP_STANDARD_POLICIES_HPP +#define PB_DS_GP_HT_MAP_STANDARD_POLICIES_HPP + +#include +#include +#include +#include + +namespace __gnu_pbds +{ + namespace detail + { + template + struct default_probe_fn + { + private: + typedef typename Comb_Probe_Fn::size_type size_type; + + public: + typedef + typename __conditional_type< + is_same< + __gnu_pbds::direct_mask_range_hashing, + Comb_Probe_Fn>::value, + __gnu_pbds::linear_probe_fn, + __gnu_pbds::quadratic_probe_fn >::__type + type; + }; + + } // namespace detail +} // namespace __gnu_pbds + +#endif + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..519b9b857dfab9e7db60ab280ab05a579de6b96a --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp @@ -0,0 +1,80 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file trace_fn_imps.hpp + * Contains implementations of gp_ht_map_'s trace-mode functions. + */ + +#ifdef PB_DS_HT_MAP_TRACE_ + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +trace() const +{ + std::cerr << static_cast(m_num_e) << " " << + static_cast(m_num_used_e) << std::endl; + + for (size_type i = 0; i < m_num_e; ++i) + { + std::cerr << static_cast(i) << " "; + + switch(m_entries[i].m_stat) + { + case empty_entry_status: + std::cerr << ""; + break; + case erased_entry_status: + std::cerr << ""; + break; + case valid_entry_status: + std::cerr << PB_DS_V2F(m_entries[i].m_value); + break; + default: + _GLIBCXX_DEBUG_ASSERT(0); + }; + + std::cerr << std::endl; + } +} + +#endif // #ifdef PB_DS_HT_MAP_TRACE_ diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6da02a0bab00e3e0a96f9ac8debc9e1623750772 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp @@ -0,0 +1,64 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file direct_mask_range_hashing_imp.hpp + * Contains a range-hashing policy implementation + */ + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +swap(PB_DS_CLASS_C_DEC& other) +{ mask_based_base::swap(other); } + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +notify_resized(size_type size) +{ mask_based_base::notify_resized(size); } + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +operator()(size_type hash) const +{ return mask_based_base::range_hash(hash); } + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d23093fc9ca37d3201f13af9a54592a1530ebb5f --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp @@ -0,0 +1,64 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file direct_mod_range_hashing_imp.hpp + * Contains a range-hashing policy implementation + */ + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +swap(PB_DS_CLASS_C_DEC& other) +{ mod_based_base::swap(other); } + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +notify_resized(size_type n) +{ mod_based_base::notify_resized(n); } + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +operator()(size_type hash) const +{ return mod_based_base::range_hash(hash); } + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dd09553af10362b1efb25e2602d7ffc594337c07 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp @@ -0,0 +1,59 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file linear_probe_fn_imp.hpp + * Contains a probe policy implementation + */ + +PB_DS_CLASS_T_DEC +inline void +PB_DS_CLASS_C_DEC:: +swap(PB_DS_CLASS_C_DEC& other) +{ } + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +operator()(size_type i) const +{ + return (i); +} diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9c9cdded9b6b7410e0d7e31ee370c21e9e3a24eb --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp @@ -0,0 +1,113 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file mask_based_range_hashing.hpp + * Contains a range hashing policy base. + */ + +#ifndef PB_DS_MASK_BASED_RANGE_HASHING_HPP +#define PB_DS_MASK_BASED_RANGE_HASHING_HPP + +namespace __gnu_pbds +{ + namespace detail + { +#define PB_DS_CLASS_T_DEC template +#define PB_DS_CLASS_C_DEC mask_based_range_hashing + + template + class mask_based_range_hashing + { + protected: + typedef Size_Type size_type; + + void + swap(mask_based_range_hashing& other) + { std::swap(m_mask, other.m_mask); } + + void + notify_resized(size_type size); + + inline size_type + range_hash(size_type hash) const + { return size_type(hash & m_mask); } + + private: + size_type m_mask; + const static size_type s_num_bits_in_size_type; + const static size_type s_highest_bit_1; + }; + + PB_DS_CLASS_T_DEC + const typename PB_DS_CLASS_C_DEC::size_type + PB_DS_CLASS_C_DEC::s_num_bits_in_size_type = + sizeof(typename PB_DS_CLASS_C_DEC::size_type) << 3; + + PB_DS_CLASS_T_DEC + const typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC::s_highest_bit_1 = static_cast(1) << (s_num_bits_in_size_type - 1); + + + PB_DS_CLASS_T_DEC + void + PB_DS_CLASS_C_DEC:: + notify_resized(size_type size) + { + size_type i = 0; + while (size ^ s_highest_bit_1) + { + size <<= 1; + ++i; + } + + m_mask = 1; + i += 2; + while (i++ < s_num_bits_in_size_type) + m_mask = (m_mask << 1) ^ 1; + } + +#undef PB_DS_CLASS_T_DEC +#undef PB_DS_CLASS_C_DEC + + } // namespace detail +} // namespace __gnu_pbds + +#endif diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bffe3f79474d75df435d9a330cb7d86af6c03251 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp @@ -0,0 +1,114 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file mod_based_range_hashing.hpp + * Contains a range hashing policy base. + */ + +#ifndef PB_DS_MOD_BASED_RANGE_HASHING_HPP +#define PB_DS_MOD_BASED_RANGE_HASHING_HPP + +namespace __gnu_pbds +{ + + namespace detail + { + +#define PB_DS_CLASS_T_DEC \ + template + +#define PB_DS_CLASS_C_DEC \ + mod_based_range_hashing< \ + Size_Type> + + template + class mod_based_range_hashing + { + protected: + typedef Size_Type size_type; + + protected: + void + swap(PB_DS_CLASS_C_DEC& other); + + void + notify_resized(size_type size); + + inline size_type + range_hash(size_type hash) const; + + private: + size_type m_size; + }; + + PB_DS_CLASS_T_DEC + void + PB_DS_CLASS_C_DEC:: + swap(PB_DS_CLASS_C_DEC& other) + { + std::swap(m_size, other.m_size); + } + + PB_DS_CLASS_T_DEC + void + PB_DS_CLASS_C_DEC:: + notify_resized(size_type size) + { + m_size = size; + } + + PB_DS_CLASS_T_DEC + inline typename PB_DS_CLASS_C_DEC::size_type + PB_DS_CLASS_C_DEC:: + range_hash(size_type hash) const + { + return (hash % m_size); + } + +#undef PB_DS_CLASS_T_DEC +#undef PB_DS_CLASS_C_DEC + + } // namespace detail + +} // namespace __gnu_pbds + +#endif // #ifndef PB_DS_MOD_BASED_RANGE_HASHING_HPP diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9f4cb06e026932830f7a0f7ea82fe2155d268574 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp @@ -0,0 +1,65 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file probe_fn_base.hpp + * Contains a probe policy base. + */ + +#ifndef PB_DS_PROBE_FN_BASE_HPP +#define PB_DS_PROBE_FN_BASE_HPP + +#include + +namespace __gnu_pbds +{ + namespace detail + { + template + class probe_fn_base + { + protected: + ~probe_fn_base() { } + }; +} // namespace detail +} // namespace __gnu_pbds + +#endif diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6d7d5655a898ec817b4f7b40fe8ce87c7ceb6518 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp @@ -0,0 +1,59 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file quadratic_probe_fn_imp.hpp + * Contains a probe policy implementation + */ + +PB_DS_CLASS_T_DEC +inline void +PB_DS_CLASS_C_DEC:: +swap(PB_DS_CLASS_C_DEC& other) +{ } + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +operator()(size_type i) const +{ + return (i* i); +} diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8d321c41b4d4f225d95c27295b8b221cd79956f7 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp @@ -0,0 +1,365 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file ranged_hash_fn.hpp + * Contains a unified ranged hash functor, allowing the hash tables + * to deal with a single class for ranged hashing. + */ + +#ifndef PB_DS_RANGED_HASH_FN_HPP +#define PB_DS_RANGED_HASH_FN_HPP + +#include +#include +#include + +namespace __gnu_pbds +{ + namespace detail + { + template + class ranged_hash_fn; + +#define PB_DS_CLASS_T_DEC \ + template + +#define PB_DS_CLASS_C_DEC \ + ranged_hash_fn + + /** + * Specialization 1 + * The client supplies a hash function and a ranged hash function, + * and requests that hash values not be stored. + **/ + template + class ranged_hash_fn< Key, Hash_Fn, Allocator, Comb_Hash_Fn, false> + : public Hash_Fn, public Comb_Hash_Fn + { + protected: + typedef typename Allocator::size_type size_type; + typedef Hash_Fn hash_fn_base; + typedef Comb_Hash_Fn comb_hash_fn_base; + typedef typename Allocator::template rebind< Key>::other key_allocator; + typedef typename key_allocator::const_reference const_key_reference; + + ranged_hash_fn(size_type); + + ranged_hash_fn(size_type, const Hash_Fn&); + + ranged_hash_fn(size_type, const Hash_Fn&, const Comb_Hash_Fn&); + + void + swap(PB_DS_CLASS_C_DEC&); + + void + notify_resized(size_type); + + inline size_type + operator()(const_key_reference) const; + }; + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_hash_fn(size_type size) + { Comb_Hash_Fn::notify_resized(size); } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn) + : Hash_Fn(r_hash_fn) + { Comb_Hash_Fn::notify_resized(size); } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn, + const Comb_Hash_Fn& r_comb_hash_fn) + : Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn) + { comb_hash_fn_base::notify_resized(size); } + + PB_DS_CLASS_T_DEC + void + PB_DS_CLASS_C_DEC:: + swap(PB_DS_CLASS_C_DEC& other) + { + comb_hash_fn_base::swap(other); + std::swap((Hash_Fn& )(*this), (Hash_Fn& )other); + } + + PB_DS_CLASS_T_DEC + void + PB_DS_CLASS_C_DEC:: + notify_resized(size_type size) + { comb_hash_fn_base::notify_resized(size); } + + PB_DS_CLASS_T_DEC + inline typename PB_DS_CLASS_C_DEC::size_type + PB_DS_CLASS_C_DEC:: + operator()(const_key_reference r_key) const + { return (comb_hash_fn_base::operator()(hash_fn_base::operator()(r_key)));} + +#undef PB_DS_CLASS_T_DEC +#undef PB_DS_CLASS_C_DEC + +#define PB_DS_CLASS_T_DEC \ + template + +#define PB_DS_CLASS_C_DEC \ + ranged_hash_fn + + /** + * Specialization 2 + * The client supplies a hash function and a ranged hash function, + * and requests that hash values be stored. + **/ + template + class ranged_hash_fn + : public Hash_Fn, public Comb_Hash_Fn + { + protected: + typedef typename Allocator::size_type size_type; + typedef std::pair comp_hash; + typedef Hash_Fn hash_fn_base; + typedef Comb_Hash_Fn comb_hash_fn_base; + typedef typename Allocator::template rebind::other key_allocator; + typedef typename key_allocator::const_reference const_key_reference; + + ranged_hash_fn(size_type); + + ranged_hash_fn(size_type, const Hash_Fn&); + + ranged_hash_fn(size_type, const Hash_Fn&, const Comb_Hash_Fn&); + + void + swap(PB_DS_CLASS_C_DEC&); + + void + notify_resized(size_type); + + inline comp_hash + operator()(const_key_reference) const; + + inline comp_hash + operator()(const_key_reference, size_type) const; + }; + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_hash_fn(size_type size) + { Comb_Hash_Fn::notify_resized(size); } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn) : + Hash_Fn(r_hash_fn) + { Comb_Hash_Fn::notify_resized(size); } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn, + const Comb_Hash_Fn& r_comb_hash_fn) + : Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn) + { comb_hash_fn_base::notify_resized(size); } + + PB_DS_CLASS_T_DEC + void + PB_DS_CLASS_C_DEC:: + swap(PB_DS_CLASS_C_DEC& other) + { + comb_hash_fn_base::swap(other); + std::swap((Hash_Fn& )(*this), (Hash_Fn& )other); + } + + PB_DS_CLASS_T_DEC + void + PB_DS_CLASS_C_DEC:: + notify_resized(size_type size) + { comb_hash_fn_base::notify_resized(size); } + + PB_DS_CLASS_T_DEC + inline typename PB_DS_CLASS_C_DEC::comp_hash + PB_DS_CLASS_C_DEC:: + operator()(const_key_reference r_key) const + { + const size_type hash = hash_fn_base::operator()(r_key); + return std::make_pair(comb_hash_fn_base::operator()(hash), hash); + } + + PB_DS_CLASS_T_DEC + inline typename PB_DS_CLASS_C_DEC::comp_hash + PB_DS_CLASS_C_DEC:: + operator() +#ifdef _GLIBCXX_DEBUG + (const_key_reference r_key, size_type hash) const +#else + (const_key_reference /*r_key*/, size_type hash) const +#endif + { + _GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key)); + return std::make_pair(comb_hash_fn_base::operator()(hash), hash); + } + +#undef PB_DS_CLASS_T_DEC +#undef PB_DS_CLASS_C_DEC + +#define PB_DS_CLASS_T_DEC \ + template + +#define PB_DS_CLASS_C_DEC \ + ranged_hash_fn + + /** + * Specialization 3 + * The client does not supply a hash function (by specifying + * null_hash_fn as the Hash_Fn parameter), and requests that hash + * values not be stored. + **/ + template + class ranged_hash_fn + : public null_hash_fn, public Comb_Hash_Fn + { + protected: + typedef typename Allocator::size_type size_type; + typedef Comb_Hash_Fn comb_hash_fn_base; + + ranged_hash_fn(size_type); + + ranged_hash_fn(size_type, const Comb_Hash_Fn&); + + ranged_hash_fn(size_type, const null_hash_fn&, const Comb_Hash_Fn&); + + void + swap(PB_DS_CLASS_C_DEC&); + }; + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_hash_fn(size_type size) + { Comb_Hash_Fn::notify_resized(size); } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_hash_fn(size_type size, const Comb_Hash_Fn& r_comb_hash_fn) : + Comb_Hash_Fn(r_comb_hash_fn) + { } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_hash_fn(size_type size, const null_hash_fn& r_null_hash_fn, + const Comb_Hash_Fn& r_comb_hash_fn) + : Comb_Hash_Fn(r_comb_hash_fn) + { } + + PB_DS_CLASS_T_DEC + void + PB_DS_CLASS_C_DEC:: + swap(PB_DS_CLASS_C_DEC& other) + { comb_hash_fn_base::swap(other); } + +#undef PB_DS_CLASS_T_DEC +#undef PB_DS_CLASS_C_DEC + +#define PB_DS_CLASS_T_DEC \ + template + +#define PB_DS_CLASS_C_DEC \ + ranged_hash_fn + + /** + * Specialization 4 + * The client does not supply a hash function (by specifying + * null_hash_fn as the Hash_Fn parameter), and requests that hash + * values be stored. + **/ + template + class ranged_hash_fn + : public null_hash_fn, public Comb_Hash_Fn + { + protected: + typedef typename Allocator::size_type size_type; + typedef Comb_Hash_Fn comb_hash_fn_base; + + ranged_hash_fn(size_type); + + ranged_hash_fn(size_type, const Comb_Hash_Fn&); + + ranged_hash_fn(size_type, const null_hash_fn&, const Comb_Hash_Fn&); + + void + swap(PB_DS_CLASS_C_DEC&); + }; + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_hash_fn(size_type size) + { Comb_Hash_Fn::notify_resized(size); } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_hash_fn(size_type size, const Comb_Hash_Fn& r_comb_hash_fn) + : Comb_Hash_Fn(r_comb_hash_fn) + { } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_hash_fn(size_type size, const null_hash_fn& r_null_hash_fn, + const Comb_Hash_Fn& r_comb_hash_fn) + : Comb_Hash_Fn(r_comb_hash_fn) + { } + + PB_DS_CLASS_T_DEC + void + PB_DS_CLASS_C_DEC:: + swap(PB_DS_CLASS_C_DEC& other) + { comb_hash_fn_base::swap(other); } + +#undef PB_DS_CLASS_T_DEC +#undef PB_DS_CLASS_C_DEC + + } // namespace detail +} // namespace __gnu_pbds + +#endif diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp new file mode 100644 index 0000000000000000000000000000000000000000..da1c3224c23c71a948f950d7aadf01460bebde66 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp @@ -0,0 +1,333 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file ranged_probe_fn.hpp + * Contains a unified ranged probe functor, allowing the probe tables to deal with + * a single class for ranged probeing. + */ + +#ifndef PB_DS_RANGED_PROBE_FN_HPP +#define PB_DS_RANGED_PROBE_FN_HPP + +#include +#include +#include + +namespace __gnu_pbds +{ + namespace detail + { + template + class ranged_probe_fn; + +#define PB_DS_CLASS_T_DEC \ + template + +#define PB_DS_CLASS_C_DEC \ + ranged_probe_fn + + /** + * Specialization 1 + * The client supplies a probe function and a ranged probe + * function, and requests that hash values not be stored. + **/ + template + class ranged_probe_fn + : public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn + { + protected: + typedef typename Allocator::size_type size_type; + typedef Comb_Probe_Fn comb_probe_fn_base; + typedef Hash_Fn hash_fn_base; + typedef Probe_Fn probe_fn_base; + typedef typename Allocator::template rebind::other key_allocator; + typedef typename key_allocator::const_reference const_key_reference; + + ranged_probe_fn(size_type); + + ranged_probe_fn(size_type, const Hash_Fn&); + + ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&); + + ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&, + const Probe_Fn&); + + void + swap(PB_DS_CLASS_C_DEC&); + + void + notify_resized(size_type); + + inline size_type + operator()(const_key_reference) const; + + inline size_type + operator()(const_key_reference, size_type, size_type) const; + }; + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_probe_fn(size_type size) + { Comb_Probe_Fn::notify_resized(size); } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn) + : Hash_Fn(r_hash_fn) + { Comb_Probe_Fn::notify_resized(size); } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, + const Comb_Probe_Fn& r_comb_probe_fn) + : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn) + { comb_probe_fn_base::notify_resized(size); } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, + const Comb_Probe_Fn& r_comb_probe_fn, + const Probe_Fn& r_probe_fn) + : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn) + { comb_probe_fn_base::notify_resized(size); } + + PB_DS_CLASS_T_DEC + void + PB_DS_CLASS_C_DEC:: + swap(PB_DS_CLASS_C_DEC& other) + { + comb_probe_fn_base::swap(other); + std::swap((Hash_Fn& )(*this), (Hash_Fn&)other); + } + + PB_DS_CLASS_T_DEC + void + PB_DS_CLASS_C_DEC:: + notify_resized(size_type size) + { comb_probe_fn_base::notify_resized(size); } + + PB_DS_CLASS_T_DEC + inline typename PB_DS_CLASS_C_DEC::size_type + PB_DS_CLASS_C_DEC:: + operator()(const_key_reference r_key) const + { return comb_probe_fn_base::operator()(hash_fn_base::operator()(r_key)); } + + PB_DS_CLASS_T_DEC + inline typename PB_DS_CLASS_C_DEC::size_type + PB_DS_CLASS_C_DEC:: + operator()(const_key_reference, size_type hash, size_type i) const + { + return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i)); + } + +#undef PB_DS_CLASS_T_DEC +#undef PB_DS_CLASS_C_DEC + +#define PB_DS_CLASS_T_DEC \ + template + +#define PB_DS_CLASS_C_DEC \ + ranged_probe_fn + + /** + * Specialization 2- The client supplies a probe function and a ranged + * probe function, and requests that hash values not be stored. + **/ + template + class ranged_probe_fn + : public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn + { + protected: + typedef typename Allocator::size_type size_type; + typedef std::pair comp_hash; + typedef Comb_Probe_Fn comb_probe_fn_base; + typedef Hash_Fn hash_fn_base; + typedef Probe_Fn probe_fn_base; + typedef typename Allocator::template rebind::other key_allocator; + typedef typename key_allocator::const_reference const_key_reference; + + ranged_probe_fn(size_type); + + ranged_probe_fn(size_type, const Hash_Fn&); + + ranged_probe_fn(size_type, const Hash_Fn&, + const Comb_Probe_Fn&); + + ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&, + const Probe_Fn&); + + void + swap(PB_DS_CLASS_C_DEC&); + + void + notify_resized(size_type); + + inline comp_hash + operator()(const_key_reference) const; + + inline size_type + operator()(const_key_reference, size_type, size_type) const; + + inline size_type + operator()(const_key_reference, size_type) const; + }; + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_probe_fn(size_type size) + { Comb_Probe_Fn::notify_resized(size); } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn) + : Hash_Fn(r_hash_fn) + { Comb_Probe_Fn::notify_resized(size); } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, + const Comb_Probe_Fn& r_comb_probe_fn) + : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn) + { comb_probe_fn_base::notify_resized(size); } + + PB_DS_CLASS_T_DEC + PB_DS_CLASS_C_DEC:: + ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, + const Comb_Probe_Fn& r_comb_probe_fn, + const Probe_Fn& r_probe_fn) + : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn) + { comb_probe_fn_base::notify_resized(size); } + + PB_DS_CLASS_T_DEC + void + PB_DS_CLASS_C_DEC:: + swap(PB_DS_CLASS_C_DEC& other) + { + comb_probe_fn_base::swap(other); + std::swap((Hash_Fn& )(*this), (Hash_Fn& )other); + } + + PB_DS_CLASS_T_DEC + void + PB_DS_CLASS_C_DEC:: + notify_resized(size_type size) + { comb_probe_fn_base::notify_resized(size); } + + PB_DS_CLASS_T_DEC + inline typename PB_DS_CLASS_C_DEC::comp_hash + PB_DS_CLASS_C_DEC:: + operator()(const_key_reference r_key) const + { + const size_type hash = hash_fn_base::operator()(r_key); + return std::make_pair(comb_probe_fn_base::operator()(hash), hash); + } + + PB_DS_CLASS_T_DEC + inline typename PB_DS_CLASS_C_DEC::size_type + PB_DS_CLASS_C_DEC:: + operator()(const_key_reference, size_type hash, size_type i) const + { + return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i)); + } + + PB_DS_CLASS_T_DEC + inline typename PB_DS_CLASS_C_DEC::size_type + PB_DS_CLASS_C_DEC:: + operator() +#ifdef _GLIBCXX_DEBUG + (const_key_reference r_key, size_type hash) const +#else + (const_key_reference /*r_key*/, size_type hash) const +#endif + { + _GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key)); + return hash; + } + +#undef PB_DS_CLASS_T_DEC +#undef PB_DS_CLASS_C_DEC + + /** + * Specialization 3 and 4 + * The client does not supply a hash function or probe function, + * and requests that hash values not be stored. + **/ + template + class ranged_probe_fn + : public Comb_Probe_Fn, public null_hash_fn, public null_probe_fn + { + protected: + typedef typename Allocator::size_type size_type; + typedef Comb_Probe_Fn comb_probe_fn_base; + typedef typename Allocator::template rebind::other key_allocator; + typedef typename key_allocator::const_reference const_key_reference; + + ranged_probe_fn(size_type size) + { Comb_Probe_Fn::notify_resized(size); } + + ranged_probe_fn(size_type, const Comb_Probe_Fn& r_comb_probe_fn) + : Comb_Probe_Fn(r_comb_probe_fn) + { } + + ranged_probe_fn(size_type, const null_hash_fn&, + const Comb_Probe_Fn& r_comb_probe_fn, + const null_probe_fn&) + : Comb_Probe_Fn(r_comb_probe_fn) + { } + + void + swap(ranged_probe_fn& other) + { comb_probe_fn_base::swap(other); } + }; + } // namespace detail +} // namespace __gnu_pbds + +#endif + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b59cfb691a31ff45ac0ef7bed88b1c8dfa534488 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp @@ -0,0 +1,79 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file sample_probe_fn.hpp + * Contains a sample probe policy. + */ + +#ifndef PB_DS_SAMPLE_PROBE_FN_HPP +#define PB_DS_SAMPLE_PROBE_FN_HPP + +// A sample probe policy. +class sample_probe_fn +{ + +public: + + // Size type. + typedef size_t size_type; + +public: + + // Default constructor. + sample_probe_fn(); + + // Copy constructor. + sample_probe_fn(const sample_probe_fn& other); + + // Swaps content. + inline void + swap(sample_probe_fn& other); + +protected: + + // Returns the i-th offset from the hash value of some key r_key. + inline size_type + operator()(const_key_reference r_key, size_type i) const; + +}; + +#endif // #ifndef PB_DS_SAMPLE_PROBE_FN_HPP diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ce7a59611c5db3430f513b0c8decbcd124d7a6d0 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp @@ -0,0 +1,83 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file sample_range_hashing.hpp + * Contains a range hashing policy. + */ + +#ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP +#define PB_DS_SAMPLE_RANGE_HASHING_HPP + +// A sample range-hashing functor. +class sample_range_hashing +{ + +public: + + // Size type. + typedef size_t size_type; + +public: + + // Default constructor. + sample_range_hashing(); + + // Copy constructor. + sample_range_hashing(const sample_range_hashing& other); + + // Swaps content. + inline void + swap(sample_range_hashing& other); + +protected: + + // Notifies the policy object that the container's __size has changed to size. + void + notify_resized(size_type size); + + // Transforms the __hash value hash into a ranged-hash value. + inline size_type + operator()(size_type hash) const; + +}; + +#endif // #ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8fb8c73f4b9ff13259e2cdc819a6b8131b0c2e31 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp @@ -0,0 +1,83 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file sample_ranged_hash_fn.hpp + * Contains a ranged hash policy. + */ + +#ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP +#define PB_DS_SAMPLE_RANGED_HASH_FN_HPP + +// A sample ranged-hash functor. +class sample_ranged_hash_fn +{ + +public: + + // Size type. + typedef size_t size_type; + +public: + + // Default constructor. + sample_ranged_hash_fn(); + + // Copy constructor. + sample_ranged_hash_fn(const sample_ranged_hash_fn& other); + + // Swaps content. + inline void + swap(sample_ranged_hash_fn& other); + +protected: + + // Notifies the policy object that the container's __size has changed to size. + void + notify_resized(size_type size); + + // Transforms r_key into a position within the table. + inline size_type + operator()(const_key_reference r_key) const; + +}; + +#endif // #ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp new file mode 100644 index 0000000000000000000000000000000000000000..98f0a6505f31288f86b3d0c64869f4a6548920d3 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp @@ -0,0 +1,83 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file sample_ranged_probe_fn.hpp + * Contains a ranged probe policy. + */ + +#ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP +#define PB_DS_SAMPLE_RANGED_PROBE_FN_HPP + +// A sample ranged-probe functor. +class sample_ranged_probe_fn +{ + +public: + + // Size type. + typedef size_t size_type; + +public: + + // Default constructor. + sample_ranged_probe_fn(); + + // Copy constructor. + sample_ranged_probe_fn(const sample_ranged_probe_fn& other); + + // Swaps content. + inline void + swap(sample_ranged_probe_fn& other); + +protected: + + // Notifies the policy object that the container's __size has changed to size. + void + notify_resized(size_type size); + + // Transforms the const key reference r_key into the i-th position within the table. This method is called for each collision within the probe sequence. + inline size_type + operator()(const_key_reference r_key, size_t hash, size_type i) const; + +}; + +#endif // #ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4bea23f70e862df90a70a3a90294779a3e9181c6 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp @@ -0,0 +1,168 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file const_iterator.hpp + * Contains an iterator class returned by the table's const find and insert + * methods. + */ + +#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP +#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP + +#include +#include + +namespace __gnu_pbds +{ + namespace detail + { + +#define PB_DS_CLASS_C_DEC \ + left_child_next_sibling_heap_const_iterator_ + +#define PB_DS_BASE_C_DEC \ + left_child_next_sibling_heap_node_const_point_iterator_ + + // Const point-type iterator. + template + class left_child_next_sibling_heap_const_iterator_ : public PB_DS_BASE_C_DEC + { + + private: + typedef typename PB_DS_BASE_C_DEC::node_pointer node_pointer; + + typedef PB_DS_BASE_C_DEC base_type; + + public: + + // Category. + typedef std::forward_iterator_tag iterator_category; + + // Difference type. + typedef typename Allocator::difference_type difference_type; + + // Iterator's value type. + typedef typename base_type::value_type value_type; + + // Iterator's pointer type. + typedef typename base_type::pointer pointer; + + // Iterator's const pointer type. + typedef typename base_type::const_pointer const_pointer; + + // Iterator's reference type. + typedef typename base_type::reference reference; + + // Iterator's const reference type. + typedef typename base_type::const_reference const_reference; + + public: + + inline + left_child_next_sibling_heap_const_iterator_(node_pointer p_nd) : base_type(p_nd) + { } + + // Default constructor. + inline + left_child_next_sibling_heap_const_iterator_() + { } + + // Copy constructor. + inline + left_child_next_sibling_heap_const_iterator_(const PB_DS_CLASS_C_DEC& other) : base_type(other) + { } + + // Compares content to a different iterator object. + inline bool + operator==(const PB_DS_CLASS_C_DEC& other) const + { return (base_type::m_p_nd == other.m_p_nd); } + + // Compares content (negatively) to a different iterator object. + inline bool + operator!=(const PB_DS_CLASS_C_DEC& other) const + { return (base_type::m_p_nd != other.m_p_nd); } + + inline PB_DS_CLASS_C_DEC& + operator++() + { + _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd != NULL); + inc(); + return (*this); + } + + inline PB_DS_CLASS_C_DEC + operator++(int) + { + PB_DS_CLASS_C_DEC ret_it(base_type::m_p_nd); + operator++(); + return (ret_it); + } + + private: + void + inc() + { + if (base_type::m_p_nd->m_p_next_sibling != NULL) + { + base_type::m_p_nd = base_type::m_p_nd->m_p_next_sibling; + while (base_type::m_p_nd->m_p_l_child != NULL) + base_type::m_p_nd = base_type::m_p_nd->m_p_l_child; + return; + } + + while (true) + { + node_pointer p_next = base_type::m_p_nd; + base_type::m_p_nd = base_type::m_p_nd->m_p_prev_or_parent; + if (base_type::m_p_nd == NULL || base_type::m_p_nd->m_p_l_child == p_next) + return; + } + } + }; + +#undef PB_DS_CLASS_C_DEC +#undef PB_DS_BASE_C_DEC + + } // namespace detail +} // namespace __gnu_pbds + +#endif diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..214fa5038c10bd0dde8b26823f30901ff3c4c08f --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp @@ -0,0 +1,160 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file const_point_iterator.hpp + * Contains an iterator class returned by the table's const find and insert + * methods. + */ + +#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP +#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP + +#include +#include + +namespace __gnu_pbds +{ + namespace detail + { + +#define PB_DS_CLASS_T_DEC \ + template + +#define PB_DS_CLASS_C_DEC \ + left_child_next_sibling_heap_node_const_point_iterator_ + + // Const point-type iterator. + template + class left_child_next_sibling_heap_node_const_point_iterator_ + { + + protected: + typedef typename Allocator::template rebind::other::pointer node_pointer; + + public: + + // Category. + typedef trivial_iterator_tag iterator_category; + + // Difference type. + typedef trivial_iterator_difference_type difference_type; + + // Iterator's value type. + typedef typename Node::value_type value_type; + + // Iterator's pointer type. + typedef + typename Allocator::template rebind< + value_type>::other::pointer + pointer; + + // Iterator's const pointer type. + typedef + typename Allocator::template rebind< + value_type>::other::const_pointer + const_pointer; + + // Iterator's reference type. + typedef + typename Allocator::template rebind< + value_type>::other::reference + reference; + + // Iterator's const reference type. + typedef + typename Allocator::template rebind< + value_type>::other::const_reference + const_reference; + + public: + + inline + left_child_next_sibling_heap_node_const_point_iterator_(node_pointer p_nd) : m_p_nd(p_nd) + { } + + // Default constructor. + inline + left_child_next_sibling_heap_node_const_point_iterator_() : m_p_nd(NULL) + { } + + // Copy constructor. + inline + left_child_next_sibling_heap_node_const_point_iterator_(const PB_DS_CLASS_C_DEC& other) : m_p_nd(other.m_p_nd) + { } + + // Access. + inline const_pointer + operator->() const + { + _GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL); + return &m_p_nd->m_value; + } + + // Access. + inline const_reference + operator*() const + { + _GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL); + return m_p_nd->m_value; + } + + // Compares content to a different iterator object. + inline bool + operator==(const PB_DS_CLASS_C_DEC& other) const + { return m_p_nd == other.m_p_nd; } + + // Compares content (negatively) to a different iterator object. + inline bool + operator!=(const PB_DS_CLASS_C_DEC& other) const + { return m_p_nd != other.m_p_nd; } + + public: + node_pointer m_p_nd; + }; + +#undef PB_DS_CLASS_T_DEC +#undef PB_DS_CLASS_C_DEC + + } // namespace detail +} // namespace __gnu_pbds + +#endif diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f1bb79c320aee718652382855e1e452a4f5eabda --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp @@ -0,0 +1,158 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file constructors_destructor_fn_imps.hpp + * Contains an implementation class for left_child_next_sibling_heap_. + */ + +PB_DS_CLASS_T_DEC +typename PB_DS_CLASS_C_DEC::node_allocator +PB_DS_CLASS_C_DEC::s_node_allocator; + +PB_DS_CLASS_T_DEC +typename PB_DS_CLASS_C_DEC::no_throw_copies_t +PB_DS_CLASS_C_DEC::s_no_throw_copies_ind; + +PB_DS_CLASS_T_DEC +PB_DS_CLASS_C_DEC:: +left_child_next_sibling_heap_() : + m_p_root(NULL), + m_size(0) +{ + _GLIBCXX_DEBUG_ONLY(assert_valid();) +} + +PB_DS_CLASS_T_DEC +PB_DS_CLASS_C_DEC:: +left_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn) : + Cmp_Fn(r_cmp_fn), + m_p_root(NULL), + m_size(0) +{ + _GLIBCXX_DEBUG_ONLY(assert_valid();) +} + +PB_DS_CLASS_T_DEC +PB_DS_CLASS_C_DEC:: +left_child_next_sibling_heap_(const PB_DS_CLASS_C_DEC& other) +: Cmp_Fn(other), m_p_root(NULL), m_size(0) +{ + m_size = other.m_size; + _GLIBCXX_DEBUG_ONLY(other.assert_valid();) + m_p_root = recursive_copy_node(other.m_p_root); + m_size = other.m_size; + _GLIBCXX_DEBUG_ONLY(assert_valid();) +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +swap(PB_DS_CLASS_C_DEC& other) +{ + _GLIBCXX_DEBUG_ONLY(assert_valid();) + _GLIBCXX_DEBUG_ONLY(other.assert_valid();) + value_swap(other); + std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other); + _GLIBCXX_DEBUG_ONLY(assert_valid();) + _GLIBCXX_DEBUG_ONLY(other.assert_valid();) +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +value_swap(PB_DS_CLASS_C_DEC& other) +{ + std::swap(m_p_root, other.m_p_root); + std::swap(m_size, other.m_size); +} + +PB_DS_CLASS_T_DEC +PB_DS_CLASS_C_DEC:: +~left_child_next_sibling_heap_() +{ + clear(); +} + +PB_DS_CLASS_T_DEC +typename PB_DS_CLASS_C_DEC::node_pointer +PB_DS_CLASS_C_DEC:: +recursive_copy_node(const_node_pointer p_nd) +{ + if (p_nd == NULL) + return (NULL); + + node_pointer p_ret = s_node_allocator.allocate(1); + + try + { + new (p_ret) node(*p_nd); + } + catch(...) + { + s_node_allocator.deallocate(p_ret, 1); + __throw_exception_again; + } + + p_ret->m_p_l_child = p_ret->m_p_next_sibling = + p_ret->m_p_prev_or_parent = NULL; + + try + { + p_ret->m_p_l_child = recursive_copy_node(p_nd->m_p_l_child); + p_ret->m_p_next_sibling = recursive_copy_node(p_nd->m_p_next_sibling); + } + catch(...) + { + clear_imp(p_ret); + __throw_exception_again; + } + + if (p_ret->m_p_l_child != NULL) + p_ret->m_p_l_child->m_p_prev_or_parent = p_ret; + + if (p_ret->m_p_next_sibling != NULL) + p_ret->m_p_next_sibling->m_p_prev_or_parent = + p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd ? p_ret : NULL; + + return p_ret; +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6f2e78042d2b8df8310f16c5fa60077ece2fe1e0 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp @@ -0,0 +1,147 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file debug_fn_imps.hpp + * Contains an implementation class for left_child_next_sibling_heap_. + */ + +#ifdef _GLIBCXX_DEBUG + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +assert_valid() const +{ + _GLIBCXX_DEBUG_ASSERT(m_p_root == NULL || m_p_root->m_p_prev_or_parent == NULL); + + if (m_p_root != NULL) + assert_node_consistent(m_p_root, Single_Link_Roots); + assert_size(); + assert_iterators(); +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +assert_node_consistent(const_node_pointer p_nd, bool single_link) const +{ + if (p_nd == NULL) + return; + + assert_node_consistent(p_nd->m_p_l_child, false); + assert_node_consistent(p_nd->m_p_next_sibling, single_link); + + if (single_link) + _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_prev_or_parent == NULL); + else if (p_nd->m_p_next_sibling != NULL) + _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd); + + if (p_nd->m_p_l_child == NULL) + return; + + const_node_pointer p_child = p_nd->m_p_l_child; + while (p_child != NULL) + { + const_node_pointer p_next_child = p_child->m_p_next_sibling; + _GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(p_nd->m_value, p_child->m_value)); + p_child = p_next_child; + } + _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child->m_p_prev_or_parent == p_nd); +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +assert_iterators() const +{ + const size_type calc_size = std::distance(begin(), end()); + if (calc_size == size()) + return; + _GLIBCXX_DEBUG_ASSERT(0); +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +assert_size() const +{ + if (size_from_node(m_p_root) == m_size) + return; + _GLIBCXX_DEBUG_ASSERT(0); +} + +PB_DS_CLASS_T_DEC +typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +size_under_node(const_node_pointer p_nd) +{ return 1 + size_from_node(p_nd->m_p_l_child); } + +PB_DS_CLASS_T_DEC +typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +size_from_node(const_node_pointer p_nd) +{ + size_type ret = 0; + while (p_nd != NULL) + { + ret += 1 + size_from_node(p_nd->m_p_l_child); + p_nd = p_nd->m_p_next_sibling; + } + return ret; +} + +PB_DS_CLASS_T_DEC +typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +degree(const_node_pointer p_nd) +{ + size_type ret = 0; + const_node_pointer p_child = p_nd->m_p_l_child; + while (p_child != NULL) + { + ++ret; + p_child = p_child->m_p_next_sibling; + } + return ret; +} + +#endif diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c6026a342e81001bc4efece8ace8da80b7e10713 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp @@ -0,0 +1,156 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file erase_fn_imps.hpp + * Contains an implementation class for left_child_next_sibling_heap_. + */ + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +clear() +{ + clear_imp(m_p_root); + _GLIBCXX_DEBUG_ASSERT(m_size == 0); + m_p_root = NULL; +} + +PB_DS_CLASS_T_DEC +inline void +PB_DS_CLASS_C_DEC:: +actual_erase_node(node_pointer p_nd) +{ + _GLIBCXX_DEBUG_ASSERT(m_size > 0); + --m_size; + p_nd->~node(); + s_node_allocator.deallocate(p_nd, 1); +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +clear_imp(node_pointer p_nd) +{ + while (p_nd != NULL) + { + clear_imp(p_nd->m_p_l_child); + node_pointer p_next = p_nd->m_p_next_sibling; + actual_erase_node(p_nd); + p_nd = p_next; + } +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +to_linked_list() +{ + _GLIBCXX_DEBUG_ONLY(assert_valid();) + node_pointer p_cur = m_p_root; + while (p_cur != NULL) + if (p_cur->m_p_l_child != NULL) + { + node_pointer p_child_next = p_cur->m_p_l_child->m_p_next_sibling; + p_cur->m_p_l_child->m_p_next_sibling = p_cur->m_p_next_sibling; + p_cur->m_p_next_sibling = p_cur->m_p_l_child; + p_cur->m_p_l_child = p_child_next; + } + else + p_cur = p_cur->m_p_next_sibling; + +#ifdef _GLIBCXX_DEBUG + const_node_pointer p_counter = m_p_root; + size_type count = 0; + while (p_counter != NULL) + { + ++count; + _GLIBCXX_DEBUG_ASSERT(p_counter->m_p_l_child == NULL); + p_counter = p_counter->m_p_next_sibling; + } + _GLIBCXX_DEBUG_ASSERT(count == m_size); +#endif +} + +PB_DS_CLASS_T_DEC +template +typename PB_DS_CLASS_C_DEC::node_pointer +PB_DS_CLASS_C_DEC:: +prune(Pred pred) +{ + node_pointer p_cur = m_p_root; + m_p_root = NULL; + node_pointer p_out = NULL; + while (p_cur != NULL) + { + node_pointer p_next = p_cur->m_p_next_sibling; + if (pred(p_cur->m_value)) + { + p_cur->m_p_next_sibling = p_out; + if (p_out != NULL) + p_out->m_p_prev_or_parent = p_cur; + p_out = p_cur; + } + else + { + p_cur->m_p_next_sibling = m_p_root; + if (m_p_root != NULL) + m_p_root->m_p_prev_or_parent = p_cur; + m_p_root = p_cur; + } + p_cur = p_next; + } + return p_out; +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +bubble_to_top(node_pointer p_nd) +{ + node_pointer p_parent = parent(p_nd); + while (p_parent != NULL) + { + swap_with_parent(p_nd, p_parent); + p_parent = parent(p_nd); + } +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4fe762e69307108644639d0c40de259178f9c90e --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp @@ -0,0 +1,70 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file info_fn_imps.hpp + * Contains an implementation class for left_child_next_sibling_heap_. + */ + +PB_DS_CLASS_T_DEC +inline bool +PB_DS_CLASS_C_DEC:: +empty() const +{ + return (m_size == 0); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +size() const +{ + return (m_size); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +max_size() const +{ + return (s_node_allocator.max_size()); +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7b966e7b03395d9d55a69f0e0d2fa324523221c6 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp @@ -0,0 +1,181 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file insert_fn_imps.hpp + * Contains an implementation class for left_child_next_sibling_heap_. + */ + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::node_pointer +PB_DS_CLASS_C_DEC:: +get_new_node_for_insert(const_reference r_val) +{ + return get_new_node_for_insert(r_val, s_no_throw_copies_ind); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::node_pointer +PB_DS_CLASS_C_DEC:: +get_new_node_for_insert(const_reference r_val, false_type) +{ + node_pointer p_new_nd = s_node_allocator.allocate(1); + + cond_dealtor_t cond(p_new_nd); + + new (const_cast( + static_cast(&p_new_nd->m_value))) + typename node::value_type(r_val); + + cond.set_no_action(); + + ++m_size; + + return (p_new_nd); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::node_pointer +PB_DS_CLASS_C_DEC:: +get_new_node_for_insert(const_reference r_val, true_type) +{ + node_pointer p_new_nd = s_node_allocator.allocate(1); + + new (const_cast( + static_cast(&p_new_nd->m_value))) + typename node::value_type(r_val); + + ++m_size; + + return (p_new_nd); +} + +PB_DS_CLASS_T_DEC +inline void +PB_DS_CLASS_C_DEC:: +make_child_of(node_pointer p_nd, node_pointer p_new_parent) +{ + _GLIBCXX_DEBUG_ASSERT(p_nd != NULL); + _GLIBCXX_DEBUG_ASSERT(p_new_parent != NULL); + + p_nd->m_p_next_sibling = p_new_parent->m_p_l_child; + + if (p_new_parent->m_p_l_child != NULL) + p_new_parent->m_p_l_child->m_p_prev_or_parent = p_nd; + + p_nd->m_p_prev_or_parent = p_new_parent; + + p_new_parent->m_p_l_child = p_nd; +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::node_pointer +PB_DS_CLASS_C_DEC:: +parent(node_pointer p_nd) +{ + while (true) + { + node_pointer p_pot = p_nd->m_p_prev_or_parent; + + if (p_pot == NULL || p_pot->m_p_l_child == p_nd) + return p_pot; + + p_nd = p_pot; + } +} + +PB_DS_CLASS_T_DEC +inline void +PB_DS_CLASS_C_DEC:: +swap_with_parent(node_pointer p_nd, node_pointer p_parent) +{ + if (p_parent == m_p_root) + m_p_root = p_nd; + + _GLIBCXX_DEBUG_ASSERT(p_nd != NULL); + _GLIBCXX_DEBUG_ASSERT(p_parent != NULL); + _GLIBCXX_DEBUG_ASSERT(parent(p_nd) == p_parent); + + const bool nd_direct_child = p_parent->m_p_l_child == p_nd; + const bool parent_root = p_parent->m_p_prev_or_parent == NULL; + const bool parent_direct_child = + !parent_root&& p_parent->m_p_prev_or_parent->m_p_l_child == p_parent; + + std::swap(p_parent->m_p_prev_or_parent, p_nd->m_p_prev_or_parent); + std::swap(p_parent->m_p_next_sibling, p_nd->m_p_next_sibling); + std::swap(p_parent->m_p_l_child, p_nd->m_p_l_child); + std::swap(p_parent->m_metadata, p_nd->m_metadata); + + _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child != NULL); + _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent != NULL); + + if (p_nd->m_p_next_sibling != NULL) + p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd; + + if (p_parent->m_p_next_sibling != NULL) + p_parent->m_p_next_sibling->m_p_prev_or_parent = p_parent; + + if (p_parent->m_p_l_child != NULL) + p_parent->m_p_l_child->m_p_prev_or_parent = p_parent; + + if (parent_direct_child) + p_nd->m_p_prev_or_parent->m_p_l_child = p_nd; + else if (!parent_root) + p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd; + + if (!nd_direct_child) + { + p_nd->m_p_l_child->m_p_prev_or_parent = p_nd; + + p_parent->m_p_prev_or_parent->m_p_next_sibling = p_parent; + } + else + { + _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child == p_nd); + _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent == p_parent); + + p_nd->m_p_l_child = p_parent; + p_parent->m_p_prev_or_parent = p_nd; + } + + _GLIBCXX_DEBUG_ASSERT(parent(p_parent) == p_nd); +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e2daaba64fc07ce06d38b6b8d87d5bf62b301f88 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp @@ -0,0 +1,94 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file iterators_fn_imps.hpp + * Contains an implementation class for left_child_next_sibling_heap_. + */ + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::iterator +PB_DS_CLASS_C_DEC:: +begin() +{ + node_pointer p_nd = m_p_root; + + if (p_nd == NULL) + return (iterator(NULL)); + + while (p_nd->m_p_l_child != NULL) + p_nd = p_nd->m_p_l_child; + + return (iterator(p_nd)); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +begin() const +{ + node_pointer p_nd = m_p_root; + + if (p_nd == NULL) + return (const_iterator(NULL)); + + while (p_nd->m_p_l_child != NULL) + p_nd = p_nd->m_p_l_child; + + return (const_iterator(p_nd)); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::iterator +PB_DS_CLASS_C_DEC:: +end() +{ + return (iterator(NULL)); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +end() const +{ + return (const_iterator(NULL)); +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a08947b839c5772994f8707675d3855ed7eedbfd --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp @@ -0,0 +1,355 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file left_child_next_sibling_heap_.hpp + * Contains an implementation class for a basic heap. + */ + +#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_HPP +#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_HPP + +/* + * Based on CLRS. + */ + +#include +#include +#include +#include +#include +#include +#ifdef PB_DS_LC_NS_HEAP_TRACE_ +#include +#endif +#include + +namespace __gnu_pbds +{ + namespace detail + { + +#ifdef _GLIBCXX_DEBUG +#define PB_DS_CLASS_T_DEC \ + template< \ + typename Value_Type, \ + class Cmp_Fn, \ + typename Node_Metadata, \ + class Allocator, \ + bool Single_Link_Roots> +#else +#define PB_DS_CLASS_T_DEC \ + template< \ + typename Value_Type, \ + class Cmp_Fn, \ + typename Node_Metadata, \ + class Allocator> +#endif + +#ifdef _GLIBCXX_DEBUG +#define PB_DS_CLASS_C_DEC \ + left_child_next_sibling_heap_< \ + Value_Type, \ + Cmp_Fn, \ + Node_Metadata, \ + Allocator, \ + Single_Link_Roots> +#else +#define PB_DS_CLASS_C_DEC \ + left_child_next_sibling_heap_< \ + Value_Type, \ + Cmp_Fn, \ + Node_Metadata, \ + Allocator> +#endif + + /** + * class description = "Base class for some types of h3ap$"> + **/ +#ifdef _GLIBCXX_DEBUG + template +#else + template +#endif + class left_child_next_sibling_heap_ : public Cmp_Fn + { + + protected: + typedef + typename Allocator::template rebind< + left_child_next_sibling_heap_node_< + Value_Type, + Node_Metadata, + Allocator> >::other + node_allocator; + + typedef typename node_allocator::value_type node; + + typedef typename node_allocator::pointer node_pointer; + + typedef typename node_allocator::const_pointer const_node_pointer; + + typedef Node_Metadata node_metadata; + + typedef std::pair< node_pointer, node_pointer> node_pointer_pair; + + private: + typedef cond_dealtor< node, Allocator> cond_dealtor_t; + + enum + { + simple_value = is_simple::value + }; + + typedef integral_constant no_throw_copies_t; + + public: + + typedef typename Allocator::size_type size_type; + + typedef typename Allocator::difference_type difference_type; + + typedef Value_Type value_type; + + typedef + typename Allocator::template rebind< + value_type>::other::pointer + pointer; + + typedef + typename Allocator::template rebind< + value_type>::other::const_pointer + const_pointer; + + typedef + typename Allocator::template rebind< + value_type>::other::reference + reference; + + typedef + typename Allocator::template rebind< + value_type>::other::const_reference + const_reference; + + typedef + left_child_next_sibling_heap_node_const_point_iterator_< + node, + Allocator> + const_point_iterator; + + typedef const_point_iterator point_iterator; + + typedef + left_child_next_sibling_heap_const_iterator_< + node, + Allocator> + const_iterator; + + typedef const_iterator iterator; + + typedef Cmp_Fn cmp_fn; + + typedef Allocator allocator; + + public: + + left_child_next_sibling_heap_(); + + left_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn); + + left_child_next_sibling_heap_(const PB_DS_CLASS_C_DEC& other); + + void + swap(PB_DS_CLASS_C_DEC& other); + + ~left_child_next_sibling_heap_(); + + inline bool + empty() const; + + inline size_type + size() const; + + inline size_type + max_size() const; + + Cmp_Fn& + get_cmp_fn(); + + const Cmp_Fn& + get_cmp_fn() const; + + inline iterator + begin(); + + inline const_iterator + begin() const; + + inline iterator + end(); + + inline const_iterator + end() const; + + void + clear(); + +#ifdef PB_DS_LC_NS_HEAP_TRACE_ + void + trace() const; +#endif + + protected: + + inline node_pointer + get_new_node_for_insert(const_reference r_val); + + inline static void + make_child_of(node_pointer p_nd, node_pointer p_new_parent); + + void + value_swap(PB_DS_CLASS_C_DEC& other); + + inline static node_pointer + parent(node_pointer p_nd); + + inline void + swap_with_parent(node_pointer p_nd, node_pointer p_parent); + + void + bubble_to_top(node_pointer p_nd); + + inline void + actual_erase_node(node_pointer p_nd); + + void + clear_imp(node_pointer p_nd); + + void + to_linked_list(); + + template + node_pointer + prune(Pred pred); + +#ifdef _GLIBCXX_DEBUG + void + assert_valid() const; + + void + assert_node_consistent(const_node_pointer p_nd, bool single_link) const; + + static size_type + size_under_node(const_node_pointer p_nd); + + static size_type + degree(const_node_pointer p_nd); +#endif + +#ifdef PB_DS_LC_NS_HEAP_TRACE_ + static void + trace_node(const_node_pointer, size_type level); +#endif + + protected: + node_pointer m_p_root; + + size_type m_size; + + private: +#ifdef _GLIBCXX_DEBUG + void + assert_iterators() const; + + void + assert_size() const; + + static size_type + size_from_node(const_node_pointer p_nd); +#endif + + node_pointer + recursive_copy_node(const_node_pointer p_nd); + + inline node_pointer + get_new_node_for_insert(const_reference r_val, false_type); + + inline node_pointer + get_new_node_for_insert(const_reference r_val, true_type); + +#ifdef PB_DS_LC_NS_HEAP_TRACE_ + template + static void + trace_node_metadata(const_node_pointer p_nd, type_to_type); + + static void + trace_node_metadata(const_node_pointer, type_to_type); +#endif + + private: + static node_allocator s_node_allocator; + + static no_throw_copies_t s_no_throw_copies_ind; + }; + +#include +#include +#include +#include +#include +#include +#include +#include + +#undef PB_DS_CLASS_C_DEC +#undef PB_DS_CLASS_T_DEC + + } // namespace detail +} // namespace __gnu_pbds + +#endif diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp new file mode 100644 index 0000000000000000000000000000000000000000..422a89a45657159888cef7a2ef3eadf57044a134 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp @@ -0,0 +1,129 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file node.hpp + * Contains an implementation struct for this type of heap's node. + */ + +#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP +#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP + +#include + +namespace __gnu_pbds +{ + namespace detail + { + + template + struct left_child_next_sibling_heap_node_ + { + private: + typedef + left_child_next_sibling_heap_node_< + Value_Type, + Metadata_Type, + Allocator> + this_type; + + public: + typedef typename Allocator::size_type size_type; + + typedef + typename Allocator::template rebind< + this_type>::other::pointer + node_pointer; + + typedef Value_Type value_type; + + typedef Metadata_Type metadata_type; + + public: + value_type m_value; + + metadata_type m_metadata; + + node_pointer m_p_l_child; + + node_pointer m_p_next_sibling; + + node_pointer m_p_prev_or_parent; + }; + + template + struct left_child_next_sibling_heap_node_< + Value_Type, + null_left_child_next_sibling_heap_node_metadata, + Allocator> + { + private: + typedef + left_child_next_sibling_heap_node_< + Value_Type, + null_left_child_next_sibling_heap_node_metadata, + Allocator> + this_type; + + public: + typedef typename Allocator::size_type size_type; + + typedef + typename Allocator::template rebind< + this_type>::other::pointer + node_pointer; + + typedef Value_Type value_type; + + public: + value_type m_value; + + node_pointer m_p_l_child; + + node_pointer m_p_next_sibling; + + node_pointer m_p_prev_or_parent; + }; + + } // namespace detail +} // namespace __gnu_pbds + +#endif // #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp new file mode 100644 index 0000000000000000000000000000000000000000..766476607aaeaa25eb46205f6b9ac2922f72af95 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp @@ -0,0 +1,61 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file null_metadata.hpp + * Contains an implementation struct for this type of heap's node. + */ + +#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NULL_METADATA_HPP +#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NULL_METADATA_HPP + +namespace __gnu_pbds +{ + namespace detail + { + + struct null_left_child_next_sibling_heap_node_metadata + { }; + + } // namespace detail +} // namespace __gnu_pbds + +#endif // #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NULL_METADATA_HPP diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8603299c57afa9f5c7e382db3f29648d05b9090e --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp @@ -0,0 +1,62 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file policy_access_fn_imps.hpp + * Contains an implementation class for left_child_next_sibling_heap_. + */ + +PB_DS_CLASS_T_DEC +Cmp_Fn& +PB_DS_CLASS_C_DEC:: +get_cmp_fn() +{ + return (*this); +} + +PB_DS_CLASS_T_DEC +const Cmp_Fn& +PB_DS_CLASS_C_DEC:: +get_cmp_fn() const +{ + return (*this); +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..82a6634c3e5d147de229e3b3750cf700bcc1e453 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp @@ -0,0 +1,101 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file trace_fn_imps.hpp + * Contains an implementation class for left_child_next_sibling_heap_. + */ + +#ifdef PB_DS_LC_NS_HEAP_TRACE_ + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +trace() const +{ + std::cerr << std::endl; + + trace_node(m_p_root, 0); + + std::cerr << std::endl; +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +trace_node(const_node_pointer p_nd, size_type level) +{ + while (p_nd != NULL) + { + for (size_type i = 0; i < level; ++i) + std::cerr << ' '; + + std::cerr << p_nd << + " prev = " << p_nd->m_p_prev_or_parent << + " next " << p_nd->m_p_next_sibling << + " left = " << p_nd->m_p_l_child << " "; + + trace_node_metadata(p_nd, type_to_type()); + + std::cerr << p_nd->m_value << std::endl; + + trace_node(p_nd->m_p_l_child, level + 1); + + p_nd = p_nd->m_p_next_sibling; + } +} + +PB_DS_CLASS_T_DEC +template +void +PB_DS_CLASS_C_DEC:: +trace_node_metadata(const_node_pointer p_nd, type_to_type) +{ + std::cerr << "(" << p_nd->m_metadata << ") "; +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +trace_node_metadata(const_node_pointer, type_to_type) +{ } + +#endif // #ifdef PB_DS_LC_NS_HEAP_TRACE_ diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0ed55a5de5bf3e6e82b34840ab8d28f60ae9edc8 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp @@ -0,0 +1,147 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file constructor_destructor_fn_imps.hpp + * Contains implementations of PB_DS_CLASS_NAME. + */ + +PB_DS_CLASS_T_DEC +typename PB_DS_CLASS_C_DEC::entry_allocator +PB_DS_CLASS_C_DEC::s_entry_allocator; + +PB_DS_CLASS_T_DEC +Eq_Fn PB_DS_CLASS_C_DEC::s_eq_fn; + +PB_DS_CLASS_T_DEC +null_lu_metadata PB_DS_CLASS_C_DEC::s_null_lu_metadata; + +PB_DS_CLASS_T_DEC +Update_Policy PB_DS_CLASS_C_DEC::s_update_policy; + +PB_DS_CLASS_T_DEC +type_to_type< + typename PB_DS_CLASS_C_DEC::update_metadata> PB_DS_CLASS_C_DEC::s_metadata_type_indicator; + +PB_DS_CLASS_T_DEC +template +void +PB_DS_CLASS_C_DEC:: +copy_from_range(It first_it, It last_it) +{ + while (first_it != last_it) + insert(*(first_it++)); +} + +PB_DS_CLASS_T_DEC +PB_DS_CLASS_C_DEC:: +PB_DS_CLASS_NAME() : m_p_l(NULL) +{ _GLIBCXX_DEBUG_ONLY(assert_valid();) } + +PB_DS_CLASS_T_DEC +template +PB_DS_CLASS_C_DEC:: +PB_DS_CLASS_NAME(It first_it, It last_it) : m_p_l(NULL) +{ + copy_from_range(first_it, last_it); + _GLIBCXX_DEBUG_ONLY(assert_valid();); +} + +PB_DS_CLASS_T_DEC +PB_DS_CLASS_C_DEC:: +PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) : +#ifdef _GLIBCXX_DEBUG + debug_base(), +#endif +m_p_l(NULL) +{ + try + { + for (const_iterator it = other.begin(); it != other.end(); ++it) + { + entry_pointer p_l = allocate_new_entry(*it, + PB_DS_TYPES_TRAITS_C_DEC::m_no_throw_copies_indicator); + + p_l->m_p_next = m_p_l; + m_p_l = p_l; + } + } + catch(...) + { + deallocate_all(); + __throw_exception_again; + } + _GLIBCXX_DEBUG_ONLY(assert_valid();) +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +swap(PB_DS_CLASS_C_DEC& other) +{ + _GLIBCXX_DEBUG_ONLY(assert_valid();) + _GLIBCXX_DEBUG_ONLY(other.assert_valid();) + _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);) + std::swap(m_p_l, other.m_p_l); + _GLIBCXX_DEBUG_ONLY(assert_valid();) + _GLIBCXX_DEBUG_ONLY(other.assert_valid();) +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +deallocate_all() +{ + entry_pointer p_l = m_p_l; + while (p_l != NULL) + { + entry_pointer p_next_l = p_l->m_p_next; + actual_erase_entry(p_l); + p_l = p_next_l; + } + m_p_l = NULL; +} + +PB_DS_CLASS_T_DEC +PB_DS_CLASS_C_DEC:: +~PB_DS_CLASS_NAME() +{ deallocate_all(); } + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ae652fc5114e930ea6f162a4d95e064c5e488c22 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp @@ -0,0 +1,63 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file debug_fn_imps.hpp + * Contains implementations of cc_ht_map_'s debug-mode functions. + */ + +#ifdef _GLIBCXX_DEBUG + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +assert_valid() const +{ + size_type calc_size = 0; + for (const_iterator it = begin(); it != end(); ++it) + { + debug_base::check_key_exists(PB_DS_V2F(*it)); + ++calc_size; + } + debug_base::check_size(calc_size); +} + +#endif diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a06286150aa3fa969d114cfdfb2be96ac5fba9d7 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp @@ -0,0 +1,66 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file entry_metadata_base.hpp + * Contains an implementation for a list update map. + */ + +#ifndef PB_DS_LU_MAP_ENTRY_METADATA_BASE_HPP +#define PB_DS_LU_MAP_ENTRY_METADATA_BASE_HPP + +namespace __gnu_pbds +{ + namespace detail + { + template + struct lu_map_entry_metadata_base + { + Metadata m_update_metadata; + }; + + template<> + struct lu_map_entry_metadata_base + { }; + } // namespace detail +} // namespace __gnu_pbds + +#endif diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0daf0daf3a7bfc5d29c54d954a358f5f33d87d5e --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp @@ -0,0 +1,141 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file erase_fn_imps.hpp + * Contains implementations of lu_map_. + */ + +PB_DS_CLASS_T_DEC +inline bool +PB_DS_CLASS_C_DEC:: +erase(const_key_reference r_key) +{ + _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) + if (m_p_l == NULL) + return false; + + if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value))) + { + entry_pointer p_next = m_p_l->m_p_next; + actual_erase_entry(m_p_l); + m_p_l = p_next; + return true; + } + + entry_pointer p_l = m_p_l; + while (p_l->m_p_next != NULL) + if (s_eq_fn(r_key, PB_DS_V2F(p_l->m_p_next->m_value))) + { + erase_next(p_l); + return true; + } + else + p_l = p_l->m_p_next; + return false; +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +clear() +{ + deallocate_all(); +} + +PB_DS_CLASS_T_DEC +template +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +erase_if(Pred pred) +{ + _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) + size_type num_ersd = 0; + while (m_p_l != NULL && pred(m_p_l->m_value)) + { + entry_pointer p_next = m_p_l->m_p_next; + ++num_ersd; + actual_erase_entry(m_p_l); + m_p_l = p_next; + } + + if (m_p_l == NULL) + return num_ersd; + + entry_pointer p_l = m_p_l; + while (p_l->m_p_next != NULL) + { + if (pred(p_l->m_p_next->m_value)) + { + ++num_ersd; + erase_next(p_l); + } + else + p_l = p_l->m_p_next; + } + + _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) + return num_ersd; +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +erase_next(entry_pointer p_l) +{ + _GLIBCXX_DEBUG_ASSERT(p_l != NULL); + _GLIBCXX_DEBUG_ASSERT(p_l != m_p_l); + _GLIBCXX_DEBUG_ASSERT(p_l->m_p_next != NULL); + entry_pointer p_next_l = p_l->m_p_next->m_p_next; + actual_erase_entry(p_l->m_p_next); + p_l->m_p_next = p_next_l; +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +actual_erase_entry(entry_pointer p_l) +{ + _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_l->m_value));) + p_l->~entry(); + s_entry_allocator.deallocate(p_l, 1); +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6c78f4b7e31c38f2cab7a08de1f92c2028c06330 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp @@ -0,0 +1,96 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file find_fn_imps.hpp + * Contains implementations of lu_map_. + */ + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::entry_pointer +PB_DS_CLASS_C_DEC:: +find_imp(const_key_reference r_key) const +{ + if (m_p_l == NULL) + return NULL; + if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value))) + { + apply_update(m_p_l, s_metadata_type_indicator); + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);) + return m_p_l; + } + + entry_pointer p_l = m_p_l; + while (p_l->m_p_next != NULL) + { + entry_pointer p_next = p_l->m_p_next; + if (s_eq_fn(r_key, PB_DS_V2F(p_next->m_value))) + { + if (apply_update(p_next, s_metadata_type_indicator)) + { + p_l->m_p_next = p_next->m_p_next; + p_next->m_p_next = m_p_l; + m_p_l = p_next; + return m_p_l; + } + return p_next; + } + else + p_l = p_next; + } + + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);) + return NULL; +} + +PB_DS_CLASS_T_DEC +template +inline bool +PB_DS_CLASS_C_DEC:: +apply_update(entry_pointer p_l, type_to_type) +{ return s_update_policy(p_l->m_update_metadata); } + +PB_DS_CLASS_T_DEC +inline bool +PB_DS_CLASS_C_DEC:: +apply_update(entry_pointer, type_to_type) +{ return s_update_policy(s_null_lu_metadata); } + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..343bb9922161e3046046d5a66652b5d6a48ab12e --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp @@ -0,0 +1,63 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file info_fn_imps.hpp + * Contains implementations of lu_map_. + */ + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +size() const +{ return std::distance(begin(), end()); } + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +max_size() const +{ return s_entry_allocator.max_size(); } + +PB_DS_CLASS_T_DEC +inline bool +PB_DS_CLASS_C_DEC:: +empty() const +{ return (m_p_l == NULL); } diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bbbc496dde072aa486d66063453a289d7ed1ad00 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp @@ -0,0 +1,112 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file insert_fn_imps.hpp + * Contains implementations of lu_map_. + */ + +PB_DS_CLASS_T_DEC +inline std::pair< + typename PB_DS_CLASS_C_DEC::point_iterator, + bool> +PB_DS_CLASS_C_DEC:: +insert(const_reference r_val) +{ + _GLIBCXX_DEBUG_ONLY(assert_valid();) + entry_pointer p_l = find_imp(PB_DS_V2F(r_val)); + + if (p_l != NULL) + { + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(PB_DS_V2F(r_val));) + return std::make_pair(point_iterator(&p_l->m_value), false); + } + + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(PB_DS_V2F(r_val));) + + p_l = allocate_new_entry(r_val, traits_base::m_no_throw_copies_indicator); + p_l->m_p_next = m_p_l; + m_p_l = p_l; + _GLIBCXX_DEBUG_ONLY(assert_valid();) + return std::make_pair(point_iterator(&p_l->m_value), true); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::entry_pointer +PB_DS_CLASS_C_DEC:: +allocate_new_entry(const_reference r_val, false_type) +{ + entry_pointer p_l = s_entry_allocator.allocate(1); + cond_dealtor_t cond(p_l); + new (const_cast(static_cast(&p_l->m_value))) + value_type(r_val); + + cond.set_no_action(); + _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));) + init_entry_metadata(p_l, s_metadata_type_indicator); + return p_l; +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::entry_pointer +PB_DS_CLASS_C_DEC:: +allocate_new_entry(const_reference r_val, true_type) +{ + entry_pointer p_l = s_entry_allocator.allocate(1); + new (&p_l->m_value) value_type(r_val); + _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));) + init_entry_metadata(p_l, s_metadata_type_indicator); + return p_l; +} + +PB_DS_CLASS_T_DEC +template +inline void +PB_DS_CLASS_C_DEC:: +init_entry_metadata(entry_pointer p_l, type_to_type) +{ new (&p_l->m_update_metadata) Metadata(s_update_policy()); } + +PB_DS_CLASS_T_DEC +inline void +PB_DS_CLASS_C_DEC:: +init_entry_metadata(entry_pointer, type_to_type) +{ } + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e43e4675df9b2e0565c7c3b82f6a46d379409a2f --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp @@ -0,0 +1,86 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file iterators_fn_imps.hpp + * Contains implementations of lu_map_. + */ + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::iterator +PB_DS_CLASS_C_DEC:: +begin() +{ + if (m_p_l == NULL) + { + _GLIBCXX_DEBUG_ASSERT(empty()); + return end(); + } + return iterator(&m_p_l->m_value, m_p_l, this); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +begin() const +{ + if (m_p_l == NULL) + { + _GLIBCXX_DEBUG_ASSERT(empty()); + return end(); + } + return iterator(&m_p_l->m_value, m_p_l, const_cast(this)); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::iterator +PB_DS_CLASS_C_DEC:: +end() +{ return iterator(NULL, NULL, this); } + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_iterator +PB_DS_CLASS_C_DEC:: +end() const +{ + return const_iterator(NULL, NULL, const_cast(this)); +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/lu_map_.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/lu_map_.hpp new file mode 100644 index 0000000000000000000000000000000000000000..79a94ca59e50420fffb9a6b52c1b106c2a293e5b --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/lu_map_.hpp @@ -0,0 +1,365 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file lu_map_.hpp + * Contains a list update map. + */ + +#include +#include +#include +#include +#include +#include +#include +#ifdef _GLIBCXX_DEBUG +#include +#endif +#ifdef PB_DS_LU_MAP_TRACE_ +#include +#endif +#include + +namespace __gnu_pbds +{ + namespace detail + { +#define PB_DS_CLASS_T_DEC \ + template + +#ifdef PB_DS_DATA_TRUE_INDICATOR +#define PB_DS_CLASS_NAME lu_map_data_ +#endif + +#ifdef PB_DS_DATA_FALSE_INDICATOR +#define PB_DS_CLASS_NAME lu_map_no_data_ +#endif + +#define PB_DS_CLASS_C_DEC \ + PB_DS_CLASS_NAME + +#define PB_DS_TYPES_TRAITS_C_DEC \ + types_traits + +#ifdef _GLIBCXX_DEBUG +#define PB_DS_DEBUG_MAP_BASE_C_DEC \ + debug_map_base::other::const_reference> +#endif + +#ifdef PB_DS_DATA_TRUE_INDICATOR +#define PB_DS_V2F(X) (X).first +#define PB_DS_V2S(X) (X).second +#define PB_DS_EP2VP(X)& ((X)->m_value) +#endif + +#ifdef PB_DS_DATA_FALSE_INDICATOR +#define PB_DS_V2F(X) (X) +#define PB_DS_V2S(X) Mapped_Data() +#define PB_DS_EP2VP(X)& ((X)->m_value.first) +#endif + + /* Skip to the lu, my darling. */ + // list-based (with updates) associative container. + template + class PB_DS_CLASS_NAME : +#ifdef _GLIBCXX_DEBUG + protected PB_DS_DEBUG_MAP_BASE_C_DEC, +#endif + public PB_DS_TYPES_TRAITS_C_DEC + { + private: + typedef PB_DS_TYPES_TRAITS_C_DEC traits_base; + + struct entry + : public lu_map_entry_metadata_base + { + typename traits_base::value_type m_value; + typename Allocator::template rebind::other::pointer m_p_next; + }; + + typedef typename Allocator::template rebind::other entry_allocator; + typedef typename entry_allocator::pointer entry_pointer; + typedef typename entry_allocator::const_pointer const_entry_pointer; + typedef typename entry_allocator::reference entry_reference; + typedef typename entry_allocator::const_reference const_entry_reference; + + typedef typename Allocator::template rebind::other entry_pointer_allocator; + typedef typename entry_pointer_allocator::pointer entry_pointer_array; + + typedef typename traits_base::value_type value_type_; + typedef typename traits_base::pointer pointer_; + typedef typename traits_base::const_pointer const_pointer_; + typedef typename traits_base::reference reference_; + typedef typename traits_base::const_reference const_reference_; + +#define PB_DS_GEN_POS entry_pointer + +#include +#include +#include +#include + +#undef PB_DS_GEN_POS + + +#ifdef _GLIBCXX_DEBUG + typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base; +#endif + + typedef cond_dealtor cond_dealtor_t; + + public: + typedef Allocator allocator; + typedef typename Allocator::size_type size_type; + typedef typename Allocator::difference_type difference_type; + typedef Eq_Fn eq_fn; + typedef Update_Policy update_policy; + typedef typename Update_Policy::metadata_type update_metadata; + typedef typename traits_base::key_type key_type; + typedef typename traits_base::key_pointer key_pointer; + typedef typename traits_base::const_key_pointer const_key_pointer; + typedef typename traits_base::key_reference key_reference; + typedef typename traits_base::const_key_reference const_key_reference; + typedef typename traits_base::mapped_type mapped_type; + typedef typename traits_base::mapped_pointer mapped_pointer; + typedef typename traits_base::const_mapped_pointer const_mapped_pointer; + typedef typename traits_base::mapped_reference mapped_reference; + typedef typename traits_base::const_mapped_reference const_mapped_reference; + typedef typename traits_base::value_type value_type; + typedef typename traits_base::pointer pointer; + typedef typename traits_base::const_pointer const_pointer; + typedef typename traits_base::reference reference; + typedef typename traits_base::const_reference const_reference; + +#ifdef PB_DS_DATA_TRUE_INDICATOR + typedef point_iterator_ point_iterator; +#endif + +#ifdef PB_DS_DATA_FALSE_INDICATOR + typedef const_point_iterator_ point_iterator; +#endif + + typedef const_point_iterator_ const_point_iterator; + +#ifdef PB_DS_DATA_TRUE_INDICATOR + typedef iterator_ iterator; +#endif + +#ifdef PB_DS_DATA_FALSE_INDICATOR + typedef const_iterator_ iterator; +#endif + + typedef const_iterator_ const_iterator; + + public: + PB_DS_CLASS_NAME(); + + PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&); + + virtual + ~PB_DS_CLASS_NAME(); + + template + PB_DS_CLASS_NAME(It first_it, It last_it); + + void + swap(PB_DS_CLASS_C_DEC&); + + inline size_type + size() const; + + inline size_type + max_size() const; + + inline bool + empty() const; + + inline mapped_reference + operator[](const_key_reference r_key) + { +#ifdef PB_DS_DATA_TRUE_INDICATOR + _GLIBCXX_DEBUG_ONLY(assert_valid();) + return insert(std::make_pair(r_key, mapped_type())).first->second; +#else + insert(r_key); + return traits_base::s_null_mapped; +#endif + } + + inline std::pair + insert(const_reference); + + inline point_iterator + find(const_key_reference r_key) + { + _GLIBCXX_DEBUG_ONLY(assert_valid();) + entry_pointer p_e = find_imp(r_key); + return point_iterator(p_e == NULL ? NULL: &p_e->m_value); + } + + inline const_point_iterator + find(const_key_reference r_key) const + { + _GLIBCXX_DEBUG_ONLY(assert_valid();) + entry_pointer p_e = find_imp(r_key); + return const_point_iterator(p_e == NULL ? NULL: &p_e->m_value); + } + + inline bool + erase(const_key_reference); + + template + inline size_type + erase_if(Pred); + + void + clear(); + + inline iterator + begin(); + + inline const_iterator + begin() const; + + inline iterator + end(); + + inline const_iterator + end() const; + +#ifdef _GLIBCXX_DEBUG + void + assert_valid() const; +#endif + +#ifdef PB_DS_LU_MAP_TRACE_ + void + trace() const; +#endif + + protected: + + template + void + copy_from_range(It, It); + + private: +#ifdef PB_DS_DATA_TRUE_INDICATOR + friend class iterator_; +#endif + + friend class const_iterator_; + + inline entry_pointer + allocate_new_entry(const_reference, false_type); + + inline entry_pointer + allocate_new_entry(const_reference, true_type); + + template + inline static void + init_entry_metadata(entry_pointer, type_to_type); + + inline static void + init_entry_metadata(entry_pointer, type_to_type); + + void + deallocate_all(); + + void + erase_next(entry_pointer); + + void + actual_erase_entry(entry_pointer); + + void + inc_it_state(const_pointer& r_p_value, entry_pointer& r_pos) const + { + r_pos = r_pos->m_p_next; + r_p_value = (r_pos == NULL) ? NULL : &r_pos->m_value; + } + + template + inline static bool + apply_update(entry_pointer, type_to_type); + + inline static bool + apply_update(entry_pointer, type_to_type); + + inline entry_pointer + find_imp(const_key_reference) const; + + static entry_allocator s_entry_allocator; + static Eq_Fn s_eq_fn; + static Update_Policy s_update_policy; + static type_to_type s_metadata_type_indicator; + static null_lu_metadata s_null_lu_metadata; + + mutable entry_pointer m_p_l; + }; + +#include +#include +#include +#include +#include +#include +#include +#include + +#undef PB_DS_CLASS_T_DEC +#undef PB_DS_CLASS_C_DEC +#undef PB_DS_TYPES_TRAITS_C_DEC +#undef PB_DS_DEBUG_MAP_BASE_C_DEC +#undef PB_DS_CLASS_NAME +#undef PB_DS_V2F +#undef PB_DS_EP2VP +#undef PB_DS_V2S + + } // namespace detail +} // namespace __gnu_pbds diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..30d657234b2d0e97bfea78e34dd7eab450f710b8 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp @@ -0,0 +1,65 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file trace_fn_imps.hpp + * Contains implementations of lu_map_. + */ + +#ifdef PB_DS_LU_MAP_TRACE_ + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +trace() const +{ + std::cerr << m_p_l << std::endl << std::endl; + const_entry_pointer p_l = m_p_l; + while (p_l != NULL) + { + std::cerr << PB_DS_V2F(p_l->m_value) << std::endl; + p_l = p_l->m_p_next; + } + std::cerr << std::endl; +} + +#endif + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5643f15b991929a8a5de095ee3575b08cdff495a --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp @@ -0,0 +1,92 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file counter_lu_metadata.hpp + * Contains implementation of a lu counter policy's metadata. + */ + +namespace __gnu_pbds +{ + namespace detail + { + template + class counter_lu_policy_base; + + // A list-update metadata type that moves elements to the front of + // the list based on the counter algorithm. + template + class counter_lu_metadata + { + public: + typedef Size_Type size_type; + + private: + counter_lu_metadata(size_type init_count) : m_count(init_count) + { } + + friend class counter_lu_policy_base; + + mutable size_type m_count; + }; + + template + class counter_lu_policy_base + { + protected: + typedef Size_Type size_type; + + counter_lu_metadata + operator()(size_type max_size) const + { return counter_lu_metadata(std::rand() % max_size); } + + template + bool + operator()(Metadata_Reference r_data, size_type m_max_count) const + { + if (++r_data.m_count != m_max_count) + return false; + r_data.m_count = 0; + return true; + } + }; + } // namespace detail +} // namespace __gnu_pbds diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp new file mode 100644 index 0000000000000000000000000000000000000000..013b4344a5f490c76f27629f0341a98ce3e7fb82 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp @@ -0,0 +1,57 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file counter_lu_policy_imp.hpp + * Contains a lu counter policy implementation. + */ + +PB_DS_CLASS_T_DEC +detail::counter_lu_metadata +PB_DS_CLASS_C_DEC:: +operator()() const +{ return (base_type::operator()(max_count)); } + +PB_DS_CLASS_T_DEC +bool +PB_DS_CLASS_C_DEC:: +operator()(metadata_reference r_data) const +{ return (base_type::operator()(r_data, max_count)); } diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp new file mode 100644 index 0000000000000000000000000000000000000000..677875eb6122f675c7cf634fa23f7a6602730d5e --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp @@ -0,0 +1,61 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file mtf_lu_policy_imp.hpp + * Contains a move-to-front policy implementation. + */ + +PB_DS_CLASS_T_DEC +null_lu_metadata PB_DS_CLASS_C_DEC::s_metadata; + +PB_DS_CLASS_T_DEC +typename PB_DS_CLASS_C_DEC::metadata_type +PB_DS_CLASS_C_DEC:: +operator()() const +{ return s_metadata; } + +PB_DS_CLASS_T_DEC +inline bool +PB_DS_CLASS_C_DEC:: +operator()(metadata_reference /*r_data*/) const +{ return true; } + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c2cbc0eeacbcb881f4fad77275f17315f62e205d --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp @@ -0,0 +1,80 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file sample_update_policy.hpp + * Contains a sample policy for list update containers. + */ + +#ifndef PB_DS_SAMPLE_UPDATE_POLICY_HPP +#define PB_DS_SAMPLE_UPDATE_POLICY_HPP + +// A sample list-update policy. +struct sample_update_policy +{ + // Default constructor. + sample_update_policy(); + + // Copy constructor. + sample_update_policy(const sample_update_policy&); + + // Swaps content. + inline void + swap(sample_update_policy& other); + +protected: + // Metadata on which this functor operates. + typedef some_metadata_type metadata_type; + + // Creates a metadata object. + metadata_type + operator()() const; + + // Decides whether a metadata object should be moved to the front of + // the list. A list-update based containers object will call this + // method to decide whether to move a node to the front of the + // list. The method shoule return true if the node should be moved + // to the front of the list. + bool + operator()(metadata_reference) const; +}; + +#endif diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9176b9330fbb4d94899f667ed8e58091577c6491 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp @@ -0,0 +1,80 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file cond_dtor.hpp + * Contains a conditional destructor + */ + +template +class cond_dtor +{ +public: + cond_dtor(value_vector a_vec, iterator& r_last_it, Size_Type total_size) + : m_a_vec(a_vec), m_r_last_it(r_last_it), m_max_size(total_size), + m_no_action(false) + { } + + ~cond_dtor() + { + if (m_no_action) + return; + iterator it = m_a_vec; + while (it != m_r_last_it) + { + it->~value_type(); + ++it; + } + + if (m_max_size > 0) + value_allocator().deallocate(m_a_vec, m_max_size); + } + + inline void + set_no_action() + { m_no_action = true; } + +protected: + value_vector m_a_vec; + iterator& m_r_last_it; + const Size_Type m_max_size; + bool m_no_action; +}; diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6a89bfa42e25b8d5c78d788749cb087027a94ffb --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp @@ -0,0 +1,279 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file constructors_destructor_fn_imps.hpp + * Contains an implementation class for ov_tree_. + */ + +PB_DS_CLASS_T_DEC +typename PB_DS_CLASS_C_DEC::value_allocator +PB_DS_CLASS_C_DEC::s_value_alloc; + +PB_DS_CLASS_T_DEC +typename PB_DS_CLASS_C_DEC::metadata_allocator +PB_DS_CLASS_C_DEC::s_metadata_alloc; + +PB_DS_CLASS_T_DEC +PB_DS_CLASS_C_DEC:: +PB_DS_OV_TREE_CLASS_NAME() : + m_a_values(NULL), + m_a_metadata(NULL), + m_end_it(NULL), + m_size(0) +{ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) } + +PB_DS_CLASS_T_DEC +PB_DS_CLASS_C_DEC:: +PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn) : + cmp_fn_base(r_cmp_fn), + m_a_values(NULL), + m_a_metadata(NULL), + m_end_it(NULL), + m_size(0) +{ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) } + +PB_DS_CLASS_T_DEC +PB_DS_CLASS_C_DEC:: +PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) : + cmp_fn_base(r_cmp_fn), + node_update(r_node_update), + m_a_values(NULL), + m_a_metadata(NULL), + m_end_it(NULL), + m_size(0) +{ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) } + +PB_DS_CLASS_T_DEC +PB_DS_CLASS_C_DEC:: +PB_DS_OV_TREE_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) : +#ifdef _GLIBCXX_DEBUG + debug_base(other), +#endif +#ifdef PB_DS_TREE_TRACE + PB_DS_TREE_TRACE_BASE_C_DEC(other), +#endif + cmp_fn_base(other), + node_update(other), + m_a_values(NULL), + m_a_metadata(NULL), + m_end_it(NULL), + m_size(0) +{ + copy_from_ordered_range(other.begin(), other.end()); + _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) +} + +PB_DS_CLASS_T_DEC +template +inline void +PB_DS_CLASS_C_DEC:: +copy_from_range(It first_it, It last_it) +{ +#ifdef PB_DS_DATA_TRUE_INDICATOR + typedef + std::map< + key_type, + mapped_type, + Cmp_Fn, + typename Allocator::template rebind< + value_type>::other> + map_type; +#else + typedef + std::set< + key_type, + Cmp_Fn, + typename Allocator::template rebind< + Key>::other> + map_type; +#endif + + map_type m(first_it, last_it); + copy_from_ordered_range(m.begin(), m.end()); +} + +PB_DS_CLASS_T_DEC +template +void +PB_DS_CLASS_C_DEC:: +copy_from_ordered_range(It first_it, It last_it) +{ + const size_type len = std::distance(first_it, last_it); + if (len == 0) + return; + + value_vector a_values = s_value_alloc.allocate(len); + iterator target_it = a_values; + It source_it = first_it; + It source_end_it = last_it; + + cond_dtor cd(a_values, target_it, len); + while (source_it != source_end_it) + { + new (const_cast(static_cast(target_it))) + value_type(*source_it++); + + ++target_it; + } + + reallocate_metadata((node_update* )this, len); + cd.set_no_action(); + m_a_values = a_values; + m_size = len; + m_end_it = m_a_values + m_size; + update(PB_DS_node_begin_imp(), (node_update* )this); + +#ifdef _GLIBCXX_DEBUG + const_iterator dbg_it = m_a_values; + while (dbg_it != m_end_it) + { + debug_base::insert_new(PB_DS_V2F(*dbg_it)); + dbg_it++; + } + PB_DS_CLASS_C_DEC::assert_valid(); +#endif +} + +PB_DS_CLASS_T_DEC +template +void +PB_DS_CLASS_C_DEC:: +copy_from_ordered_range(It first_it, It last_it, It other_first_it, + It other_last_it) +{ + clear(); + const size_type len = std::distance(first_it, last_it) + + std::distance(other_first_it, other_last_it); + + value_vector a_values = s_value_alloc.allocate(len); + + iterator target_it = a_values; + It source_it = first_it; + It source_end_it = last_it; + + cond_dtor cd(a_values, target_it, len); + while (source_it != source_end_it) + { + new (const_cast(static_cast(target_it))) + value_type(*source_it++); + ++target_it; + } + + source_it = other_first_it; + source_end_it = other_last_it; + + while (source_it != source_end_it) + { + new (const_cast(static_cast(target_it))) + value_type(*source_it++); + ++target_it; + } + + reallocate_metadata((node_update* )this, len); + cd.set_no_action(); + m_a_values = a_values; + m_size = len; + m_end_it = m_a_values + m_size; + update(PB_DS_node_begin_imp(), (node_update* )this); + +#ifdef _GLIBCXX_DEBUG + const_iterator dbg_it = m_a_values; + while (dbg_it != m_end_it) + { + debug_base::insert_new(PB_DS_V2F(*dbg_it)); + dbg_it++; + } + PB_DS_CLASS_C_DEC::assert_valid(); +#endif +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +swap(PB_DS_CLASS_C_DEC& other) +{ + _GLIBCXX_DEBUG_ONLY(assert_valid();) + value_swap(other); + std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other); + _GLIBCXX_DEBUG_ONLY(assert_valid();) +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +value_swap(PB_DS_CLASS_C_DEC& other) +{ + std::swap(m_a_values, other.m_a_values); + std::swap(m_a_metadata, other.m_a_metadata); + std::swap(m_size, other.m_size); + std::swap(m_end_it, other.m_end_it); + _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);) +} + +PB_DS_CLASS_T_DEC +PB_DS_CLASS_C_DEC:: +~PB_DS_OV_TREE_CLASS_NAME() +{ + _GLIBCXX_DEBUG_ONLY(assert_valid();) + cond_dtor cd(m_a_values, m_end_it, m_size); + reallocate_metadata((node_update* )this, 0); +} + +PB_DS_CLASS_T_DEC +inline void +PB_DS_CLASS_C_DEC:: +update(node_iterator /*it*/, null_node_update_pointer) +{ } + +PB_DS_CLASS_T_DEC +template +void +PB_DS_CLASS_C_DEC:: +update(node_iterator nd_it, Node_Update* p_update) +{ + const_node_iterator end_it = PB_DS_node_end_imp(); + if (nd_it == end_it) + return; + update(nd_it.get_l_child(), p_update); + update(nd_it.get_r_child(), p_update); + node_update::operator()(nd_it, end_it); +} diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2da25cb50a69505732541b9f0ef5563f79c77a8e --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp @@ -0,0 +1,90 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file debug_fn_imps.hpp + * Contains an implementation class for ov_tree_. + */ + +#ifdef _GLIBCXX_DEBUG + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +assert_valid() const +{ + std::cout << "av1" << std::endl; + + if (m_a_values == NULL || m_end_it == NULL || m_size == 0) + _GLIBCXX_DEBUG_ASSERT(m_a_values == NULL && m_end_it == NULL && m_size == 0); + + std::cout << "av2" << std::endl; + assert_iterators(); + std::cout << "av3" << std::endl; +} + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +assert_iterators() const +{ + debug_base::check_size(m_size); + size_type iterated_num = 0; + const_iterator prev_it = end(); + _GLIBCXX_DEBUG_ASSERT( m_end_it == m_a_values + m_size); + for (const_iterator it = begin(); it != end(); ++it) + { + ++iterated_num; + _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(PB_DS_V2F(*it));) + _GLIBCXX_DEBUG_ASSERT(lower_bound(PB_DS_V2F(*it)) == it); + const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it)); + --upper_bound_it; + _GLIBCXX_DEBUG_ASSERT(upper_bound_it == it); + if (prev_it != end()) + _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(*prev_it), + PB_DS_V2F(*it))); + prev_it = it; + } + _GLIBCXX_DEBUG_ASSERT(iterated_num == m_size); +} + +#endif + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..de69a4a932be13d965eba6cdcc43bb542b817991 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp @@ -0,0 +1,199 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file erase_fn_imps.hpp + * Contains an implementation class for ov_tree_. + */ + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +clear() +{ + _GLIBCXX_DEBUG_ONLY(assert_valid();) + if (m_size == 0) + { + _GLIBCXX_DEBUG_ONLY(assert_valid();) + return; + } + else + { + reallocate_metadata((node_update* )this, 0); + cond_dtor cd(m_a_values, m_end_it, m_size); + } + + _GLIBCXX_DEBUG_ONLY(debug_base::clear();) + m_a_values = NULL; + m_size = 0; + m_end_it = m_a_values; + _GLIBCXX_DEBUG_ONLY(assert_valid();) +} + +PB_DS_CLASS_T_DEC +template +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +erase_if(Pred pred) +{ + _GLIBCXX_DEBUG_ONLY(assert_valid();) + +#ifdef PB_DS_REGRESSION + typename Allocator::group_throw_prob_adjustor adjust(m_size); +#endif + + size_type new_size = 0; + size_type num_val_ersd = 0; + iterator source_it = m_a_values; + for (source_it = begin(); source_it != m_end_it; ++source_it) + if (!pred(*source_it)) + ++new_size; + else + ++num_val_ersd; + + if (new_size == 0) + { + clear(); + return num_val_ersd; + } + + value_vector a_new_values = s_value_alloc.allocate(new_size); + iterator target_it = a_new_values; + cond_dtor cd(a_new_values, target_it, new_size); + _GLIBCXX_DEBUG_ONLY(debug_base::clear()); + for (source_it = begin(); source_it != m_end_it; ++source_it) + { + if (!pred(*source_it)) + { + new (const_cast(static_cast(target_it))) + value_type(*source_it); + + _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(*source_it))); + ++target_it; + } + } + + reallocate_metadata((node_update* )this, new_size); + cd.set_no_action(); + + { + cond_dtor cd1(m_a_values, m_end_it, m_size); + } + + m_a_values = a_new_values; + m_size = new_size; + m_end_it = target_it; + update(node_begin(), (node_update* )this); + _GLIBCXX_DEBUG_ONLY(assert_valid();) + return num_val_ersd; +} + +PB_DS_CLASS_T_DEC +template +It +PB_DS_CLASS_C_DEC:: +erase_imp(It it) +{ + _GLIBCXX_DEBUG_ONLY(assert_valid();) + if (it == end()) + return end(); + + _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::check_key_exists(PB_DS_V2F(*it));) + +#ifdef PB_DS_REGRESSION + typename Allocator::group_throw_prob_adjustor adjust(m_size); +#endif + + _GLIBCXX_DEBUG_ASSERT(m_size > 0); + value_vector a_values = s_value_alloc.allocate(m_size - 1); + iterator source_it = begin(); + iterator source_end_it = end(); + iterator target_it = a_values; + iterator ret_it = end(); + + cond_dtor cd(a_values, target_it, m_size - 1); + + _GLIBCXX_DEBUG_ONLY(size_type cnt = 0;) + + while (source_it != source_end_it) + { + if (source_it != it) + { + _GLIBCXX_DEBUG_ONLY(++cnt;) + _GLIBCXX_DEBUG_ASSERT(cnt != m_size); + new (const_cast(static_cast(target_it))) + value_type(*source_it); + + ++target_it; + } + else + ret_it = target_it; + ++source_it; + } + + _GLIBCXX_DEBUG_ASSERT(m_size > 0); + reallocate_metadata((node_update* )this, m_size - 1); + cd.set_no_action(); + _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::erase_existing(PB_DS_V2F(*it));) + { + cond_dtor cd1(m_a_values, m_end_it, m_size); + } + + m_a_values = a_values; + --m_size; + m_end_it = m_a_values + m_size; + update(node_begin(), (node_update* )this); + _GLIBCXX_DEBUG_ONLY(assert_valid();) + return It(ret_it); +} + +PB_DS_CLASS_T_DEC +bool +PB_DS_CLASS_C_DEC:: +erase(const_key_reference r_key) +{ + point_iterator it = find(r_key); + if (it == end()) + return false; + erase(it); + return true; +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d8dd64815d93b31befa4124f8eb42178a35942ea --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp @@ -0,0 +1,66 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file info_fn_imps.hpp + * Contains an implementation class for ov_tree_. + */ + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +size() const +{ + _GLIBCXX_DEBUG_ONLY(assert_valid();) + return m_size; +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::size_type +PB_DS_CLASS_C_DEC:: +max_size() const +{ return s_value_alloc.max_size(); } + +PB_DS_CLASS_T_DEC +inline bool +PB_DS_CLASS_C_DEC:: +empty() const +{ return size() == 0; } diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..865981e4adb61ffd991aabc021766fb1ea4aead6 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp @@ -0,0 +1,69 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file insert_fn_imps.hpp + * Contains an implementation class for ov_tree_. + */ + +PB_DS_CLASS_T_DEC +void +PB_DS_CLASS_C_DEC:: +reallocate_metadata(null_node_update_pointer, size_type) +{ } + +PB_DS_CLASS_T_DEC +template +void +PB_DS_CLASS_C_DEC:: +reallocate_metadata(Node_Update_* , size_type new_size) +{ + metadata_pointer a_new_metadata_vec =(new_size == 0) ? NULL : s_metadata_alloc.allocate(new_size); + + if (m_a_metadata != NULL) + { + for (size_type i = 0; i < m_size; ++i) + m_a_metadata[i].~metadata_type(); + s_metadata_alloc.deallocate(m_a_metadata, m_size); + } + std::swap(m_a_metadata, a_new_metadata_vec); +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b15a08bfe6e84fbc15aa635517616d7067551b7f --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp @@ -0,0 +1,109 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file iterators_fn_imps.hpp + * Contains an implementation class for ov_tree_. + */ + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_node_iterator +PB_DS_CLASS_C_DEC:: +node_begin() const +{ return PB_DS_node_begin_imp(); } + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_node_iterator +PB_DS_CLASS_C_DEC:: +node_end() const +{ return PB_DS_node_end_imp(); } + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::node_iterator +PB_DS_CLASS_C_DEC:: +node_begin() +{ return PB_DS_node_begin_imp(); } + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::node_iterator +PB_DS_CLASS_C_DEC:: +node_end() +{ return PB_DS_node_end_imp(); } + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_node_iterator +PB_DS_CLASS_C_DEC:: +PB_DS_node_begin_imp() const +{ + return const_node_iterator(const_cast(mid_pointer(begin(), end())), + const_cast(begin()), + const_cast(end()),(m_a_metadata == NULL)? + NULL : + mid_pointer(m_a_metadata, m_a_metadata + m_size)); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::const_node_iterator +PB_DS_CLASS_C_DEC:: +PB_DS_node_end_imp() const +{ + return const_node_iterator(end(), end(), end(), + (m_a_metadata == NULL) ? NULL : m_a_metadata + m_size); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::node_iterator +PB_DS_CLASS_C_DEC:: +PB_DS_node_begin_imp() +{ + return node_iterator(mid_pointer(begin(), end()), begin(), end(), + (m_a_metadata == NULL) ? NULL : mid_pointer(m_a_metadata, m_a_metadata + m_size)); +} + +PB_DS_CLASS_T_DEC +inline typename PB_DS_CLASS_C_DEC::node_iterator +PB_DS_CLASS_C_DEC:: +PB_DS_node_end_imp() +{ + return node_iterator(end(), end(), + end(),(m_a_metadata == NULL) ? NULL : m_a_metadata + m_size); +} + diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp new file mode 100644 index 0000000000000000000000000000000000000000..987a2a57c7be1f652feaf7674dbbced7f8e914e7 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp @@ -0,0 +1,298 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file node_iterators.hpp + * Contains an implementation class for ov_tree_. + */ + +#ifndef PB_DS_OV_TREE_NODE_ITERATORS_HPP +#define PB_DS_OV_TREE_NODE_ITERATORS_HPP + +#include +#include +#include + +namespace __gnu_pbds +{ + namespace detail + { + +#define PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC \ + ov_tree_node_const_it_ + + // Const node reference. + template + class ov_tree_node_const_it_ + { + + protected: + typedef + typename Allocator::template rebind< + Value_Type>::other::pointer + pointer; + + typedef + typename Allocator::template rebind< + Value_Type>::other::const_pointer + const_pointer; + + typedef + typename Allocator::template rebind< + Metadata_Type>::other::const_pointer + const_metadata_pointer; + + typedef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC this_type; + + protected: + + template + inline static Ptr + mid_pointer(Ptr p_begin, Ptr p_end) + { + _GLIBCXX_DEBUG_ASSERT(p_end >= p_begin); + return (p_begin + (p_end - p_begin) / 2); + } + + public: + + typedef trivial_iterator_tag iterator_category; + + typedef trivial_iterator_difference_type difference_type; + + typedef + typename Allocator::template rebind< + Value_Type>::other::const_pointer + value_type; + + typedef + typename Allocator::template rebind< + typename remove_const< + Value_Type>::type>::other::const_pointer + reference; + + typedef + typename Allocator::template rebind< + typename remove_const< + Value_Type>::type>::other::const_pointer + const_reference; + + typedef Metadata_Type metadata_type; + + typedef + typename Allocator::template rebind< + metadata_type>::other::const_reference + const_metadata_reference; + + public: + inline + ov_tree_node_const_it_(const_pointer p_nd = NULL, const_pointer p_begin_nd = NULL, const_pointer p_end_nd = NULL, const_metadata_pointer p_metadata = NULL) : m_p_value(const_cast(p_nd)), m_p_begin_value(const_cast(p_begin_nd)), m_p_end_value(const_cast(p_end_nd)), m_p_metadata(p_metadata) + { } + + inline const_reference + operator*() const + { return m_p_value; } + + inline const_metadata_reference + get_metadata() const + { + enum + { + has_metadata = !is_same::value + }; + + PB_DS_STATIC_ASSERT(should_have_metadata, has_metadata); + _GLIBCXX_DEBUG_ASSERT(m_p_metadata != NULL); + return *m_p_metadata; + } + + inline this_type + get_l_child() const + { + if (m_p_begin_value == m_p_value) + return (this_type(m_p_begin_value, m_p_begin_value, m_p_begin_value)); + + const_metadata_pointer p_begin_metadata = + m_p_metadata - (m_p_value - m_p_begin_value); + + return (this_type(mid_pointer(m_p_begin_value, m_p_value), + m_p_begin_value, + m_p_value, + mid_pointer(p_begin_metadata, m_p_metadata))); + } + + inline this_type + get_r_child() const + { + if (m_p_value == m_p_end_value) + return (this_type(m_p_end_value, m_p_end_value, m_p_end_value)); + + const_metadata_pointer p_end_metadata = + m_p_metadata + (m_p_end_value - m_p_value); + + return (this_type(mid_pointer(m_p_value + 1, m_p_end_value), + m_p_value + 1, + m_p_end_value,(m_p_metadata == NULL) ? + NULL : mid_pointer(m_p_metadata + 1, p_end_metadata))); + } + + inline bool + operator==(const this_type& other) const + { + const bool is_end = m_p_begin_value == m_p_end_value; + const bool is_other_end = other.m_p_begin_value == other.m_p_end_value; + + if (is_end) + return (is_other_end); + + if (is_other_end) + return (is_end); + + return m_p_value == other.m_p_value; + } + + inline bool + operator!=(const this_type& other) const + { return !operator==(other); } + + public: + pointer m_p_value; + pointer m_p_begin_value; + pointer m_p_end_value; + + const_metadata_pointer m_p_metadata; + }; + +#define PB_DS_OV_TREE_NODE_ITERATOR_C_DEC \ + ov_tree_node_it_ + + // Node reference. + template + class ov_tree_node_it_ : public PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC + { + + private: + typedef PB_DS_OV_TREE_NODE_ITERATOR_C_DEC this_type; + + typedef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC base_type; + + typedef typename base_type::pointer pointer; + + typedef typename base_type::const_pointer const_pointer; + + typedef + typename base_type::const_metadata_pointer + const_metadata_pointer; + + public: + + typedef trivial_iterator_tag iterator_category; + + typedef trivial_iterator_difference_type difference_type; + + typedef + typename Allocator::template rebind< + Value_Type>::other::pointer + value_type; + + typedef + typename Allocator::template rebind< + typename remove_const< + Value_Type>::type>::other::pointer + reference; + + typedef + typename Allocator::template rebind< + typename remove_const< + Value_Type>::type>::other::pointer + const_reference; + + public: + inline + ov_tree_node_it_(const_pointer p_nd = NULL, const_pointer p_begin_nd = NULL, const_pointer p_end_nd = NULL, const_metadata_pointer p_metadata = NULL) : base_type(p_nd, p_begin_nd, p_end_nd, p_metadata) + { } + + // Access. + inline reference + operator*() const + { return reference(base_type::m_p_value); } + + // Returns the node reference associated with the left node. + inline ov_tree_node_it_ + get_l_child() const + { + if (base_type::m_p_begin_value == base_type::m_p_value) + return (this_type(base_type::m_p_begin_value, base_type::m_p_begin_value, base_type::m_p_begin_value)); + + const_metadata_pointer p_begin_metadata = + base_type::m_p_metadata - (base_type::m_p_value - base_type::m_p_begin_value); + + return (this_type(base_type::mid_pointer(base_type::m_p_begin_value, base_type::m_p_value), + base_type::m_p_begin_value, + base_type::m_p_value, + base_type::mid_pointer(p_begin_metadata, base_type::m_p_metadata))); + } + + // Returns the node reference associated with the right node. + inline ov_tree_node_it_ + get_r_child() const + { + if (base_type::m_p_value == base_type::m_p_end_value) + return (this_type(base_type::m_p_end_value, base_type::m_p_end_value, base_type::m_p_end_value)); + + const_metadata_pointer p_end_metadata = + base_type::m_p_metadata + (base_type::m_p_end_value - base_type::m_p_value); + + return (this_type(base_type::mid_pointer(base_type::m_p_value + 1, base_type::m_p_end_value), + base_type::m_p_value + 1, + base_type::m_p_end_value,(base_type::m_p_metadata == NULL)? + NULL : base_type::mid_pointer(base_type::m_p_metadata + 1, p_end_metadata))); + } + + }; + +#undef PB_DS_OV_TREE_NODE_ITERATOR_C_DEC +#undef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC + +} // namespace detail +} // namespace __gnu_pbds + +#endif diff --git a/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cfc2e09da460a29ccb04156997466260d5b3d7f5 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/include/c++/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp @@ -0,0 +1,57 @@ +// -*- C++ -*- + +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, +// MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. + +// Permission to use, copy, modify, sell, and distribute this software +// is hereby granted without fee, provided that the above copyright +// notice appears in all copies, and that both that copyright notice +// and this permission notice appear in supporting documentation. None +// of the above authors, nor IBM Haifa Research Laboratories, make any +// representation about the suitability of this software for any +// purpose. It is provided "as is" without express or implied +// warranty. + +/** + * @file policy_access_fn_imps.hpp + * Contains an implementation class for bin_search_tree_. + */ + +PB_DS_CLASS_T_DEC +Cmp_Fn& +PB_DS_CLASS_C_DEC:: +get_cmp_fn() +{ return *this; } + +PB_DS_CLASS_T_DEC +const Cmp_Fn& +PB_DS_CLASS_C_DEC:: +get_cmp_fn() const +{ return *this; } diff --git a/mingw/lib/gcc/mingw32/4.3.3/libstdc++.a b/mingw/lib/gcc/mingw32/4.3.3/libstdc++.a new file mode 100644 index 0000000000000000000000000000000000000000..a7ad386c50f06f7378c546c7753628881c34b710 --- /dev/null +++ b/mingw/lib/gcc/mingw32/4.3.3/libstdc++.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84faac3bd5afc90222c6916f6066472c31871a28b346578bc5a184fd2e1b2f6e +size 1909962