On 07/26/2016 01:58 PM, ParticlePeter wrote:
On Tuesday, 26 July 2016 at 20:18:48 UTC, Steven Schveighoffer wrote:
...
void processMember( T, ignore... )() {
  foreach( member; __traits( allMembers, T )) { // this is a
compile-time list, so it's a static foreach.
    foreach(i, arg; ignore ){ // i is the index into the ignore tuple
      static if( arg == member ) break; // break out of the foreach
loop, need to ignore it.
      else static if(i + 1 == arg.length) // this is the last element!
      {
      // process member here, generate e.g. setter function as string
mixin
      }
    }
  }
}

There is one problem with this approach, ignore might be empty (I should
have mentioned it). Would you know a workaround for that case as well?

It should work for empty ignore. Can you show with a short example please.

Ali

Reply via email to