An annoying compile issue

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Oct 25 20:53:19 PDT 2015


On Monday, 26 October 2015 at 03:44:31 UTC, WhatMeWorry wrote:
> First, isn't Vector!(float,3) a template which creates a tuple 
> consisting of float, float, float; so aren't the argument types 
> identical?

I'm not familiar with the gl3n library so I'm not sure what their 
Vector is, but most D templates are not created from tuples and 
don't work that way.

Looking at the source, it indeed seems to be based on a static 
array rather than a tuple:
https://github.com/Dav1dde/gl3n/blob/master/gl3n/linalg.d#L49

---
  vt[dimension] vector; /// Holds all coordinates, length conforms 
dimension.
---

Which means there's no simple, built-in way to getting a tuple 
out of that. You could write one though, and recently there was a 
post about maybe putting that in Phobos, but it isn't there now.

> model = model.scale(size.x, size.y, 1.0f);

meh that's prolly what I'd do... unless you wanted to modify the 
library and add some expansion code to that vector type.


More information about the Digitalmars-d-learn mailing list