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
Properties | Public Member Functions | List of all members
Loyc.Collections.IBRange< out T > Interface Template Reference

A bidirectional range. Allows you to read or remove the first or last element in a range. More...


Source file:
Inheritance diagram for Loyc.Collections.IBRange< out T >:
Loyc.Collections.IFRange< out T > Loyc.ICloneable< out T > Loyc.ICloneable< out T > Loyc.Collections.IIsEmpty Loyc.Collections.IBRangeEx< R, T > Loyc.Collections.IMBRange< T > Loyc.Collections.IRange< out T > Loyc.Collections.IBRangeEx< T > Loyc.Collections.IRangeEx< R, T > Loyc.Collections.IMRange< T > Loyc.Collections.EmptyList< T > Loyc.Collections.IMRange< T > Loyc.Collections.IRangeEx< R, T > Loyc.Collections.ListSlice< T > Loyc.Collections.NegListSlice< T > Loyc.Collections.Repeated< T > Loyc.Collections.Slice_< T > Loyc.Collections.StringSlice

Remarks

A bidirectional range. Allows you to read or remove the first or last element in a range.

The bidirectional range interface is useful for supporting data structures such as doubly-linked lists that have a front and a back but no efficient access to the middle.

Please see IFRange{T} for general documentation about ranges.

Properties

Back [get]
 Returns the value of the last item in the range. More...
 
- Properties inherited from Loyc.Collections.IFRange< out T >
Front [get]
 Returns the first value in the range, without popping it. More...
 
- Properties inherited from Loyc.Collections.IIsEmpty
bool IsEmpty [get]
 

Public Member Functions

PopBack (out bool fail)
 Removes the last item from the range and returns it. More...
 
- Public Member Functions inherited from Loyc.Collections.IFRange< out T >
PopFront (out bool fail)
 Removes the first item from the range and returns it. More...
 
- Public Member Functions inherited from Loyc.ICloneable< out T >
Clone ()
 

Member Function Documentation

T Loyc.Collections.IBRange< out T >.PopBack ( out bool  fail)

Removes the last item from the range and returns it.

Parameters
failReceives the current value of IsEmpty.
Returns
The first item of the range, or default(T) if IsEmpty.

The remarks of IFRange{T}.PopFront apply to this method.

Implemented in Loyc.Collections.Repeated< T >, Loyc.Collections.ListSlice< T >, Loyc.Collections.EmptyList< T >, Loyc.Collections.StringSlice, Loyc.Collections.Slice_< T >, Loyc.Collections.ArraySlice< T >, and Loyc.Collections.NegListSlice< T >.

Property Documentation

T Loyc.Collections.IBRange< out T >.Back
get

Returns the value of the last item in the range.

Exceptions
EmptySequenceExceptionThe sequence is empty.

A reasonable default implementation:

T Back { get { return Range.PopBack(Clone()); } }