Boost logo

Boost :

From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2019-06-26 07:18:14


On Wed, Jun 26, 2019 at 2:25 AM Gavin Lambert via Boost <
boost_at_[hidden]> wrote:

> On 26/06/2019 08:02, JeanHeyd Meneide wrote:
> > I can understand that it is cumbersome to write most of the
> specialization.
>

> The specialisation syntax in C++ is fundamentally flawed, and in my
> view, should absolutely never be used by anybody.
>
> One such example of this is that (especially for header-only libraries,
> although with care this can also be used for compiled libraries) it is
> very useful to be able to allow multiple versions of a library to
> co-exist through external namespacing:
>
> namespace v1
> {
> #include <library_v1/lib.hpp>
> }
> namespace v2
> {
> #include <library_v2/lib.hpp>
> }
>
> Most of the time this Just Worksâ„¢; one of the cases where this
> completely falls over is that in this scenario it is impossible for the
> library to define any specialisations in the std namespace (or indeed
> any other namespace outside of its internal bubble, including the global
> namespace).
>
> Using ADL is much more convenient; explicit policy arguments can be used
> as a fallback when ADL is not possible.

 Hi Gavin,

This subject is one I've struggled with, going back and forth in my own
closed-source
libraries between traits, functions, combination, what not; and that I
never felt happy
about. Do you know of any good treatment on the subject that details the
pros and cons
of the various approaches? I've seen it mentioned in Boost reviews as well,
notably the
Boost.Convert one, with Steven especially, but I clearly lack the depth to
fully grasp it.

Any good sources on that subject?
Do recommended practice change a lot between pre-C++11, C__11, C++14,
C++17, etc...?

TIA, --DD


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