59template <
typename I>
inline
60typename const_integral_iterator<I>::pointer
61const_integral_iterator<I>::operator->()
const
68template <
typename I>
inline
69typename const_integral_iterator<I>::reference
70const_integral_iterator<I>::operator*()
const
77template <
typename I>
inline
78typename const_integral_iterator<I>::value_type
79const_integral_iterator<I>::operator[](difference_type n)
const
81 return value_ + n * step_;
86template <
typename I>
inline
87typename const_integral_iterator<I>::self_type&
88const_integral_iterator<I>::operator++()
96template <
typename I>
inline
97typename const_integral_iterator<I>::self_type
98const_integral_iterator<I>::operator++(
int)
100 self_type temp(*
this);
107template <
typename I>
inline
108typename const_integral_iterator<I>::self_type&
109const_integral_iterator<I>::operator--()
117template <
typename I>
inline
118typename const_integral_iterator<I>::self_type
119const_integral_iterator<I>::operator--(
int)
121 self_type temp(*
this);
128template <
typename I>
inline
129typename const_integral_iterator<I>::self_type&
130const_integral_iterator<I>::operator+=(difference_type n)
138template <
typename I>
inline
139typename const_integral_iterator<I>::self_type&
140const_integral_iterator<I>::operator-=(difference_type n)
148template <
typename I>
inline
149typename const_integral_iterator<I>::self_type
150const_integral_iterator<I>::operator+(difference_type n)
const
152 self_type temp(*
this);
159template <
typename I>
inline
160typename const_integral_iterator<I>::self_type
161const_integral_iterator<I>::operator-(difference_type n)
const
163 self_type temp(*
this);
170template <
typename I>
inline
171typename const_integral_iterator<I>::difference_type
172const_integral_iterator<I>::operator-(
const self_type& other)
const
174 LASS_ASSERT(step_ == other.step_);
175 LASS_ASSERT((value_ - other.value_) % step_ == 0);
176 return (value_ - other.value_) / step_;
181template <
typename I>
inline
182bool operator==(
const const_integral_iterator<I>& a,
const const_integral_iterator<I>& b)
184 LASS_ASSERT(a.step_ == b.step_);
185 return a.value_ == b.value_;
190template <
typename I>
inline
191bool operator!=(
const const_integral_iterator<I>& a,
const const_integral_iterator<I>& b)
198template <
typename I>
inline
199bool operator<(
const const_integral_iterator<I>& a,
const const_integral_iterator<I>& b)
201 LASS_ASSERT(a.step_ == b.step_);
202 return a.value_ < b.value_;
207template <
typename I>
inline
208bool operator>(
const const_integral_iterator<I>& a,
const const_integral_iterator<I>& b)
215template <
typename I>
inline
216bool operator<=(
const const_integral_iterator<I>& a,
const const_integral_iterator<I>& b)
223template <
typename I>
inline
224bool operator>=(
const const_integral_iterator<I>& a,
const const_integral_iterator<I>& b)
233template <
typename I>
inline
234integral_range_t<I>::integral_range_t():
243template <
typename I>
inline
244integral_range_t<I>::integral_range_t(value_type last):
247 step_(last >= 0 ? 1 : -1)
253template <
typename I>
inline
254integral_range_t<I>::integral_range_t(value_type first, value_type last):
257 step_(last >= first ? 1 : -1)
263template <
typename I>
inline
264integral_range_t<I>::integral_range_t(value_type first, value_type last, value_type step):
269 LASS_ASSERT(step != 0);
270 value_type m = (last_ - first_) % step_;
275 LASS_ASSERT((last_ - first_) % step_ == 0);
280template <
typename I>
inline
281typename integral_range_t<I>::const_iterator
282integral_range_t<I>::begin()
const
284 return const_iterator(first_, step_);
289template <
typename I>
inline
290typename integral_range_t<I>::const_iterator
291integral_range_t<I>::end()
const
293 return const_iterator(last_, step_);
298template <
typename I>
inline
299typename integral_range_t<I>::const_reverse_iterator
300integral_range_t<I>::rbegin()
const
302 return const_reverse_iterator(end());
307template <
typename I>
inline
308typename integral_range_t<I>::const_reverse_iterator
309integral_range_t<I>::rend()
const
311 return const_reverse_iterator(begin());
316template <
typename I>
inline
317typename integral_range_t<I>::self_type&
318integral_range_t<I>::operator++()
320 LASS_ASSERT(first_ != last_);
326template <
typename I>
inline
327typename integral_range_t<I>::self_type&
328integral_range_t<I>::operator--()
330 LASS_ASSERT(first_ != last_);
336template <
typename I>
inline
337typename integral_range_t<I>::self_type&
338integral_range_t<I>::operator+=(difference_type n)
340 LASS_ASSERT((step_ > 0) ? (first_ + n * step_ <= last_) : (first_ + n * step_ >= last_));
346template <
typename I>
inline
347typename integral_range_t<I>::self_type&
348integral_range_t<I>::operator-=(difference_type n)
355template <
typename I>
inline
356typename integral_range_t<I>::self_type
357integral_range_t<I>::operator+(difference_type n)
const
359 self_type temp(*
this);
366template <
typename I>
inline
367typename integral_range_t<I>::self_type
368integral_range_t<I>::operator-(difference_type n)
const
370 self_type temp(*
this);
377template <
typename I>
inline
378const typename integral_range_t<I>::size_type
379integral_range_t<I>::size()
const
381 LASS_ASSERT((last_ - first_) % step_ == 0);
382 return static_cast<size_type
>((last_ - first_) / step_);
387template <
typename I>
inline
388const bool integral_range_t<I>::empty()
const
390 return first_ == last_;
395template <
typename I>
inline
396const bool integral_range_t<I>::operator!()
const
403template <
typename I>
inline
404integral_range_t<I>::operator bool()
const
412void integral_range_t<I>::swap(self_type& other)
414 std::swap(first_, other.first_);
415 std::swap(last_, other.last_);
416 std::swap(step_, other.step_);
421template <
typename I>
inline
424 return integral_range_t<I>(last);
429template <
typename I>
inline
432 return integral_range_t<I>(first, last);
437template <
typename I>
inline
438integral_range_t<I>
integral_range(
const I& first,
const I& last,
const I& step)
440 return integral_range_t<I>(first, last, step);
445template <
typename I>
inline
446bool operator==(
const integral_range_t<I>& a,
const integral_range_t<I>& b)
448 LASS_ASSERT(a.step_ == b.step_ && a.last_ == b.last_);
449 return a.first_ == b.first_;
454template <
typename I>
inline
455bool operator!=(
const integral_range_t<I>& a,
const integral_range_t<I>& b)
462template <
typename I>
inline
463bool operator<(
const integral_range_t<I>& a,
const integral_range_t<I>& b)
465 LASS_ASSERT(a.step_ == b.step_ && a.last_ == b.last_);
466 return a.first_ < b.first_;
471template <
typename I>
inline
472bool operator>(
const integral_range_t<I>& a,
const integral_range_t<I>& b)
479template <
typename I>
inline
480bool operator<=(
const integral_range_t<I>& a,
const integral_range_t<I>& b)
487template <
typename I>
inline
488bool operator>=(
const integral_range_t<I>& a,
const integral_range_t<I>& b)
lass extensions to the standard library
Library for Assembled Shared Sources.