Boost logo

Boost Users :

From: Niels Dekker - mail address until 2008-12-31 (nd_mail_address_valid_until_2008-12-31_at_[hidden])
Date: 2008-05-10 12:58:20


Surya Kiran Gullapalli wrote:
> With the standard c++ containers, I can always use forward declaration
> of my classes in the interface files (header files) and then include
> the appropriate header files in the implementation files (source
> files).
>
> With boost bimap this seems to be not possible. Lets say I've MyClass
> and I do like this.
>
> ----------------------------
> class MyClass
>
> boost::bimap<string, MyClass> my_bimap ;
> --------------------------
>
> The compiler spits out a lot of error messages. But If i avoid forward
> declaration and include MyClass header file before declaring
> boost::bimap, every thing is normal.

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

HTH,

-- 
Niels Dekker
http://www.xs4all.nl/~nd/dekkerware
Scientific programmer at LKEB, Leiden University Medical Center

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