2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
4 // Stefan Bund <g0dil@berlios.de>
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 \brief IteratorTraits public header */
24 #ifndef HH_IteratorTraits_
25 #define HH_IteratorTraits_ 1
28 #include <boost/type_traits/integral_constant.hpp>
32 //#include "IteratorTraits.mpp"
33 ///////////////////////////////hh.p////////////////////////////////////////
37 // The following is *not* standard mandated but it *is* mandated by TR1 and I know of no
38 // implementation for which this is not correct
40 /** \brief Check for contiguous mutable storage
42 This type trait returns \c true, if \a RandomAccessIterator is an iterator into a contiguous
43 storage area which may be written to. If this is the case, some algorithms may be optimized
44 by directly modifying the underlying storage instead of relying on the STL interface.
46 This trait will return \c true for pointers. Additonally it should be configured to return
47 true for all standard containers which obey above implementation restrictions. This
48 typically includes \c std::vector and \c std::basic_string.
50 To do so, the template must be specialized for those containers \c iterator type. If
51 compiling with g++, this is implemented in \ref IteratorTraits.ih. This file should be
52 extended for further compilers if necessary.
54 template <class RandomAccessIterator>
55 struct contiguous_storage_iterator
56 : public boost::false_type
60 struct contiguous_storage_iterator<T *>
61 : public boost::true_type
64 /** \brief Convert contiguous storage iterator to pointer
66 storage_iterator will convert a contiguous storage iterator into a pointer to the same
67 element in the container. This allows to directly access the containers storage.
69 template <class Iterator>
70 typename std::iterator_traits<Iterator>::pointer storage_iterator(Iterator i);
74 ///////////////////////////////hh.e////////////////////////////////////////
75 //#include "IteratorTraits.cci"
76 //#include "IteratorTraits.ct"
77 #include "IteratorTraits.cti"
78 #include "IteratorTraits.ih"
85 // c-file-style: "senf"
86 // indent-tabs-mode: nil
87 // ispell-local-dictionary: "american"