Changeset 1543 for trunk/yat


Ignore:
Timestamp:
Oct 1, 2008, 5:53:04 AM (13 years ago)
Author:
Peter
Message:

fixes #368

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/WeightedIterator.h

    r1541 r1543  
    5050       \brief DataIterator
    5151     */
    52     typedef DataIterator data_iterator_type;
     52    typedef DataIterator data_iterator;
    5353
    5454    /**
    5555       \brief DataIterator
    5656     */
    57     typedef WeightIterator weight_iterator_type;
     57    typedef WeightIterator weight_iterator;
    5858
    5959    /**
     
    140140 
    141141
     142  /**
     143     Specialization for WeightedIterator
     144   */
     145  template <typename DataIterator, typename WeightIterator>
     146  struct weighted_iterator_traits<WeightedIterator<DataIterator
     147                                                   ,WeightIterator> >
     148  {
     149    /**
     150       WeightedIterator is weighted
     151     */
     152    typedef weighted_iterator_tag type;
     153  };
     154
     155  /**
     156     Specialization for WeightedIterator
     157   */
     158  template <typename DataIterator, typename WeightIterator>
     159  struct iterator_traits<WeightedIterator<DataIterator, WeightIterator> >
     160  {
     161  private:
     162    typedef WeightedIterator<DataIterator,WeightIterator> WI;
     163    typedef typename WI::data_iterator data_iterator;
     164    typedef typename WI::weight_iterator weight_iterator;
     165  public:
     166    /**
     167       data_reference is same reference of data_iterator_base
     168     */
     169    typedef typename
     170    std::iterator_traits<data_iterator>::reference data_reference;
     171
     172    /**
     173       weight_reference is same reference of weight_iterator_base
     174     */
     175    typedef typename
     176    std::iterator_traits<weight_iterator>::reference weight_reference;
     177
     178    /**
     179       \return dereferenced data_iterator
     180     */
     181    data_reference data(WI iter) const { return * iter.data_base(); }
     182
     183    /**
     184       \return dereferenced weight_iterator
     185     */
     186    weight_reference weight(WI iter) const { return * iter.weight_base(); }
     187  };
    142188
    143189}}} // of namespace utility, yat, and theplu
Note: See TracChangeset for help on using the changeset viewer.