Enhanced C#
Language of your choice: library documentation

Documentation moved to ecsharp.net

GitHub doesn't support HTTP redirects, so you'll be redirected in 3 seconds.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public fields | Properties | Public Member Functions | List of all members
Loyc.Collections.RangeEnumerator< R, T > Struct Template Reference

Helper struct: enumerates through a forward range (IFRange{T}), calling the range methods through R instead of through IFRange{T}. More...


Source file:
Inheritance diagram for Loyc.Collections.RangeEnumerator< R, T >:

Remarks

Helper struct: enumerates through a forward range (IFRange{T}), calling the range methods through R instead of through IFRange{T}.

Although there is a ICloneable{R} constraint on R, it is currently worthless due to a limitation of C#. Since IFRange{T} already includes ICloneable(IFRange(T)), this structure cannot simply invoke Clone() directly because the compiler complains that Clone() is ambiguous. Consequently it is necessary to cast the range to ICloneable{R} just to clone it; if R is a value type then it is boxed, which defeats the entire performance advantage of calling ICloneable{R}.Clone() instead of ICloneable{IFRange{T}}.Clone.

Nevertheless, I have left the constraint in place, in the hope that EC# can eventually eliminate this limitation thanks to its "using" cast. Once EC# compiles directly to CIL, range(using ICloneable<R>).Clone() will not perform boxing.

Type Constraints
R :IFRange<T> 
R :ICloneable<R> 

Public fields

_range
 
_current
 

Properties

Current [get]
 
object
System.Collections.IEnumerator. 
Current [get]
 

Public Member Functions

 RangeEnumerator (R range)
 
bool MoveNext ()
 
void IDisposable. Dispose ()
 
void
System.Collections.IEnumerator. 
Reset ()