FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to check type for table or hashtable type??

 
Post new topic   Reply to topic     Forum Index -> General
View previous topic :: View next topic  
Author Message
WinerFresh



Joined: 03 Nov 2008
Posts: 5

PostPosted: Mon Jul 27, 2009 6:42 am    Post subject: How to check type for table or hashtable type?? Reply with quote

I've got that code:
Code:

template isTab( T : T[] ) {
   const bool isTab = true;
}
template isTab( T : T[U], U /*: char[]*/ ) {
   const bool isTab = true;
}
template isTab( T ){
   const bool isTab = false;
}

And when I trying to check something like that:
Code:

int[char[]] tab;
static if( isTab!(typeof(tab))
 // blablabla...

I've got:
Code:
./test.d:20: template instance isTab!(int[wchar[]]) matches more than one template declaration, isTab(T : T[U],U) and isTab(T)
./test.d:20: Error: expression isTab!(int[wchar[]]) is not constant or does not evaluate to a bool

WTF??
Back to top
View user's profile Send private message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Tue Jul 28, 2009 12:27 am    Post subject: Reply with quote

Which compiler, and what version, are you using? I can't reproduce the error here...
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
WinerFresh



Joined: 03 Nov 2008
Posts: 5

PostPosted: Wed Jul 29, 2009 10:32 am    Post subject: Reply with quote

I solved it. The error was only on prerelease gdc 0.25 20080312, using dmd 1.024
Back to top
View user's profile Send private message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Wed Jul 29, 2009 6:34 pm    Post subject: Reply with quote

Good deal.
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> General All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group