Skip to content

[cxx-interop] Add conversions between std::u16string and Swift.String #61695

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

Merged
merged 1 commit into from
Oct 24, 2022

Conversation

egorzhdan
Copy link
Contributor

This change adds a few extensions to the C++ stdlib overlay to allow convenient conversions between C++ UTF-16 strings and Swift strings.

…ing`

This change adds a few extensions to the C++ stdlib overlay to allow convenient conversions between C++ UTF-16 strings and Swift strings.
@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Oct 24, 2022
extension std.u16string {
public init(_ string: String) {
self.init()
for char in string.utf16 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will optimize this in a follow-up patch.

@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan egorzhdan merged commit 8a95701 into main Oct 24, 2022
@egorzhdan egorzhdan deleted the egorzhdan/cxx-u16string branch October 24, 2022 15:21
egorzhdan added a commit that referenced this pull request Jan 17, 2023
…` and `Swift.String`""

This re-lands #61695 since the linker error on CentOS has been fixed.

This reverts commit e97b1c8
egorzhdan added a commit that referenced this pull request Jan 17, 2023
…` and `Swift.String`""

This re-lands #61695 since the linker error on CentOS has been fixed in #63058.

This reverts commit e97b1c8
egorzhdan added a commit that referenced this pull request Feb 1, 2023
…` and `Swift.String`""

This re-lands #61695 since the linker error on CentOS has been fixed in #63058.

This reverts commit e97b1c8
egorzhdan added a commit that referenced this pull request Feb 22, 2023
…` and `Swift.String`""

This re-lands #61695 since the linker error on CentOS has been fixed in #63058.

This reverts commit e97b1c8
egorzhdan added a commit that referenced this pull request Feb 22, 2023
…` and `Swift.String`""

This re-lands #61695 since the linker error on CentOS has been fixed in #63058.

This reverts commit e97b1c8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants