# types_traits.hpp

Go to the documentation of this file.

    00001 // -*- C++ -*-
    00002
    00003 // Copyright (C) 2005, 2006 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 2, 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 // You should have received a copy of the GNU General Public License
    00017 // along with this library; see the file COPYING.  If not, write to
    00018 // the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
    00019 // MA 02111-1307, USA.
    00020
    00021 // As a special exception, you may use this file as part of a free
    00022 // software library without restriction.  Specifically, if other files
    00023 // instantiate templates or use macros or inline functions from this
    00024 // file, or you compile this file and link it with other files to
    00025 // produce an executable, this file does not by itself cause the
    00026 // resulting executable to be covered by the GNU General Public
    00027 // License.  This exception does not however invalidate any other
    00028 // reasons why the executable file might be covered by the GNU General
    00029 // Public License.
    00030
    00031 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
    00032
    00033 // Permission to use, copy, modify, sell, and distribute this software
    00034 // is hereby granted without fee, provided that the above copyright
    00035 // notice appears in all copies, and that both that copyright notice
    00036 // and this permission notice appear in supporting documentation. None
    00037 // of the above authors, nor IBM Haifa Research Laboratories, make any
    00038 // representation about the suitability of this software for any
    00039 // purpose. It is provided "as is" without express or implied
    00040 // warranty.
    00041
    00042 /**
    00043  * @file types_traits.hpp
    00044  * Contains a traits class of types used by containers.
    00045  */
    00046
    00047 #ifndef PB_DS_TYPES_TRAITS_HPP
    00048 #define PB_DS_TYPES_TRAITS_HPP
    00049
    00050 #include <ext/pb_ds/detail/basic_types.hpp>
    00051 #include <ext/pb_ds/detail/type_utils.hpp>
    00052 #include <utility>
    00053
    00054 namespace pb_ds
    00055 {
    00056   namespace detail
    00057   {
    00058     template<typename Key, typename Mapped, typename Alloc, bool Store_Extra>
    00059     struct vt_base_selector
    00060     {
    00061       typedef value_type_base<Key, Mapped, Alloc, Store_Extra> type;
    00062     };
    00063
    00064     template<typename Key, typename Mapped, typename Alloc, bool Store_Extra>
    00065     struct types_traits
    00066     : public vt_base_selector<Key, Mapped, Alloc, Store_Extra>::type
    00067     {
    00068       typedef typename Alloc::template rebind<Key>::other key_allocator;
    00069       typedef typename key_allocator::value_type key_type;
    00070       typedef typename key_allocator::pointer key_pointer;
    00071       typedef typename key_allocator::const_pointer const_key_pointer;
    00072       typedef typename key_allocator::reference key_reference;
    00073       typedef typename key_allocator::const_reference const_key_reference;
    00074       typedef typename Alloc::size_type size_type;
    00075
    00076       // Extra value (used when the extra value is stored with each value).
    00077       typedef std::pair<size_type, size_type> comp_hash;
    00078
    00079       integral_constant<int, Store_Extra> m_store_extra_indicator;
    00080       typename no_throw_copies<Key, Mapped>::indicator m_no_throw_copies_indicator;
    00081     };
    00082   } // namespace detail
    00083 } // namespace pb_ds
    00084
    00085 #endif