Package: Sequence        GrAL: Packages | Concepts | Homepage

GrAL::sequence::integer_range< INT > Class Template Reference

Union of integer intervals. More...

#include </home/guntram/tmp/GrAL/sequence/include/Container/integer-range.h>

List of all members.

Public Types

typedef std::vector
< interval_type >
::const_iterator 
interval_iterator
 STL-compliant iterator.

Public Member Functions

 integer_range ()
 Construct empty range.
 integer_range (INT i)
 Construct range of single point.
 integer_range (interval_type iv)
 Construct range of single interval.
template<class IT >
 integer_range (IT b, IT e)
 Construct ouf of a range of elements.
bool empty () const
 True if no integer is contained.
void clear ()
 Set to empty range.
interval_iterator begin_interval () const
 First interval.
interval_iterator end_interval () const
 Past-the-end interval.
element_type low () const
 smallest element. The range is contained in [low(), high()]
element_type high () const
 largest element. The range is contained in [low(), high()]
const_iterator begin () const
const_iterator end () const
template<class IT >
void init (IT b, IT e)
 Initialize range with sequence of elements.
void push_back (element_type i)
 Add an element to the range.
bool contains (INT i) const
 True iff i is contained in an interval.
void read (std::istream &in)


Detailed Description

template<class INT>
class GrAL::sequence::integer_range< INT >

Union of integer intervals.

This class represents a set of integers, represented as a sequence of closed intervals. It main feature it the ability to read range descriptions like 6,8,10-33,40-100 via operator>>.

Definition at line 36 of file integer-range.h.


Member Function Documentation

template<class INT >
template<class IT >
void GrAL::sequence::integer_range< INT >::init ( IT  b,
IT  e 
) [inline]

Initialize range with sequence of elements.

The sequence [b,e[ may be unordered and contain duplicates.

Definition at line 153 of file integer-range.h.

References GrAL::sequence::sort_and_make_unique().

Referenced by GrAL::sequence::integer_range< INT >::integer_range().

template<class INT>
void GrAL::sequence::integer_range< INT >::push_back ( element_type  i  )  [inline]

Add an element to the range.

Precondition:
i > high()

Definition at line 104 of file integer-range.h.

References GrAL::sequence::integer_range< INT >::empty(), GrAL::sequence::integer_range< INT >::high(), and REQUIRE.


The documentation for this class was generated from the following file:

©  Guntram Berti 1997-2009. See the GrAL Homepage for up-to-date information.

Generated on Tue Mar 31 18:53:26 2009 for Sequence by doxygen 1.5.8