mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-15 00:42:12 +02:00
pass by reference
This commit is contained in:
parent
b4f3c0586f
commit
5de5884341
@ -159,13 +159,14 @@ T StringTo(const std::string &t, const std::string &unit) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> T StringTo(std::string t) {
|
template <typename T> T StringTo(const std::string& t) {
|
||||||
auto unit = RemoveUnit(t);
|
std::string tmp{t};
|
||||||
return StringTo<T>(t, unit);
|
auto unit = RemoveUnit(tmp);
|
||||||
|
return StringTo<T>(tmp, unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline slsDetectorDefs::detectorType StringTo(std::string s){
|
inline slsDetectorDefs::detectorType StringTo(const std::string& s){
|
||||||
return slsDetectorDefs::detectorTypeToEnum(s);
|
return slsDetectorDefs::detectorTypeToEnum(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,6 @@ TEST_CASE("string to std::chrono::duration", "[support]") {
|
|||||||
REQUIRE(StringTo<ns>("150ns") == ns(150));
|
REQUIRE(StringTo<ns>("150ns") == ns(150));
|
||||||
REQUIRE(StringTo<ns>("150s") == s(150));
|
REQUIRE(StringTo<ns>("150s") == s(150));
|
||||||
REQUIRE(StringTo<s>("3 s") == s(3));
|
REQUIRE(StringTo<s>("3 s") == s(3));
|
||||||
|
|
||||||
REQUIRE_THROWS(StringTo<ns>("5xs"));
|
REQUIRE_THROWS(StringTo<ns>("5xs"));
|
||||||
REQUIRE_THROWS(StringTo<ns>("asvn"));
|
REQUIRE_THROWS(StringTo<ns>("asvn"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user