N
nassim.bouayad.agha
Hello,
here is a code snippet showning my problem :
template<typename _K>
class TClass1
{
public:
void Process(const _K& arg) const
{
}
};
template<typename _I>
class TClass2
{
public:
void Process(const _I* & arg) const
{
_class1.Process(arg);
}
protected:
TClass1<_I*> _class1;
};
int main(int argc, char* argv[])
{
TClass2<int> test1;
int* ptr = new int;
test1.Process(ptr);
delete ptr;
return 0;
}
This code does not compile, I have got the following error message :
"cannot convert parameter 1 from 'const int *' to 'int *const & '"
Any idea?I have noted that if I declare _class1 as TClass1<const _I*>,
it is working...
Regards!
here is a code snippet showning my problem :
template<typename _K>
class TClass1
{
public:
void Process(const _K& arg) const
{
}
};
template<typename _I>
class TClass2
{
public:
void Process(const _I* & arg) const
{
_class1.Process(arg);
}
protected:
TClass1<_I*> _class1;
};
int main(int argc, char* argv[])
{
TClass2<int> test1;
int* ptr = new int;
test1.Process(ptr);
delete ptr;
return 0;
}
This code does not compile, I have got the following error message :
"cannot convert parameter 1 from 'const int *' to 'int *const & '"
Any idea?I have noted that if I declare _class1 as TClass1<const _I*>,
it is working...
Regards!