libstdc++
|
00001 // -*- C++ -*- 00002 00003 // Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the terms 00007 // of the GNU General Public License as published by the Free Software 00008 // Foundation; either version 3, or (at your option) any later 00009 // version. 00010 00011 // This library is distributed in the hope that it will be useful, but 00012 // WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 // General Public License for more details. 00015 00016 // Under Section 7 of GPL version 3, you are granted additional 00017 // permissions described in the GCC Runtime Library Exception, version 00018 // 3.1, as published by the Free Software Foundation. 00019 00020 // You should have received a copy of the GNU General Public License and 00021 // a copy of the GCC Runtime Library Exception along with this program; 00022 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00023 // <http://www.gnu.org/licenses/>. 00024 00025 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. 00026 00027 // Permission to use, copy, modify, sell, and distribute this software 00028 // is hereby granted without fee, provided that the above copyright 00029 // notice appears in all copies, and that both that copyright notice 00030 // and this permission notice appear in supporting documentation. None 00031 // of the above authors, nor IBM Haifa Research Laboratories, make any 00032 // representation about the suitability of this software for any 00033 // purpose. It is provided "as is" without express or implied 00034 // warranty. 00035 00036 /** 00037 * @file unordered_iterator/point_const_iterator.hpp 00038 * Contains an iterator class returned by the tables' const find and insert 00039 * methods. 00040 */ 00041 00042 class point_iterator_; 00043 00044 /// Const point-type iterator. 00045 class point_const_iterator_ 00046 { 00047 public: 00048 /// Category. 00049 typedef trivial_iterator_tag iterator_category; 00050 00051 /// Difference type. 00052 typedef trivial_iterator_difference_type difference_type; 00053 00054 /// Iterator's value type. 00055 typedef value_type_ value_type; 00056 00057 /// Iterator's pointer type. 00058 typedef pointer_ pointer; 00059 00060 /// Iterator's const pointer type. 00061 typedef const_pointer_ const_pointer; 00062 00063 /// Iterator's reference type. 00064 typedef reference_ reference; 00065 00066 /// Iterator's const reference type. 00067 typedef const_reference_ const_reference; 00068 00069 inline 00070 point_const_iterator_(const_pointer p_value) : m_p_value(p_value) 00071 { } 00072 00073 /// Default constructor. 00074 inline 00075 point_const_iterator_() : m_p_value(0) 00076 { } 00077 00078 /// Copy constructor. 00079 inline 00080 point_const_iterator_(const point_const_iterator_& other) 00081 : m_p_value(other.m_p_value) 00082 { } 00083 00084 /// Copy constructor. 00085 inline 00086 point_const_iterator_(const point_iterator_& other) 00087 : m_p_value(other.m_p_value) 00088 { } 00089 00090 /// Access. 00091 const_pointer 00092 operator->() const 00093 { 00094 _GLIBCXX_DEBUG_ASSERT(m_p_value != 0); 00095 return m_p_value; 00096 } 00097 00098 /// Access. 00099 const_reference 00100 operator*() const 00101 { 00102 _GLIBCXX_DEBUG_ASSERT(m_p_value != 0); 00103 return *m_p_value; 00104 } 00105 00106 /// Compares content to a different iterator object. 00107 bool 00108 operator==(const point_iterator_& other) const 00109 { return m_p_value == other.m_p_value; } 00110 00111 /// Compares content to a different iterator object. 00112 bool 00113 operator==(const point_const_iterator_& other) const 00114 { return m_p_value == other.m_p_value; } 00115 00116 /// Compares content (negatively) to a different iterator object. 00117 bool 00118 operator!=(const point_iterator_& other) const 00119 { return m_p_value != other.m_p_value; } 00120 00121 /// Compares content (negatively) to a different iterator object. 00122 bool 00123 operator!=(const point_const_iterator_& other) const 00124 { return m_p_value != other.m_p_value; } 00125 00126 protected: 00127 const_pointer m_p_value; 00128 00129 friend class point_iterator_; 00130 00131 friend class PB_DS_CLASS_C_DEC; 00132 }; 00133