ASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_find_search_start() { trigger_policy_base::notify_find_search_start(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_find_search_collision() { trigger_policy_base::notify_find_search_collision(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_find_search_end() { trigger_policy_base::notify_find_search_end(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_insert_search_start() { trigger_policy_base::notify_insert_search_start(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_insert_search_collision() { trigger_policy_base::notify_insert_search_collision(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_insert_search_end() { trigger_policy_base::notify_insert_search_end(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erase_search_start() { trigger_policy_base::notify_erase_search_start(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erase_search_collision() { trigger_policy_base::notify_erase_search_collision(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erase_search_end() { trigger_policy_base::notify_erase_search_end(); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_inserted(size_type num_e) { trigger_policy_base::notify_inserted(num_e); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: notify_erased(size_type num_e) { trigger_policy_base::notify_erased(num_e); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_cleared() { trigger_policy_base::notify_cleared(); } PB_DS_CLASS_T_DEC inline bool PB_DS_CLASS_C_DEC:: is_resize_needed() const { return trigger_policy_base::is_resize_needed(); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: get_new_size(size_type size, size_type num_used_e) const { if (trigger_policy_base::is_grow_needed(size, num_used_e)) return size_policy_base::get_nearest_larger_size(size); return size_policy_base::get_nearest_smaller_size(size); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: notify_resized(size_type new_size) { trigger_policy_base::notify_resized(new_size); m_size = new_size; } PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: get_actual_size() const { PB_DS_STATIC_ASSERT(access, external_size_access); return m_size; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: resize(size_type new_size) { PB_DS_STATIC_ASSERT(access, external_size_access); size_type actual_size = size_policy_base::get_nearest_larger_size(1); while (actual_size < new_size) { const size_type pot = size_policy_base::get_nearest_larger_size(actual_size); if (pot == actual_size && pot < new_size) __throw_resize_error(); actual_size = pot; } if (actual_size > 0) --actual_size; const size_type old_size = m_size; try { do_resize(actual_size - 1); } catch(insert_error& ) { m_size = old_size; __throw_resize_error(); } catch(...) { m_size = old_size; __throw_exception_again; } } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: do_resize(size_type) { // Do nothing } PB_DS_CLASS_T_DEC Trigger_Policy& PB_DS_CLASS_C_DEC:: get_trigger_policy() { return *this; } PB_DS_CLASS_T_DEC const Trigger_Policy& PB_DS_CLASS_C_DEC:: get_trigger_policy() const { return *this; } PB_DS_CLASS_T_DEC Size_Policy& PB_DS_CLASS_C_DEC:: get_size_policy() { return *this; } PB_DS_CLASS_T_DEC const Size_Policy& PB_DS_CLASS_C_DEC:: get_size_policy() const { return *this; } // -*- 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_resize_policy.hpp * Contains a sample resize policy for hash tables. */ #ifndef PB_DS_SAMPLE_RESIZE_POLICY_HPP #define PB_DS_SAMPLE_RESIZE_POLICY_HPP // A sample resize policy. class sample_resize_policy { public: // Size type. typedef size_t size_type; // Default constructor. sample_resize_policy(); // Copy constructor. sample_range_hashing(const sample_resize_policy& other); // Swaps content. inline void swap(sample_resize_policy& other); protected: // Notifies a search started. inline void notify_insert_search_start(); // Notifies a search encountered a collision. inline void notify_insert_search_collision(); // Notifies a search ended. inline void notify_insert_search_end(); // Notifies a search started. inline void notify_find_search_start(); // Notifies a search encountered a collision. inline void notify_find_search_collision(); // Notifies a search ended. inline void notify_find_search_end(); // Notifies a search started. inline void notify_erase_search_start(); // Notifies a search encountered a collision. inline void notify_erase_search_collision(); // Notifies a search ended. inline void notify_erase_search_end(); // Notifies an element was inserted. inline void notify_inserted(size_type num_e); // Notifies an element was erased. inline void notify_erased(size_type num_e); // Notifies the table was cleared. void notify_cleared(); // Notifies the table was resized to new_size. void notify_resized(size_type new_size); // Queries whether a resize is needed. inline bool is_resize_needed() const; // Queries what the new size should be. size_type get_new_size(size_type size, size_type num_used_e) const; }; #endif // -*- 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_size_policy.hpp * Contains a sample size resize-policy. */ #ifndef PB_DS_SAMPLE_SIZE_POLICY_HPP #define PB_DS_SAMPLE_SIZE_POLICY_HPP // A sample size policy. class sample_size_policy { public: // Size type. typedef size_t size_type; // Default constructor. sample_size_policy(); // Copy constructor. sample_range_hashing(const sample_size_policy& other); // Swaps content. inline void swap(sample_size_policy& other); protected: // Given a __size size, returns a __size that is larger. inline size_type get_nearest_larger_size(size_type size) const; // Given a __size size, returns a __size that is smaller. inline size_type get_nearest_smaller_size(size_type size) const; }; #endif // -*- 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_resize_trigger.hpp * Contains a sample resize trigger policy class. */ #ifndef PB_DS_SAMPLE_RESIZE_TRIGGER_HPP #define PB_DS_SAMPLE_RESIZE_TRIGGER_HPP // A sample resize trigger policy. class sample_resize_trigger { public: // Size type. typedef size_t size_type; // Default constructor. sample_resize_trigger(); // Copy constructor. sample_range_hashing(const sample_resize_trigger& other); // Swaps content. inline void swap(sample_resize_trigger& other); protected: // Notifies a search started. inline void notify_insert_search_start(); // Notifies a search encountered a collision. inline void notify_insert_search_collision(); // Notifies a search ended. inline void notify_insert_search_end(); // Notifies a search started. inline void notify_find_search_start(); // Notifies a search encountered a collision. inline void notify_find_search_collision(); // Notifies a search ended. inline void notify_find_search_end(); // Notifies a search started. inline void notify_erase_search_start(); // Notifies a search encountered a collision. inline void notify_erase_search_collision(); // Notifies a search ended. inline void notify_erase_search_end(); // Notifies an element was inserted. the total number of entries in // the table is num_entries. inline void notify_inserted(size_type num_entries); // Notifies an element was erased. inline void notify_erased(size_type num_entries); // Notifies the table was cleared. void notify_cleared(); // Notifies the table was resized as a result of this object's // signifying that a resize is needed. void notify_resized(size_type new_size); // Notifies the table was resized externally. void notify_externally_resized(size_type new_size); // Queries whether a resize is needed. inline bool is_resize_needed() const; // Queries whether a grow is needed. inline bool is_grow_needed(size_type size, size_type num_entries) const; private: // Resizes to new_size. virtual void do_resize(size_type new_size); }; } // namespace __gnu_pbds #endif // -*- 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // 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_prime_size_policy_imp.hpp * Contains a resize size policy implementation. */ #pragma GCC system_header namespace detail { enum { num_distinct_sizes_32_bit = 30, num_distinct_sizes_64_bit = 62, num_distinct_sizes = sizeof(std::size_t) != 8 ? num_distinct_sizes_32_bit : num_distinct_sizes_64_bit, }; // Originally taken from the SGI implementation; acknowledged in the docs. // Further modified (for 64 bits) from tr1's hashtable. static const std::size_t g_a_sizes[num_distinct_sizes_64_bit] = { /* 0 */ 5ul, /* 1 */ 11ul, /* 2 */ 23ul, /* 3 */ 47ul, /* 4 */ 97ul, /* 5 */ 199ul, /* 6 */ 409ul, /* 7 */ 823ul, /* 8 */ 1741ul, /* 9 */ 3469ul, /* 10 */ 6949ul, /* 11 */ 14033ul, /* 12 */ 28411ul, /* 13 */ 57557ul, /* 14 */ 116731ul, /* 15 */ 236897ul, /* 16 */ 480881ul, /* 17 */ 976369ul, /* 18 */ 1982627ul, /* 19 */ 4026031ul, /* 20 */ 8175383ul, /* 21 */ 16601593ul, /* 22 */ 33712729ul, /* 23 */ 68460391ul, /* 24 */ 139022417ul, /* 25 */ 282312799ul, /* 26 */ 573292817ul, /* 27 */ 1164186217ul, /* 28 */ 2364114217ul, /* 29 */ 4294967291ul, /* 30 */ (std::size_t)8589934583ull, /* 31 */ (std::size_t)17179869143ull, /* 32 */ (std::size_t)34359738337ull, /* 33 */ (std::size_t)68719476731ull, /* 34 */ (std::size_t)137438953447ull, /* 35 */ (std::size_t)274877906899ull, /* 36 */ (std::size_t)549755813881ull, /* 37 */ (std::size_t)1099511627689ull, /* 38 */ (std::size_t)2199023255531ull, /* 39 */ (std::size_t)4398046511093ull, /* 40 */ (std::size_t)8796093022151ull, /* 41 */ (std::size_t)17592186044399ull, /* 42 */ (std::size_t)35184372088777ull, /* 43 */ (std::size_t)70368744177643ull, /* 44 */ (std::size_t)140737488355213ull, /* 45 */ (std::size_t)281474976710597ull, /* 46 */ (std::size_t)562949953421231ull, /* 47 */ (std::size_t)1125899906842597ull, /* 48 */ (std::size_t)2251799813685119ull, /* 49 */ (std::size_t)4503599627370449ull, /* 50 */ (std::size_t)9007199254740881ull, /* 51 */ (std::size_t)18014398509481951ull, /* 52 */ (std::size_t)36028797018963913ull, /* 53 */ (std::size_t)72057594037927931ull, /* 54 */ (std::size_t)144115188075855859ull, /* 55 */ (std::size_t)288230376151711717ull, /* 56 */ (std::size_t)576460752303423433ull, /* 57 */ (std::size_t)1152921504606846883ull, /* 58 */ (std::size_t)2305843009213693951ull, /* 59 */ (std::size_t)4611686018427387847ull, /* 60 */ (std::size_t)9223372036854775783ull, /* 61 */ (std::size_t)18446744073709551557ull, }; } // namespace detail PB_DS_CLASS_T_DEC inline PB_DS_CLASS_C_DEC:: hash_prime_size_policy(size_type n) : m_start_size(n) { m_start_size = get_nearest_larger_size(n); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { std::swap(m_start_size, other.m_start_size); } PB_DS_CLASS_T_DEC inline PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: get_nearest_larger_size(size_type n) const { const std::size_t* const p_upper = std::upper_bound(detail::g_a_sizes, detail::g_a_sizes + detail::num_distinct_sizes, n); if (p_upper == detail::g_a_sizes + detail::num_distinct_sizes) __throw_resize_error(); return *p_upper; } PB_DS_CLASS_T_DEC inline PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: get_nearest_smaller_size(size_type n) const { const size_t* p_lower = std::lower_bound(detail::g_a_sizes, detail::g_a_sizes + detail::num_distinct_sizes, n); if (*p_lower >= n && p_lower != detail::g_a_sizes) --p_lower; if (*p_lower < m_start_size) return m_start_size; return *p_lower; } // -*- 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_exponential_size_policy_imp.hpp * Contains a resize size policy implementation. */ PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: hash_exponential_size_policy(size_type start_size, size_type grow_factor) : m_start_size(start_size), m_grow_factor(grow_factor) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: swap(PB_DS_CLASS_C_DEC& other) { std::swap(m_start_size, other.m_start_size); std::swap(m_grow_factor, other.m_grow_factor); } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: get_nearest_larger_size(size_type size) const { size_type ret = m_start_size; while (ret <= size) { const size_type next_ret = ret* m_grow_factor; if (next_ret < ret) __throw_insert_error(); ret = next_ret; } return ret; } PB_DS_CLASS_T_DEC typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC:: get_nearest_smaller_size(size_type size) const { size_type ret = m_start_size; while (true) { const size_type next_ret = ret* m_grow_factor; if (next_ret < ret) __throw_resize_error(); if (next_ret >= size) return (ret); ret = next_ret; } return ret; }  .X .. $counter_lu_policy_imp.hpp counter_lu_metadata.hpp mtf_lu_policy_imp.hpp„sample_update_policy.hpp// -*- 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)); } // -*- 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 // -*- 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; } // -*- 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 // -*- 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 tree_trace_base.hpp * Contains tree-related policies. */ #ifndef PB_DS_TREE_TRACE_BASE_HPP #define PB_DS_TREE_TRACE_BASE_HPP #ifdef PB_DS_TREE_TRACE #include #include namespace __gnu_pbds { namespace detail { #ifdef PB_DS_TREE_TRACE #define PB_DS_CLASS_T_DEC \ template< \ class Const_Node_Iterator, \ class Node_Iterator, \ class Cmp_Fn, \ bool Node_Based, \ class Allocator> #define PB_DS_CLASS_C_DEC \ tree_trace_base< \ Const_Node_Iterator, \ Node_Iterator, \ Cmp_Fn, \ Node_Based, \ Allocator> #define PB_DS_BASE_C_DEC \ basic_tree_policy_base< \ Const_Node_Iterator, \ Node_Iterator, \ Allocator> template class tree_trace_base : private PB_DS_BASE_C_DEC { public: void trace() const; private: typedef PB_DS_BASE_C_DEC base_type; typedef Const_Node_Iterator const_node_iterator; typedef typename Allocator::size_type size_type; private: void trace_node(const_node_iterator nd_it, size_type level) const; virtual bool empty() const = 0; virtual const_node_iterator node_begin() const = 0; virtual const_node_iterator node_end() const = 0; static void print_node_pointer(Const_Node_Iterator nd_it, integral_constant); static void print_node_pointer(Const_Node_Iterator nd_it, integral_constant); template static void trace_it_metadata(Const_Node_Iterator nd_it, type_to_type); static void trace_it_metadata(Const_Node_Iterator, type_to_type); }; PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace() const { if (empty()) return; trace_node(node_begin(), 0); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace_node(const_node_iterator nd_it, size_type level) const { if (nd_it.get_r_child() != node_end()) trace_node(nd_it.get_r_child(), level + 1); for (size_type i = 0; i < level; ++i) std::cerr << ' '; print_node_pointer(nd_it, integral_constant()); std::cerr << base_type::extract_key(*(*nd_it)); typedef type_to_type< typename const_node_iterator::metadata_type> m_type_ind_t; trace_it_metadata(nd_it, m_type_ind_t()); std::cerr << std::endl; if (nd_it.get_l_child() != node_end()) trace_node(nd_it.get_l_child(), level + 1); } PB_DS_CLASS_T_DEC template void PB_DS_CLASS_C_DEC:: trace_it_metadata(Const_Node_Iterator nd_it, type_to_type) { std::cerr << " (" << static_cast(nd_it.get_metadata()) << ") "; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace_it_metadata(Const_Node_Iterator, type_to_type) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: print_node_pointer(Const_Node_Iterator nd_it, integral_constant) { std::cerr << nd_it.m_p_nd << " "; } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: print_node_pointer(Const_Node_Iterator nd_it, integral_constant) { std::cerr <<* nd_it << " "; } #undef PB_DS_CLASS_T_DEC #undef PB_DS_CLASS_C_DEC #undef PB_DS_BASE_C_DEC #endif // #ifdef PB_DS_TREE_TRACE } // namespace detail } // namespace __gnu_pbds #endif // #ifdef PB_DS_TREE_TRACE #endif // #ifndef PB_DS_TREE_TRACE_BASE_HPP  .X .. split_join_fn_imps.hppinsert_fn_imps.hpptrace_fn_imps.hppfind_fn_imps.hpp,#constructors_destructor_fn_imps.hppdebug_fn_imps.hpperase_fn_imps.hppthin_heap_.hpp// -*- 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 split_join_fn_imps.hpp * Contains an implementation for thin_heap_. */ PB_DS_CLASS_T_DEC template void PB_DS_CLASS_C_DEC:: split(Pred pred, PB_DS_CLASS_C_DEC& other) { _GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(other.assert_valid();) other.clear(); if (base_type::empty()) { _GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(other.assert_valid();) return; } base_type::to_linked_list(); node_pointer p_out = base_type::prune(pred); while (p_out != NULL) { _GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0); --base_type::m_size; ++other.m_size; node_pointer p_next = p_out->m_p_next_sibling; other.make_root_and_link(p_out); p_out = p_next; } _GLIBCXX_DEBUG_ONLY(other.assert_valid();) node_pointer p_cur = base_type::m_p_root; m_p_max = NULL; base_type::m_p_root = NULL; while (p_cur != NULL) { node_pointer p_next = p_cur->m_p_next_sibling; make_root_and_link(p_cur); p_cur = p_next; } _GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(other.assert_valid();) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: join(PB_DS_CLASS_C_DEC& other) { _GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(other.assert_valid();) node_pointer p_other = other.m_p_root; while (p_other != NULL) { node_pointer p_next = p_other->m_p_next_sibling; make_root_and_link(p_other); p_other = p_next; } base_type::m_size += other.m_size; other.m_p_root = NULL; other.m_size = 0; other.m_p_max = NULL; _GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(other.assert_valid();) } // -*- 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 for thin_heap_. */ PB_DS_CLASS_T_DEC inline typename PB_DS_CLASS_C_DEC::point_iterator PB_DS_CLASS_C_DEC:: push(const_reference r_val) { _GLIBCXX_DEBUG_ONLY(assert_valid();) node_pointer p_nd = base_type::get_new_node_for_insert(r_val); p_nd->m_metadata = 0; p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = NULL; if (base_type::m_p_root == NULL) { p_nd->m_p_next_sibling = NULL; m_p_max = base_type::m_p_root = p_nd; _GLIBCXX_DEBUG_ONLY(assert_valid();) return point_iterator(p_nd); } p_nd->m_p_next_sibling = base_type::m_p_root; base_type::m_p_root->m_p_prev_or_parent = NULL; base_type::m_p_root = p_nd; update_max(p_nd); _GLIBCXX_DEBUG_ONLY(assert_valid();) return point_iterator(p_nd); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: make_root(node_pointer p_nd) { p_nd->m_metadata = p_nd->m_p_l_child == NULL? 0 : 1 + p_nd->m_p_l_child->m_metadata; } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: make_root_and_link(node_pointer p_nd) { make_root(p_nd); p_nd->m_p_prev_or_parent = NULL; p_nd->m_p_next_sibling = base_type::m_p_root; if (base_type::m_p_root != NULL) base_type::m_p_root->m_p_prev_or_parent = NULL; base_type::m_p_root = p_nd; update_max(p_nd); } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: fix(node_pointer p_y) { while (true) { if (p_y->m_p_prev_or_parent == NULL) { fix_root(p_y); return; } else if (p_y->m_metadata == 1&& p_y->m_p_next_sibling == NULL) { if (p_y->m_p_l_child != NULL) { fix_sibling_rank_1_unmarked(p_y); return; } fix_sibling_rank_1_marked(p_y); p_y = p_y->m_p_prev_or_parent; } else if (p_y->m_metadata > p_y->m_p_next_sibling->m_metadata + 1) { _GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child != NULL); if (p_y->m_metadata != p_y->m_p_l_child->m_metadata + 2) { fix_sibling_general_unmarked(p_y); return; } fix_sibling_general_marked(p_y); p_y = p_y->m_p_prev_or_parent; } else if ((p_y->m_p_l_child == NULL&& p_y->m_metadata == 2) ||(p_y->m_p_l_child != NULL&& p_y->m_metadata == p_y->m_p_l_child->m_metadata + 3)) { node_pointer p_z = p_y->m_p_prev_or_parent; fix_child(p_y); p_y = p_z; } else return; } } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: fix_root(node_pointer p_y) { _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent == NULL); make_root(p_y); _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, true);) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: fix_sibling_rank_1_unmarked(node_pointer p_y) { _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL); _GLIBCXX_DEBUG_ONLY(node_pointer p_w = p_y->m_p_l_child;) _GLIBCXX_DEBUG_ASSERT(p_w != NULL); _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling == NULL); _GLIBCXX_DEBUG_ASSERT(p_y->m_p_next_sibling == NULL); p_y->m_p_next_sibling = p_y->m_p_l_child; p_y->m_p_next_sibling->m_p_prev_or_parent = p_y; p_y->m_p_l_child = NULL; _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, false);) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: fix_sibling_rank_1_marked(node_pointer p_y) { _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL); _GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child == NULL); p_y->m_metadata = 0; _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, false);) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: fix_sibling_general_unmarked(node_pointer p_y) { _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL); node_pointer p_w = p_y->m_p_l_child; _GLIBCXX_DEBUG_ASSERT(p_w != NULL); _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != NULL); p_y->m_p_l_child = p_w->m_p_next_sibling; p_w->m_p_next_sibling->m_p_prev_or_parent = p_y; p_w->m_p_next_sibling = p_y->m_p_next_sibling; _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != NULL); p_w->m_p_next_sibling->m_p_prev_or_parent = p_w; p_y->m_p_next_sibling = p_w; p_w->m_p_prev_or_parent = p_y; _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, false);) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: fix_sibling_general_marked(node_pointer p_y) { _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL); --p_y->m_metadata; _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, false);) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: fix_child(node_pointer p_y) { _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL); if (p_y->m_p_next_sibling != NULL) p_y->m_p_next_sibling->m_p_prev_or_parent = p_y->m_p_prev_or_parent; if (p_y->m_p_prev_or_parent->m_p_l_child == p_y) p_y->m_p_prev_or_parent->m_p_l_child = p_y->m_p_next_sibling; else p_y->m_p_prev_or_parent->m_p_next_sibling = p_y->m_p_next_sibling; make_root_and_link(p_y); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: modify(point_iterator it, const_reference r_new_val) { _GLIBCXX_DEBUG_ONLY(assert_valid();) node_pointer p_nd = it.m_p_nd; _GLIBCXX_DEBUG_ASSERT(p_nd != NULL); const bool smaller = Cmp_Fn::operator()(r_new_val, p_nd->m_value); p_nd->m_value = r_new_val; if (smaller) { remove_node(p_nd); p_nd->m_p_l_child = NULL; make_root_and_link(p_nd); _GLIBCXX_DEBUG_ONLY(assert_valid();) return; } if (p_nd->m_p_prev_or_parent == NULL) { update_max(p_nd); _GLIBCXX_DEBUG_ONLY(assert_valid();) return; } node_pointer p_y = p_nd->m_p_prev_or_parent; _GLIBCXX_DEBUG_ASSERT(p_y != NULL); if (p_nd->m_p_next_sibling != NULL) p_nd->m_p_next_sibling->m_p_prev_or_parent = p_y; if (p_y->m_p_l_child == p_nd) p_y->m_p_l_child = p_nd->m_p_next_sibling; else p_y->m_p_next_sibling = p_nd->m_p_next_sibling; fix(p_y); make_root_and_link(p_nd); _GLIBCXX_DEBUG_ONLY(assert_valid();) } PB_DS_CLASS_T_DEC inline void PB_DS_CLASS_C_DEC:: update_max(node_pointer p_nd) { if (m_p_max == NULL || Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value)) m_p_max = p_nd; } // -*- 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_THIN_HEAP_TRACE_ PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: trace() const { std::cerr << std::endl; std::cerr << "m_p_max " << m_p_max << std::endl; base_type::trace(); } #endif // #ifdef PB_DS_THIN_HEAP_TRACE_ // -*- 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