std.traits.set_function_attributes
- multiple declarations
- Template SetFunctionAttributes
- Alias SetFunctionAttributes
Template SetFunctionAttributes
Constructs a new function or delegate type with the same basic signature as the given one, but different attributes (including linkage).
This is especially useful for adding/removing attributes to/from types in generic code, where the actual type name cannot be spelt out.
Arguments
template SetFunctionAttributes(T, string linkage, uint attrs);
Parameters
Name | Description |
---|---|
T | The base type. |
linkage | The desired linkage of the result type. |
attrs | The desired FunctionAttributes of the result type. |
Example
alias ExternC(T) = SetFunctionAttributes!(T, "C", functionAttributes!T); auto assumePure(T)(T t) if (isFunctionPointer!T || isDelegate!T) { enum attrs = functionAttributes!T | FunctionAttribute.pure_; return cast(SetFunctionAttributes!(T, functionLinkage!T, attrs)) t; }
Alias SetFunctionAttributes
Constructs a new function or delegate type with the same basic signature as the given one, but different attributes (including linkage).
This is especially useful for adding/removing attributes to/from types in generic code, where the actual type name cannot be spelt out.
Declaration
alias SetFunctionAttributes(T, string linkage, uint attrs) = FunctionTypeOf!(SetFunctionAttributes!(T*,linkage,attrs))
;
Parameters
Name | Description |
---|---|
T | The base type. |
linkage | The desired linkage of the result type. |
attrs | The desired FunctionAttributes of the result type. |
Example
alias ExternC(T) = SetFunctionAttributes!(T, "C", functionAttributes!T); auto assumePure(T)(T t) if (isFunctionPointer!T || isDelegate!T) { enum attrs = functionAttributes!T | FunctionAttribute.pure_; return cast(SetFunctionAttributes!(T, functionLinkage!T, attrs)) t; }
Authors
Walter Bright,
Tomasz Stachowiak (
),
Andrei Alexandrescu,
Shin Fujishiro,
Robert Clipsham,
David Nadlinger,
Kenji Hara,
Shoichi Kato
isExpressions