I’m working in a code base that uses both Metal and Metal-cpp. Metal-cpp is a header provided by Apple that provides C++ bindings to the Metal framework. Metal-cpp has its own pointer compatible types. They can be cast to/from the Obj-C Metal types because its types are just thin shims who just call objc_msgsend on the underlying pointer.
This causes some problems for Swift/C++ interop though. I need to return the C++ Metal types from Swift, but I can’t use those types in Swift because they’re reference types. (Which would require messing with the header.) That means I need to use the Obj-C Metal types in my Swift code but return the C++ Metal types across the language boundary.
Is there a feature to refine functions for C++ like there is for Obj-C? I’d like to be able to change the return type. I know I can manually generate the header and then modify it. But I’m not sure that’s sustainable - I’m pretty sure that header changes every compilation.