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...
On Saturday, 16 January 2021 at 18:39:03 UTC, Marcone wrote:
For example, I want my function template to only accept integer
or string;
You can do that with either
- `static if` inside the body [1]
import std.traits;
void foo(T)(T t)
{
static if (isIntegral!T) {}
else static ass
On Saturday, 16 January 2021 at 18:39:03 UTC, Marcone wrote:
For example, I want my function template to only accept integer
or string;
There are different ways of doing that. I'd say this one is easy
to follow:
import std.stdio;
void print(T)(T entry) if(is(T==string) || is(T==int))
{
For example, I want my function template to only accept integer
or string;
On Saturday, 16 January 2021 at 15:41:38 UTC, solidstate1991
wrote:
On Saturday, 16 January 2021 at 14:18:55 UTC, Tove wrote:
probably you can use
https://dlang.org/spec/traits.html#getOverloads
I don't know how to use it with functions outside of
structs/classes.
void foo() {}
void foo(str
On Saturday, 16 January 2021 at 14:18:55 UTC, Tove wrote:
probably you can use
https://dlang.org/spec/traits.html#getOverloads
I don't know how to use it with functions outside of
structs/classes.
What you are describing sounds like regular reference counting.
All resources (i.e. windows) are pinned somewhere in memory. Its just
that you have to use special API's to destroy them rather than free.
On Saturday, 16 January 2021 at 14:14:57 UTC, solidstate1991
wrote:
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, bu
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 wr
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.
Is there any elegant/smart solution to reference counting
resources without ever freeing any objects?
When the ref hits 0 it should free some other resource that isn't
memory...
Resource[10] resources;
resources[3].inc; // 1 ref - 0->1 transition enable some feature
resources[3].dec; // 0 r
11 matches
Mail list logo