So, User-Defined Attributes
Jacob Carlborg
doob at me.com
Sun Jan 6 03:37:53 PST 2013
On 2013-01-06 10:48, Philippe Sigaud wrote:
> Walter, what is the official way to return an attributed value?
>
> XXX? foo()
> {
> @Marked int i;
> return i;
> }
Don't know if this is what you want but:
struct Marked {}
struct Attrs (T...) {}
auto bar ()
{
@Marked int i;
return Attrs!(__traits(getAttributes, i))();
}
void main ()
{
writeln(bar()); // prints Attrs!(Marked)()
}
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list