mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-08 08:11:14 +00:00
Remove using namespace std from json_diff.hpp (#16222)
The directive sat at global scope in a header that DeviceManager.hpp includes, so most of the GUI compiled with all of std in the global namespace. 42 files had come to rely on it, mostly for string, vector and unordered_map, four of them for the ""sv and ""ms literals. Those sites are qualified. GCodeViewer.cpp spelled the type as std::vector<::string>, which only resolved through the directive. The files that use the ""sv and ""ms literals get a file-scope "using namespace std::string_view_literals;" or "using namespace std::chrono_literals;", as other sources already do.
This commit is contained in:
@@ -1682,13 +1682,13 @@ int GuideFrame::SaveProfileData()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void StringReplace(string &strBase, string strSrc, string strDes)
|
||||
void StringReplace(std::string &strBase, std::string strSrc, std::string strDes)
|
||||
{
|
||||
string::size_type pos = 0;
|
||||
string::size_type srcLen = strSrc.size();
|
||||
string::size_type desLen = strDes.size();
|
||||
std::string::size_type pos = 0;
|
||||
std::string::size_type srcLen = strSrc.size();
|
||||
std::string::size_type desLen = strDes.size();
|
||||
pos = strBase.find(strSrc, pos);
|
||||
while ((pos != string::npos)) {
|
||||
while ((pos != std::string::npos)) {
|
||||
strBase.replace(pos, srcLen, strDes);
|
||||
pos = strBase.find(strSrc, (pos + desLen));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user