Changeset 958 for trunk/yat/utility
- Timestamp:
- Oct 10, 2007, 5:44:06 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/iterator_traits.h
r937 r958 56 56 57 57 // but specialized to return weighted type for some things 58 // 59 // if you add a new weighted iterator, add a new specialization like 60 // this one. 58 61 template <class U, class V> 59 62 struct weighted_iterator_traits<yat::utility::IteratorWeighted<U,V> > { … … 64 67 65 68 /* 66 struct used to determine if a pair of iterators should be treated 67 as weighted 68 69 Metafunction that works on a pair weighted-unweighted types and 70 return weighted_type. The metafunction is specialized for 71 unweighted unweighted in which case unweighted is returned. 72 */ 69 73 template <class T1, class T2> 70 struct weighted_iterator_traits2{74 struct unweighted_type_and { 71 75 typedef weighted_type type; 72 76 }; 73 77 74 // but specialized to return weighted type for some things 78 /* 79 Specialization that sets type to be unweighted when both arguments 80 are unweighted 81 */ 82 template <> 83 struct unweighted_type_and<unweighted_type, unweighted_type> { 84 typedef unweighted_type type; 85 }; 86 87 /* 88 struct used to determine if a pair of iterators should be treated 89 as weighted. If both iterators are unweighted, type is set to 90 unweighted else weighted. 91 */ 75 92 template <class T1, class T2> 76 struct weighted_iterator_traits2<yat::utility::IteratorWeighted<U,V> > { 77 typedef weighted_type type; 93 struct weighted_if_any2 { 94 typedef typename weighted_iterator_traits<T1>::type w_type1; 95 typedef typename weighted_iterator_traits<T2>::type w_type2; 96 typedef typename unweighted_type_and<w_type1, w_type2>::type type; 78 97 }; 79 */ 98 99 /* 100 Same as weighted_iterator_traits2 but for 3 arguments. 101 */ 102 template <class T1, class T2, class T3> 103 struct weighted_if_any3 { 104 typedef typename weighted_if_any2<T1, T2>::type tmp; 105 typedef typename weighted_iterator_traits<T3>::type w_type3; 106 typedef typename unweighted_type_and<tmp, w_type3>::type type; 107 }; 80 108 81 109 // check (at compile time) that iterator is unweighted.
Note: See TracChangeset
for help on using the changeset viewer.