diff --git a/include/sqlpp11/data_types/text/operand.h b/include/sqlpp11/data_types/text/operand.h index fc2fda1c..1bf169be 100644 --- a/include/sqlpp11/data_types/text/operand.h +++ b/include/sqlpp11/data_types/text/operand.h @@ -29,6 +29,9 @@ #include #include +#if __cplusplus >= 201703L +#include +#endif #include #include #include @@ -50,6 +53,16 @@ namespace sqlpp text_operand(_value_t t) : _t(std::move(t)) { } +#if __cplusplus >= 201703L + // allow construction from an std::string_view + text_operand(std::string_view t) : _t(t) + { + } + // additional const char* overload, required to disambiguate + text_operand(const char* t) : _t(t) + { + } +#endif text_operand(const text_operand&) = default; text_operand(text_operand&&) = default; diff --git a/include/sqlpp11/data_types/text/wrap_operand.h b/include/sqlpp11/data_types/text/wrap_operand.h index c2318e43..7a8f8a9f 100644 --- a/include/sqlpp11/data_types/text/wrap_operand.h +++ b/include/sqlpp11/data_types/text/wrap_operand.h @@ -28,6 +28,9 @@ #define SQLPP11_DATA_TYPES_TEXT_WRAP_OPERAND_H #include +#if __cplusplus >= 201703L +#include +#endif #include #include @@ -35,10 +38,16 @@ namespace sqlpp { struct text_operand; +#if __cplusplus >= 201703L + using checked_type = std::string_view; +#else + using checked_type = std::string; +#endif + template struct wrap_operand< T, - typename std::enable_if::value and not is_result_field_t::value>::type> + typename std::enable_if::value and not is_result_field_t::value>::type> { using type = text_operand; };