Standard C++ Template Library
I've two questions:
1) I wanted to use the following syntax:
std::vector<std::string> names;
This code causes 4 compiler warnings.
Whats wrong with this code?
2) Do you know a link to a good tutorial or article about the use of the c++ Standard Template Library?
The link at gamedev.net's articles doesn't work
Thank you for your help!
[edited by - Matheass on November 16, 2003 6:30:41 AM]
[edited by - Matheass on November 16, 2003 6:31:13 AM]
Have a read of this site, should help you get to grips with using the STL:
http://www.yrl.co.uk/~phil/stl/stl.htmlx
http://www.yrl.co.uk/~phil/stl/stl.htmlx
Hi,
I think it's the compiler... the statement is too long
try this:
using std::string;
using std::vector;
typedef vector < string > StrVector;
StrVector names;
names.push_back( "buck wheat" );
Hope this helps.... I think there are some switches to correct this problem... but I haven't used VC++ 6.0 in dog ages... so I can't remember
[edited by - vetroXL on November 16, 2003 7:16:28 AM]
[edited by - vetroXL on November 16, 2003 7:17:47 AM]
[edited by - vetroXL on November 16, 2003 7:18:20 AM]
I think it's the compiler... the statement is too long
try this:
using std::string;
using std::vector;
typedef vector < string > StrVector;
StrVector names;
names.push_back( "buck wheat" );
Hope this helps.... I think there are some switches to correct this problem... but I haven't used VC++ 6.0 in dog ages... so I can't remember
[edited by - vetroXL on November 16, 2003 7:16:28 AM]
[edited by - vetroXL on November 16, 2003 7:17:47 AM]
[edited by - vetroXL on November 16, 2003 7:18:20 AM]
The index over at SGI is also worth a read, if you need a quick reference . You should have a basic understanding of STL though, their descriptions don't qualify as a tutorial .
I can't read the warnings you get, the page doesn't work. But I remember having had similar issues once (VC++ 6.0).
This should probably do the trick. It worked for me, at least.
//edit: curse you pointy brackets!
[edited by - Wildfire on November 16, 2003 7:19:08 AM]
I can't read the warnings you get, the page doesn't work. But I remember having had similar issues once (VC++ 6.0).
typedef std::string String;std::vector<String> names;
This should probably do the trick. It worked for me, at least.
//edit: curse you pointy brackets!
[edited by - Wildfire on November 16, 2003 7:19:08 AM]
I think your compiler is broken. G++ 3.3.1 with all warnings enabled compiles that code without a complaint.
--
Dave Mikesell Software & Consulting
--
Dave Mikesell Software & Consulting
quote:Original post by MatheassNothing, just MSVC++ that is choking on too long debug information.
1) I wanted to use the following syntax:
std::vector<<std::string>std::string> names;
This code causes 4 compiler warnings.
Whats wrong with this code?
You can disable there warnings by adding this line (before including any STL headers):
#pragma warning (disable : 4786)
(I *think* that is the correct syntax, cannot verify at the moment)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement