can't use variadic template arg in dependent type
Larry Evans
cppljevans at cos-internet.com
Tue Jan 9 09:12:48 PST 2007
On 01/09/2007 03:15 AM, Daniel Keep wrote:
> Larry Evans wrote:
[snip]
> Ok, it took me a while, but I think I see what you're trying to do here.
> Have you tried something along these lines:
>
> > class A(Targs...)
> > {
> > private static alias Targs _Targs;
> > }
> >
> > void funA(Ttype)(in Ttype a)
> > {
> > alias Ttype._Targs Targs;
> > }
>
> If you really want to make sure that it's an A!(Targs), you could try this:
>
> > static if( !is( A!(Targs) == Ttype ) )
> > static assert(false, "I can see through your clever deception!");
[snip]
> Hope this helps,
Yes. It helps. However, the reason I want'ed to do this
was to try and emulate the "trick" of using c++'s function
template overload resolution rules to determine if a type
was a member of an set of types, like boost's mpl::set.
However, even with your suggestion, I'm still unable to
do it. So far, what I've got is shown in the 1st attachemnt.
The 2nd attachment shows the compiler error.
This c++ "trick" was described on section 9.10 of the book
described here:
http://www.boost-consulting.com/metaprogramming-book.html
and the cloest c++ counterpart to what I'm trying to do
was posted in another message to this newsgroup:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=46428
The ultimate goal is to use a similar technique to
store the grammar productions to emulate spirit.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: set_proto.d
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20070109/8a9f4d39/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: set_proto-d.compilation
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20070109/8a9f4d39/attachment-0001.ksh>
More information about the Digitalmars-d
mailing list