aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_')
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp162
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp154
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp152
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp141
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp150
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp64
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp175
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp88
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp349
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp123
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp55
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp52
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp95
13 files changed, 1760 insertions, 0 deletions
diff --git a/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
new file mode 100644
index 000000000..5955df161
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
@@ -0,0 +1,162 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file 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 <ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_C_DEC \
+ left_child_next_sibling_heap_const_iterator_<Node, Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ left_child_next_sibling_heap_node_const_point_iterator_<Node, Allocator>
+
+ // Const point-type iterator.
+ template<typename Node, class Allocator>
+ class left_child_next_sibling_heap_const_iterator_ : public PB_DS_BASE_C_DEC
+ {
+
+ 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/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
new file mode 100644
index 000000000..7d682526b
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
@@ -0,0 +1,154 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file 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 <ext/pb_ds/tag_and_trait.hpp>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Node, class Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ left_child_next_sibling_heap_node_const_point_iterator_<Node, Allocator>
+
+ // Const point-type iterator.
+ template<typename Node, class Allocator>
+ class left_child_next_sibling_heap_node_const_point_iterator_
+ {
+
+ protected:
+ typedef typename Allocator::template rebind<Node>::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/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 000000000..ea0572527
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,152 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file 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/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
new file mode 100644
index 000000000..86871ac38
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
@@ -0,0 +1,141 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file 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/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
new file mode 100644
index 000000000..9fa09f49b
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
@@ -0,0 +1,150 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file 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 Pred>
+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/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
new file mode 100644
index 000000000..75e6561c3
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file 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/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
new file mode 100644
index 000000000..926ccd39c
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
@@ -0,0 +1,175 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file 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<void* >(
+ static_cast<const void* >(&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<void* >(
+ static_cast<const void* >(&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/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
new file mode 100644
index 000000000..dca70fdd5
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file 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/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
new file mode 100644
index 000000000..34ad4bee0
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
@@ -0,0 +1,349 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file 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 <iterator>
+#include <ext/pb_ds/detail/cond_dealtor.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp>
+#ifdef PB_DS_LC_NS_HEAP_TRACE_
+#include <iostream>
+#endif
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#ifdef _GLIBCXX_DEBUG
+#define PB_DS_CLASS_T_DEC \
+ template< \
+ typename Value_Type, \
+ class Cmp_Fn, \
+ typename Node_Metadata, \
+ class Allocator, \
+ bool Single_Link_Roots>
+#else
+#define PB_DS_CLASS_T_DEC \
+ template< \
+ typename Value_Type, \
+ class Cmp_Fn, \
+ typename Node_Metadata, \
+ class Allocator>
+#endif
+
+#ifdef _GLIBCXX_DEBUG
+#define PB_DS_CLASS_C_DEC \
+ left_child_next_sibling_heap_< \
+ Value_Type, \
+ Cmp_Fn, \
+ Node_Metadata, \
+ Allocator, \
+ Single_Link_Roots>
+#else
+#define PB_DS_CLASS_C_DEC \
+ left_child_next_sibling_heap_< \
+ Value_Type, \
+ Cmp_Fn, \
+ Node_Metadata, \
+ Allocator>
+#endif
+
+ /**
+ * class description = "Base class for some types of h3ap$">
+ **/
+#ifdef _GLIBCXX_DEBUG
+ template<typename Value_Type,
+ class Cmp_Fn,
+ typename Node_Metadata,
+ class Allocator,
+ bool Single_Link_Roots>
+#else
+ template<typename Value_Type,
+ class Cmp_Fn,
+ typename Node_Metadata,
+ class Allocator>
+#endif
+ class left_child_next_sibling_heap_ : public Cmp_Fn
+ {
+
+ 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_Type>::value
+ };
+
+ typedef integral_constant<int, simple_value> 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_type;
+
+ public:
+
+ left_child_next_sibling_heap_();
+
+ left_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn);
+
+ left_child_next_sibling_heap_(const PB_DS_CLASS_C_DEC& other);
+
+ 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<typename Pred>
+ 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<typename Metadata_>
+ static void
+ trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>);
+
+ static void
+ trace_node_metadata(const_node_pointer, type_to_type<null_left_child_next_sibling_heap_node_metadata>);
+#endif
+
+ private:
+ static node_allocator s_node_allocator;
+
+ static no_throw_copies_t s_no_throw_copies_ind;
+ };
+
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp>
+
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_CLASS_T_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
new file mode 100644
index 000000000..1cdfe2883
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
@@ -0,0 +1,123 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file node.hpp
+ * Contains an implementation struct for this type of heap's node.
+ */
+
+#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP
+#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP
+
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+ template<typename Value_Type, typename Metadata_Type, class Allocator>
+ 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<typename Value_Type, class Allocator>
+ 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/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
new file mode 100644
index 000000000..040466e8e
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file 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/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
new file mode 100644
index 000000000..350b4d08a
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file 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/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
new file mode 100644
index 000000000..2b90cfa1d
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
@@ -0,0 +1,95 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file 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<node_metadata>());
+
+ std::cerr << p_nd->m_value << std::endl;
+
+ trace_node(p_nd->m_p_l_child, level + 1);
+
+ p_nd = p_nd->m_p_next_sibling;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Metadata_>
+void
+PB_DS_CLASS_C_DEC::
+trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>)
+{
+ 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<null_left_child_next_sibling_heap_node_metadata>)
+{ }
+
+#endif // #ifdef PB_DS_LC_NS_HEAP_TRACE_