[C++-sig] boost/python/slice.hpp

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu Jul 8 19:06:30 CEST 2004


--- Jonathan Brandmeyer <jbrandmeyer at earthlink.net> wrote:
> On Thu, 2004-07-08 at 12:32, Jonathan Brandmeyer wrote:
> > Since ret.stop is guaranteed to be a multiple of ret.step away from
> > ret.start, this statement should get it for you (the signs also work out
> > in the reverse case):
> > 
> > int size = (ret.stop - ret.start) / ret.step;
> 
> And since it is an inclusive range, make that:
> int size = (ret.stop - ret.start) / ret.step + 1;

I think this would make a very useful member function.
Ralf



	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 



More information about the Cplusplus-sig mailing list