cmp_fn_imps.hpp revision 169691
150724Scg// -*- C++ -*- 253413Sroger 353413Sroger// Copyright (C) 2005, 2006 Free Software Foundation, Inc. 450724Scg// 553413Sroger// This file is part of the GNU ISO C++ Library. This library is free 650724Scg// software; you can redistribute it and/or modify it under the terms 750724Scg// of the GNU General Public License as published by the Free Software 850724Scg// Foundation; either version 2, or (at your option) any later 950724Scg// version. 1050724Scg 1150724Scg// This library is distributed in the hope that it will be useful, but 1250724Scg// WITHOUT ANY WARRANTY; without even the implied warranty of 1350724Scg// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1450724Scg// General Public License for more details. 1550724Scg 1650724Scg// You should have received a copy of the GNU General Public License 1750724Scg// along with this library; see the file COPYING. If not, write to 1850724Scg// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, 1950724Scg// MA 02111-1307, USA. 2050724Scg 2150724Scg// As a special exception, you may use this file as part of a free 2250724Scg// software library without restriction. Specifically, if other files 2350724Scg// instantiate templates or use macros or inline functions from this 2450724Scg// file, or you compile this file and link it with other files to 2550724Scg// produce an executable, this file does not by itself cause the 2650724Scg// resulting executable to be covered by the GNU General Public 2750724Scg// License. This exception does not however invalidate any other 2850724Scg// reasons why the executable file might be covered by the GNU General 2950724Scg// Public License. 3050724Scg 3150724Scg// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. 3250724Scg 3350724Scg// Permission to use, copy, modify, sell, and distribute this software 3450724Scg// is hereby granted without fee, provided that the above copyright 3550724Scg// notice appears in all copies, and that both that copyright notice 3650724Scg// and this permission notice appear in supporting documentation. None 3750724Scg// of the above authors, nor IBM Haifa Research Laboratories, make any 3850724Scg// representation about the suitability of this software for any 3950724Scg// purpose. It is provided "as is" without express or implied 4050724Scg// warranty. 4150733Speter 4250724Scg/** 4350724Scg * @file cmp_fn_imps.hpp 4453413Sroger * Contains implementations of cc_ht_map_'s entire container comparison related 4553413Sroger * functions. 4653413Sroger */ 4754831Scg 4854831ScgPB_DS_CLASS_T_DEC 4953413Srogertemplate<typename Other_HT_Map_Type> 5053413Srogerbool 5153413SrogerPB_DS_CLASS_C_DEC:: 5253413Srogeroperator==(const Other_HT_Map_Type& other) const 5353465Scg{ return cmp_with_other(other); } 5453465Scg 5553465ScgPB_DS_CLASS_T_DEC 5650724Scgtemplate<typename Other_Map_Type> 5750724Scgbool 5850724ScgPB_DS_CLASS_C_DEC:: 5950724Scgcmp_with_other(const Other_Map_Type& other) const 6053413Sroger{ 6153413Sroger if (size() != other.size()) 6253413Sroger return false; 6353413Sroger 6453413Sroger for (typename Other_Map_Type::const_iterator it = other.begin(); 6550724Scg it != other.end(); ++it) 6650724Scg { 6750724Scg const_key_reference r_key = const_key_reference(PB_DS_V2F(*it)); 6850724Scg 6953413Sroger const_mapped_pointer p_mapped_value = 7056154Speter const_cast<PB_DS_CLASS_C_DEC& >(*this). 7150724Scg find_key_pointer(r_key, traits_base::m_store_hash_indicator); 7250724Scg 7350724Scg if (p_mapped_value == NULL) 7450724Scg return false; 7555209Scg 7650724Scg#ifdef PB_DS_DATA_TRUE_INDICATOR 7750724Scg if (p_mapped_value->second != it->second) 7850724Scg return false; 7954831Scg#endif 8050724Scg } 8155209Scg return true; 8250724Scg} 8355209Scg 8450724ScgPB_DS_CLASS_T_DEC 8550724Scgtemplate<typename Other_HT_Map_Type> 8650724Scgbool 8750724ScgPB_DS_CLASS_C_DEC:: 8854831Scgoperator!=(const Other_HT_Map_Type& other) const 8950724Scg{ return !operator==(other); } 9050724Scg