View previous topic :: View next topic |
Author |
Message |
WinerFresh
Joined: 03 Nov 2008 Posts: 5
|
Posted: Mon Jul 27, 2009 6:42 am Post subject: How to check type for table or hashtable type?? |
|
|
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 |
|
|
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Tue Jul 28, 2009 12:27 am Post subject: |
|
|
Which compiler, and what version, are you using? I can't reproduce the error here... _________________ Chris Nicholson-Sauls |
|
Back to top |
|
|
WinerFresh
Joined: 03 Nov 2008 Posts: 5
|
Posted: Wed Jul 29, 2009 10:32 am Post subject: |
|
|
I solved it. The error was only on prerelease gdc 0.25 20080312, using dmd 1.024 |
|
Back to top |
|
|
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Wed Jul 29, 2009 6:34 pm Post subject: |
|
|
Good deal. _________________ Chris Nicholson-Sauls |
|
Back to top |
|
|
|