Adding UDA at compile time

Alex Parrill via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 26 07:00:58 PDT 2015


On Wednesday, 26 August 2015 at 08:19:04 UTC, Andrea Fontana 
wrote:
> I wonder if there's a way to add UDA to functions at 
> compile-time (so I can read later from other parts of 
> application).
>
> Andrea

What do you mean? UDAs are already specified at compile time.


	@("hello")
	void foo() {
		
	}

	static assert(__traits(getAttributes, foo)[0] == "hello");



More information about the Digitalmars-d-learn mailing list