On Thu, 21 Aug 2014 05:39:14 +0000 Shachar via Digitalmars-d-learn <digitalmars-d-learn@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.
signature.asc
Description: PGP signature