Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dev/alias.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace sqlite_orm {
};

template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool
inline constexpr bool
is_operator_argument_v<T, std::enable_if_t<polyfill::is_specialization_of<T, alias_column_t>::value>> =
true;

Expand Down Expand Up @@ -152,7 +152,7 @@ namespace sqlite_orm {
};

template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool
inline constexpr bool
is_operator_argument_v<T, std::enable_if_t<polyfill::is_specialization_of<T, alias_holder>::value>> = true;

#ifdef SQLITE_ORM_WITH_CPP20_ALIASES
Expand Down
10 changes: 5 additions & 5 deletions dev/alias_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ namespace sqlite_orm {
namespace internal {

template<class A>
SQLITE_ORM_INLINE_VAR constexpr bool is_alias_v = std::is_base_of<alias_tag, A>::value;
inline constexpr bool is_alias_v = std::is_base_of<alias_tag, A>::value;

template<class A>
struct is_alias : polyfill::bool_constant<is_alias_v<A>> {};

/** @short Alias of a column in a record set, see `orm_column_alias`.
*/
template<class A>
SQLITE_ORM_INLINE_VAR constexpr bool is_column_alias_v =
inline constexpr bool is_column_alias_v =
polyfill::conjunction<is_alias<A>, polyfill::negation<polyfill::is_detected<type_t, A>>>::value;

template<class A>
Expand All @@ -39,7 +39,7 @@ namespace sqlite_orm {
/** @short Alias of any type of record set, see `orm_recordset_alias`.
*/
template<class A>
SQLITE_ORM_INLINE_VAR constexpr bool is_recordset_alias_v =
inline constexpr bool is_recordset_alias_v =
polyfill::conjunction<is_alias<A>, polyfill::is_detected<type_t, A>>::value;

template<class A>
Expand All @@ -48,7 +48,7 @@ namespace sqlite_orm {
/** @short Alias of a concrete table, see `orm_table_alias`.
*/
template<class A>
SQLITE_ORM_INLINE_VAR constexpr bool is_table_alias_v = polyfill::conjunction<
inline constexpr bool is_table_alias_v = polyfill::conjunction<
is_recordset_alias<A>,
polyfill::negation<std::is_same<polyfill::detected_t<type_t, A>, std::remove_const_t<A>>>>::value;

Expand All @@ -58,7 +58,7 @@ namespace sqlite_orm {
/** @short Moniker of a CTE, see `orm_cte_moniker`.
*/
template<class A>
SQLITE_ORM_INLINE_VAR constexpr bool is_cte_moniker_v =
inline constexpr bool is_cte_moniker_v =
#if (SQLITE_VERSION_NUMBER >= 3008003) && defined(SQLITE_ORM_WITH_CTE)
polyfill::conjunction_v<is_recordset_alias<A>,
std::is_same<polyfill::detected_t<type_t, A>, std::remove_const_t<A>>>;
Expand Down
2 changes: 1 addition & 1 deletion dev/ast/upsert_clause.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace sqlite_orm {
#endif

template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool is_upsert_clause_v =
inline constexpr bool is_upsert_clause_v =
#if SQLITE_VERSION_NUMBER >= 3024000
polyfill::is_specialization_of<T, upsert_clause>::value;
#else
Expand Down
2 changes: 1 addition & 1 deletion dev/ast/where.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace sqlite_orm {
};

template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool is_where_v = polyfill::is_specialization_of<T, where_t>::value;
inline constexpr bool is_where_v = polyfill::is_specialization_of<T, where_t>::value;

template<class T>
struct is_where : polyfill::bool_constant<is_where_v<T>> {};
Expand Down
10 changes: 0 additions & 10 deletions dev/carray.h
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
#pragma once

/*
* Note: This feature needs constexpr variables with external linkage.
* which can be achieved before C++17's inline variables, but differs from compiler to compiler.
* Hence we make it only available for compilers supporting inline variables.
*/

#ifndef SQLITE_ORM_IMPORT_STD_MODULE
#if SQLITE_VERSION_NUMBER >= 3020000
#ifdef SQLITE_ORM_INLINE_VARIABLES_SUPPORTED
#include <utility> // std::move
#ifndef SQLITE_ORM_WITH_CPP20_ALIASES
#include <type_traits> // std::integral_constant
#endif
#endif
#endif
#endif

#include "functional/gsl.h"
#include "pointer_value.h"

#if SQLITE_VERSION_NUMBER >= 3020000
#ifdef SQLITE_ORM_INLINE_VARIABLES_SUPPORTED
SQLITE_ORM_EXPORT namespace sqlite_orm {

#ifdef SQLITE_ORM_WITH_CPP20_ALIASES
Expand Down Expand Up @@ -146,4 +137,3 @@ SQLITE_ORM_EXPORT namespace sqlite_orm {
};
}
#endif
#endif
6 changes: 2 additions & 4 deletions dev/column_pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@ namespace sqlite_orm {
};

template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool is_column_pointer_v =
polyfill::is_specialization_of<T, column_pointer>::value;
inline constexpr bool is_column_pointer_v = polyfill::is_specialization_of<T, column_pointer>::value;

template<class T>
struct is_column_pointer : polyfill::bool_constant<is_column_pointer_v<T>> {};

template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool is_operator_argument_v<T, std::enable_if_t<is_column_pointer<T>::value>> =
true;
inline constexpr bool is_operator_argument_v<T, std::enable_if_t<is_column_pointer<T>::value>> = true;

#if (SQLITE_VERSION_NUMBER >= 3008003) && defined(SQLITE_ORM_WITH_CTE)
template<class A>
Expand Down
4 changes: 2 additions & 2 deletions dev/conditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ namespace sqlite_orm {
};

template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool is_binary_condition_v = is_base_template_of_v<binary_condition, T>;
inline constexpr bool is_binary_condition_v = is_base_template_of_v<binary_condition, T>;

template<class T>
struct is_binary_condition : polyfill::bool_constant<is_binary_condition_v<T>> {};
Expand Down Expand Up @@ -554,7 +554,7 @@ namespace sqlite_orm {
};

template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool is_order_by_v =
inline constexpr bool is_order_by_v =
polyfill::disjunction<polyfill::is_specialization_of<T, order_by_t>,
polyfill::is_specialization_of<T, multi_order_by_t>,
polyfill::is_specialization_of<T, dynamic_order_by_t>>::value;
Expand Down
6 changes: 3 additions & 3 deletions dev/constraints.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ namespace sqlite_orm {
namespace internal {

template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool is_foreign_key_v =
inline constexpr bool is_foreign_key_v =
#if SQLITE_VERSION_NUMBER >= 3006019
polyfill::is_specialization_of<T, foreign_key_t>::value;
#else
Expand All @@ -474,13 +474,13 @@ namespace sqlite_orm {
struct is_foreign_key : polyfill::bool_constant<is_foreign_key_v<T>> {};

template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool is_primary_key_v = std::is_base_of<primary_key_base, T>::value;
inline constexpr bool is_primary_key_v = std::is_base_of<primary_key_base, T>::value;

template<class T>
struct is_primary_key : polyfill::bool_constant<is_primary_key_v<T>> {};

template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool is_generated_always_v =
inline constexpr bool is_generated_always_v =
#if SQLITE_VERSION_NUMBER >= 3031000
polyfill::is_specialization_of<T, generated_always_t>::value;
#else
Expand Down
3 changes: 1 addition & 2 deletions dev/core_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ namespace sqlite_orm {
};

template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool is_built_in_function_v =
is_base_template_of<built_in_function_t, T>::value;
inline constexpr bool is_built_in_function_v = is_base_template_of<built_in_function_t, T>::value;

template<class T>
struct is_built_in_function : polyfill::bool_constant<is_built_in_function_v<T>> {};
Expand Down
2 changes: 1 addition & 1 deletion dev/expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace sqlite_orm {
};

template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool
inline constexpr bool
is_operator_argument_v<T, std::enable_if_t<polyfill::is_specialization_of<T, expression_t>::value>> = true;

template<class T>
Expand Down
6 changes: 3 additions & 3 deletions dev/field_of.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ namespace sqlite_orm {
* short: `alias_column<alias_d<Derived>>(&Base::field)`
*/
template<class F, class T, class SFINAE = void>
SQLITE_ORM_INLINE_VAR constexpr bool is_field_of_v = false;
inline constexpr bool is_field_of_v = false;

/*
* `true` if a pointer-to-member of Base is convertible to a pointer-to-member of Derived.
*/
template<class O, class Base, class F>
SQLITE_ORM_INLINE_VAR constexpr bool
inline constexpr bool
is_field_of_v<F Base::*, O, std::enable_if_t<std::is_convertible<F Base::*, F O::*>::value>> = true;

template<class F, class T>
SQLITE_ORM_INLINE_VAR constexpr bool is_field_of_v<column_pointer<T, F>, T, void> = true;
inline constexpr bool is_field_of_v<column_pointer<T, F>, T, void> = true;

template<class F, class T>
struct is_field_of : polyfill::bool_constant<is_field_of_v<F, T>> {};
Expand Down
4 changes: 2 additions & 2 deletions dev/field_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ namespace sqlite_orm {
struct indirectly_test_printable;

template<class T, class SFINAE = void>
SQLITE_ORM_INLINE_VAR constexpr bool is_printable_v = false;
inline constexpr bool is_printable_v = false;
template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool
inline constexpr bool
is_printable_v<T, polyfill::void_t<indirectly_test_printable<decltype(field_printer<T>{})>>> = true;

template<class T>
Expand Down
12 changes: 6 additions & 6 deletions dev/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ namespace sqlite_orm {
using aggregate_fin_function_t = decltype(&F::fin);

template<class F, class SFINAE = void>
SQLITE_ORM_INLINE_VAR constexpr bool is_scalar_udf_v = false;
inline constexpr bool is_scalar_udf_v = false;
template<class F>
SQLITE_ORM_INLINE_VAR constexpr bool is_scalar_udf_v<F, polyfill::void_t<scalar_call_function_t<F>>> = true;
inline constexpr bool is_scalar_udf_v<F, polyfill::void_t<scalar_call_function_t<F>>> = true;

template<class F>
struct is_scalar_udf : polyfill::bool_constant<is_scalar_udf_v<F>> {};

template<class F, class SFINAE = void>
SQLITE_ORM_INLINE_VAR constexpr bool is_aggregate_udf_v = false;
inline constexpr bool is_aggregate_udf_v = false;
template<class F>
SQLITE_ORM_INLINE_VAR constexpr bool is_aggregate_udf_v<
inline constexpr bool is_aggregate_udf_v<
F,
polyfill::void_t<aggregate_step_function_t<F>,
aggregate_fin_function_t<F>,
Expand Down Expand Up @@ -222,7 +222,7 @@ namespace sqlite_orm {
};

template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool
inline constexpr bool
is_operator_argument_v<T, std::enable_if_t<polyfill::is_specialization_of<T, function_call>::value>> = true;

template<class T>
Expand Down Expand Up @@ -504,7 +504,7 @@ SQLITE_ORM_EXPORT namespace sqlite_orm {
#ifdef SQLITE_ORM_WITH_CPP20_ALIASES
requires (orm_scalar_udf<UDF> || orm_aggregate_udf<UDF>)
#endif
SQLITE_ORM_INLINE_VAR constexpr internal::function<UDF> func{};
inline constexpr internal::function<UDF> func{};

#ifdef SQLITE_ORM_WITH_CPP20_ALIASES
inline namespace literals {
Expand Down
9 changes: 1 addition & 8 deletions dev/functional/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@
#include <version>
#endif

#ifdef SQLITE_ORM_INLINE_VARIABLES_SUPPORTED
#define SQLITE_ORM_INLINE_VAR inline
#else
#define SQLITE_ORM_INLINE_VAR
#endif

#if __cpp_lib_constexpr_functional >= 201907L
#define SQLITE_ORM_CONSTEXPR_CPP20 constexpr
#else
Expand Down Expand Up @@ -73,8 +67,7 @@
#define SQLITE_ORM_STL_HAS_DEFAULT_SENTINEL
#endif

#if (defined(SQLITE_ORM_CLASSTYPE_TEMPLATE_ARGS_SUPPORTED) && defined(SQLITE_ORM_INLINE_VARIABLES_SUPPORTED) && \
defined(SQLITE_ORM_CONSTEVAL_SUPPORTED)) && \
#if (defined(SQLITE_ORM_CLASSTYPE_TEMPLATE_ARGS_SUPPORTED) && defined(SQLITE_ORM_CONSTEVAL_SUPPORTED)) && \
(defined(SQLITE_ORM_CPP20_CONCEPTS_SUPPORTED))
#define SQLITE_ORM_WITH_CPP20_ALIASES
#endif
Expand Down
5 changes: 3 additions & 2 deletions dev/functional/cxx_check_prerequisites.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#endif

#if (__cpp_noexcept_function_type < 201510L) || \
(__cpp_fold_expressions < 201603L || __cpp_constexpr < 201603L || __cpp_aggregate_bases < 201603L) || \
(__cpp_if_constexpr < 201606L)
(__cpp_fold_expressions < 201603L || __cpp_constexpr < 201603L || __cpp_aggregate_bases < 201603L || \
__cpp_range_based_for < 201603L) || \
(__cpp_if_constexpr < 201606L || __cpp_inline_variables < 201606L || __cpp_structured_bindings < 201606L)
#error A fully C++17-compliant compiler is required.
#endif
12 changes: 0 additions & 12 deletions dev/functional/cxx_core_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,6 @@
#define SQLITE_ORM_HAS_INCLUDE(file) 0L
#endif

#if __cpp_range_based_for >= 201603L
#define SQLITE_ORM_SENTINEL_BASED_FOR_SUPPORTED
#endif

#if __cpp_inline_variables >= 201606L
#define SQLITE_ORM_INLINE_VARIABLES_SUPPORTED
#endif

#if __cpp_structured_bindings >= 201606L
#define SQLITE_ORM_STRUCTURED_BINDINGS_SUPPORTED
#endif

#if __cpp_deduction_guides >= 201703L
#define SQLITE_ORM_CTAD_SUPPORTED
#endif
Expand Down
14 changes: 7 additions & 7 deletions dev/functional/cxx_type_traits_polyfill.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace sqlite_orm {
template<typename B1, typename... Bn>
struct conjunction<B1, Bn...> : mpl::conditional_t<bool(B1::value), conjunction<Bn...>, B1> {};
template<typename... Bs>
SQLITE_ORM_INLINE_VAR constexpr bool conjunction_v = conjunction<Bs...>::value;
inline constexpr bool conjunction_v = conjunction<Bs...>::value;

template<typename...>
struct disjunction : std::false_type {};
Expand All @@ -56,12 +56,12 @@ namespace sqlite_orm {
template<typename B1, typename... Bn>
struct disjunction<B1, Bn...> : mpl::conditional_t<bool(B1::value), B1, disjunction<Bn...>> {};
template<typename... Bs>
SQLITE_ORM_INLINE_VAR constexpr bool disjunction_v = disjunction<Bs...>::value;
inline constexpr bool disjunction_v = disjunction<Bs...>::value;

template<typename B>
struct negation : bool_constant<!bool(B::value)> {};
template<typename B>
SQLITE_ORM_INLINE_VAR constexpr bool negation_v = negation<B>::value;
inline constexpr bool negation_v = negation<B>::value;
#endif

#if __cpp_lib_remove_cvref >= 201711L
Expand Down Expand Up @@ -127,7 +127,7 @@ namespace sqlite_orm {
using detected_or_t = typename detected_or<Default, Op, Args...>::type;

template<template<class...> class Op, class... Args>
SQLITE_ORM_INLINE_VAR constexpr bool is_detected_v = is_detected<Op, Args...>::value;
inline constexpr bool is_detected_v = is_detected<Op, Args...>::value;
#endif

#if 0 // proposed but not pursued
Expand All @@ -136,17 +136,17 @@ namespace sqlite_orm {
// is_specialization_of: https://github.com/cplusplus/papers/issues/812

template<typename Type, template<typename...> class Primary>
SQLITE_ORM_INLINE_VAR constexpr bool is_specialization_of_v = false;
inline constexpr bool is_specialization_of_v = false;

template<template<typename...> class Primary, class... Types>
SQLITE_ORM_INLINE_VAR constexpr bool is_specialization_of_v<Primary<Types...>, Primary> = true;
inline constexpr bool is_specialization_of_v<Primary<Types...>, Primary> = true;

template<typename Type, template<typename...> class Primary>
struct is_specialization_of : bool_constant<is_specialization_of_v<Type, Primary>> {};
#endif

template<typename...>
SQLITE_ORM_INLINE_VAR constexpr bool always_false_v = false;
inline constexpr bool always_false_v = false;

template<size_t I>
using index_constant = std::integral_constant<size_t, I>;
Expand Down
2 changes: 1 addition & 1 deletion dev/functional/is_base_template_of.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ namespace sqlite_orm {
#endif

template<template<typename...> class Base, typename T>
SQLITE_ORM_INLINE_VAR constexpr bool is_base_template_of_v = is_base_template_of<Base, T>::value;
inline constexpr bool is_base_template_of_v = is_base_template_of<Base, T>::value;
}
}
4 changes: 2 additions & 2 deletions dev/functional/mpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ namespace sqlite_orm {
* of older compilers having problems with the detection of dependent templates [SQLITE_ORM_BROKEN_ALIAS_TEMPLATE_DEPENDENT_NTTP_EXPR].
*/
template<class T, class SFINAE = void>
SQLITE_ORM_INLINE_VAR constexpr bool is_quoted_metafuntion_v = false;
inline constexpr bool is_quoted_metafuntion_v = false;
template<class Q>
SQLITE_ORM_INLINE_VAR constexpr bool
inline constexpr bool
is_quoted_metafuntion_v<Q, polyfill::void_t<indirectly_test_metafunction<Q::template fn>>> = true;

template<class T>
Expand Down
Loading