C
Christof Warlich
Hi,
can anyone tell why line 6 below gives the compilation error:
error: expected primary-expression before '>' token
Everything works fine if MemoryBlockSizes is replaced by a constant,
e.g. an int.
Thanks for any hint,
Christof
template<int i>
struct Loop {
template<typename MemoryBlockSizes>
static inline unsigned int index(unsigned int size) {
if(size <= MemoryBlockSizes::value) {
Loop<i-1>::index<MemoryBlockSizes>(size);
}
else {
return i;
}
}
};
template<>
struct Loop<0> {
template<typename MemoryBlockSizes>
static inline unsigned int index(unsigned int size){
if(size <= MemoryBlockSizes::value) {
return 0xffffffff;
}
else {
return 0;
}
}
};
can anyone tell why line 6 below gives the compilation error:
error: expected primary-expression before '>' token
Everything works fine if MemoryBlockSizes is replaced by a constant,
e.g. an int.
Thanks for any hint,
Christof
template<int i>
struct Loop {
template<typename MemoryBlockSizes>
static inline unsigned int index(unsigned int size) {
if(size <= MemoryBlockSizes::value) {
Loop<i-1>::index<MemoryBlockSizes>(size);
}
else {
return i;
}
}
};
template<>
struct Loop<0> {
template<typename MemoryBlockSizes>
static inline unsigned int index(unsigned int size){
if(size <= MemoryBlockSizes::value) {
return 0xffffffff;
}
else {
return 0;
}
}
};