Providing Swift overlays for C++ standard library types | GSoC'22

Good Evening @Alex_L, @egor.zhdan and everyone in the C++ Interop Team.
I am Abhishek Rawat from India, a 3rd year Computer Science student and am interested in contributing to the C++ Interop Group for the project titled Providing Swift overlays for C++ standard library types.
While researching for the project, I tried to go through the C++ stdlib to get a better understanding of how some standard library types have been implemented. I also took a look at how the Swift's current core stdlib works.
I also went through the Swift's Standard Library Programmers Manual so that I can conform to the best practices while writing code for the same.
Can you please provide me more resources so that I can get a better understanding on how the project should span and how I can contribute the most to it.
Thank you :)


Hey @abshk, thanks for your post, it's great that you're interested in this project and already started looking into the stdlib implementation!

Here are some resources to learn more about Swift/C++ interop in general:

This specific project would be focused on creating a Swift overlay module for the C++ stdlib. Some other overlay modules already exist in the Swift toolchains to allow the developer to call OS APIs from Swift more conveniently, for example:

Here is what you would likely need to do to create an overlay module for the C++ stdlib:

  • Extend the CMake build scripts for the Swift compiler to incorporate the overlay module. That module would need to be built & shipped with Swift toolchains. This might take some time since the Swift build logic is fairly complicated, but I can provide help with that.
  • Implement the Swift extensions for C++ types. Here you would need to consider possible usages of C++ APIs from Swift, and think about making the bridging ergonomic, correct & fast. We've mentioned some C++ types in the project description that would benefit from being extended in Swift (std::string, std::map, std::set, std::vector), but this list is not exclusive, and if you have other types in mind, that would be very interesting (and it would make sense to mention such types in the proposal if you decide to proceed with writing the proposal).
  • An interesting aspect of this is that different platforms use different C++ standard libraries (libc++ on Apple platforms, libstdc++ on Linux, Microsoft standard library on Windows). We are focusing on libc++ for now, and we don't necessarily require the participant to make the overlay work for non-Apple platforms, although we are eventually going to support those as well, and if some of that work can be done as part of this project, that would be a plus.
  • Write tests for the new functionality to make sure it doesn't regress in the future.

If that sounds interesting to you, the next step for you would be writing a proposal to describe the outcomes that you expect to achieve, and a rough timeline of the work. Feel free to ask us questions while writing a proposal, and if you have any questions about the project, please ask those as well!