Discussion:
[boost] string_view versus string_ref
Andrzej Krzemienski via Boost
2017-07-06 07:46:36 UTC
Permalink
Hi Everyone,
I would like to understand the situation with these two templates:
basic_string_view and basic_string_ref.

The official, advertised library is string_ref:
http://www.boost.org/doc/libs/1_64_0/libs/utility/doc/html/string_ref.html

At the same time we have string_view:
http://www.boost.org/doc/libs/1_64_0/boost/utility/string_view.hpp

But the latter is never mentioned in the documentation, except in Boost.Log:
(see http://www.boost.org/users/history/version_1_61_0.html)

The support for boost::basic_string_ref and its specializations is
deprecated; users are encouraged to switch to boost::basic_string_view.
The support for boost::basic_string_ref will be removed in future
releases.
My question: is there any official position of Boost about having these two
templates?

Regards,
&rzej;

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Andrey Semashev via Boost
2017-07-06 08:05:35 UTC
Permalink
Post by Andrzej Krzemienski via Boost
Hi Everyone,
basic_string_view and basic_string_ref.
http://www.boost.org/doc/libs/1_64_0/libs/utility/doc/html/string_ref.html
http://www.boost.org/doc/libs/1_64_0/boost/utility/string_view.hpp
(see http://www.boost.org/users/history/version_1_61_0.html)
The support for boost::basic_string_ref and its specializations is
deprecated; users are encouraged to switch to boost::basic_string_view.
The support for boost::basic_string_ref will be removed in future
releases.
My question: is there any official position of Boost about having these two
templates?
My understanding is that string_ref is a legacy implementation and is
deprecated. It should be removed at some point. Users should use
string_view. The docs seem to need an update though.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Niall Douglas via Boost
2017-07-06 11:26:11 UTC
Permalink
Post by Andrzej Krzemienski via Boost
My question: is there any official position of Boost about having these two
templates?
Marshall said in one of his talks that string_ref is there for the
legacy users, string_view is to implement the C++ 17 string_view for
modern users.

Niall
--
ned Productions Limited Consulting
http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Marshall Clow via Boost
2017-07-06 13:53:09 UTC
Permalink
On Thu, Jul 6, 2017 at 12:46 AM, Andrzej Krzemienski via Boost <
Post by Andrzej Krzemienski via Boost
Hi Everyone,
basic_string_view and basic_string_ref.
http://www.boost.org/doc/libs/1_64_0/libs/utility/doc/html/string_ref.html
http://www.boost.org/doc/libs/1_64_0/boost/utility/string_view.hpp
(see http://www.boost.org/users/history/version_1_61_0.html)
The support for boost::basic_string_ref and its specializations is
deprecated; users are encouraged to switch to boost::basic_string_view.
The support for boost::basic_string_ref will be removed in future
releases.
My question: is there any official position of Boost about having these two
templates?
Yes. boost::string_view is the preferred solution; it is closer to
std::string_view, and it has significantly more constexpr support.

I'd like to remove boost::string_ref at some point in the future.

-- Marshall

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