Guilherme Vieira <[email protected]> wrote:

@Walter: would it be hard/impossible for the compiler to look at memoize and
tell it exhibits pure behavior and is, thus, pure?

The simplest solution is this:

template memoize( alias fn ) {
    static if ( isPure!fn ) {
        pure auto memoize( ParameterTypeTuple!fn ) {
            // Blah!
        }
    } else {
        auto memoize( ParameterTypeTuple!fn ) {
            // Blah!
        }

    }
}


--
Simen

Reply via email to