Fwd: Using 'detail' folder from a another Boost library

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: Using 'detail' folder from a another Boost library

Boost - Dev mailing list
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?

Sincerely,
Jean

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Using 'detail' folder from a another Boost library

Boost - Dev mailing list
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.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost