digitalmars.D - Concatenating Tuples
- dsimcha (4/4) Oct 14 2008 Is there a way to concatenate tuples at compile time in D2? The obvious...
- BCS (6/12) Oct 14 2008 just put them side by side.
- dsimcha (4/16) Oct 14 2008 Sorry for the poorly worded question. What you suggested would work for...
- BCS (2/21) Oct 14 2008 That should work there as well, if it dosn't work, it's a bug. (I think)...
- dsimcha (3/24) Oct 14 2008 Sorry, you're right. My bad. I thought I already had tried this and it...
- dsimcha (21/45) Oct 14 2008 Ok, now I know why this has been so weird. Looks like we do have a legi...
- Jarrett Billingsley (2/12) Oct 15 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1670
Is there a way to concatenate tuples at compile time in D2? The obvious ~ operator doesn't work on tuples. Also, while I'm at it, maybe there's a better way to achieve my end goal here. Is there a way to get a tuple representation of a class object that includes the stuff from the base classes?
Oct 14 2008
Reply to dsimcha,Is there a way to concatenate tuples at compile time in D2? The obvious ~ operator doesn't work on tuples. Also, while I'm at it, maybe there's a better way to achieve my end goal here. Is there a way to get a tuple representation of a class object that includes the stuff from the base classes?just put them side by side. template Tpl(T...) { alias T Tpl; } alias Tpl!(a,b,c) A; alias Tpl!(d,e,f) B; alias Tpl!(A,B) C;
Oct 14 2008
== Quote from BCS (ao pathlink.com)'s articleReply to dsimcha,Sorry for the poorly worded question. What you suggested would work for type tuples. I'm looking for a way to do this for value tuples, i.e. the kind you would get from Object.tupleof.Is there a way to concatenate tuples at compile time in D2? The obvious ~ operator doesn't work on tuples. Also, while I'm at it, maybe there's a better way to achieve my end goal here. Is there a way to get a tuple representation of a class object that includes the stuff from the base classes?just put them side by side. template Tpl(T...) { alias T Tpl; } alias Tpl!(a,b,c) A; alias Tpl!(d,e,f) B; alias Tpl!(A,B) C;
Oct 14 2008
Reply to dsimcha,== Quote from BCS (ao pathlink.com)'s articleThat should work there as well, if it dosn't work, it's a bug. (I think).Reply to dsimcha,Sorry for the poorly worded question. What you suggested would work for type tuples. I'm looking for a way to do this for value tuples, i.e. the kind you would get from Object.tupleof.Is there a way to concatenate tuples at compile time in D2? The obvious ~ operator doesn't work on tuples. Also, while I'm at it, maybe there's a better way to achieve my end goal here. Is there a way to get a tuple representation of a class object that includes the stuff from the base classes?just put them side by side. template Tpl(T...) { alias T Tpl; } alias Tpl!(a,b,c) A; alias Tpl!(d,e,f) B; alias Tpl!(A,B) C;
Oct 14 2008
== Quote from BCS (ao pathlink.com)'s articleReply to dsimcha,Sorry, you're right. My bad. I thought I already had tried this and it didn't work but I guess not. Seems to work now.== Quote from BCS (ao pathlink.com)'s articleThat should work there as well, if it dosn't work, it's a bug. (I think).Reply to dsimcha,Sorry for the poorly worded question. What you suggested would work for type tuples. I'm looking for a way to do this for value tuples, i.e. the kind you would get from Object.tupleof.Is there a way to concatenate tuples at compile time in D2? The obvious ~ operator doesn't work on tuples. Also, while I'm at it, maybe there's a better way to achieve my end goal here. Is there a way to get a tuple representation of a class object that includes the stuff from the base classes?just put them side by side. template Tpl(T...) { alias T Tpl; } alias Tpl!(a,b,c) A; alias Tpl!(d,e,f) B; alias Tpl!(A,B) C;
Oct 14 2008
== Quote from dsimcha (dsimcha yahoo.com)'s article== Quote from BCS (ao pathlink.com)'s articleOk, now I know why this has been so weird. Looks like we do have a legit bug here. Your suggestion works in the toy case, but not in my actual use case. I'll file this in Bugzilla if someone else hasn't found it already. //The following works. import std.stdio, std.typetuple; void main() { auto foo = TypeTuple!("1 ", "2 "); auto bar = TypeTuple!("3"); writeln(TypeTuple!(foo, bar)); } //The following doesn't work. import std.stdio, std.typetuple; void main() { auto foo = new Foo; writeln(TypeTuple!(foo.tupleof)); } Error messages: D:\code\test\test3.d|13|Error: tuple is not a valid template value argument| E:\dmd\bin\..\src\phobos\std\typetuple.d|13|template instance std.typetuple.TypeTuple!(tuple((Foo).a)) error instantiating|Reply to dsimcha,Sorry, you're right. My bad. I thought I already had tried this and it didn't work but I guess not. Seems to work now.== Quote from BCS (ao pathlink.com)'s articleThat should work there as well, if it dosn't work, it's a bug. (I think).Reply to dsimcha,Sorry for the poorly worded question. What you suggested would work for type tuples. I'm looking for a way to do this for value tuples, i.e. the kind you would get from Object.tupleof.Is there a way to concatenate tuples at compile time in D2? The obvious ~ operator doesn't work on tuples. Also, while I'm at it, maybe there's a better way to achieve my end goal here. Is there a way to get a tuple representation of a class object that includes the stuff from the base classes?just put them side by side. template Tpl(T...) { alias T Tpl; } alias Tpl!(a,b,c) A; alias Tpl!(d,e,f) B; alias Tpl!(A,B) C;
Oct 14 2008
On Wed, Oct 15, 2008 at 12:05 AM, dsimcha <dsimcha yahoo.com> wrote://The following doesn't work. import std.stdio, std.typetuple; void main() { auto foo = new Foo; writeln(TypeTuple!(foo.tupleof)); } Error messages: D:\code\test\test3.d|13|Error: tuple is not a valid template value argument| E:\dmd\bin\..\src\phobos\std\typetuple.d|13|template instance std.typetuple.TypeTuple!(tuple((Foo).a)) error instantiating|http://d.puremagic.com/issues/show_bug.cgi?id=1670
Oct 15 2008