mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-11 23:20:03 +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) {
|
||||
auto unit = RemoveUnit(t);
|
||||
return StringTo<T>(t, unit);
|
||||
template <typename T> T StringTo(const std::string& t) {
|
||||
std::string tmp{t};
|
||||
auto unit = RemoveUnit(tmp);
|
||||
return StringTo<T>(tmp, unit);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline slsDetectorDefs::detectorType StringTo(std::string s){
|
||||
inline slsDetectorDefs::detectorType StringTo(const std::string& 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>("150s") == s(150));
|
||||
REQUIRE(StringTo<s>("3 s") == s(3));
|
||||
|
||||
REQUIRE_THROWS(StringTo<ns>("5xs"));
|
||||
REQUIRE_THROWS(StringTo<ns>("asvn"));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user