www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - errata on tuple webpage (both 1.0 and 2.0)

reply Navin Kumar <navinkumar+dlang gmail.com> writes:
Not sure where is the best place to note this, but on the webpages:
http://www.digitalmars.com/d/1.0/tuple.html and
http://www.digitalmars.com/d/2.0/tuple.html  there seems to be a mistake,

"alias Tuple!(float, float, 3) TP; // TP is now a tuple of two floats and 3"
"TP.length	// evaluates to 3"
"alias TP[0..length-1] TQ; // TQ is now the same as Tuple!(float, float)"

Shouldn't that be 0..length-2 ?  Seems like 0..length-1 wouldn't result in a
slice, but the entire tuple itself.
Mar 28 2010
parent Navin Kumar <navinkumar+dlang gmail.com> writes:
Nevermind, it is correct.  I misunderstood how ".." works.

Navin Kumar Wrote:

 Not sure where is the best place to note this, but on the webpages:
http://www.digitalmars.com/d/1.0/tuple.html and
http://www.digitalmars.com/d/2.0/tuple.html  there seems to be a mistake,
 
 "alias Tuple!(float, float, 3) TP; // TP is now a tuple of two floats and 3"
 "TP.length	// evaluates to 3"
 "alias TP[0..length-1] TQ; // TQ is now the same as Tuple!(float, float)"
 
 Shouldn't that be 0..length-2 ?  Seems like 0..length-1 wouldn't result in a
slice, but the entire tuple itself.
 

Mar 28 2010