
22 Jul
2007
22 Jul
'07
1:44 p.m.
Eric Niebler wrote:
This one by Greg Colvin. (BoostCon had two tracks. So why not two trip reports?) Enjoy! http://www.artima.com/cppsource
By following that link, I got on your own report. I was surprised to see you considered boost.any to be a form of duck typing. To me, it's not duck typing at all. Duck typing would allow us to do stuff like this: any a = string("hello world"); any b = a.substr(0, 5); a = 4; any c = a.substr(0, 5); // throws an exception, a has no member function 'substr' with that signature. boost.any does not allow that kind of thing at all. boost.variant is a bit closer, but apart from the fact it is limited to a set of types it can neither do it because it would require some kind of compile-time reflection.