Hi,
what i'm trying to do is:
/////////////// Code Start
template <class TType, int* p = 0>
class Template
{
public:
Template<TType, p>() {};
};
/////////////// Code End
That works on Visual Studio 2005, but doesn't work on mingw 5.1.4 and
comeau.
They both says:
mingw:
could not convert template argument `0' to `int*
comeau:
argument of type "int" is incompatible with template parameter of type
"int *"
template <class TType, int* p = 0>
^
so the problem is quite clear, it seems there's no an acceptable
conversion from int to int*
But if i try to do something like that:
/////////////// Code Start
#define zero (int*)0
template <class TType, int* p = zero>
class Template
{
public:
Template<TType, p>() {};
};
/////////////// Code End
Now, that works on comeau, but still doesn't work with mingw.
My questions:
1] Why is that illegal?
2] How can solve this problem?
Many thanks,
--
Clyde
what i'm trying to do is:
/////////////// Code Start
template <class TType, int* p = 0>
class Template
{
public:
Template<TType, p>() {};
};
/////////////// Code End
That works on Visual Studio 2005, but doesn't work on mingw 5.1.4 and
comeau.
They both says:
mingw:
could not convert template argument `0' to `int*
comeau:
argument of type "int" is incompatible with template parameter of type
"int *"
template <class TType, int* p = 0>
^
so the problem is quite clear, it seems there's no an acceptable
conversion from int to int*
But if i try to do something like that:
/////////////// Code Start
#define zero (int*)0
template <class TType, int* p = zero>
class Template
{
public:
Template<TType, p>() {};
};
/////////////// Code End
Now, that works on comeau, but still doesn't work with mingw.
My questions:
1] Why is that illegal?
2] How can solve this problem?
Many thanks,
--
Clyde
Comment