Getting Field Names of a specific UDA in compile time.
    Adam D. Ruppe 
    destructionator at gmail.com
       
    Sat Oct  3 14:00:30 UTC 2020
    
    
  
On Saturday, 3 October 2020 at 13:10:31 UTC, realhet wrote:
> I only managed to get the string[] by making a static foreach, 
> but I don't know how to put that in an enum xxx = ...; 
> statement.
There's always other ways but general rule: if you can get it one 
way, just wrap that up in a function and call that function for 
your enum initializer.
string[] your_function() {
      // implementation here you already have
      return it;
}
enum NodeNames = your_function();
Though with arrays btw `static immutable` tends to give better 
results than `enum` since it avoids extra allocations.
    
    
More information about the Digitalmars-d-learn
mailing list