On Friday, 30 January 2015 at 07:13:09 UTC, Jeremy DeHaan wrote:
That seems strange. I figured that it would be smart enough to
deduce the parameter type based on the type that it was trying
to
be assigned to.
It seems sensible to me, as changing string to auto would leave
the type of the expression undefined. But maybe your expectation
is a reasonable enhancement, I'll leave it for someone more
knowledgeable than myself to judge.
That is good to hear. It seemed like that was the way it would
work, but I've never had to specify a default template parameter
type. I'm hoping to avoid having to specify a template
parameter,
but it seems like it can't be helped if users want to get their
string type as a wstring or dstring though.
It doesn't seem too bad to me. I used a similar pattern quite
recently to wrap glGetIntegeriv into gl.get!int. One way or
another you'll have to specify the type, but if you want to cut
down on redundant code then
auto ret = thing.getString!wchar;
is a good bet. And I'm fairly certain that since you're using a
default param of char,
auto ret = thing.getString;
should compile and result in ret being a char string.