However, the thing in this thread is yet again different: it's kind of like `is_trivially_const_referenceable_as<T, U>`.
The problem is, I don't see how the compiler could ever infer this kind of thing for user-defined types.
I absolutely agree, for example in my case there is no way for compiler to check the function will not delete the raw pointers I gave it( and corrupt unique_ptr). This working depends on me reading function documentation where it says it does not modify pointers, and then hacking a way to expose vector of unique_ptr as vector of pointers.
But to be honest I do not believe this is such a horrible problem, as I mentioned if library just provides overloads with string_view/span the issue is solved since those types "erase" container type(although they obviously work with any region of memory, not just containers).
Basically the String class knows when it is initialized from 'static :) lifetime char array so it does not allocate it on heap. I presume with ABI break it is possible to make std::string do this, but I am not sure people would be delighted about unpredictable branch in some special
member functions.