Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-05-10 13:07:44


AMDG

Niels Dekker - mail address until 2008-12-31 wrote:
>
> First of all, your MyClass forward declaration should end with a
> semicolon (;), of course! Still, you're saying that the forward
> declaration would be sufficient when you declare an instance of a
> container from the Standard C++ Library, right? So would the following
> compile on your platform?
>
> //----------------------------
> #include <map>
> #include <string>
> using std::string ;
>
> class MyClass ;
> std::map<string, MyClass> my_map ;
>
> int main() { return 0 ; }
> //----------------------------
>
> It doesn't compile on my platform. I also tried www.dinkumware.com/exam
> and www.comeaucomputing.com/tryitout
>

That can't possible compile. It is possible that

#include <map>
#include <string>
using std::string ;

class MyClass ;
extern std::map<string, MyClass> my_map ;

class MyClass {};
std::map<string, MyClass> my_map ;

int main() { return 0 ; }

would compile. I don't think it's technically legal though.

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net