Re: Std Map .. Help
From: John Harrison (john_andronicus_at_hotmail.com)
Date: 04/20/04
- Next message: Artie Gold: "Re: Std Map .. Help"
- Previous message: E. Robert Tisdale: "Re: I need an understanding of what C++ is good for -Thanks"
- In reply to: ash: "Std Map .. Help"
- Next in thread: Artie Gold: "Re: Std Map .. Help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 20 Apr 2004 21:01:17 +0100
<ash> wrote in message news:6hva805ff5l984slf2m9ogsjo8i5c2f7k5@4ax.com...
> Hi,
>
> I'm getting started with STL, and am stuck at creating a map
> container. I checked one of the texts and found a code in there. To
> make it simple, i wrote the following:
>
> #include <iostream.h>
Non-standard header file, use <iostream> (without a .h)
> #include <string.h>
This is a valid header file, but it doesn't declare the std::string class
which is what you are thinking it does, instead it declares the C string
handling routines. Use <string> instead (again without a .h)
> #include <map>
>
> typedef std::map<string,string,std::less<string>> mymap;
std::less is unecessary, but string is wrong, it should be std::string. Try
this
typedef std::map<std::string,std::string> mymap;
>
> int main()
> {
> mymap somemap;
> return 0;
> }
>
>
> This gives me 6 error messages, an a warning. Could anyone point me
> the mistake....i've been to grasp the topic for two days now!
Don't know what book you are reading, doesn't it have any syntactically
valid programs in it?
You need to use the correct header files (no C++ header files have .h in
them)
You need to remember std::
You should forget about std::less (at least for now).
john
- Next message: Artie Gold: "Re: Std Map .. Help"
- Previous message: E. Robert Tisdale: "Re: I need an understanding of what C++ is good for -Thanks"
- In reply to: ash: "Std Map .. Help"
- Next in thread: Artie Gold: "Re: Std Map .. Help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|