cpp11-range icon indicating copy to clipboard operation
cpp11-range copied to clipboard

fix bug int/size_t

Open timocafe opened this issue 9 years ago • 0 comments

Hello,

I find a bug (not really I just improve). If you are doing a range like

std::size_t size(9999);
for(int i: range(0:size))
     //blablabla

This will not compile as size is uint64_t and 0 is an int. The compiler will complain because there are two type and range use only one.

I fix it using an identity struct from my past experience (http://stackoverflow.com/questions/26705581/operator-and-float-argument) Some more advance meta-programming may do the job, but I am not template guru.

Free to you to merge it, but at least in my version I fix it.

Best,

Tim

timocafe avatar Nov 23 '16 14:11 timocafe