default args for templates

Manu turkeyman at gmail.com
Fri Jan 17 04:18:27 PST 2014


Observing strange behaviour, just want to know if it's correct...

struct VertexBuffer(VertexDataType = void) {}

VertexBuffer x;
  Error: struct VertexBuffer(VertexDataType = void) is used as a type

auto y = VertexBuffer();
  Error: struct VertexBuffer(VertexDataType = void) cannot deduce template
function from argument types !()()

But this works:
VertexBuffer!() z;


Why should I need to supply an empty argument list? This defeats the
purpose of the default arg, and obscures my code in the common case.

Untyped vertex buffers are the default, and it would be nice to be able to
declare them trivially.

Also, those error messages are quite unhelpful.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140117/a615794d/attachment-0001.html>


More information about the Digitalmars-d mailing list