digitalmars.D - reason variadic templates
- cppljevans cox-internet.com (12/12) Oct 15 2005 Variadic templates would help implement:
- Sean Kelly (7/17) Oct 15 2005 I'm fairly certain that tuples can be implemented in D right now. I agr...
- Larry Evans (14/26) Nov 04 2005 Well, actually, what I was looking for was something like
- Larry Evans (5/9) Oct 01 2006 Doug Gregor patched g++ to implement variadic templates:
- Lionello Lunesu (10/19) Oct 01 2006 I'm not into metaprogramming, but I think this would be a great feature ...
- Bill Baxter (5/29) Oct 02 2006 That is pretty great.
Variadic templates would help implement: http://all-technology.com/eigenpolls/dwishlist/index.php?it=28 because each tuple type could be expressed as a template: tuple!(T1,T2,...,Tn) some_function(A1,A2,...,Am) where T1,..,Tn are the result types, and A1,...,Am are the argument types to some function, some_function. Thus, the dwishlist example above: int,int getPoint(); could be expressed: tuple!(int,int) getPoint(); boost tuple already has this: http://www.boost.org/libs/tuple/doc/tuple_users_guide.html#tuple_types
Oct 15 2005
In article <dir2ns$28pb$1 digitaldaemon.com>, cppljevans cox-internet.com says...Variadic templates would help implement: http://all-technology.com/eigenpolls/dwishlist/index.php?it=28 because each tuple type could be expressed as a template: tuple!(T1,T2,...,Tn) some_function(A1,A2,...,Am) where T1,..,Tn are the result types, and A1,...,Am are the argument types to some function, some_function. Thus, the dwishlist example above: int,int getPoint(); could be expressed: tuple!(int,int) getPoint();I'm fairly certain that tuples can be implemented in D right now. I agree that variadric templates would be a very nice feature however. This has come up in the past and Walter seemed to like the idea, so it will probably happen eventually. Sean
Oct 15 2005
On 10/15/2005 11:34 AM, Sean Kelly wrote:In article <dir2ns$28pb$1 digitaldaemon.com>, cppljevans cox-internet.com says...[snip]Well, actually, what I was looking for was something like boost's mpl::vector or mpl::list. Any tuple (or variant) could then be created with a combination of mpl::vector and mpl::fold. [snip]because each tuple type could be expressed as a template: tuple!(T1,T2,...,Tn) some_function(A1,A2,...,Am) where T1,..,Tn are the result types, and A1,...,Am are the argument types to some function, some_function.I'm fairly certain that tuples can be implemented in D right now. I agree thatDoes anybody have some sample code I could view?variadric templates would be a very nice feature however. This has come up in the past and Walter seemed to like the idea, so it will probably happen eventually.Can't wait. The way boost did it was with help of the Boost preprocessor library and, IIRC, some special class value to signal the end of valid template arguments. They also did some preprocessing to generate header files. Anyway, it was pretty confusing to me, and I thought if D had a better way, I'd be very happy!
Nov 04 2005
On 11/04/2005 08:03 AM, Larry Evans wrote: [snip]Doug Gregor patched g++ to implement variadic templates: http://archives.free.net.ph/message/20060926.213635.0a8fa8a2.en.html Maybe Doug's implementation would give Walter some howto ideas.variadric templates would be a very nice feature however. This has come up in the past and Walter seemed to like the idea, so it will probably happen eventually.
Oct 01 2006
"Larry Evans" <cppljevans cos-internet.com> wrote in message news:efokmo$1det$1 digitaldaemon.com...On 11/04/2005 08:03 AM, Larry Evans wrote: [snip]I'm not into metaprogramming, but I think this would be a great feature of D to pick up. Already I'm noticing some D templates doing the same copy-paste trick to get a template to accept any number of parameters (like in the S&S examples in the respective thread). IIRC the was another D template library that actually used a D program/script to generate its .d files for any number of parameters! Surely we can do better than that... L.Doug Gregor patched g++ to implement variadic templates: http://archives.free.net.ph/message/20060926.213635.0a8fa8a2.en.html Maybe Doug's implementation would give Walter some howto ideas.variadric templates would be a very nice feature however. This has come up in the past and Walter seemed to like the idea, so it will probably happen eventually.
Oct 01 2006
Lionello Lunesu wrote:"Larry Evans" <cppljevans cos-internet.com> wrote in message news:efokmo$1det$1 digitaldaemon.com...That is pretty great. Though I would prefer some sort of "static foreach" kind of construct rather than having to go purely functional to use the feature. --bbOn 11/04/2005 08:03 AM, Larry Evans wrote: [snip]I'm not into metaprogramming, but I think this would be a great feature of D to pick up. Already I'm noticing some D templates doing the same copy-paste trick to get a template to accept any number of parameters (like in the S&S examples in the respective thread). IIRC the was another D template library that actually used a D program/script to generate its .d files for any number of parameters! Surely we can do better than that... L.Doug Gregor patched g++ to implement variadic templates: http://archives.free.net.ph/message/20060926.213635.0a8fa8a2.en.html Maybe Doug's implementation would give Walter some howto ideas.variadric templates would be a very nice feature however. This has come up in the past and Walter seemed to like the idea, so it will probably happen eventually.
Oct 02 2006