Boost logo

Boost :

Subject: Re: [boost] Fwd: Using 'detail' folder from a another Boost library
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2017-11-27 20:03:06


On 11/27/17 22:07, Jean Guegant via Boost wrote:
> Hi everyone,
>
> I am trying to unify the way Boost.Beast and Boost.Asio pick an
> implementation of string_view (std::experimental::string_view,
> std::string_view). In order to do so, I am including the header
> file <boost/asio/detail/string_view.hpp> within
> <boost/beast/core/string.hpp> (see PR: https://github.com/boostorg/
> beast/pull/910/files). Is that a bad practice to include the a "detail"
> folder from another library? If so, what would you recommend to solve my
> unification problem?

Yes, using implementation details of other libraries is generally a bad
idea.

There can be multiple solutions to this problem. You can implement a
similar logic in both libraries, for example. Or you can implement the
detection logic in Boost.Asio and make it define a certain macro that
can be used in Boost.Beast to detect the current configuration. If you
can write code to be agnostic to the actual type of the string view,
that would be best.

I think there were also proposed libraries to solve this problem. Edward
Diener's cxx_dual and Niall Douglas' BindLib come to mind. Although
those are not part of Boost, so not an option currently.


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