X
xuatla
Hi,
When I compile the following test code I got a warning about implicit
typename. This happens in the member functions. Do you know the detail
reason and solution? Thanks.
- X
----------
test.cpp:29: warning: `cDerived<T>:
tr_type' is implicitly a typename
test.cpp:29: warning: implicit typename is deprecated, please see the
documentation for details
test.cpp:29: warning: `cDerived<T>:
tr_type' is implicitly a typename
test.cpp:29: warning: implicit typename is deprecated, please see the
documentation for details
-----------
// -- source code: test.cpp
#include <iostream>
using namespace std;
template <typename T>
class cBase
{
public:
typedef unsigned int size_type;
typedef T val_type;
typedef T* ptr_type;
public:
cBase()
{
// ...
} ;
} ;
template <class T>
class cDerived : public cBase<T>
{
public:
cDerived()
{
// ...
} ;
//line 28 here
ptr_type getMemory(ptr_type& p) // compiling warning: see above
{
return p;
} ;
} ;
int main()
{
cDerived<double>::size_type i = 0; // OK
cDerived<double>::val_type d = 0.1; // OK
cDerived<double>:
tr_type p = new double[10]; // OK
return 1;
}
When I compile the following test code I got a warning about implicit
typename. This happens in the member functions. Do you know the detail
reason and solution? Thanks.
- X
----------
test.cpp:29: warning: `cDerived<T>:
test.cpp:29: warning: implicit typename is deprecated, please see the
documentation for details
test.cpp:29: warning: `cDerived<T>:
test.cpp:29: warning: implicit typename is deprecated, please see the
documentation for details
-----------
// -- source code: test.cpp
#include <iostream>
using namespace std;
template <typename T>
class cBase
{
public:
typedef unsigned int size_type;
typedef T val_type;
typedef T* ptr_type;
public:
cBase()
{
// ...
} ;
} ;
template <class T>
class cDerived : public cBase<T>
{
public:
cDerived()
{
// ...
} ;
//line 28 here
ptr_type getMemory(ptr_type& p) // compiling warning: see above
{
return p;
} ;
} ;
int main()
{
cDerived<double>::size_type i = 0; // OK
cDerived<double>::val_type d = 0.1; // OK
cDerived<double>:
return 1;
}