Better ExtractFromString

- Throw a exception if we cannot extract from string.
  (We throw the same exception as `std::sto*`)
- Add a specialization to extract string from string
- Add some unit test
This commit is contained in:
Matthieu Gautier
2022-04-26 14:41:54 +02:00
parent aa1f73472d
commit 717c39f2ef
3 changed files with 34 additions and 1 deletions

View File

@@ -405,3 +405,8 @@ std::vector<std::string> kiwix::getTitleVariants(const std::string& title) {
variants.push_back(kiwix::toTitle(title));
return variants;
}
template<>
std::string kiwix::extractFromString(const std::string& str) {
return str;
}