Templates class member functions not conditional?

monarch_dodra monarchdodra at gmail.com
Tue Sep 11 10:37:02 PDT 2012


On Tuesday, 11 September 2012 at 10:51:35 UTC, monarch_dodra
wrote:
> [SNIP]

One of my gripes was that the static if creates a new block,
which brakes a struct/class's natural flow. The code gets
indented, the DDoc gets placed further away from the function's
name, teh condition gets placed kind of far from the function's
name etc...

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.

I think I'll come to grips with this.


More information about the Digitalmars-d-learn mailing list