|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2020-11-30 00:36:01
Gavin Lambert wrote:
> > For this specific use, it doesn't need to. It can just match against a
> > StringLike concept, as I said.
>
> Except that you can't use concepts in a compiled library, only in a
> header-only one. (Or it still requires you to write that concrete type
> conversion.)
Of course you can.
class string_view
{
public:
template<class StringLike,
class E = enable_if_t<is_string_like<StringLike>>
>
string_view( StringLike const& sl ): p_( sl.data() ), n_( sl.size() ) {}
};
void my_compiled_library( string_view sv );
This is not something theoretical. E.g. Victor Zverovich has independently
come to the same conclusion:
https://twitter.com/vzverovich/status/1333111364357746690
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk