I'd like to thank everyone for their help! I was finally able to
do what I'd like. I didn't end up using a variant, but maybe
there's a better way to do what I want using it, and I just
couldn't figure it out.
Here's the solution I finally came up with:
https://run.dlang.io/is/GdDDBp
If
On Thursday, 17 January 2019 at 02:21:21 UTC, Steven O wrote:
void main()
{
alias Rec_type = Tuple!(int, "x", int, "y", int, "z");
RedBlackTree!Rec_type[1] test;
}
alias Rec_type1 = Tuple!(int, "x", int, "y", int, "z");
alias Rec_type2 = Tuple!(int, "x", int, "y", string, "z");
On Friday, 18 January 2019 at 15:07:41 UTC, Steven Schveighoffer
wrote:
On 1/18/19 9:58 AM, Alex wrote:
On Friday, 18 January 2019 at 13:31:28 UTC, Steven
Schveighoffer wrote:
[...]
In this case, I would say Phobos lacks an appropriate
interface definition, what do you think?
But what is
On 1/18/19 10:10 AM, Neia Neutuladh wrote:
On Fri, 18 Jan 2019 10:07:41 -0500, Steven Schveighoffer wrote:
But what is the common interface between those 2 types? Even in
Dcollections, where RedBlackTree came from, there was no interfaces that
didn't specify the type they were dealing with. In
On Fri, 18 Jan 2019 10:07:41 -0500, Steven Schveighoffer wrote:
> But what is the common interface between those 2 types? Even in
> Dcollections, where RedBlackTree came from, there was no interfaces that
> didn't specify the type they were dealing with. In other words, there is
> no common
On 1/18/19 9:58 AM, Alex wrote:
On Friday, 18 January 2019 at 13:31:28 UTC, Steven Schveighoffer wrote:
To answer the OP, what he wants is an array of different
RedBlackTrees. Since RedBlackTree is a class, his code is not far off
from something that works. This does compile, and produces an
On Friday, 18 January 2019 at 13:31:28 UTC, Steven Schveighoffer
wrote:
To answer the OP, what he wants is an array of different
RedBlackTrees. Since RedBlackTree is a class, his code is not
far off from something that works. This does compile, and
produces an Object[]:
auto arr = [
On 1/17/19 11:06 PM, Jonathan M Davis wrote:
On Thursday, January 17, 2019 1:21:41 AM MST Dukc via Digitalmars-d-learn
wrote:
On Thursday, 17 January 2019 at 02:27:20 UTC, Neia Neutuladh
wrote:
1. Make a wrapper class. Now you can store Object[], or you can
make a
base class or base interface
On Thursday, January 17, 2019 1:21:41 AM MST Dukc via Digitalmars-d-learn
wrote:
> On Thursday, 17 January 2019 at 02:27:20 UTC, Neia Neutuladh
>
> wrote:
> > 1. Make a wrapper class. Now you can store Object[], or you can
> > make a
> > base class or base interface and use that.
> > 2. Use
On Thursday, 17 January 2019 at 02:27:20 UTC, Neia Neutuladh
wrote:
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
On Thursday, 17 January 2019 at 02:27:20 UTC, Neia Neutuladh
wrote:
1. Make a wrapper class. Now you can store Object[], or you can
make a
base class or base interface and use that.
2. Use Variant, which can wrap anything, or the related
Algebraic, which
can wrap a fixed collection of types.
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
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;
}
13 matches
Mail list logo