Boost logo

Boost :

Subject: Re: [boost] Abstract STL Container Adaptors
From: Andy Jost (Andrew.Jost_at_[hidden])
Date: 2013-03-15 11:34:03


From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of Jeffrey Lee Hellrung, Jr.

> Despite the other comments, this has a legitimate use case:
> - The algorithm is code-wise large and called many times on different containers, or, say, embedded within compiled library, so either it isn't practical or isn't possible to inline it.
> - The dispatch overhead from the type erasure is negligible compared with other operations in the algorithm.
> - You want to avoid imposing unnecessary memory requirements on the caller, such as forcing them to copy their data into a specific data structure.

This is quite aligned with my thinking. I would add one more use case, which is when the algorithm is fixed, but the code calling it is still under development. In that case, separately compiling the algorithm could substantially improve incremental build times.

> Off the top of my head, computational geometry algorithms are sometimes of this nature.

Also compiler algorithms.

> Additionally, I think this functionality is basically or entirely present in Steven Watanabe's Boost.TypeErasure library [1; warning: docs may be outdate, I just did a Google search].

Thanks, that is helpful!


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