Canonicalizes a given name with respect to the Standard C++ Library. This handles removing the inline namespace within `std` that is used by various standard libraries (e.g., `std::__1`). Names outside of namespace std are returned unmodified.
| 3217 | // used by various standard libraries (e.g., `std::__1`). Names outside |
| 3218 | // of namespace std are returned unmodified. |
| 3219 | inline std::string CanonicalizeForStdLibVersioning(std::string s) { |
| 3220 | static const char prefix[] = "std::__"; |
| 3221 | if (s.compare(0, strlen(prefix), prefix) == 0) { |
| 3222 | std::string::size_type end = s.find("::", strlen(prefix)); |
| 3223 | if (end != s.npos) { |
| 3224 | // Erase everything between the initial `std` and the second `::`. |
| 3225 | s.erase(strlen("std"), end - strlen("std")); |
| 3226 | } |
| 3227 | } |
| 3228 | return s; |
| 3229 | } |
| 3230 | |
| 3231 | // GetTypeName<T>() returns a human-readable name of type T. |
| 3232 | // NB: This function is also used in Google Mock, so don't move it inside of |