On 14-03-2013 18:20, Andy Jost wrote:
Hi Boosters,
Here, abstract_set
is implicitly convertible from any type having the interface of std::set . 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