summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--icespider/core/ihttpRequest.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/icespider/core/ihttpRequest.h b/icespider/core/ihttpRequest.h
index 5141068..e226e42 100644
--- a/icespider/core/ihttpRequest.h
+++ b/icespider/core/ihttpRequest.h
@@ -59,6 +59,8 @@ namespace IceSpider {
virtual std::ostream & dump(std::ostream & s) const = 0;
+ static_assert(std::is_constructible_v<std::string, std::string_view>);
+
template<typename T, typename K>
[[nodiscard]] inline std::optional<T>
getFrom(const K & key, OptionalString (IHttpRequest::*src)(const K &) const) const
@@ -67,12 +69,9 @@ namespace IceSpider {
if constexpr (std::is_convertible<std::string_view, T>::value) {
return *v;
}
- else if constexpr (std::is_constructible<std::string_view, T>::value) {
+ else if constexpr (std::is_constructible<T, std::string_view>::value) {
return T(*v);
}
- else if constexpr (std::is_same<std::string, T>::value) {
- return std::to_string(*v);
- }
else {
try {
return boost::lexical_cast<T>(*v);