 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
opb Guest
|
Posted: Sun Jun 05, 2005 4:14 pm Post subject: Partial template specialization |
|
|
Hi!
Why can I compile this in BuilderX, but not in BCB6?
And is there a solution to this?
template <typename T, unsigned int N>
class RefArray
{
RefArray<T,N>(T * pElements)
{
}
};
template <typename T>
class RefArray<T,1>
{
RefArray <T,1>(T* pElements)
{
}
};
|
|
| Back to top |
|
 |
Thomas Maeder [TeamB] Guest
|
Posted: Sun Jun 05, 2005 5:51 pm Post subject: Re: Partial template specialization |
|
|
"opb" <brunstad (AT) online (DOT) no> writes:
| Quote: | Why can I compile this in BuilderX, but not in BCB6?
|
It seems that a problem with non-type template parameters was fixed
from C++ Builder 6 to C++BuilderX.
| Quote: | And is there a solution to this?
template <typename T, unsigned int N
class RefArray
{
RefArray
{
}
};
template <typename T
class RefArray
{
RefArray
{
}
};
|
My first shot would be to try substituting the unsigned int parameter
by a type parameter. Something like:
template <unsigned int N>
struct IntToType
{
enum
{
value = N
};
};
template <typename T, typename IntToTypeInstance>
class RefArray
{
RefArray(T * pElements)
{
}
};
template <typename T>
class RefArray<T, IntToType<1> >
{
RefArray(T* pElements)
{
}
};
|
|
| Back to top |
|
 |
|
|
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
|
|