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

[SR-12658] [C++] Reimplement std::vector in Swift as a generic struct #55101

Open
gribozavr opened this issue Apr 23, 2020 · 0 comments
Open
Labels
c++ interop Feature: Interoperability with C++ new feature standard library Area: Standard library umbrella

Comments

@gribozavr
Copy link
Collaborator

Previous ID SR-12658
Radar None
Original Reporter @gribozavr
Type New Feature
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels New Feature, CxxInterop
Assignee None
Priority Medium

md5: 8824241c5c7c351f9abec39aedb4c5c0

Issue Description:

It is possible to import std::vector using our general strategy to import templates (import only full specializations), however, for a vocabulary type like std::vector that might be too limiting, as the imported type won't be usable with type variables.

One idea is to reimplement std::vector in Swift: implement a generic Swift struct with identical memory layout to std::vector.

Fortunately, in libc\\, sizeof(std::vector<int>) == sizeof(std::vector<bool>), so all specializations have identical size. In libstdc++ that is not the case.

I'm not sure this idea will work out well, but it is worth trying.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@zoecarver zoecarver added c++ interop Feature: Interoperability with C++ and removed CxxInterop labels Apr 25, 2022
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++ new feature standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants