On 02/11/2012 01:47 AM, bearophile wrote:
Timon Gehr:
I'm not sure what you are saying here.
I meant using something like this, instead of a template:
bool IsNumberWithError(T, string file=__FILE__, int line=__LINE__)() {
enum bool result = is( ...
if (!result)
__ctfeWriteln(file, "(", line, "): '", typeid(T), "' is not a
number.");
return result;
}
I consider pragma msg a superior solution for this specific case.
So does __ctfeWriteln.
I know, but I hope __ctfeWriteln will become __ctfeWrite or someone will write
a __ctfeWrite too. See the pull request for discussions about this. Having no
way to avoid the ending newline is awful, it forces me to build large strings
with appends and print them all at once instead of using just a series or
writes. Not having an ending newline was my first requirement for an acceptable
compile-time printing function.
Bye,
bearophile
I agree and don't think there are any valid counter-arguments.