hash_load_check_resize_trigger_size_base.hpp revision 302408
1296936Smmel// -*- C++ -*- 2296936Smmel 3296936Smmel// Copyright (C) 2005, 2006 Free Software Foundation, Inc. 4296936Smmel// 5296936Smmel// This file is part of the GNU ISO C++ Library. This library is free 6296936Smmel// software; you can redistribute it and/or modify it under the terms 7296936Smmel// of the GNU General Public License as published by the Free Software 8296936Smmel// Foundation; either version 2, or (at your option) any later 9296936Smmel// version. 10296936Smmel 11296936Smmel// This library is distributed in the hope that it will be useful, but 12296936Smmel// WITHOUT ANY WARRANTY; without even the implied warranty of 13296936Smmel// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14296936Smmel// General Public License for more details. 15296936Smmel 16296936Smmel// You should have received a copy of the GNU General Public License 17296936Smmel// along with this library; see the file COPYING. If not, write to 18296936Smmel// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, 19296936Smmel// MA 02111-1307, USA. 20296936Smmel 21296936Smmel// As a special exception, you may use this file as part of a free 22296936Smmel// software library without restriction. Specifically, if other files 23296936Smmel// instantiate templates or use macros or inline functions from this 24296936Smmel// file, or you compile this file and link it with other files to 25296936Smmel// produce an executable, this file does not by itself cause the 26296936Smmel// resulting executable to be covered by the GNU General Public 27296936Smmel// License. This exception does not however invalidate any other 28296936Smmel// reasons why the executable file might be covered by the GNU General 29296936Smmel// Public License. 30296936Smmel 31296936Smmel// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. 32296936Smmel 33296936Smmel// Permission to use, copy, modify, sell, and distribute this software 34296936Smmel// is hereby granted without fee, provided that the above copyright 35296936Smmel// notice appears in all copies, and that both that copyright notice 36296936Smmel// and this permission notice appear in supporting documentation. None 37296936Smmel// of the above authors, nor IBM Haifa Research Laboratories, make any 38296936Smmel// representation about the suitability of this software for any 39296936Smmel// purpose. It is provided "as is" without express or implied 40296936Smmel// warranty. 41296936Smmel 42296936Smmel/** 43296936Smmel * @file hash_load_check_resize_trigger_size_base.hpp 44296936Smmel * Contains an base holding size for some resize policies. 45296936Smmel */ 46296936Smmel 47296936Smmel#ifndef PB_DS_HASH_LOAD_CHECK_RESIZE_TRIGGER_SIZE_BASE_HPP 48296936Smmel#define PB_DS_HASH_LOAD_CHECK_RESIZE_TRIGGER_SIZE_BASE_HPP 49296936Smmel 50296936Smmelnamespace pb_ds 51296936Smmel{ 52296936Smmel namespace detail 53296936Smmel { 54296936Smmel // Primary template. 55296936Smmel template<typename Size_Type, bool Hold_Size> 56296936Smmel class hash_load_check_resize_trigger_size_base; 57296936Smmel 58296936Smmel // Specializations. 59296936Smmel template<typename Size_Type> 60296936Smmel class hash_load_check_resize_trigger_size_base<Size_Type, true> 61296936Smmel { 62296936Smmel protected: 63296936Smmel typedef Size_Type size_type; 64296936Smmel 65296936Smmel hash_load_check_resize_trigger_size_base(): m_size(0) 66296936Smmel { } 67296936Smmel 68296936Smmel inline void 69296936Smmel swap(hash_load_check_resize_trigger_size_base& other) 70296936Smmel { std::swap(m_size, other.m_size); } 71296936Smmel 72296936Smmel inline void 73296936Smmel set_size(size_type size) 74296936Smmel { m_size = size; } 75296936Smmel 76296936Smmel inline size_type 77296936Smmel get_size() const 78296936Smmel { return m_size; } 79296936Smmel 80296936Smmel private: 81296936Smmel size_type m_size; 82296936Smmel }; 83296936Smmel 84296936Smmel template<typename Size_Type> 85296936Smmel class hash_load_check_resize_trigger_size_base<Size_Type, false> 86296936Smmel { 87296936Smmel protected: 88296936Smmel typedef Size_Type size_type; 89296936Smmel 90296936Smmel protected: 91296936Smmel inline void 92296936Smmel swap(hash_load_check_resize_trigger_size_base& other) { } 93296936Smmel 94296936Smmel inline void 95296936Smmel set_size(size_type size) { } 96296936Smmel }; 97296936Smmel } // namespace detail 98296936Smmel} // namespace pb_ds 99296936Smmel 100296936Smmel#endif 101296936Smmel