Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string_ref and string_view interoperability? #2

Open
OlafvdSpek opened this issue Jan 16, 2017 · 7 comments
Open

string_ref and string_view interoperability? #2

OlafvdSpek opened this issue Jan 16, 2017 · 7 comments

Comments

@OlafvdSpek
Copy link

OlafvdSpek commented Jan 16, 2017

It'd be nice if string_ref and string_view could interoperate..

void f0(boost::string_ref);
void f1(boost::string_view);

int main(int argc, char* argv[])
{
	boost::string_ref sr;
	boost::string_view sv;
	f0(sr);
	f0(sv); // error
	f1(sr); // error
	f1(sv);
@mclow
Copy link
Owner

mclow commented Jan 16, 2017

I think it would be much nicer if everyone would use string_view and we could get rid of string_ref. (which is the long-term plan)

@OlafvdSpek
Copy link
Author

boost::string_view or std::string_view? ;)

That'd sure be nice but neither of them is available everywhere yet.

@mclow
Copy link
Owner

mclow commented Jan 16, 2017

I was speaking in the context of boost, so boost::string_view.
I would like to remove boost::string_ref and have everyone who is currently using that to use boost::string_view

@OlafvdSpek
Copy link
Author

What about interoperability between boost::string_view and std::string_view?

#include <boost/utility/string_view.hpp>
#include <string_view>

void f0(boost::string_view);
void f1(std::string_view);

int main(int argc, char* argv[])
{
	boost::string_view a;
	std::string_view b;
	f0(a);
	f0(b); // error
	f1(a); // error
	f1(b);
}
// MSVC 2017

@OlafvdSpek
Copy link
Author

@mclow ?

@mclow
Copy link
Owner

mclow commented Jul 24, 2018

My general feeling is that if you have std::string_view you should use that.
boost::string_view is for situations (pre-C++17, etc) where you don't have std::string_view.

@OlafvdSpek
Copy link
Author

OlafvdSpek commented Jul 24, 2018

OK, so no plans for interoperability?

Fortunately std::string_view has better availability now so it's less of a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants