Replace -__cplusplus with CXX_STD_VER, because the latter works correctly with MSVC.

This commit is contained in:
MeanSquaredError
2024-09-02 22:22:30 +03:00
committed by Roland Bock
parent b100ede72e
commit f56564d632
7 changed files with 25 additions and 11 deletions

View File

@@ -26,9 +26,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sqlpp11/compat/cxx_std_ver.h>
#include <string>
#include <utility>
#if __cplusplus >= 201703L
#if CXX_STD_VER >= 201703L
#include <string_view>
#endif
#include <sqlpp11/type_traits.h>
@@ -51,7 +53,7 @@ namespace sqlpp
text_operand(_value_t t) : _t(std::move(t))
{
}
#if __cplusplus >= 201703L
#if CXX_STD_VER >= 201703L
// allow construction from an std::string_view
text_operand(std::string_view t) : _t(t)
{

View File

@@ -26,13 +26,15 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sqlpp11/compat/cxx_std_ver.h>
#include <sqlpp11/data_types/parameter_value.h>
#include <sqlpp11/data_types/parameter_value_base.h>
#include <sqlpp11/data_types/text/data_type.h>
#include <sqlpp11/data_types/text/wrap_operand.h>
#include <sqlpp11/data_types/text/operand.h>
#if __cplusplus >= 201703L
#if CXX_STD_VER >= 201703L
#include <string_view>
#endif
@@ -51,7 +53,7 @@ namespace sqlpp
target._bind_text_parameter(index, &_value, _is_null);
}
#if __cplusplus >= 201703L
#if CXX_STD_VER >= 201703L
parameter_value_base& operator=(const std::string_view& val)
{
_value = val;

View File

@@ -26,8 +26,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sqlpp11/compat/cxx_std_ver.h>
#include <utility>
#if __cplusplus >= 201703L
#if CXX_STD_VER >= 201703L
#include <string_view>
#endif
#include <sqlpp11/type_traits.h>
@@ -37,7 +39,7 @@ namespace sqlpp
{
struct text_operand;
#if __cplusplus >= 201703L
#if CXX_STD_VER >= 201703L
using checked_type = std::string_view;
#else
using checked_type = std::string;

View File

@@ -26,6 +26,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sqlpp11/compat/cxx_std_ver.h>
#include <functional>
#include <iterator>
#include <utility>
@@ -81,7 +83,7 @@ namespace sqlpp
class iterator
{
public:
#if __cplusplus >= 202002L
#if CXX_STD_VER >= 202002L
using iterator_concept = std::input_iterator_tag;
#else
// LegacyInputIterator describes best our iterator's capabilities. However our iterator does not

View File

@@ -23,6 +23,8 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sqlpp11/compat/cxx_std_ver.h>
#include "compare.h"
#include "Sample.h"
#include <sqlpp11/sqlpp11.h>
@@ -47,7 +49,7 @@ int Insert(int, char* [])
"INSERT INTO tab_bar (beta,gamma) VALUES('cheesecake'," + getTrue() + ")");
compare(__LINE__, insert_into(bar).set(bar.beta = ::sqlpp::null, bar.gamma = true),
"INSERT INTO tab_bar (beta,gamma) VALUES(NULL," + getTrue() + ")");
#if __cplusplus >= 201703L
#if CXX_STD_VER >= 201703L
// string_view argument
std::string_view cheeseCake = "cheesecake";
compare(__LINE__, insert_into(bar).set(bar.beta = cheeseCake, bar.gamma = true),

View File

@@ -23,6 +23,8 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sqlpp11/compat/cxx_std_ver.h>
#include "compare.h"
#include "Sample.h"
#include <sqlpp11/sqlpp11.h>
@@ -68,7 +70,7 @@ int Where(int, char*[])
compare(__LINE__, where(is_equal_to_or_null(bar.beta, ::sqlpp::value_or_null("SQL"))), " WHERE (tab_bar.beta='SQL')");
compare(__LINE__, where(is_equal_to_or_null(bar.beta, ::sqlpp::value_or_null<sqlpp::text>(::sqlpp::null))),
" WHERE tab_bar.beta IS NULL");
#if __cplusplus >= 201703L
#if CXX_STD_VER >= 201703L
// string_view argument
std::string_view sqlString = "SQL";
compare(__LINE__, where(bar.beta == sqlString), " WHERE (tab_bar.beta='SQL')");

View File

@@ -23,11 +23,13 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sqlpp11/compat/cxx_std_ver.h>
#include "MockDb.h"
#include "Sample.h"
#include "is_regular.h"
#include <iostream>
#if __cplusplus >= 201703L
#if CXX_STD_VER >= 201703L
#include <string_view>
#endif
#include <sqlpp11/functions.h>
@@ -109,7 +111,7 @@ int Insert(int, char*[])
prepared_insert.params.delta = sqlpp::value_or_null(17);
db(prepared_insert);
#if __cplusplus >= 201703L
#if CXX_STD_VER >= 201703L
auto prepared_insert_sv = db.prepare(insert_into(t).set(t.gamma = parameter(t.gamma), t.delta = parameter(t.delta), t.beta = parameter(t.beta)));
prepared_insert_sv.params.gamma = true;
prepared_insert_sv.params.delta = 17;