I'm trying to implement a template Vector and i would like to know if this is possible.

My current vector class is:

public class Vector(T, size_t size) {
    private T components[size];
}

And i would like to implement a property as this:

@property
public size_t length() const {
return Trait.ExpandFor(size, components, Function(+, (n, j))); // Kind of messy but you get my point.
}

instead of doing for(...) over a array i would like to make a trait that produce this code

return (x * x + y * y + z * z + ...)

Reply via email to