
On 10/20/07, Corrado Zoccolo <czoccolo@gmail.com> wrote:
On 10/20/07, Sebastian Redl <sebastian.redl@getdesigned.at> wrote:
So, is this more a boost::any with SBO or a boost::optional that can store polymorphic types if necessary?
I haven't looked at boost::any implementation yet, but I guess it is based on the same recipe as boost::function, so I think that what you need can be implemented easily with optional_poly as a basic tool.
It seems to me like it is the latter. That sounds useful, but right now
I'd need the former.
I will work on some sample code to show how it can be obtained, and come back.
It was actually pretty easy. boost::any used plain dynamic polymorphism through a pointer, so it was only matter of changing this pointer with an optional_poly, and remove some of the ad-hoc code for cloning (achieved automatically with optional_poly). This gives you a boost::any with small object optimization, and shows the potential usefulness of optional_poly as a basic tool to implement higher abstractions with low penalties. I posted this example, as well as the other big example in the vault (* http://tinyurl.com/2rfaah*). Corrado
Sebastian Redl
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- __________________________________________________________________________
dott. Corrado Zoccolo mailto:zoccolo@di.unipi.it PhD - Department of Computer Science - University of Pisa, Italy --------------------------------------------------------------------------
-- __________________________________________________________________________ dott. Corrado Zoccolo mailto:zoccolo@di.unipi.it PhD - Department of Computer Science - University of Pisa, Italy -------------------------------------------------------------------------- The self-confidence of a warrior is not the self-confidence of the average man. The average man seeks certainty in the eyes of the onlooker and calls that self-confidence. The warrior seeks impeccability in his own eyes and calls that humbleness. Tales of Power - C. Castaneda