How to capture a BitFlags type in a function parameter?

realhet real_het at hotmail.com
Sun Jan 31 14:04:00 UTC 2021


Hi,

I wan't to process every specialization of the BitFlags struct in 
a function:
So far the best I can come up is this:

   static void stdUI(F)(ref F flags) 
if(F.stringof.startsWith("BitFlags!(")){}

But it's obviously lame.
If I try this way:

   static void stdUI(E, U)(ref BitFlags!(E, U) flags){}

I get a cannot deduce arguments error.

Same error with:
   static void stdUI(E, U, B = BitFlags!(E, U))(ref B flags){}

I'd like to know the Enum type as well.

Thank You for your help in advance!




More information about the Digitalmars-d-learn mailing list