Improved code to avoid duplicate calls to c_str for namespace/class/path strings