types_traits.hpp revision 256281
153812Salfred// -*- C++ -*- 253812Salfred 353812Salfred// Copyright (C) 2005, 2006 Free Software Foundation, Inc. 453812Salfred// 553812Salfred// This file is part of the GNU ISO C++ Library. This library is free 653812Salfred// software; you can redistribute it and/or modify it under the terms 753812Salfred// of the GNU General Public License as published by the Free Software 859501Sphantom// Foundation; either version 2, or (at your option) any later 9124535Sru// version. 1053812Salfred 1184306Sru// This library is distributed in the hope that it will be useful, but 1253812Salfred// WITHOUT ANY WARRANTY; without even the implied warranty of 1353812Salfred// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1453812Salfred// General Public License for more details. 1553812Salfred 1653812Salfred// You should have received a copy of the GNU General Public License 1753812Salfred// along with this library; see the file COPYING. If not, write to 1853812Salfred// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, 1957686Ssheldonh// MA 02111-1307, USA. 2057686Ssheldonh 2157686Ssheldonh// As a special exception, you may use this file as part of a free 2257686Ssheldonh// software library without restriction. Specifically, if other files 2353812Salfred// instantiate templates or use macros or inline functions from this 2453812Salfred// file, or you compile this file and link it with other files to 2557686Ssheldonh// produce an executable, this file does not by itself cause the 2657686Ssheldonh// resulting executable to be covered by the GNU General Public 2753812Salfred// License. This exception does not however invalidate any other 2853812Salfred// reasons why the executable file might be covered by the GNU General 2953812Salfred// Public License. 3053812Salfred 3153812Salfred// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. 3253812Salfred 3353812Salfred// Permission to use, copy, modify, sell, and distribute this software 3453812Salfred// is hereby granted without fee, provided that the above copyright 3553812Salfred// notice appears in all copies, and that both that copyright notice 3653812Salfred// and this permission notice appear in supporting documentation. None 3753812Salfred// of the above authors, nor IBM Haifa Research Laboratories, make any 3853812Salfred// representation about the suitability of this software for any 3957686Ssheldonh// purpose. It is provided "as is" without express or implied 4057686Ssheldonh// warranty. 4153812Salfred 4253812Salfred/** 4353812Salfred * @file types_traits.hpp 4453812Salfred * Contains a traits class of types used by containers. 4553812Salfred */ 4653812Salfred 4753812Salfred#ifndef PB_DS_TYPES_TRAITS_HPP 48131530Sru#define PB_DS_TYPES_TRAITS_HPP 4953812Salfred 5057686Ssheldonh#include <ext/pb_ds/detail/basic_types.hpp> 5157686Ssheldonh#include <ext/pb_ds/detail/type_utils.hpp> 5253812Salfred#include <utility> 5353812Salfred 54110442Scharniernamespace pb_ds 5553812Salfred{ 56110442Scharnier namespace detail 5753812Salfred { 5853812Salfred template<typename Key, typename Mapped, typename Alloc, bool Store_Extra> 5953812Salfred struct vt_base_selector 6053812Salfred { 6153812Salfred typedef value_type_base<Key, Mapped, Alloc, Store_Extra> type; 6253812Salfred }; 6353812Salfred 6453812Salfred template<typename Key, typename Mapped, typename Alloc, bool Store_Extra> 6553812Salfred struct types_traits 6653812Salfred : public vt_base_selector<Key, Mapped, Alloc, Store_Extra>::type 6753812Salfred { 6853812Salfred typedef typename Alloc::template rebind<Key>::other key_allocator; 6953812Salfred typedef typename key_allocator::value_type key_type; 7053812Salfred typedef typename key_allocator::pointer key_pointer; 71110442Scharnier typedef typename key_allocator::const_pointer const_key_pointer; 7253812Salfred typedef typename key_allocator::reference key_reference; 73110442Scharnier typedef typename key_allocator::const_reference const_key_reference; 7473093Sru typedef typename Alloc::size_type size_type; 7553812Salfred 76147700Shmp // Extra value (used when the extra value is stored with each value). 7754744Sphantom typedef std::pair<size_type, size_type> comp_hash; 7854744Sphantom 7954744Sphantom integral_constant<int, Store_Extra> m_store_extra_indicator; 8054744Sphantom typename no_throw_copies<Key, Mapped>::indicator m_no_throw_copies_indicator; 8154744Sphantom }; 82 } // namespace detail 83} // namespace pb_ds 84 85#endif 86