Templates class member functions not conditional?
Jonathan M Davis
jmdavisProg at gmx.com
Tue Sep 11 10:52:45 PDT 2012
On Tuesday, September 11, 2012 19:37:02 monarch_dodra wrote:
> However, when written like this:
>
> struct C(T)
> {
> private T val;
>
> // Gets front
> @property T front()
> {val = value;}
>
> //Writes to front
> static if(isAssignable!(T,T))
> @property void front(T value)
> {val = value;}
> }
>
> Then I think it reads alright.
Whereas I think that that hards readibility, because it hides the fact that a
static if is used. If you're submitting code for Phobos, please do something
like
static if(isAssignable!(T, T)) @property void front(T value) {val = value;}
or
static if(isAssignable!(T,T))
@property void front(T value) { value = value; }
rather than what you have above, otherwise it will harm maintainability.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list