From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2002-09-03 10:54:21
Douglas Gregor wrote:
> As for the any_less function object: why not supply it as a specialization
> of std::less? Then we get set<any> for free...
It's dangerous for types that is not less comparable. I think std::less can
be speicalized only for dynamic_any<less_comparable /* other stuff */ >.
> Here's the reasoning behind the idea: polymorphic adaptors provide a
> bridge between compile-time and run-time polymorphism. For instance,
> boost::function is a polymorphic adaptor for function objects, so one can
> transform code like this:
> template<typename Compare> void sort(Compare comp);
> into non-template code like this:
> void sort(const boost::function<bool (int x , int y)>& comp);
> The two functions are semantically very similar, except that the first is
> a template and the second is not, and therefore the decision between the
> two can be made based on the size vs. speed tradeoff.
> All polymorphic adaptors could be used in this way, so the challenge would
> be to make an 'any' that is a polymorphic adaptor generator. Then we could
> have polymorphic adaptors for whatever concept we need, so that, for
> instance, we could develop with large template libraries more rapidly
> using these adaptors and separate compilation.
> I'm not sure if it's entirely possible, but it really would be interesting
I started to read the documentation. It's very interesting. Let me think
about that in the context of any/dynamyc_any.
I'm also going to post overview of new features in the near future.
-- Best regards, Alexander Nasonov e-mail account: alnsn e-mail server: mail.ru
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk