Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2000-11-09 02:21:02


Kevlin -

Congrats for solving a recurring problem in C++ in a simple and elegant
fashion. This will be a nice addition to boost (no voting now...it's a
landslide).

I have 3 minor suggestions:
1) Add a throw specification to any_cast.
2) A section on performance in the documentation. You hint at this in the
write-up, but some explicit notes would be nice.
3) I agree with the removal of operator void*. It is evil....

Here's a rather obvious alternative to your property example.

  std::map<std::string, boost::any> properties;

  int i = 10;
  double d = 100.1;
  std::string s = "mystring";

  properties["prop1"] = boost::any(i);
  properties["prop2"] = boost::any(d);
  properties["prop3"] = boost::any(std::string("some_string"));

  boost::any aProperty = properties.find("prop1")->second;

Thanks again!

Jeff
jeff_at_[hidden]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk