Fwd: Using 'detail' folder from a another Boost library
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
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
within (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.
participants (2)
-
Andrey Semashev
-
Jean Guegant