D-Programming-Language/phobos — pull request #555 by klickverbot (2012-04-28 16:57:54+00:00)
Title: std.traits: Add SetFunctionAttributes.

Currently, function/delegate types are quite hard to handle in D. For example, there is no easy way to add or remove attributes from functions in generic code (in situations like shown in the examples). Additionally, attributes can currently only specified in some declarations, but e.g. `cast(extern(C) void function())` does not compile.

The added template provides an easy solution for the former problem. I have been using it in various projects to implement things like `assumeNothrow(someDg)`, `ExternC`, etc. While it could be debatted if something like `assumePure` should be included in Phobos as well (like `assumeUnique`), I think this is a solid start in any case.