Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-02-28 10:48:16


I think your stdex::integer class is the same as the counting_iterator in
the iterator adaptor library to be released soon. You can take a
look at it in CVS: /boost/boost/counting_iterator.hpp.

Cheers,
Jeremy

On Wed, 28 Feb 2001, Craig Hicks wrote:
hicks>
hicks> I wonder if something like stdex::integer already exists in the boost
hicks> library for just this purpose,
hicks> or if perhaps there is another containerless way which I couldn't see.
hicks>
hicks> Regards,
hicks>
hicks> Craig Hicks
hicks> KGK Ltd, Tokyo Japan
hicks>
hicks>
hicks>
hicks> namespace stdex
hicks> {
hicks>
hicks> struct integer
hicks> : public std::iterator <random_access_iterator_tag, int>
hicks> {
hicks> int i;
hicks> int& operator * () { return i; }
hicks> const int& operator * () const { return i; }
hicks>
hicks> integer& operator += (int n) { i+=n; return *this;}
hicks> integer& operator -= (int n) { i-=n; return *this;}
hicks>
hicks> integer operator + (int n) { integer s=*this; i+=n; return *this; }
hicks> integer operator - (int n) { integer s=*this; i-=n; return *this; }
hicks>
hicks> difference_type operator - (const integer& s) { return i-s.i; }
hicks>
hicks> integer& operator ++ () { ++i; return *this; } // pre
hicks> integer operator ++ (int) { integer s=*this; ++i; return s;} // post
hicks>
hicks> integer& operator -- () { --i; return *this; } // pre
hicks> integer operator -- (int) { integer s=*this; --i; return s;} // post
hicks>
hicks> integer& operator = (int n) { i=n; return *this; }
hicks>
hicks> integer(int n) : i(n) {}
hicks> integer(const integer& s) : i(s.i) {}
hicks> integer() : i(0) {}
hicks> };
hicks>
hicks> }
hicks>
hicks>
hicks>
hicks>
hicks>
hicks>
hicks> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
hicks>
hicks>
hicks>

----------------------------------------------------------------------
 Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk