Eliminating code duplication for static/nonstatic functions
Vladimir Panteleev
vladimir at thecybershadow.net
Sat Sep 21 08:18:09 PDT 2013
On Thursday, 19 September 2013 at 17:10:43 UTC, Andrei
Alexandrescu wrote:
> Consider a struct that may or may not have state depending on a
> type parameter:
I would like to note that this problem is a specific case of the
general problem of changing a function's signature based on a
compile-time value. The same problem exists with other
attributes, and varying the presence of a template or function
parameter. One example was that I wanted to define an overload
set of function templates, where in some overloads, some
parameters were function parameters, and in other overloads, the
same parameters were template parameters (there was a significant
optimization opportunity when the parameters were known at
compile-time).
More information about the Digitalmars-d
mailing list