Boost logo

Boost :

From: Thorsten Ottosen (tottosen_at_[hidden])
Date: 2006-01-04 05:41:15

axter wrote:
> "Thorsten Ottosen" <tottosen_at_[hidden]> wrote in message
> news:<dpf7ec$9kl$1_at_[hidden]>...

> I just tested it again, and again it fails to compile.
> I even went through the trouble of taking out all the compiler directives,
> and cleaning the code so-as to remove any possible noise, but it still fails
> to compile.

> I get the above error from the following four lines of code:
> boost::ptr_map<int, Shape> mIntToShape;
> int i123 = 123;
> mIntToShape.insert(i123, new Circle("blue"));
> mIntToShape[i123].draw(); //This line is what causes the
> error

operator[]() has special requirements in that it inserts a default
constructed element. This implies T must be default constructible. It
also implies that T cannot be abstract. I guess the docs could be better

If you just want to do lookup, call;


Boost list run by bdawes at, gregod at, cpdaniel at, john at