Standard C++ Template Library

Started by
6 comments, last by Matheass 20 years, 5 months ago
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]
Advertisement
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
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]
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).
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]
How do I set my laser printer on stun?
I think your compiler is broken. G++ 3.3.1 with all warnings enabled compiles that code without a complaint.

--
Dave Mikesell Software & Consulting
Your codes doesn''t work, too. There are the same warnings, too.
I''m using VC++ 6.0
quote:Original post by Matheass
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?
Nothing, just MSVC++ that is choking on too long debug information.

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