Passing Swift String type to a Cpp function in the new interop

I have implemented the new cpp-swift interop mechanism using modulemap file. I have a use case to pass a swift string to the cpp function. I observed that the below code works and I am able to pass a swift String type directly to a cpp function which received it as const char *. This works only if its received as const char * in cpp(and not char *). However, this is not an interop documented behaviour for interoperating String types and wanted to know whether this is safe to use. If not, can someone suggest an alternative approach to pass a swift string to Cpp.

// Swift code
 public static func StringToCharPointer () -> Void
    {
       // calling cpp function and passing a swift String type as argument, which is received as const char *

        Student.Convert (sUItextdata)    //sUItextdata is of type 'String'     
    }
//static Cpp function
void Student::Convert (const char * pStr)
{
    std::string s(pStr);
    std::cout << "char * converted from swift String : " << s << std::endl;
}

Note : I am aware that there is a way to pass it to cpp and receive it as std:string, but I do not wish to use that.

Maybe I don't understand your question but I feel like the easiest way is to have a function that takes a std::string on the C++ side and then call std::string::data if you really need it as a char *.

I believe Swift has implicit conversions from Array<T> to UnsafePointer<T> and from String to UnsafePointer<Int8>, UnsafePointer<UInt8>, and UnsafePointer<Void>. This thread enumerates all the implicit pointer conversions.