diff --git a/include/sqlpp11/core/aggregate_function/avg.h b/include/sqlpp11/core/aggregate_function/avg.h index 48265038..f1a8893a 100644 --- a/include/sqlpp11/core/aggregate_function/avg.h +++ b/include/sqlpp11/core/aggregate_function/avg.h @@ -26,8 +26,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include +#include +#include #include namespace sqlpp @@ -74,7 +74,7 @@ namespace sqlpp template using check_avg_arg = - std::enable_if_t<(is_numeric::value or is_boolean::value) and not contains_aggregate_function_t::value>; + ::sqlpp::enable_if_t<(is_numeric::value or is_boolean::value) and not contains_aggregate_function_t::value>; template > auto avg(T t) -> avg_t diff --git a/include/sqlpp11/core/aggregate_function/count.h b/include/sqlpp11/core/aggregate_function/count.h index bfa7832b..40c22131 100644 --- a/include/sqlpp11/core/aggregate_function/count.h +++ b/include/sqlpp11/core/aggregate_function/count.h @@ -26,8 +26,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include +#include +#include #include #include @@ -77,7 +77,7 @@ namespace sqlpp template using check_count_arg = - std::enable_if_t::value and not contains_aggregate_function_t::value>; + ::sqlpp::enable_if_t::value and not contains_aggregate_function_t::value>; template > auto count(T t) -> count_t diff --git a/include/sqlpp11/core/enable_over.h b/include/sqlpp11/core/aggregate_function/enable_over.h similarity index 100% rename from include/sqlpp11/core/enable_over.h rename to include/sqlpp11/core/aggregate_function/enable_over.h diff --git a/include/sqlpp11/core/aggregate_function/max.h b/include/sqlpp11/core/aggregate_function/max.h index f440a93a..dd43acc1 100644 --- a/include/sqlpp11/core/aggregate_function/max.h +++ b/include/sqlpp11/core/aggregate_function/max.h @@ -26,8 +26,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include +#include +#include #include #include @@ -76,7 +76,7 @@ namespace sqlpp template using check_max_arg = - std::enable_if_t::value and not contains_aggregate_function_t::value>; + ::sqlpp::enable_if_t::value and not contains_aggregate_function_t::value>; template > auto max(T t) -> max_t diff --git a/include/sqlpp11/core/aggregate_function/min.h b/include/sqlpp11/core/aggregate_function/min.h index eaba8908..a1f983e3 100644 --- a/include/sqlpp11/core/aggregate_function/min.h +++ b/include/sqlpp11/core/aggregate_function/min.h @@ -26,8 +26,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include +#include +#include #include #include @@ -76,7 +76,7 @@ namespace sqlpp template using check_min_arg = - std::enable_if_t::value and not contains_aggregate_function_t::value>; + ::sqlpp::enable_if_t::value and not contains_aggregate_function_t::value>; template > auto min(T t) -> min_t diff --git a/include/sqlpp11/core/aggregate_function/over.h b/include/sqlpp11/core/aggregate_function/over.h index 42a1bff0..0a6ab11d 100644 --- a/include/sqlpp11/core/aggregate_function/over.h +++ b/include/sqlpp11/core/aggregate_function/over.h @@ -26,8 +26,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include +#include +#include #include namespace sqlpp @@ -59,7 +59,7 @@ namespace sqlpp struct nodes_of>: public nodes_of {}; template - using check_over_args = std::enable_if_t::value>; + using check_over_args = ::sqlpp::enable_if_t::value>; template Context& serialize(Context& context, const over_t& t) diff --git a/include/sqlpp11/core/aggregate_function/sum.h b/include/sqlpp11/core/aggregate_function/sum.h index decc1c1c..392f8c1b 100644 --- a/include/sqlpp11/core/aggregate_function/sum.h +++ b/include/sqlpp11/core/aggregate_function/sum.h @@ -26,8 +26,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include +#include +#include #include #include @@ -77,7 +77,7 @@ namespace sqlpp template using check_sum_arg = - std::enable_if_t<(is_numeric::value or is_boolean::value) and not contains_aggregate_function_t::value>; + ::sqlpp::enable_if_t<(is_numeric::value or is_boolean::value) and not contains_aggregate_function_t::value>; template > auto sum(T t) -> sum_t diff --git a/include/sqlpp11/core/basic/column.h b/include/sqlpp11/core/basic/column.h index 1f48ce9c..7a71f270 100644 --- a/include/sqlpp11/core/basic/column.h +++ b/include/sqlpp11/core/basic/column.h @@ -26,8 +26,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include +#include +#include #include #include #include diff --git a/include/sqlpp11/core/enable_join.h b/include/sqlpp11/core/basic/enable_join.h similarity index 100% rename from include/sqlpp11/core/enable_join.h rename to include/sqlpp11/core/basic/enable_join.h diff --git a/include/sqlpp11/core/basic/parameter.h b/include/sqlpp11/core/basic/parameter.h index 6948644a..d3263d92 100644 --- a/include/sqlpp11/core/basic/parameter.h +++ b/include/sqlpp11/core/basic/parameter.h @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include #include diff --git a/include/sqlpp11/core/basic/table.h b/include/sqlpp11/core/basic/table.h index 11f29d68..456447ea 100644 --- a/include/sqlpp11/core/basic/table.h +++ b/include/sqlpp11/core/basic/table.h @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include #include diff --git a/include/sqlpp11/core/basic/table_alias.h b/include/sqlpp11/core/basic/table_alias.h index 57b64c3d..b31e9a2b 100644 --- a/include/sqlpp11/core/basic/table_alias.h +++ b/include/sqlpp11/core/basic/table_alias.h @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include #include diff --git a/include/sqlpp11/core/basic/value.h b/include/sqlpp11/core/basic/value.h index 47cd6662..7ed5153a 100644 --- a/include/sqlpp11/core/basic/value.h +++ b/include/sqlpp11/core/basic/value.h @@ -50,7 +50,7 @@ namespace sqlpp }; template - using check_value_arg = std::enable_if_t, no_value_t>::value and values_are_comparable::value>; + using check_value_arg = ::sqlpp::enable_if_t, no_value_t>::value and values_are_comparable::value>; template Context& serialize(Context& context, const value_t& t) diff --git a/include/sqlpp11/core/basic/verbatim_table.h b/include/sqlpp11/core/basic/verbatim_table.h index 002cc282..d2f22db3 100644 --- a/include/sqlpp11/core/basic/verbatim_table.h +++ b/include/sqlpp11/core/basic/verbatim_table.h @@ -28,7 +28,7 @@ #include -#include +#include #include namespace sqlpp diff --git a/include/sqlpp11/core/clause/insert_value_list.h b/include/sqlpp11/core/clause/insert_value_list.h index 15e676d0..764abbf5 100644 --- a/include/sqlpp11/core/clause/insert_value_list.h +++ b/include/sqlpp11/core/clause/insert_value_list.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/sqlpp11/core/clause/select_as.h b/include/sqlpp11/core/clause/select_as.h index e4714497..b8293289 100644 --- a/include/sqlpp11/core/clause/select_as.h +++ b/include/sqlpp11/core/clause/select_as.h @@ -27,8 +27,8 @@ */ #include -#include -#include +#include +#include namespace sqlpp { diff --git a/include/sqlpp11/core/simple_column.h b/include/sqlpp11/core/clause/simple_column.h similarity index 100% rename from include/sqlpp11/core/simple_column.h rename to include/sqlpp11/core/clause/simple_column.h diff --git a/include/sqlpp11/core/single_table.h b/include/sqlpp11/core/clause/single_table.h similarity index 100% rename from include/sqlpp11/core/single_table.h rename to include/sqlpp11/core/clause/single_table.h diff --git a/include/sqlpp11/core/clause/update.h b/include/sqlpp11/core/clause/update.h index 67f06a7b..7a9bc9e1 100644 --- a/include/sqlpp11/core/clause/update.h +++ b/include/sqlpp11/core/clause/update.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/sqlpp11/core/compat/make_unique.h b/include/sqlpp11/core/compat/make_unique.h index 6d421fb2..923df574 100644 --- a/include/sqlpp11/core/compat/make_unique.h +++ b/include/sqlpp11/core/compat/make_unique.h @@ -34,15 +34,23 @@ #define CXX_STD_VER __cplusplus #endif +#if CXX_STD_VER >= 201402L + namespace sqlpp { - template - std::unique_ptr make_unique(Args&&... args) - { -#if CXX_STD_VER >= 201402L - return std::make_unique(std::forward(args)...); + using ::std::make_unique; +} + #else - return std::unique_ptr(new T(std::forward(args)...)); -#endif - } + +namespace sqlpp +{ + template + std::unique_ptr make_unique(Args&&... args) + { + return std::unique_ptr(new T(std::forward(args)...)); + } } // namespace sqlpp + +#endif + diff --git a/include/sqlpp11/core/compat/type_traits.h b/include/sqlpp11/core/compat/type_traits.h new file mode 100644 index 00000000..dd660290 --- /dev/null +++ b/include/sqlpp11/core/compat/type_traits.h @@ -0,0 +1,51 @@ +#pragma once + +/* + * Copyright (c) 2024, Roland Bock + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#ifdef _MSVC_LANG +#define CXX_STD_VER _MSVC_LANG +#else +#define CXX_STD_VER __cplusplus +#endif + +#if CXX_STD_VER >= 201703L +namespace sqlpp +{ + using ::std::enable_if_t; +} // namespace sqlpp + +#else + +namespace sqlpp +{ + template + using enable_if_t = typename ::std::enable_if::type; +} // namespace sqlpp + +#endif diff --git a/include/sqlpp11/core/function/lower.h b/include/sqlpp11/core/function/lower.h index 7b48dda8..87838c41 100644 --- a/include/sqlpp11/core/function/lower.h +++ b/include/sqlpp11/core/function/lower.h @@ -61,7 +61,7 @@ namespace sqlpp } template - using check_lower_args = std::enable_if_t::value>; + using check_lower_args = ::sqlpp::enable_if_t::value>; template > auto lower(T t) -> lower_t diff --git a/include/sqlpp11/core/function/trim.h b/include/sqlpp11/core/function/trim.h index 9779466a..6bbc5342 100644 --- a/include/sqlpp11/core/function/trim.h +++ b/include/sqlpp11/core/function/trim.h @@ -69,7 +69,7 @@ namespace sqlpp } template - using check_trim_args = std::enable_if_t::value>; + using check_trim_args = ::sqlpp::enable_if_t::value>; template > auto trim(T t) -> trim_t diff --git a/include/sqlpp11/core/function/upper.h b/include/sqlpp11/core/function/upper.h index f55bb456..e3b5a730 100644 --- a/include/sqlpp11/core/function/upper.h +++ b/include/sqlpp11/core/function/upper.h @@ -61,7 +61,7 @@ namespace sqlpp } template - using check_upper_args = std::enable_if_t::value>; + using check_upper_args = ::sqlpp::enable_if_t::value>; template > auto upper(T t) -> upper_t diff --git a/include/sqlpp11/core/operator/any.h b/include/sqlpp11/core/operator/any.h index 481d1024..467310b7 100644 --- a/include/sqlpp11/core/operator/any.h +++ b/include/sqlpp11/core/operator/any.h @@ -80,7 +80,7 @@ namespace sqlpp } template - using check_any_args = std::enable_if_t::value>; + using check_any_args = ::sqlpp::enable_if_t::value>; template >> auto any(statement_t t) -> any_t> diff --git a/include/sqlpp11/core/operator/arithmetic_expression.h b/include/sqlpp11/core/operator/arithmetic_expression.h index 3ac80fbd..960560fc 100644 --- a/include/sqlpp11/core/operator/arithmetic_expression.h +++ b/include/sqlpp11/core/operator/arithmetic_expression.h @@ -29,8 +29,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include -#include +#include +#include #include namespace sqlpp @@ -56,7 +56,7 @@ namespace sqlpp }; template - using check_arithmetic_args = std::enable_if_t::value and is_numeric::value>; + using check_arithmetic_args = ::sqlpp::enable_if_t::value and is_numeric::value>; #warning: need to document that this is on purpose (not integral, or unsigned integral, or floating_point) because it is difficult to know for the library to know what the actual result type will be (it is difficult to guess in C++ already, and it is probably different from DB vendor to vendor). template @@ -142,7 +142,7 @@ namespace sqlpp } template - using check_concatenation_args = std::enable_if_t::value and is_text::value>; + using check_concatenation_args = ::sqlpp::enable_if_t::value and is_text::value>; template > constexpr auto operator+(L l, R r) -> arithmetic_expression @@ -200,7 +200,7 @@ namespace sqlpp }; template - using check_modulus_args = std::enable_if_t<(is_integral::value or is_unsigned_integral::value) and (is_integral::value or is_unsigned_integral::value)>; + using check_modulus_args = ::sqlpp::enable_if_t<(is_integral::value or is_unsigned_integral::value) and (is_integral::value or is_unsigned_integral::value)>; template > constexpr auto operator%(L l, R r) -> arithmetic_expression diff --git a/include/sqlpp11/core/operator/as_expression.h b/include/sqlpp11/core/operator/as_expression.h index 3210fa7e..3509e890 100644 --- a/include/sqlpp11/core/operator/as_expression.h +++ b/include/sqlpp11/core/operator/as_expression.h @@ -73,7 +73,7 @@ namespace sqlpp return context; } template - using check_as_args = std::enable_if_t< + using check_as_args = ::sqlpp::enable_if_t< has_value_type::value and not is_alias_t::value and has_name::value >; diff --git a/include/sqlpp11/core/operator/assign_expression.h b/include/sqlpp11/core/operator/assign_expression.h index 44c7f995..fe7bad43 100644 --- a/include/sqlpp11/core/operator/assign_expression.h +++ b/include/sqlpp11/core/operator/assign_expression.h @@ -51,10 +51,10 @@ namespace sqlpp template using check_assign_args = - std::enable_if_t::value and (can_be_null::value or not can_be_null::value)>; + ::sqlpp::enable_if_t::value and (can_be_null::value or not can_be_null::value)>; template - using check_assign_default_args = std::enable_if_t::value>; + using check_assign_default_args = ::sqlpp::enable_if_t::value>; template struct is_assignment> : public std::true_type {}; diff --git a/include/sqlpp11/core/operator/between_expression.h b/include/sqlpp11/core/operator/between_expression.h index 06ce0883..df47b938 100644 --- a/include/sqlpp11/core/operator/between_expression.h +++ b/include/sqlpp11/core/operator/between_expression.h @@ -26,7 +26,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include @@ -49,7 +49,7 @@ namespace sqlpp template using check_between_args = - std::enable_if_t::value and values_are_comparable::value>; + ::sqlpp::enable_if_t::value and values_are_comparable::value>; template struct value_type_of> @@ -78,7 +78,7 @@ namespace sqlpp template constexpr auto in(L l, Args... args) - -> std::enable_if_t<((sizeof...(Args) > 0) and ... and values_are_compatible_v), between_t> + -> ::sqlpp::enable_if_t<((sizeof...(Args) > 0) and ... and values_are_compatible_v), between_t> { return between_t{l, std::tuple{args...}}; } diff --git a/include/sqlpp11/core/operator/bit_expression.h b/include/sqlpp11/core/operator/bit_expression.h index 396d0553..7b312958 100644 --- a/include/sqlpp11/core/operator/bit_expression.h +++ b/include/sqlpp11/core/operator/bit_expression.h @@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include -#include +#include #include #include @@ -65,7 +65,7 @@ namespace sqlpp }; template - using check_bit_expression_args = std::enable_if_t::value and (is_integral::value or is_unsigned_integral::value)>; + using check_bit_expression_args = ::sqlpp::enable_if_t::value and (is_integral::value or is_unsigned_integral::value)>; #if 0 template diff --git a/include/sqlpp11/core/operator/comparison_expression.h b/include/sqlpp11/core/operator/comparison_expression.h index 3eb6ec3d..72e56250 100644 --- a/include/sqlpp11/core/operator/comparison_expression.h +++ b/include/sqlpp11/core/operator/comparison_expression.h @@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include -#include +#include #include #include #include @@ -50,7 +50,7 @@ namespace sqlpp }; template - using check_comparison_args = std::enable_if_t::value>; + using check_comparison_args = ::sqlpp::enable_if_t::value>; template struct value_type_of> @@ -258,7 +258,7 @@ namespace sqlpp }; template - using check_like_args = std::enable_if_t::value and is_text::value>; + using check_like_args = ::sqlpp::enable_if_t::value and is_text::value>; template > constexpr auto like(L l, R r) -> comparison_expression diff --git a/include/sqlpp11/core/enable_as.h b/include/sqlpp11/core/operator/enable_as.h similarity index 100% rename from include/sqlpp11/core/enable_as.h rename to include/sqlpp11/core/operator/enable_as.h diff --git a/include/sqlpp11/core/enable_comparison.h b/include/sqlpp11/core/operator/enable_comparison.h similarity index 100% rename from include/sqlpp11/core/enable_comparison.h rename to include/sqlpp11/core/operator/enable_comparison.h diff --git a/include/sqlpp11/core/operator/exists_expression.h b/include/sqlpp11/core/operator/exists_expression.h index 8c99a6e5..001f4a71 100644 --- a/include/sqlpp11/core/operator/exists_expression.h +++ b/include/sqlpp11/core/operator/exists_expression.h @@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include +#include namespace sqlpp { @@ -49,7 +49,7 @@ namespace sqlpp }; template - using check_exists_arg = std::enable_if_t::value and has_result_row_t::value>; template struct value_type_of> diff --git a/include/sqlpp11/core/operator/in_expression.h b/include/sqlpp11/core/operator/in_expression.h index 47f295d9..968b2a78 100644 --- a/include/sqlpp11/core/operator/in_expression.h +++ b/include/sqlpp11/core/operator/in_expression.h @@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include +#include #include #include #include @@ -70,7 +70,7 @@ namespace sqlpp template using check_in_args = - std::enable_if_t<(sizeof...(Args) != 0) and logic::all_t::value...>::value>; + ::sqlpp::enable_if_t<(sizeof...(Args) != 0) and logic::all_t::value...>::value>; template struct value_type_of>> diff --git a/include/sqlpp11/core/operator/logical_expression.h b/include/sqlpp11/core/operator/logical_expression.h index d529a06c..1a6e3863 100644 --- a/include/sqlpp11/core/operator/logical_expression.h +++ b/include/sqlpp11/core/operator/logical_expression.h @@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include -#include +#include #include #include //#include @@ -55,7 +55,7 @@ namespace sqlpp }; template - using check_logical_args = std::enable_if_t::value and is_boolean::value>; + using check_logical_args = ::sqlpp::enable_if_t::value and is_boolean::value>; template struct value_type_of> diff --git a/include/sqlpp11/core/operator/sort_order_expression.h b/include/sqlpp11/core/operator/sort_order_expression.h index a1929a29..f73178e7 100644 --- a/include/sqlpp11/core/operator/sort_order_expression.h +++ b/include/sqlpp11/core/operator/sort_order_expression.h @@ -55,7 +55,7 @@ namespace sqlpp }; template - using check_sort_order_args = std::enable_if_t::value>; + using check_sort_order_args = ::sqlpp::enable_if_t::value>; template struct nodes_of> diff --git a/include/sqlpp11/core/query/dynamic.h b/include/sqlpp11/core/query/dynamic.h index 90977d6a..6a724e48 100644 --- a/include/sqlpp11/core/query/dynamic.h +++ b/include/sqlpp11/core/query/dynamic.h @@ -27,7 +27,7 @@ */ #include -#include +#include #include namespace sqlpp @@ -88,7 +88,7 @@ namespace sqlpp } template - using check_dynamic_args = std::enable_if_t::value>; + using check_dynamic_args = ::sqlpp::enable_if_t::value>; template > auto dynamic(bool condition, Expr t) -> dynamic_t diff --git a/include/sqlpp11/core/type_traits.h b/include/sqlpp11/core/type_traits.h index f9f84b68..dcd2920a 100644 --- a/include/sqlpp11/core/type_traits.h +++ b/include/sqlpp11/core/type_traits.h @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include