Re: How to obtain certain traits of delegates returned by functions in template constraints?

2013-12-14 Thread DoctorCaptain
Most uses of the 'is expression' allows using a specifier to name the entity that matched. So, inserting ReturnedDelegate in your '== delegate' line gives the name ReturnedDelegate to the delegate. That name can be used further: template exT(T, alias nextGen) if ( // Ensure next

How to obtain certain traits of delegates returned by functions in template constraints?

2013-12-14 Thread DoctorCaptain
My question is hopefully short and straightforward to answer, but it's also a two-parter. I am working on a template that generates a function that implements an algorithm using several helper functions that are provided to the template by the user. I would like to add constraints to the temp

Re: Problem: Cannot create class out of nothing using witchcraft

2013-10-16 Thread DoctorCaptain
AWW you posted that while I was writing my latest novel. So T[i] doesn't work? I guess I shouldn't have opened my eyes this morning. In any case, typeof() DOES work, so as long as there is a way to extract the type, we're good. I am extremely pleased it's actually possible to get individual d

Re: Problem: Cannot create class out of nothing using witchcraft

2013-10-16 Thread DoctorCaptain
On Wednesday, 16 October 2013 at 18:47:25 UTC, Benjamin Thaut wrote: Am 16.10.2013 16:08, schrieb Benjamin Thaut: Am 16.10.2013 10:40, schrieb DoctorCaptain: http://dpaste.dzfl.pl/07b20d75 Note the use of typeof() to get the type of the elements at each index of members, to generate a type

Re: Problem: Cannot create class out of nothing using witchcraft

2013-10-16 Thread DoctorCaptain
On Wednesday, 16 October 2013 at 14:08:52 UTC, Benjamin Thaut wrote: Am 16.10.2013 10:40, schrieb DoctorCaptain: http://dpaste.dzfl.pl/07b20d75 Note the use of typeof() to get the type of the elements at each index of members, to generate a type on which a constructor can be called to

Re: Problem: Cannot create class out of nothing using witchcraft

2013-10-16 Thread DoctorCaptain
On Wednesday, 16 October 2013 at 06:09:48 UTC, Benjamin Thaut wrote: Am 16.10.2013 03:17, schrieb DoctorCaptain: I've gotten extremely close. The DPaste link that follows demonstrates three different templates: ... So is there any reason why you still pass the variadic arguments t

Re: Problem: Cannot create class out of nothing using witchcraft

2013-10-15 Thread DoctorCaptain
I've gotten extremely close. The DPaste link that follows demonstrates three different templates: The first template is capable of generating the string for and mixing in the definition of a class that has a single arbitrary argument. An object of that class is instantiated, and its printSelf

Re: Problem: Cannot create class out of nothing using witchcraft

2013-10-15 Thread DoctorCaptain
I missed an extremely critical point. The working example with the single arbitrary template instantiation as a data member of the generated class, http://dpaste.dzfl.pl/6d618af9 , has the template instantiation aliases inside of main, meaning the alias is NOT within the scope of GrabBagT, but

Re: Problem: Cannot create class out of nothing using witchcraft

2013-10-15 Thread DoctorCaptain
On Tuesday, 15 October 2013 at 13:14:46 UTC, Benjamin Thaut wrote: Your going way to complicated by actually passing the variadic arguments to the generator function. If you don't pass the variadic arguments to the generator function its way simpler and also works ;-) http://dpaste.dzfl.pl/59

Re: Problem: Cannot create class out of nothing using witchcraft

2013-10-15 Thread DoctorCaptain
Fixing links: If the template I am trying to instantiate IS NOT variadic, and I pass in an alias of an instantiated template, then the receiving template has all of the type information it needs. Example: dpaste.dzfl.pl/6d618af9 http://dpaste.dzfl.pl/6d618af9 If the template I am trying to

Problem: Cannot create class out of nothing using witchcraft

2013-10-15 Thread DoctorCaptain
dmd v2.063.2 Hi there! I'm terribly hopeful that you're more interested in the problem at hand than my choice of title. I've been using D for a while as my language of choice for various projects here and there, and I've recently discovered that template programming is magic. This is good. As pa