
On 20 May 2010 18:38, Artyom <artyomtnk@yahoo.com> wrote:
You just said what I was thinking about. There is some kind of Urban Myths in Boost community
- Concepts are **always** better then inheritance
Sad.
I don't consider this one an urban myth. - If you need different types, then inheritance doesn't work feasibly, so concepts are the only choice, and are thus better by default - If inheritance can be feasibly done, then a single virtualizing wrapper can be written for the concept. Since the overhead of this is just in the virtual tables and such, it's the same as would be added in making it natively virtual (and all the wrapping instantiation of templates can be done in source files, making the templating completely invisible to the users of the virtual interface, and meaning that there's no opportunity for multiple-instantiation "bloat"). So since it allows additional options at negligible -- if any -- cost, it's better. Unless you have a counterexample?