-
Notifications
You must be signed in to change notification settings - Fork 221
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
Add type caster for string_view. #68
Conversation
Thanks @qnzhou — this looks great, but it is missing a testcase. Could you add one for both directions of the conversion? |
assert t.identity_string("orange") == "orange" | ||
assert t.identity_string("橘子") == "橘子" | ||
assert t.identity_string("ส้ม") == "ส้ม" | ||
assert t.identity_string("البرتقالي") == "البرتقالي" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there something funny going on with parentheses here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand. Is there anything wrong with the parentheses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be a rendering issue? At least on the GitHub web interface, I don't see a closing parenthesis after the arabic strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fascinating. That code passes the test suite, so I will believe you ;).
assert t.identity_string_view("orange") == "orange" | ||
assert t.identity_string_view("橘子") == "橘子" | ||
assert t.identity_string_view("ส้ม") == "ส้ม" | ||
assert t.identity_string_view("البرتقالي") == "البرتقالي" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
A small update to automatically type cast
std::string_view
.