On Thu, 17 Jan 2019 02:21:21 +, Steven O wrote:
> I want to create a heterogeneous collection of red-black trees, and I
> can't seem to figure out if it's possible.
RedBlackTree!int and RedBlackTree!string are entirely different types
(they just happen to be generated from the same template).
I want to create a heterogeneous collection of red-black trees,
and I can't seem to figure out if it's possible.
I can easily do:
import std.container.rbtree;
import std.typecons;
void main()
{
alias Rec_type = Tuple!(int, "x", int, "y", int, "z");
RedBlackTree!Rec_type[1] test;
}
Tha
On Tuesday, 15 January 2019 at 11:14:54 UTC, John Burton wrote:
As an example let's say I have a type 'Window' that represents
a win32 window. I'd like to be able to construct an instance of
the type with some optional parameters that default to some
reasonable settings and create the underlyin
On Thu, Jan 17, 2019 at 12:58:20AM +, Victor Porton via Digitalmars-d-learn
wrote:
> This way I would make data duplication (data files distributed with
> the source and the same data embedding as strings into my D sources).
[...]
You could use -J and string imports, perhaps?
In any case, if
This way I would make data duplication (data files distributed
with the source and the same data embedding as strings into my D
sources).
Note that the source is multilingual (I am currently working on a
multi-language bindings of a C library).
On Wednesday, 16 January 2019 at 23:29:45 UTC, Johan Engelen
wrote:
On Wednesday, 16 January 2019 at 22:10:14 UTC, Johan Engelen
wrote:
On Wednesday, 16 January 2019 at 17:36:31 UTC, Márcio Martins
wrote:
On Tuesday, 15 January 2019 at 22:51:15 UTC, Johan Engelen
wrote:
What platform are you o
On Wednesday, 16 January 2019 at 22:10:14 UTC, Johan Engelen
wrote:
On Wednesday, 16 January 2019 at 17:36:31 UTC, Márcio Martins
wrote:
On Tuesday, 15 January 2019 at 22:51:15 UTC, Johan Engelen
wrote:
What platform are you on?
Linux x64
OK, so that should work. What is your testcase? Try
Weird, the code does work in my program during startup, but when
I call the same function from Application.onShutdown it gets the
0 results.
Are the widgets destroyed before onShutdown?
Here's a stripped down version my Application subclass:
int
main (string[] args)
{
auto applicatio
On Wednesday, 16 January 2019 at 17:36:31 UTC, Márcio Martins
wrote:
On Tuesday, 15 January 2019 at 22:51:15 UTC, Johan Engelen
wrote:
What platform are you on?
Linux x64
OK, so that should work. What is your testcase? Try with
`-fxray-instruction-threshold=1` to also instrument small
func
On Wed, 16 Jan 2019 21:07:24 +, Victor Porton wrote:
> What is the rule for unittest which uses a file (containing example data
> for testing) available only in the source distribution, not in binary
> distribution?
>
> I am writing a library.
The easy way of doing things is to define a versi
On Wednesday, 16 January 2019 at 21:07:24 UTC, Victor Porton
wrote:
What is the rule for unittest which uses a file (containing
example data for testing) available only in the source
distribution, not in binary distribution?
I am writing a library.
The library has also a file main.d which is
On Wed, Jan 16, 2019 at 09:07:24PM +, Victor Porton via Digitalmars-d-learn
wrote:
> What is the rule for unittest which uses a file (containing example
> data for testing) available only in the source distribution, not in
> binary distribution?
>
> I am writing a library.
>
> The library ha
What is the rule for unittest which uses a file (containing
example data for testing) available only in the source
distribution, not in binary distribution?
I am writing a library.
The library has also a file main.d which is compiled only in DUB
"application" configuration (I use this configu
On Wednesday, 16 January 2019 at 19:59:02 UTC, Steven
Schveighoffer wrote:
I'm guessing it's a missed case in the compiler, and not
intentionally omitted.
-Steve
The workaround is quite silly. Seems like a parser issue.
---
pragma(mangle, "Foo")
extern(C) void foo();
mixin template T()
On 1/16/19 2:41 PM, Sebastiaan Koppe wrote:
While it is perfectly ok to define an extern(C) function in a function
method, I can't seem to get pragma(mangle, "...") on it to work.
---
pragma(mangle, "Foo") // Ok
extern(C) void foo();
void main() {
pragma(mangle, "Bar") // Error
On Wednesday, 16 January 2019 at 19:41:04 UTC, Sebastiaan Koppe
wrote:
While it is perfectly ok to define an extern(C) function in a
function method, I can't seem to get pragma(mangle, "...") on
it to work.
---
pragma(mangle, "Foo")// Ok
extern(C) void foo();
void main() {
pragma(mang
While it is perfectly ok to define an extern(C) function in a
function method, I can't seem to get pragma(mangle, "...") on it
to work.
---
pragma(mangle, "Foo")// Ok
extern(C) void foo();
void main() {
pragma(mangle, "Bar")// Error
extern(C) void bar();
}
---
Any idea why
On Wed, Jan 16, 2019 at 06:25:48PM +, bauss via Digitalmars-d-learn wrote:
[...]
> I'm aware of how to do it manually as I already stated I went with a
> similar approach.
>
> There should just be something standard for it and uniq should have an
> overload or something that allows for another
On Wednesday, 16 January 2019 at 18:20:57 UTC, H. S. Teoh wrote:
T
I'm aware of how to do it manually as I already stated I went
with a similar approach.
There should just be something standard for it and uniq should
have an overload or something that allows for another behavior
that does
De-duplicating a range that's not necessarily sorted seems to be a
pretty common task, so here's a generic function for whoever else might
want to do this:
import std.range.primitives;
auto deduplicate(R)(R range)
if (isInputRange!R)
{
impor
On Wed, Jan 16, 2019 at 04:37:21PM +, bauss via Digitalmars-d-learn wrote:
> On Wednesday, 16 January 2019 at 16:35:04 UTC, H. S. Teoh wrote:
[...]
> > It's not trivial. In order for the computer to know whether or not
> > the i'th element should be excluded, it needs to know what has come
> >
On Wednesday, 16 January 2019 at 17:28:14 UTC, Alex wrote:
On Wednesday, 16 January 2019 at 16:52:50 UTC, bauss wrote:
The problem with sorting is that the following:
[3,5,6,6,2,1,2,5,3]
will then become
[1,2,3,5,6]
or
[6,5,3,2,1]
and not:
[3,5,6,2,1]
which would be what you'd wanna use
On Tuesday, 15 January 2019 at 22:51:15 UTC, Johan Engelen wrote:
What platform are you on?
Linux x64
On Wed, 16 Jan 2019 12:01:06 -0500, Steven Schveighoffer wrote:
> It was 2.068 that removed the HiddenFuncError, and made this a compile
> error instead. If your compiler is that or newer, definitely file a bug
> report.
Oh god, that must have been awful. I'm glad we're no longer in those
benight
On Wednesday, 16 January 2019 at 16:52:50 UTC, bauss wrote:
The problem with sorting is that the following:
[3,5,6,6,2,1,2,5,3]
will then become
[1,2,3,5,6]
or
[6,5,3,2,1]
and not:
[3,5,6,2,1]
which would be what you'd wanna use in some situations.
The important thing to know here is tha
On Wednesday, 16 January 2019 at 17:01:06 UTC, Steven
Schveighoffer wrote:
On 1/14/19 2:30 PM, Neia Neutuladh wrote:
On Mon, 14 Jan 2019 09:10:39 +, Vijay Nayar wrote:
a.foo(1); // issues runtime error (instead of calling
A.foo(int))
Calling the function doesn't issue any sort of e
On 1/14/19 2:30 PM, Neia Neutuladh wrote:
On Mon, 14 Jan 2019 09:10:39 +, Vijay Nayar wrote:
a.foo(1); // issues runtime error (instead of calling
A.foo(int))
Calling the function doesn't issue any sort of error. Overriding one
overload without overloading or explicitly aliasing in
On Wednesday, 16 January 2019 at 16:40:34 UTC, Alex wrote:
On Wednesday, 16 January 2019 at 16:21:12 UTC, bauss wrote:
On Wednesday, 16 January 2019 at 16:12:28 UTC, H. S. Teoh
wrote:
On Wed, Jan 16, 2019 at 03:57:49PM +, bauss via
Digitalmars-d-learn wrote:
Is there a way to achieve the f
On Wednesday, 16 January 2019 at 16:21:12 UTC, bauss wrote:
On Wednesday, 16 January 2019 at 16:12:28 UTC, H. S. Teoh wrote:
On Wed, Jan 16, 2019 at 03:57:49PM +, bauss via
Digitalmars-d-learn wrote:
Is there a way to achieve the following:
[...]
enum Foo : string
{
a = "aa",
b =
On Wednesday, 16 January 2019 at 16:35:04 UTC, H. S. Teoh wrote:
On Wed, Jan 16, 2019 at 04:21:12PM +, bauss via
Digitalmars-d-learn wrote:
On Wednesday, 16 January 2019 at 16:12:28 UTC, H. S. Teoh
wrote:
[...]
> .uniq only works on adjacent identical elements. You should
> sort your arra
On Wed, Jan 16, 2019 at 04:21:12PM +, bauss via Digitalmars-d-learn wrote:
> On Wednesday, 16 January 2019 at 16:12:28 UTC, H. S. Teoh wrote:
[...]
> > .uniq only works on adjacent identical elements. You should sort
> > your array first.
> >
> > If you need to preserve the original order but
On Wednesday, 16 January 2019 at 16:12:28 UTC, H. S. Teoh wrote:
On Wed, Jan 16, 2019 at 03:57:49PM +, bauss via
Digitalmars-d-learn wrote:
Is there a way to achieve the following:
[...]
enum Foo : string
{
a = "aa",
b = "bb",
c = "cc"
}
void main()
{
auto a = [Foo.a, Foo.
On Wed, Jan 16, 2019 at 03:57:49PM +, bauss via Digitalmars-d-learn wrote:
> Is there a way to achieve the following:
[...]
> enum Foo : string
> {
> a = "aa",
> b = "bb",
> c = "cc"
> }
>
> void main()
> {
> auto a = [Foo.a, Foo.b, Foo.a, Foo.b, Foo.c];
>
> auto b = a.uni
Is there a way to achieve the following:
import std.stdio;
import std.algorithm : uniq;
import std.array : array;
enum Foo : string
{
a = "aa",
b = "bb",
c = "cc"
}
void main()
{
auto a = [Foo.a, Foo.b, Foo.a, Foo.b, Foo.c];
auto b = a.uniq;
writeln(b);
// Expecte
On Tuesday, 15 January 2019 at 11:14:54 UTC, John Burton wrote:
auto window = Window(title = "My Window", width = 1000,
fullscreen = true);
In this particular case I would make the constructor take 3
parameters - title, width and height. Full screen is a rare
functionality and shouldn't clutt
On Wednesday, 16 January 2019 at 11:21:53 UTC, Dukc wrote:
On Tuesday, 15 January 2019 at 11:14:54 UTC, John Burton wrote:
This is ok, but I'm not so keen on separating the creation and
construction like this.
Is there a better way that's not ugly?
You can make the constructor a template that
On Tuesday, 15 January 2019 at 11:14:54 UTC, John Burton wrote:
auto window = Window();
window.title = "My Window";
window.width = 1000;
window.create();
You can slightly modify it to the way APIs like DirectX or Vulkan
do it.
auto windowinfo = WindowInfo();
windowinfo.title = "My Window";
On Wednesday, 16 January 2019 at 11:21:53 UTC, Dukc wrote:
a template that takes a single struct of arbitrary,
meant "of arbitrary type"
On Tuesday, 15 January 2019 at 11:14:54 UTC, John Burton wrote:
This is ok, but I'm not so keen on separating the creation and
construction like this.
Is there a better way that's not ugly?
You can make the constructor a template that takes a single
struct of arbitrary, and inspects (at compi
39 matches
Mail list logo