aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_')
-rw-r--r--libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/constructors_destructor_fn_imps.hpp112
-rw-r--r--libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/debug_fn_imps.hpp73
-rw-r--r--libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/erase_fn_imps.hpp245
-rw-r--r--libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/find_fn_imps.hpp122
-rw-r--r--libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/info_fn_imps.hpp43
-rw-r--r--libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/insert_fn_imps.hpp89
-rw-r--r--libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/node.hpp89
-rw-r--r--libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/splay_fn_imps.hpp289
-rw-r--r--libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/splay_tree_.hpp342
-rw-r--r--libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/split_join_fn_imps.hpp125
10 files changed, 1529 insertions, 0 deletions
diff --git a/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/constructors_destructor_fn_imps.hpp b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 00000000000..77cbdd9d241
--- /dev/null
+++ b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,112 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice and
+// this permission notice appear in supporting documentation. None of
+// the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied warranty.
+
+/**
+ * @file constructors_destructor_fn_imps.hpp
+ * Contains an implementation class for splay_tree_.
+ */
+
+PB_ASSOC_CLASS_T_DEC
+template<class It>
+void
+PB_ASSOC_CLASS_C_DEC::
+copy_from_range(It first_it, It last_it)
+{
+ while (first_it != last_it)
+ insert(*(first_it++));
+}
+
+PB_ASSOC_CLASS_T_DEC
+PB_ASSOC_CLASS_C_DEC::
+PB_ASSOC_CLASS_NAME()
+{
+ initialize();
+
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid();)
+ }
+
+PB_ASSOC_CLASS_T_DEC
+PB_ASSOC_CLASS_C_DEC::
+PB_ASSOC_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
+ PB_ASSOC_BASE_C_DEC(r_cmp_fn)
+{
+ initialize();
+
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid();)
+ }
+
+PB_ASSOC_CLASS_T_DEC
+PB_ASSOC_CLASS_C_DEC::
+PB_ASSOC_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const Node_Updator& r_node_updator) :
+ PB_ASSOC_BASE_C_DEC(r_cmp_fn, r_node_updator)
+{
+ initialize();
+
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid();)
+ }
+
+PB_ASSOC_CLASS_T_DEC
+PB_ASSOC_CLASS_C_DEC::
+PB_ASSOC_CLASS_NAME(const PB_ASSOC_CLASS_C_DEC& r_other) :
+ PB_ASSOC_BASE_C_DEC(r_other)
+{
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid();)
+ }
+
+PB_ASSOC_CLASS_T_DEC
+void
+PB_ASSOC_CLASS_C_DEC::
+swap(PB_ASSOC_CLASS_C_DEC& r_other)
+{
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid();)
+ PB_ASSOC_DBG_ONLY(r_other.PB_ASSOC_CLASS_C_DEC::assert_valid();)
+
+ PB_ASSOC_BASE_C_DEC::swap(r_other);
+
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid();)
+ PB_ASSOC_DBG_ONLY(r_other.PB_ASSOC_CLASS_C_DEC::assert_valid();)
+ }
+
+PB_ASSOC_CLASS_T_DEC
+void
+PB_ASSOC_CLASS_C_DEC::
+initialize()
+{
+ PB_ASSOC_BASE_C_DEC::m_p_head->m_special = true;
+}
diff --git a/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/debug_fn_imps.hpp b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/debug_fn_imps.hpp
new file mode 100644
index 00000000000..51c8fa5eb8d
--- /dev/null
+++ b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/debug_fn_imps.hpp
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice and
+// this permission notice appear in supporting documentation. None of
+// the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains an implementation class for splay_tree_.
+ */
+
+#ifdef PB_ASSOC_SPLAY_TREE_DEBUG_
+
+PB_ASSOC_CLASS_T_DEC
+void
+PB_ASSOC_CLASS_C_DEC::
+assert_valid() const
+{
+ PB_ASSOC_BASE_C_DEC::assert_valid(true, true);
+
+ assert_special_imp(m_p_head->m_p_parent);
+}
+
+PB_ASSOC_CLASS_T_DEC
+void
+PB_ASSOC_CLASS_C_DEC::
+assert_special_imp(const node_pointer p_nd) const
+{
+ if (p_nd == NULL)
+ return;
+
+ PB_ASSOC_DBG_ASSERT(!p_nd->m_special);
+
+ assert_special_imp(p_nd->m_p_left);
+
+ assert_special_imp(p_nd->m_p_right);
+}
+
+#endif // #ifdef PB_ASSOC_SPLAY_TREE_DEBUG_
+
diff --git a/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/erase_fn_imps.hpp b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/erase_fn_imps.hpp
new file mode 100644
index 00000000000..1a0c00c77df
--- /dev/null
+++ b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/erase_fn_imps.hpp
@@ -0,0 +1,245 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice and
+// this permission notice appear in supporting documentation. None of
+// the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied warranty.
+
+/**
+ * @file erase_fn_imps.hpp
+ * Contains an implementation class for splay_tree_.
+ */
+
+PB_ASSOC_CLASS_T_DEC
+inline typename PB_ASSOC_CLASS_C_DEC::size_type
+PB_ASSOC_CLASS_C_DEC::
+erase(const_key_reference r_key)
+{
+ iterator it = find(r_key);
+
+ if (it == PB_ASSOC_BASE_C_DEC::find_end())
+ return (0);
+
+ erase(it);
+
+ return (1);
+}
+
+PB_ASSOC_CLASS_T_DEC
+inline typename PB_ASSOC_CLASS_C_DEC::const_iterator
+PB_ASSOC_CLASS_C_DEC::
+erase(const_iterator it)
+{
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid());
+
+ if (it == PB_ASSOC_BASE_C_DEC::find_end())
+ return (it);
+
+ const_iterator ret_it = it;
+
+ ++ret_it;
+
+ erase_node(it.m_p_nd);
+
+ return (ret_it);
+}
+
+#ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+PB_ASSOC_CLASS_T_DEC
+inline typename PB_ASSOC_CLASS_C_DEC::iterator
+PB_ASSOC_CLASS_C_DEC::
+erase(iterator it)
+{
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid());
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_BASE_C_DEC::assert_iterators();)
+
+ if (it == PB_ASSOC_BASE_C_DEC::find_end())
+ return (it);
+
+ iterator ret_it = it;
+
+ ++ret_it;
+
+ erase_node(it.m_p_nd);
+
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid());
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_BASE_C_DEC::assert_iterators();)
+
+ return (ret_it);
+}
+#endif // #ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+
+PB_ASSOC_CLASS_T_DEC
+inline typename PB_ASSOC_CLASS_C_DEC::const_reverse_iterator
+PB_ASSOC_CLASS_C_DEC::
+erase(const_reverse_iterator it)
+{
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid());
+
+ if (it == PB_ASSOC_BASE_C_DEC::find_rend())
+ return (it);
+
+ const_reverse_iterator ret_it = it;
+
+ ++ret_it;
+
+ erase_node(it.m_p_nd);
+
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid());
+
+ return (ret_it);
+}
+
+#ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+PB_ASSOC_CLASS_T_DEC
+inline typename PB_ASSOC_CLASS_C_DEC::reverse_iterator
+PB_ASSOC_CLASS_C_DEC::
+erase(reverse_iterator it)
+{
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid());
+
+ if (it == PB_ASSOC_BASE_C_DEC::find_rend())
+ return (it);
+
+ reverse_iterator ret_it = it;
+
+ ++ret_it;
+
+ erase_node(it.m_p_nd);
+
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid());
+
+ return (ret_it);
+}
+#endif // #ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+
+PB_ASSOC_CLASS_T_DEC
+template<class Pred>
+inline typename PB_ASSOC_CLASS_C_DEC::size_type
+PB_ASSOC_CLASS_C_DEC::
+erase_if(Pred pred)
+{
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid();)
+
+ size_type num_ersd = 0;
+
+ iterator it = PB_ASSOC_BASE_C_DEC::begin();
+
+ while (it != PB_ASSOC_BASE_C_DEC::end())
+ if (pred(*it))
+ {
+ ++num_ersd;
+
+ it = erase(it);
+ }
+ else
+ ++it;
+
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid();)
+
+ return (num_ersd);
+}
+
+PB_ASSOC_CLASS_T_DEC
+void
+PB_ASSOC_CLASS_C_DEC::
+erase_node(node_pointer p_nd)
+{
+ PB_ASSOC_DBG_ASSERT(p_nd != NULL);
+
+ splay(p_nd);
+
+ PB_ASSOC_DBG_ONLY(assert_valid();)
+ PB_ASSOC_DBG_ASSERT(p_nd == PB_ASSOC_BASE_C_DEC::m_p_head->m_p_parent);
+
+ node_pointer p_l = p_nd->m_p_left;
+ node_pointer p_r = p_nd->m_p_right;
+
+ PB_ASSOC_BASE_C_DEC::update_min_max_for_erased_node(p_nd);
+
+ PB_ASSOC_BASE_C_DEC::actual_erase_node(p_nd);
+
+ if (p_r == NULL)
+ {
+ PB_ASSOC_BASE_C_DEC::m_p_head->m_p_parent = p_l;
+
+ if (p_l != NULL)
+ p_l->m_p_parent = PB_ASSOC_BASE_C_DEC::m_p_head;
+
+ PB_ASSOC_DBG_ONLY(assert_valid();)
+
+ return;
+ }
+
+ node_pointer p_target_r = leftmost(p_r);
+
+ PB_ASSOC_DBG_ASSERT(p_target_r != NULL);
+
+ p_r->m_p_parent = PB_ASSOC_BASE_C_DEC::m_p_head;
+
+ PB_ASSOC_BASE_C_DEC::m_p_head->m_p_parent = p_r;
+
+ splay(p_target_r);
+
+ PB_ASSOC_DBG_ONLY(p_target_r->m_p_left = NULL);
+
+ PB_ASSOC_DBG_ASSERT(p_target_r->m_p_parent ==
+ PB_ASSOC_BASE_C_DEC::m_p_head);
+
+ PB_ASSOC_DBG_ASSERT(PB_ASSOC_BASE_C_DEC::m_p_head->m_p_parent ==
+ p_target_r);
+
+ p_target_r->m_p_left = p_l;
+
+ if (p_l != NULL)
+ p_l->m_p_parent = p_target_r;
+
+ PB_ASSOC_DBG_ONLY(assert_valid();)
+
+ apply_update(p_target_r, (Node_Updator* )this);
+}
+
+PB_ASSOC_CLASS_T_DEC
+inline typename PB_ASSOC_CLASS_C_DEC::node_pointer
+PB_ASSOC_CLASS_C_DEC::
+leftmost(node_pointer p_nd)
+{
+ PB_ASSOC_DBG_ASSERT(p_nd != NULL);
+
+ while (p_nd->m_p_left != NULL)
+ p_nd = p_nd->m_p_left;
+
+ return (p_nd);
+}
diff --git a/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/find_fn_imps.hpp b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/find_fn_imps.hpp
new file mode 100644
index 00000000000..ff67f5983ef
--- /dev/null
+++ b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/find_fn_imps.hpp
@@ -0,0 +1,122 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice and
+// this permission notice appear in supporting documentation. None of
+// the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied warranty.
+
+/**
+ * @file find_fn_imps.hpp
+ * Contains an implementation class for splay_tree_.
+ */
+
+PB_ASSOC_CLASS_T_DEC
+inline typename PB_ASSOC_CLASS_C_DEC::find_iterator
+PB_ASSOC_CLASS_C_DEC::
+lower_bound(const_key_reference r_key)
+{
+ find_iterator it = PB_ASSOC_BASE_C_DEC::find(r_key);
+
+ if (it != PB_ASSOC_BASE_C_DEC::end())
+ splay(it.m_p_nd);
+
+ return (it);
+}
+
+PB_ASSOC_CLASS_T_DEC
+inline typename PB_ASSOC_CLASS_C_DEC::const_find_iterator
+PB_ASSOC_CLASS_C_DEC::
+lower_bound(const_key_reference r_key) const
+{
+ find_iterator it = PB_ASSOC_BASE_C_DEC::lower_bound(r_key);
+
+ if (it != PB_ASSOC_BASE_C_DEC::end())
+ splay(it.m_p_nd);
+
+ return (it);
+}
+
+PB_ASSOC_CLASS_T_DEC
+inline typename PB_ASSOC_CLASS_C_DEC::find_iterator
+PB_ASSOC_CLASS_C_DEC::
+upper_bound(const_key_reference r_key)
+{
+ find_iterator it = PB_ASSOC_BASE_C_DEC::upper_bound(r_key);
+
+ if (it != PB_ASSOC_BASE_C_DEC::end())
+ splay(it.m_p_nd);
+
+ return (it);
+}
+
+PB_ASSOC_CLASS_T_DEC
+inline typename PB_ASSOC_CLASS_C_DEC::const_find_iterator
+PB_ASSOC_CLASS_C_DEC::
+upper_bound(const_key_reference r_key) const
+{
+ find_iterator it = PB_ASSOC_BASE_C_DEC::upper_bound(r_key);
+
+ if (it != PB_ASSOC_BASE_C_DEC::end())
+ splay(it.m_p_nd);
+
+ return (it);
+}
+
+PB_ASSOC_CLASS_T_DEC
+inline typename PB_ASSOC_CLASS_C_DEC::find_iterator
+PB_ASSOC_CLASS_C_DEC::
+find(const_key_reference r_key)
+{
+ find_iterator it = PB_ASSOC_BASE_C_DEC::find(r_key);
+
+ if (it != PB_ASSOC_BASE_C_DEC::end())
+ splay(it.m_p_nd);
+
+ return (it);
+}
+
+PB_ASSOC_CLASS_T_DEC
+inline typename PB_ASSOC_CLASS_C_DEC::const_find_iterator
+PB_ASSOC_CLASS_C_DEC::
+find(const_key_reference r_key) const
+{
+ const_find_iterator it = PB_ASSOC_BASE_C_DEC::find(r_key);
+
+ if (it != PB_ASSOC_BASE_C_DEC::end())
+ const_cast<PB_ASSOC_CLASS_C_DEC* >(this)->splay(it.m_p_nd);
+
+ return (it);
+}
+
diff --git a/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/info_fn_imps.hpp b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/info_fn_imps.hpp
new file mode 100644
index 00000000000..186812153da
--- /dev/null
+++ b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/info_fn_imps.hpp
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice and
+// this permission notice appear in supporting documentation. None of
+// the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied warranty.
+
+/**
+ * @file info_fn_imps.hpp
+ * Contains an implementation.
+ */
diff --git a/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/insert_fn_imps.hpp b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/insert_fn_imps.hpp
new file mode 100644
index 00000000000..77882f3e6c9
--- /dev/null
+++ b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/insert_fn_imps.hpp
@@ -0,0 +1,89 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice and
+// this permission notice appear in supporting documentation. None of
+// the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied warranty.
+
+/**
+ * @file insert_fn_imps.hpp
+ * Contains an implementation class for splay_tree_.
+ */
+
+PB_ASSOC_CLASS_T_DEC
+inline std::pair<typename PB_ASSOC_CLASS_C_DEC::find_iterator, bool>
+PB_ASSOC_CLASS_C_DEC::
+insert(const_reference r_value)
+{
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid();)
+
+ std::pair<find_iterator, bool> ins_pair =
+ PB_ASSOC_BASE_C_DEC::insert_leaf(r_value);
+
+ ins_pair.first.m_p_nd->m_special = false;
+
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_BASE_C_DEC::assert_valid(true, true));
+
+ splay(ins_pair.first.m_p_nd);
+
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_BASE_C_DEC::assert_valid(true, true));
+
+ return (ins_pair);
+}
+
+#ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+PB_ASSOC_CLASS_T_DEC
+inline typename PB_ASSOC_CLASS_C_DEC::data_reference
+PB_ASSOC_CLASS_C_DEC::
+subscript_imp(const_key_reference r_key)
+{
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid();)
+
+ std::pair<find_iterator, bool> ins_pair =
+ PB_ASSOC_BASE_C_DEC::insert_leaf(
+ value_type(r_key, Data()));
+
+ ins_pair.first.m_p_nd->m_special = false;
+
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_BASE_C_DEC::assert_valid());
+
+ splay(ins_pair.first.m_p_nd);
+
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid();)
+
+ return (ins_pair.first.m_p_nd->m_value.second);
+}
+#endif // #ifdef PB_ASSOC_DATA_TRUE
+
diff --git a/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/node.hpp b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/node.hpp
new file mode 100644
index 00000000000..5012d587f5d
--- /dev/null
+++ b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/node.hpp
@@ -0,0 +1,89 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice and
+// this permission notice appear in supporting documentation. None of
+// the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied warranty.
+
+/**
+ * @file node.hpp
+ * Contains an implementation struct for splay_tree_'s node.
+ */
+
+#ifndef SPLAY_TREE_NODE_HPP
+#define SPLAY_TREE_NODE_HPP
+
+namespace pb_assoc
+{
+
+ namespace detail
+ {
+
+ template<class Value_Type, class Allocator>
+ struct splay_tree_node_
+ {
+ public:
+ typedef
+ typename Allocator::template rebind<
+ splay_tree_node_<
+ Value_Type,
+ Allocator> >::other::pointer
+ node_pointer;
+
+ public:
+ inline bool
+ special_dec_check() const
+ {
+ return (m_special);
+ }
+
+ public:
+ typedef Value_Type value_type;
+
+ value_type m_value;
+
+ bool m_special;
+
+ node_pointer m_p_left;
+ node_pointer m_p_right;
+
+ node_pointer m_p_parent;
+ };
+
+ } // namespace detail
+
+} // namespace pb_assoc
+
+#endif // #ifndef SPLAY_TREE_NODE_HPP
diff --git a/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/splay_fn_imps.hpp b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/splay_fn_imps.hpp
new file mode 100644
index 00000000000..ffccf7b6569
--- /dev/null
+++ b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/splay_fn_imps.hpp
@@ -0,0 +1,289 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005 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 splay_fn_imps.hpp
+ * Contains an implementation class for splay_tree_.
+ */
+
+PB_ASSOC_CLASS_T_DEC
+void
+PB_ASSOC_CLASS_C_DEC::
+splay(node_pointer p_nd)
+{
+ while (p_nd->m_p_parent != PB_ASSOC_BASE_C_DEC::m_p_head)
+ {
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_BASE_C_DEC::assert_node_consistent(p_nd);)
+
+ if (p_nd->m_p_parent->m_p_parent ==
+ PB_ASSOC_BASE_C_DEC::m_p_head)
+ {
+ PB_ASSOC_BASE_C_DEC::rotate_parent(p_nd);
+
+ PB_ASSOC_DBG_ASSERT(p_nd ==
+ PB_ASSOC_BASE_C_DEC::m_p_head->m_p_parent);
+ }
+ else
+ {
+ const node_pointer p_parent = p_nd->m_p_parent;
+ const node_pointer p_grandparent = p_parent->m_p_parent;
+
+#ifdef PB_ASSOC_SPLAY_TREE_DEBUG_
+ const size_type total =
+ PB_ASSOC_BASE_C_DEC::recursive_count(p_grandparent);
+
+ PB_ASSOC_DBG_ASSERT(total >= 3);
+#endif // #ifdef PB_ASSOC_SPLAY_TREE_DEBUG_
+
+ if (p_parent->m_p_left == p_nd&&
+ p_grandparent->m_p_right == p_parent)
+ splay_zig_zag_left(p_nd, p_parent, p_grandparent);
+ else if (p_parent->m_p_right == p_nd&&
+ p_grandparent->m_p_left == p_parent)
+ splay_zig_zag_right(p_nd, p_parent, p_grandparent);
+ else if (p_parent->m_p_left == p_nd&&
+ p_grandparent->m_p_left == p_parent)
+ splay_zig_zig_left(p_nd, p_parent, p_grandparent);
+ else
+ splay_zig_zig_right(p_nd, p_parent, p_grandparent);
+
+ PB_ASSOC_DBG_ASSERT(total ==
+ PB_ASSOC_BASE_C_DEC::recursive_count(p_nd));
+ }
+
+ PB_ASSOC_DBG_ONLY(assert_node_consistent(p_nd);)
+ }
+}
+
+PB_ASSOC_CLASS_T_DEC
+inline void
+PB_ASSOC_CLASS_C_DEC::
+splay_zig_zag_left(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent)
+{
+ PB_ASSOC_DBG_ASSERT(p_parent == p_nd->m_p_parent);
+ PB_ASSOC_DBG_ASSERT(p_grandparent == p_parent->m_p_parent);
+
+ PB_ASSOC_DBG_ONLY(assert_node_consistent(p_grandparent);)
+
+ PB_ASSOC_DBG_ASSERT(p_parent->m_p_left == p_nd&&
+ p_grandparent->m_p_right == p_parent);
+
+ splay_zz_start(p_nd, p_parent, p_grandparent);
+
+ node_pointer p_b = p_nd->m_p_right;
+ node_pointer p_c = p_nd->m_p_left;
+
+ p_nd->m_p_right = p_parent;
+ p_parent->m_p_parent = p_nd;
+
+ p_nd->m_p_left = p_grandparent;
+ p_grandparent->m_p_parent = p_nd;
+
+ p_parent->m_p_left = p_b;
+ if (p_b != NULL)
+ p_b->m_p_parent = p_parent;
+
+ p_grandparent->m_p_right = p_c;
+ if (p_c != NULL)
+ p_c->m_p_parent = p_grandparent;
+
+ splay_zz_end(p_nd, p_parent, p_grandparent);
+}
+
+PB_ASSOC_CLASS_T_DEC
+inline void
+PB_ASSOC_CLASS_C_DEC::
+splay_zig_zag_right(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent)
+{
+ PB_ASSOC_DBG_ASSERT(p_parent == p_nd->m_p_parent);
+ PB_ASSOC_DBG_ASSERT(p_grandparent == p_parent->m_p_parent);
+
+ PB_ASSOC_DBG_ONLY(assert_node_consistent(p_grandparent);)
+
+ PB_ASSOC_DBG_ASSERT(p_parent->m_p_right == p_nd&&
+ p_grandparent->m_p_left == p_parent);
+
+ splay_zz_start(p_nd, p_parent, p_grandparent);
+
+ node_pointer p_b = p_nd->m_p_left;
+ node_pointer p_c = p_nd->m_p_right;
+
+ p_nd->m_p_left = p_parent;
+ p_parent->m_p_parent = p_nd;
+
+ p_nd->m_p_right = p_grandparent;
+ p_grandparent->m_p_parent = p_nd;
+
+ p_parent->m_p_right = p_b;
+ if (p_b != NULL)
+ p_b->m_p_parent = p_parent;
+
+ p_grandparent->m_p_left = p_c;
+ if (p_c != NULL)
+ p_c->m_p_parent = p_grandparent;
+
+ splay_zz_end(p_nd, p_parent, p_grandparent);
+}
+
+PB_ASSOC_CLASS_T_DEC
+inline void
+PB_ASSOC_CLASS_C_DEC::
+splay_zig_zig_left(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent)
+{
+ PB_ASSOC_DBG_ASSERT(p_parent == p_nd->m_p_parent);
+ PB_ASSOC_DBG_ASSERT(p_grandparent == p_parent->m_p_parent);
+
+ PB_ASSOC_DBG_ONLY(assert_node_consistent(p_grandparent);)
+
+ PB_ASSOC_DBG_ASSERT(p_parent->m_p_left == p_nd&&
+ p_nd->m_p_parent->m_p_parent->m_p_left == p_nd->m_p_parent);
+
+ splay_zz_start(p_nd, p_parent, p_grandparent);
+
+ node_pointer p_b = p_nd->m_p_right;
+ node_pointer p_c = p_parent->m_p_right;
+
+ p_nd->m_p_right = p_parent;
+ p_parent->m_p_parent = p_nd;
+
+ p_parent->m_p_right = p_grandparent;
+ p_grandparent->m_p_parent = p_parent;
+
+ p_parent->m_p_left = p_b;
+ if (p_b != NULL)
+ p_b->m_p_parent = p_parent;
+
+ p_grandparent->m_p_left = p_c;
+ if (p_c != NULL)
+ p_c->m_p_parent = p_grandparent;
+
+ splay_zz_end(p_nd, p_parent, p_grandparent);
+}
+
+PB_ASSOC_CLASS_T_DEC
+inline void
+PB_ASSOC_CLASS_C_DEC::
+splay_zig_zig_right(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent)
+{
+ PB_ASSOC_DBG_ASSERT(p_parent == p_nd->m_p_parent);
+ PB_ASSOC_DBG_ASSERT(p_grandparent == p_parent->m_p_parent);
+
+ PB_ASSOC_DBG_ONLY(assert_node_consistent(p_grandparent);)
+
+ PB_ASSOC_DBG_ASSERT(p_parent->m_p_right == p_nd&&
+ p_nd->m_p_parent->m_p_parent->m_p_right == p_nd->m_p_parent);
+
+ splay_zz_start(p_nd, p_parent, p_grandparent);
+
+ node_pointer p_b = p_nd->m_p_left;
+ node_pointer p_c = p_parent->m_p_left;
+
+ p_nd->m_p_left = p_parent;
+ p_parent->m_p_parent = p_nd;
+
+ p_parent->m_p_left = p_grandparent;
+ p_grandparent->m_p_parent = p_parent;
+
+ p_parent->m_p_right = p_b;
+ if (p_b != NULL)
+ p_b->m_p_parent = p_parent;
+
+ p_grandparent->m_p_right = p_c;
+ if (p_c != NULL)
+ p_c->m_p_parent = p_grandparent;
+
+ PB_ASSOC_BASE_C_DEC::update_to_top(
+ p_grandparent, (Node_Updator* )this);
+
+ splay_zz_end(p_nd, p_parent, p_grandparent);
+}
+
+PB_ASSOC_CLASS_T_DEC
+inline void
+PB_ASSOC_CLASS_C_DEC::
+splay_zz_start(node_pointer p_nd,
+#ifdef PB_ASSOC_SPLAY_TREE_DEBUG_
+ node_pointer p_parent,
+#else // #ifdef PB_ASSOC_SPLAY_TREE_DEBUG_
+ node_pointer /*p_parent*/,
+#endif // #ifdef PB_ASSOC_SPLAY_TREE_DEBUG_
+ node_pointer p_grandparent)
+{
+ PB_ASSOC_DBG_ASSERT(p_nd != NULL);
+ PB_ASSOC_DBG_ASSERT(p_parent != NULL);
+ PB_ASSOC_DBG_ASSERT(p_grandparent != NULL);
+
+ const bool grandparent_head =
+ p_grandparent->m_p_parent == PB_ASSOC_BASE_C_DEC::m_p_head;
+
+ if (grandparent_head)
+ {
+ PB_ASSOC_BASE_C_DEC::m_p_head->m_p_parent =
+ PB_ASSOC_BASE_C_DEC::m_p_head->m_p_parent;
+
+ p_nd->m_p_parent = PB_ASSOC_BASE_C_DEC::m_p_head;
+
+ return;
+ }
+
+ node_pointer p_greatgrandparent = p_grandparent->m_p_parent;
+
+ p_nd->m_p_parent = p_greatgrandparent;
+
+ if (p_grandparent == p_greatgrandparent->m_p_left)
+ p_greatgrandparent->m_p_left = p_nd;
+ else
+ p_greatgrandparent->m_p_right = p_nd;
+}
+
+PB_ASSOC_CLASS_T_DEC
+inline void
+PB_ASSOC_CLASS_C_DEC::
+splay_zz_end(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent)
+{
+ if (p_nd->m_p_parent == PB_ASSOC_BASE_C_DEC::m_p_head)
+ PB_ASSOC_BASE_C_DEC::m_p_head->m_p_parent = p_nd;
+
+ apply_update(p_grandparent, (Node_Updator* )this);
+ apply_update(p_parent, (Node_Updator* )this);
+ apply_update(p_nd, (Node_Updator* )this);
+
+ PB_ASSOC_DBG_ONLY(assert_node_consistent(p_nd);)
+ }
+
diff --git a/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/splay_tree_.hpp b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/splay_tree_.hpp
new file mode 100644
index 00000000000..e6762c9d9c5
--- /dev/null
+++ b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/splay_tree_.hpp
@@ -0,0 +1,342 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005 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 splay_tree_.hpp
+ * Contains an implementation class for splay_tree_.
+ */
+
+#ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+#ifndef BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR
+#define BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR
+#include <ext/pb_assoc/detail/bin_search_tree_/bin_search_tree_.hpp>
+#endif // #ifndef BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR
+#endif // #ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+
+#ifdef PB_ASSOC_DATA_FALSE_INDICATOR
+#ifndef BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR
+#define BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR
+#include <ext/pb_assoc/detail/bin_search_tree_/bin_search_tree_.hpp>
+#endif // #ifndef BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR
+#endif // #ifdef PB_ASSOC_DATA_FALSE_INDICATOR
+
+#include <ext/pb_assoc/detail/splay_tree_/node.hpp>
+#include <utility>
+#include <vector>
+#include <assert.h>
+
+namespace pb_assoc
+{
+
+ namespace detail
+ {
+
+#ifdef PB_ASSOC_SPLAY_TREE_DEBUG_
+#define PB_ASSOC_DBG_ASSERT(X) assert(X)
+#define PB_ASSOC_DBG_VERIFY(X) assert(X)
+#define PB_ASSOC_DBG_ONLY(X) X
+#else // #ifdef PB_ASSOC_SPLAY_TREE_DEBUG_
+#define PB_ASSOC_DBG_ASSERT(X)
+#define PB_ASSOC_DBG_VERIFY(X) {if((X)==0);}
+#define PB_ASSOC_DBG_ONLY(X) ;
+#endif // #ifdef PB_ASSOC_SPLAY_TREE_DEBUG_
+
+#define PB_ASSOC_CLASS_T_DEC \
+ template< \
+ typename Key, \
+ typename Data, \
+ class Cmp_Fn, \
+ class Allocator, \
+ class Node_Updator>
+
+#ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+#define PB_ASSOC_CLASS_NAME \
+ splay_tree_data_
+#endif // #ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+
+#ifdef PB_ASSOC_DATA_FALSE_INDICATOR
+#define PB_ASSOC_CLASS_NAME \
+ splay_tree_no_data_
+#endif // #ifdef PB_ASSOC_DATA_FALSE_INDICATOR
+
+#ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+#define PB_ASSOC_BASE_CLASS_NAME \
+ bin_search_tree_data_
+#endif // #ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+
+#ifdef PB_ASSOC_DATA_FALSE_INDICATOR
+#define PB_ASSOC_BASE_CLASS_NAME \
+ bin_search_tree_no_data_
+#endif // #ifdef PB_ASSOC_DATA_FALSE_INDICATOR
+
+#define PB_ASSOC_CLASS_C_DEC \
+ PB_ASSOC_CLASS_NAME< \
+ Key, \
+ Data, \
+ Cmp_Fn, \
+ Allocator, \
+ Node_Updator>
+
+#define PB_ASSOC_TYPES_TRAITS_C_DEC \
+ types_traits< \
+ Key, \
+ Data, \
+ Allocator>
+
+#define PB_ASSOC_NODE_C_DEC \
+ splay_tree_node_< \
+ typename PB_ASSOC_TYPES_TRAITS_C_DEC::value_type, \
+ Allocator>
+
+#define PB_ASSOC_BASE_C_DEC \
+ PB_ASSOC_BASE_CLASS_NAME< \
+ Key, \
+ Data, \
+ PB_ASSOC_NODE_C_DEC, \
+ Cmp_Fn, \
+ Allocator, \
+ Node_Updator>
+
+ template<typename Key,
+ typename Data,
+ class Cmp_Fn,
+ class Allocator,
+ class Node_Updator>
+ struct PB_ASSOC_CLASS_NAME : public PB_ASSOC_BASE_C_DEC
+ {
+
+ protected:
+
+ typedef typename Allocator::size_type size_type;
+
+ typedef
+ typename PB_ASSOC_TYPES_TRAITS_C_DEC::const_key_reference
+ const_key_reference;
+
+ typedef typename PB_ASSOC_TYPES_TRAITS_C_DEC::data_type data_type;
+
+ typedef
+ typename PB_ASSOC_TYPES_TRAITS_C_DEC::data_reference
+ data_reference;
+
+ typedef
+ typename PB_ASSOC_TYPES_TRAITS_C_DEC::const_data_reference
+ const_data_reference;
+
+ typedef typename PB_ASSOC_TYPES_TRAITS_C_DEC::value_type value_type;
+
+ typedef typename PB_ASSOC_TYPES_TRAITS_C_DEC::pointer pointer;
+
+ typedef
+ typename PB_ASSOC_TYPES_TRAITS_C_DEC::const_pointer
+ const_pointer;
+
+ typedef typename PB_ASSOC_TYPES_TRAITS_C_DEC::reference reference;
+
+ typedef
+ typename PB_ASSOC_TYPES_TRAITS_C_DEC::const_reference
+ const_reference;
+
+ typedef typename PB_ASSOC_BASE_C_DEC::node_pointer node_pointer;
+
+ typedef typename PB_ASSOC_BASE_C_DEC::find_iterator find_iterator;
+
+ typedef
+ typename PB_ASSOC_BASE_C_DEC::const_iterator
+ const_find_iterator;
+
+ typedef typename PB_ASSOC_BASE_C_DEC::iterator iterator;
+
+ typedef typename PB_ASSOC_BASE_C_DEC::const_iterator const_iterator;
+
+ typedef
+ typename PB_ASSOC_BASE_C_DEC::reverse_iterator
+ reverse_iterator;
+
+ typedef
+ typename PB_ASSOC_BASE_C_DEC::const_reverse_iterator
+ const_reverse_iterator;
+
+ protected:
+
+ PB_ASSOC_CLASS_NAME();
+
+ PB_ASSOC_CLASS_NAME(const Cmp_Fn& r_cmp_fn);
+
+ PB_ASSOC_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const Node_Updator& r_node_updator);
+
+ PB_ASSOC_CLASS_NAME(const PB_ASSOC_CLASS_C_DEC& r_other);
+
+ void
+ swap(PB_ASSOC_CLASS_C_DEC& r_other);
+
+ template<class It>
+ void
+ copy_from_range(It first_it, It last_it);
+
+ void
+ initialize();
+
+ inline std::pair<find_iterator, bool>
+ insert(const_reference r_value);
+
+#ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+ inline data_reference
+ subscript_imp(const_key_reference r_key);
+#endif // #ifdef PB_ASSOC_DATA_TRUE
+
+ inline find_iterator
+ lower_bound(const_key_reference r_key);
+
+ inline const_find_iterator
+ lower_bound(const_key_reference r_key) const;
+
+ inline find_iterator
+ upper_bound(const_key_reference r_key);
+
+ inline const_find_iterator
+ upper_bound(const_key_reference r_key) const;
+
+ inline find_iterator
+ find(const_key_reference r_key);
+
+ inline const_find_iterator
+ find(const_key_reference r_key) const;
+
+ inline size_type
+ erase(const_key_reference r_key);
+
+ inline const_iterator
+ erase(const_iterator it);
+
+#ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+ inline iterator
+ erase(iterator it);
+#endif // #ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+
+ inline const_reverse_iterator
+ erase(const_reverse_iterator it);
+
+#ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+ inline reverse_iterator
+ erase(reverse_iterator it);
+#endif // #ifdef PB_ASSOC_DATA_TRUE_INDICATOR
+
+ template<class Pred>
+ inline size_type
+ erase_if(Pred pred);
+
+ inline node_pointer
+ leftmost(node_pointer p_nd);
+
+ void
+ join(PB_ASSOC_CLASS_C_DEC& r_other);
+
+ void
+ split(const_key_reference r_key, PB_ASSOC_CLASS_C_DEC& r_other);
+
+#ifdef PB_ASSOC_SPLAY_TREE_DEBUG_
+
+ virtual void
+ assert_valid() const;
+
+ void
+ assert_special_imp(const node_pointer p_nd) const;
+
+#endif // #ifdef PB_ASSOC_SPLAY_TREE_DEBUG_
+
+ private:
+
+ void
+ splay(node_pointer p_nd);
+
+ inline void
+ splay_zig_zag_left(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent);
+
+ inline void
+ splay_zig_zag_right(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent);
+
+ inline void
+ splay_zig_zig_left(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent);
+
+ inline void
+ splay_zig_zig_right(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent);
+
+ inline void
+ splay_zz_start(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent);
+
+ inline void
+ splay_zz_end(node_pointer p_nd, node_pointer p_parent, node_pointer p_grandparent);
+
+ void
+ erase_node(node_pointer p_nd);
+
+ };
+
+#include <ext/pb_assoc/detail/splay_tree_/constructors_destructor_fn_imps.hpp>
+#include <ext/pb_assoc/detail/splay_tree_/info_fn_imps.hpp>
+#include <ext/pb_assoc/detail/splay_tree_/insert_fn_imps.hpp>
+#include <ext/pb_assoc/detail/splay_tree_/splay_fn_imps.hpp>
+#include <ext/pb_assoc/detail/splay_tree_/erase_fn_imps.hpp>
+#include <ext/pb_assoc/detail/splay_tree_/find_fn_imps.hpp>
+#include <ext/pb_assoc/detail/splay_tree_/debug_fn_imps.hpp>
+#include <ext/pb_assoc/detail/splay_tree_/split_join_fn_imps.hpp>
+
+#undef PB_ASSOC_CLASS_T_DEC
+
+#undef PB_ASSOC_CLASS_C_DEC
+
+#undef PB_ASSOC_CLASS_NAME
+
+#undef PB_ASSOC_TYPES_TRAITS_C_DEC
+
+#undef PB_ASSOC_BASE_CLASS_NAME
+
+#undef PB_ASSOC_NODE_C_DEC
+
+#undef PB_ASSOC_BASE_C_DEC
+
+#undef PB_ASSOC_DBG_ASSERT
+#undef PB_ASSOC_DBG_VERIFY
+#undef PB_ASSOC_DBG_ONLY
+
+ } // namespace detail
+
+} // namespace pb_assoc
+
diff --git a/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/split_join_fn_imps.hpp b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/split_join_fn_imps.hpp
new file mode 100644
index 00000000000..e1dd0c2eff2
--- /dev/null
+++ b/libstdc++-v3/include/ext/pb_assoc/detail/splay_tree_/split_join_fn_imps.hpp
@@ -0,0 +1,125 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005 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 class for splay_tree_.
+ */
+
+PB_ASSOC_CLASS_T_DEC
+inline void
+PB_ASSOC_CLASS_C_DEC::
+join(PB_ASSOC_CLASS_C_DEC& r_other)
+{
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid();)
+ PB_ASSOC_DBG_ONLY(r_other.PB_ASSOC_CLASS_C_DEC::assert_valid();)
+
+ if (PB_ASSOC_BASE_C_DEC::join_prep(r_other) == false)
+ {
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid();)
+ PB_ASSOC_DBG_ONLY(r_other.PB_ASSOC_CLASS_C_DEC::assert_valid();)
+
+ return;
+ }
+
+ node_pointer p_target_r = r_other.leftmost(r_other.m_p_head);
+
+ PB_ASSOC_DBG_ASSERT(p_target_r != NULL);
+
+ r_other.splay(p_target_r);
+
+ PB_ASSOC_DBG_ASSERT(p_target_r == r_other.m_p_head->m_p_parent);
+ PB_ASSOC_DBG_ASSERT(p_target_r->m_p_left == NULL);
+
+ p_target_r->m_p_left = PB_ASSOC_BASE_C_DEC::m_p_head->m_p_parent;
+
+ PB_ASSOC_DBG_ASSERT(p_target_r->m_p_left != NULL);
+ p_target_r->m_p_left->m_p_parent = p_target_r;
+
+ PB_ASSOC_BASE_C_DEC::m_p_head->m_p_parent = p_target_r;
+ p_target_r->m_p_parent = PB_ASSOC_BASE_C_DEC::m_p_head;
+
+ apply_update(p_target_r, (Node_Updator* )this);
+
+ PB_ASSOC_BASE_C_DEC::join_finish(r_other);
+
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid();)
+ PB_ASSOC_DBG_ONLY(r_other.PB_ASSOC_CLASS_C_DEC::assert_valid();)
+ }
+
+PB_ASSOC_CLASS_T_DEC
+void
+PB_ASSOC_CLASS_C_DEC::
+split(const_key_reference r_key, PB_ASSOC_CLASS_C_DEC& r_other)
+{
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid());
+ PB_ASSOC_DBG_ONLY(r_other.PB_ASSOC_CLASS_C_DEC::assert_valid());
+
+ if (PB_ASSOC_BASE_C_DEC::split_prep(r_key, r_other) == false)
+ {
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid());
+ PB_ASSOC_DBG_ONLY(r_other.PB_ASSOC_CLASS_C_DEC::assert_valid());
+
+ return;
+ }
+
+ node_pointer p_upper_bound = upper_bound(r_key).m_p_nd;
+ PB_ASSOC_DBG_ASSERT(p_upper_bound != NULL);
+
+ PB_ASSOC_DBG_ASSERT(p_upper_bound->m_p_parent ==
+ PB_ASSOC_BASE_C_DEC::m_p_head);
+
+ node_pointer p_new_root = p_upper_bound->m_p_left;
+ PB_ASSOC_DBG_ASSERT(p_new_root != NULL);
+
+ PB_ASSOC_BASE_C_DEC::m_p_head->m_p_parent = p_new_root;
+ p_new_root->m_p_parent = PB_ASSOC_BASE_C_DEC::m_p_head;
+
+ r_other.m_p_head->m_p_parent = p_upper_bound;
+ p_upper_bound->m_p_parent = r_other.m_p_head;
+ p_upper_bound->m_p_left = NULL;
+
+ apply_update(p_upper_bound, (Node_Updator* )this);
+
+ PB_ASSOC_BASE_C_DEC::split_finish(r_other);
+
+ PB_ASSOC_DBG_ONLY(PB_ASSOC_CLASS_C_DEC::assert_valid());
+ PB_ASSOC_DBG_ONLY(r_other.PB_ASSOC_CLASS_C_DEC::assert_valid());
+}
+