digitalmars.D.learn - How to specify an exact template?
- solidstate1991 (5/5) Jan 16 2021 Here's the following line, among many others:
- solidstate1991 (4/9) Jan 16 2021 Forgot to link the code example:
- Tove (4/15) Jan 16 2021 probably you can use
- solidstate1991 (3/5) Jan 16 2021 I don't know how to use it with functions outside of
- Tove (7/12) Jan 16 2021 void foo() {}
- solidstate1991 (4/4) Jan 16 2021 Well, it's quite complicated to do. I have to manually unwrap
Here's the following line, among many others: return &alphaBlend32bitMV!(ubyte); This generates an error, as this function template matches two instances, but currently I don't know how to choose the one I need, other than write a local function, that looks a bit ugly.
Jan 16 2021
On Saturday, 16 January 2021 at 14:13:29 UTC, solidstate1991 wrote:Here's the following line, among many others: return &alphaBlend32bitMV!(ubyte); This generates an error, as this function template matches two instances, but currently I don't know how to choose the one I need, other than write a local function, that looks a bit ugly.Forgot to link the code example: https://github.com/ZILtoid1991/pixelperfectengine/blob/master/pixeperfectengine/src/PixelPerfectEngine/graphics/layers/base.d#L143
Jan 16 2021
On Saturday, 16 January 2021 at 14:14:57 UTC, solidstate1991 wrote:On Saturday, 16 January 2021 at 14:13:29 UTC, solidstate1991 wrote:probably you can use https://dlang.org/spec/traits.html#getOverloadsHere's the following line, among many others: return &alphaBlend32bitMV!(ubyte); This generates an error, as this function template matches two instances, but currently I don't know how to choose the one I need, other than write a local function, that looks a bit ugly.Forgot to link the code example: https://github.com/ZILtoid1991/pixelperfectengine/blob/master/pixeperfectengine/src/PixelPerfectEngine/graphics/layers/base.d#L143
Jan 16 2021
On Saturday, 16 January 2021 at 14:18:55 UTC, Tove wrote:probably you can use https://dlang.org/spec/traits.html#getOverloadsI don't know how to use it with functions outside of structs/classes.
Jan 16 2021
On Saturday, 16 January 2021 at 15:41:38 UTC, solidstate1991 wrote:On Saturday, 16 January 2021 at 14:18:55 UTC, Tove wrote:void foo() {} void foo(string i) {} static foreach(overload; __traits(getOverloads, mixin(__MODULE__), "foo")) pragma(msg, typeof(overload));probably you can use https://dlang.org/spec/traits.html#getOverloadsI don't know how to use it with functions outside of structs/classes.
Jan 16 2021
Well, it's quite complicated to do. I have to manually unwrap each and all function template, then pray for the compile-time optimization gods that they'll be inlined. This is so annoying, that I might issue a DIP...
Jan 16 2021