15460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//===- TypeTraits.h -------------------------------------------------------===//
25460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//
35460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//                     The MCLinker Project
45460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//
55460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// This file is distributed under the University of Illinois Open Source
65460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// License. See LICENSE.TXT for details.
75460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//
85460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//===----------------------------------------------------------------------===//
987f34658dec9097d987d254a990ea7f311bfc95fStephen Hines#ifndef MCLD_ADT_TYPETRAITS_H
1087f34658dec9097d987d254a990ea7f311bfc95fStephen Hines#define MCLD_ADT_TYPETRAITS_H
115460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
125460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao#include <cstdlib>
135460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
1487f34658dec9097d987d254a990ea7f311bfc95fStephen Hinesnamespace mcld {
1587f34658dec9097d987d254a990ea7f311bfc95fStephen Hines
165460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaotemplate<typename DataType>
175460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaostruct NonConstTraits;
185460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
195460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaotemplate<typename DataType>
205460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaostruct ConstTraits
215460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao{
225460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef DataType                 value_type;
235460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef const DataType*          pointer;
245460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef const DataType&          reference;
255460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef size_t                   size_type;
265460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef ConstTraits<DataType>    const_traits;
275460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef NonConstTraits<DataType> nonconst_traits;
285460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao};
295460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
305460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaotemplate<typename DataType>
315460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaostruct NonConstTraits
325460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao{
335460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef DataType                 value_type;
345460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef DataType*                pointer;
355460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef DataType&                reference;
365460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef size_t                   size_type;
375460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef ConstTraits<DataType>    const_traits;
385460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef NonConstTraits<DataType> nonconst_traits;
395460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao};
405460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
415460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaotemplate<typename DataType>
425460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaostruct ConstIteratorTraits
435460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao{
445460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef DataType                          value_type;
455460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef const DataType*                   pointer;
465460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef const DataType&                   reference;
475460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef size_t                            size_type;
485460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef ConstTraits<DataType>             const_traits;
495460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef NonConstTraits<DataType>          nonconst_traits;
505460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef typename DataType::const_iterator iterator;
515460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao};
525460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
535460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaotemplate<typename DataType>
545460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaostruct NonConstIteratorTraits
555460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao{
565460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef DataType                    value_type;
575460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef DataType*                   pointer;
585460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef DataType&                   reference;
595460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef size_t                      size_type;
605460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef ConstTraits<DataType>       const_traits;
615460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef NonConstTraits<DataType>    nonconst_traits;
625460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  typedef typename DataType::iterator iterator;
635460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao};
645460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
655460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao} // namespace of mcld
665460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
675460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao#endif
68affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
69