This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: template(s) declaration with GCC3.2-7
- From: "Rupert Wood" <me at rupey dot net>
- To: "'Rade Trimceski'" <rtrimces at mtu dot edu>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: Tue, 22 Apr 2003 17:44:16 +0100
- Subject: RE: template(s) declaration with GCC3.2-7
Rade Trimceski wrote:
> I'm trying to compile code that was written a while ago, and
> compiled just fine with gcc 2.96. GCC 3.2-7 doesn't like it at all.
:
> #include <list>
>
> template <class _Tp>
> class LsList : public list<_Tp> {
The newer C++ standards place the STL classes, list et al, inside the 'std'
namespace.
This means you can either address it in full:
class LsList : public std::list<_Tp> {
or import the elements you need from the std namespace:
#include <list>
using std::list;
or import the std namespace wholesale:
#include <list>
using namespace std;
In header files, I prefer the first since you're not polluting the global
namespace of source files that include the header. In C++ sources (.cpp,
.cc, etc.) I prefer the second form since it's more precise but lots just
use the third because it's simplest. But this is just a matter of style so
use whichever suits you.
Hope that helps,
Rup.