onDispatch demo not compiling
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Aug 20 23:10:54 PDT 2014
On Thu, 21 Aug 2014 05:39:14 +0000
Shachar via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:
> auto onDispatch(string m, Args...)(Args args)
first: opDispatch, not onDispatch.
second: underscoresToCamelCase() can't be evaluated in compile-time
anymore. the necessary changes:
1. add 'import std.string' -- we need toUpper() from this module.
2. change toupper(c) to toUpper(c) (first thing why ctfe fails)
3. remove 'result.reserve(sym.length);' line (second thing why ctfe
fails).
4. uncomment 'return' in opDispatch. %-)
that will do the trick.
to check if underscoresToCamelCase() can be evaluated in compile time,
you can add this line to the first unittest block:
enum t = underscoresToCamelCase("hello_world");
then compiler will tell you why it can't evaluate the function.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20140821/d9ff14f1/attachment.sig>
More information about the Digitalmars-d-learn
mailing list