Boost logo

Boost :

Subject: Re: [boost] Abstract STL Container Adaptors
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2013-03-18 08:29:31


On 14-03-2013 18:20, Andy Jost wrote:
> Hi Boosters,

>
> Here, abstract_set<Node const *> is implicitly convertible from any type having the interface of std::set<Node const *>. It internally holds a reference to some implementation of a suitable set-like object and mediates interactions with the outside world through virtual methods.
>
>
> It seems the implementation of this would be a straightforward application of type erasure. It seems too easy, in fact, which makes me wonder whether I'm missing something.
>
> In any case, is this a good idea?

It could be. Its no different than using boost::function<>, that is, it
allow us to make a generic interface with decisions deferred till
run-time (at the expense of a performance loss).

I guess it could be faked in various ways, eg., the argument could be
boost::any which is then documented to be one of several set types.

-Thorsten


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