#include <picture.h>
Public Member Functions | |
irange (const int &first, const int &second, const int &last) | |
irange (const int &solevalue) | |
irange r(5); means that the range is just the single integer 5. | |
irange (const irange &other) | |
Conventional copy constructor. | |
irange & | operator= (const irange &other) |
Conventional assignment. | |
irange () | |
Instantiates range containing just the integer 0. | |
~irange () | |
Destructor. | |
int | length () |
Returns number of integers in the range. | |
int | operator[] (const int &i) const |
int | operator== (const irange &other) const |
Test for ranges identical. | |
int | operator!= (const irange &other) const |
Test for ranges different. | |
irange & | operator+= (const int &i) |
Example: irange r(0,2,10); r+=3; Then r is 3,5,7,9,11,13. | |
irange & | operator-= (const int &i) |
Other inc and dec operators are analogous to +=. |
iranges are used chiefly to index picture_of_ints and colour_picture_of_ints to define subimages.
|
irange r(0,1,7); means r represents the range of ints 0,1,2,3,4,5,6,7. Similarly, irange s(3,7,31); means s represents 3,7,11,15,19,23,27,31. |
|
Example: If we declared irange r(0,2,10); then the numbers in the range are 0,2,4,6,8,10 and r[3] equals 6. |