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
3 changes: 0 additions & 3 deletions dev/constraints.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ namespace sqlite_orm {
const primary_key_type& as_base() const {
return *this;
}
#ifndef SQLITE_ORM_AGGREGATE_BASES_SUPPORTED
constexpr primary_key_with_autoincrement(primary_key_type primary_key) : primary_key_type{primary_key} {}
#endif
};

/**
Expand Down
8 changes: 0 additions & 8 deletions dev/functional/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
#include <version>
#endif

#ifdef SQLITE_ORM_CONSTEXPR_LAMBDAS_SUPPORTED
#define SQLITE_ORM_CONSTEXPR_LAMBDA_CPP17 constexpr
#else
#define SQLITE_ORM_CONSTEXPR_LAMBDA_CPP17
#endif

#ifdef SQLITE_ORM_INLINE_VARIABLES_SUPPORTED
#define SQLITE_ORM_INLINE_VAR inline
#else
Expand Down Expand Up @@ -76,9 +70,7 @@
#define SQLITE_ORM_WITH_CPP20_ALIASES
#endif

#if defined(SQLITE_ORM_FOLD_EXPRESSIONS_SUPPORTED)
#define SQLITE_ORM_WITH_CTE
#endif

// define the inline namespace "literals" so that it is available even if it was not introduced by a feature
namespace sqlite_orm {
Expand Down
4 changes: 3 additions & 1 deletion dev/functional/cxx_check_prerequisites.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#error A fully C++17-compliant compiler is required.
#endif

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

#if __cpp_noexcept_function_type >= 201510L
#define SQLITE_ORM_NOTHROW_ALIASES_SUPPORTED
#endif

#if __cpp_aggregate_bases >= 201603L
#define SQLITE_ORM_AGGREGATE_BASES_SUPPORTED
#endif

#if __cpp_fold_expressions >= 201603L
#define SQLITE_ORM_FOLD_EXPRESSIONS_SUPPORTED
#endif

#if __cpp_constexpr >= 201603L
#define SQLITE_ORM_CONSTEXPR_LAMBDAS_SUPPORTED
#endif

#if __cpp_range_based_for >= 201603L
#define SQLITE_ORM_SENTINEL_BASED_FOR_SUPPORTED
#endif
Expand Down
2 changes: 1 addition & 1 deletion dev/functional/cxx_functional_polyfill.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ namespace sqlite_orm {
template<class Void, class... X>
struct is_invocable_impl : std::false_type {};

#if __cplusplus >= 201703
#if __cplusplus >= 201703L
template<class... Ts>
struct is_invocable_impl<polyfill::void_t<decltype(polyfill::invoke(std::declval<Ts>()...))>, Ts...>
: std::true_type {};
Expand Down
2 changes: 0 additions & 2 deletions dev/functional/function_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ namespace sqlite_orm {
using signature_type = R(Args...) const;
};

#ifdef SQLITE_ORM_NOTHROW_ALIASES_SUPPORTED
template<class R, class... Args>
struct function_traits<R(Args...) noexcept> : function_traits<R(Args...)> {
using signature_type = R(Args...) noexcept;
Expand All @@ -61,7 +60,6 @@ namespace sqlite_orm {
struct function_traits<R(Args...) const noexcept> : function_traits<R(Args...)> {
using signature_type = R(Args...) const noexcept;
};
#endif

/*
* Pick signature of function pointer
Expand Down
12 changes: 1 addition & 11 deletions dev/functional/index_sequence_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace sqlite_orm {
SQLITE_ORM_CONSTEVAL auto index_sequence_value_at(std::index_sequence<Idx...>) {
return Idx...[Pos];
}
#elif defined(SQLITE_ORM_FOLD_EXPRESSIONS_SUPPORTED)
#else
/**
* Get the index value of an `index_sequence` at a specific position.
*/
Expand All @@ -31,16 +31,6 @@ namespace sqlite_orm {
(void)((result = Idx, i++ == Pos) || ...);
return result;
}
#else
/**
* Get the index value of an `index_sequence` at a specific position.
* `Pos` must always be `0`.
*/
template<size_t Pos, size_t I, size_t... Idx>
SQLITE_ORM_CONSTEVAL size_t index_sequence_value_at(std::index_sequence<I, Idx...>) {
static_assert(Pos == 0, "");
return I;
}
#endif

template<class... Seq>
Expand Down
4 changes: 0 additions & 4 deletions dev/member_traits/member_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ namespace sqlite_orm {
template<class F>
struct getter_field_type<F(void)> : polyfill::remove_cvref<F> {};

#ifdef SQLITE_ORM_NOTHROW_ALIASES_SUPPORTED
template<class F>
struct getter_field_type<F(void) const noexcept> : polyfill::remove_cvref<F> {};

template<class F>
struct getter_field_type<F(void) noexcept> : polyfill::remove_cvref<F> {};
#endif

// SFINAE friendly trait to get a member function pointer's field type (i.e. unqualified parameter type)
template<class T>
Expand All @@ -55,10 +53,8 @@ namespace sqlite_orm {
template<class F>
struct setter_field_type<void(F)> : polyfill::remove_cvref<F> {};

#ifdef SQLITE_ORM_NOTHROW_ALIASES_SUPPORTED
template<class F>
struct setter_field_type<void(F) noexcept> : polyfill::remove_cvref<F> {};
#endif

template<class T, class SFINAE = void>
struct is_getter : std::false_type {};
Expand Down
8 changes: 1 addition & 7 deletions dev/schema/column.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,7 @@ namespace sqlite_orm {
* It is a composition of orthogonal information stored in different base classes.
*/
template<class G, class S, class... Op>
struct column_t : column_identifier, column_field<G, S>, column_constraints<Op...> {
#ifndef SQLITE_ORM_AGGREGATE_BASES_SUPPORTED
column_t(std::string name, G memberPointer, S setter, std::tuple<Op...> op) :
column_identifier{std::move(name)}, column_field<G, S>{memberPointer, setter},
column_constraints<Op...>{std::move(op)} {}
#endif
};
struct column_t : column_identifier, column_field<G, S>, column_constraints<Op...> {};

template<class T, class SFINAE = void>
struct column_field_expression {
Expand Down
5 changes: 0 additions & 5 deletions dev/schema/index.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ namespace sqlite_orm {
using object_type = void;
using table_mapped_type = T;

#ifndef SQLITE_ORM_AGGREGATE_BASES_SUPPORTED
index_t(std::string name_, bool unique_, elements_type elements_) :
index_base{std::move(name_), unique_}, elements(std::move(elements_)) {}
#endif

elements_type elements;
};
}
Expand Down
10 changes: 0 additions & 10 deletions dev/schema/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ namespace sqlite_orm {

elements_type elements;

#ifndef SQLITE_ORM_AGGREGATE_BASES_SUPPORTED
table_t(std::string name_, elements_type elements_) :
basic_table{std::move(name_)}, elements{std::move(elements_)} {}
#endif

table_t<O, true, Cs...> without_rowid() const {
return {this->name, this->elements};
}
Expand Down Expand Up @@ -311,11 +306,6 @@ namespace sqlite_orm {

module_details_type module_details;

#ifndef SQLITE_ORM_AGGREGATE_BASES_SUPPORTED
virtual_table_t(std::string name, module_details_type module_details) :
basic_table{std::move(name)}, module_details{std::move(module_details)} {}
#endif

/**
* Call passed lambda with columns not having the specified constraint trait `OpTrait`.
* @param lambda Lambda called for each column.
Expand Down
5 changes: 0 additions & 5 deletions dev/schema/triggers.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ namespace sqlite_orm {
* Statements of the triggers (to be executed when the trigger fires)
*/
elements_type elements;

#ifndef SQLITE_ORM_AGGREGATE_BASES_SUPPORTED
trigger_t(std::string name, T trigger_base, elements_type statements) :
base_trigger{std::move(name)}, base(std::move(trigger_base)), elements(std::move(statements)) {}
#endif
};

/**
Expand Down
8 changes: 0 additions & 8 deletions dev/statement_binder.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,18 +337,10 @@ namespace sqlite_orm {
}

private:
#ifdef SQLITE_ORM_FOLD_EXPRESSIONS_SUPPORTED
template<class Tpl, size_t... Idx, class Projection>
void operator()(const Tpl& tpl, std::index_sequence<Idx...>, Projection project) const {
(this->bind(polyfill::invoke(project, std::get<Idx>(tpl)), Idx), ...);
}
#else
template<class Tpl, size_t... Idx, class Projection>
void operator()(const Tpl& tpl, std::index_sequence<Idx...>, Projection project) const {
using Sink = int[sizeof...(Idx)];
(void)Sink{(this->bind(polyfill::invoke(project, std::get<Idx>(tpl)), Idx), 0)...};
}
#endif

template<class T>
void bind(const T& t, size_t idx) const {
Expand Down
6 changes: 2 additions & 4 deletions dev/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,8 @@ namespace sqlite_orm {

template<class O>
void assert_updatable_type() const {
#if defined(SQLITE_ORM_FOLD_EXPRESSIONS_SUPPORTED)
using Table = storage_pick_table_t<O, db_objects_type>;
using elements_type = elements_type_t<Table>;
using table_type = storage_pick_table_t<O, db_objects_type>;
using elements_type = elements_type_t<table_type>;
using col_index_sequence = filter_tuple_sequence_t<elements_type, is_column>;
using pk_index_sequence = filter_tuple_sequence_t<elements_type, is_primary_key>;
using pkcol_index_sequence = col_index_sequence_with<elements_type, is_primary_key>;
Expand All @@ -274,7 +273,6 @@ namespace sqlite_orm {
static_assert(
nonPrimaryKeysColumnsCount > 0,
"A table with only primary keys cannot be updated. You need at least 1 non-primary key column");
#endif
}

template<class O,
Expand Down
27 changes: 1 addition & 26 deletions dev/tuple_helper/tuple_iteration.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace sqlite_orm {
namespace internal {
#if defined(SQLITE_ORM_FOLD_EXPRESSIONS_SUPPORTED)
template<bool reversed = false, class Tpl, size_t... Idx, class L>
constexpr void iterate_tuple(Tpl& tpl, std::index_sequence<Idx...>, L&& lambda) {
if constexpr (reversed) {
Expand All @@ -24,50 +23,26 @@ namespace sqlite_orm {
(lambda(std::get<Idx>(tpl)), ...);
}
}
#else
template<bool reversed = false, class Tpl, class L>
void iterate_tuple(Tpl& /*tpl*/, std::index_sequence<>, L&& /*lambda*/) {}

template<bool reversed = false, class Tpl, size_t I, size_t... Idx, class L>
void iterate_tuple(Tpl& tpl, std::index_sequence<I, Idx...>, L&& lambda) {
if constexpr (reversed) {
iterate_tuple<reversed>(tpl, std::index_sequence<Idx...>{}, std::forward<L>(lambda));
lambda(std::get<I>(tpl));
} else {
lambda(std::get<I>(tpl));
iterate_tuple<reversed>(tpl, std::index_sequence<Idx...>{}, std::forward<L>(lambda));
}
}
#endif
template<bool reversed = false, class Tpl, class L>
constexpr void iterate_tuple(Tpl&& tpl, L&& lambda) {
iterate_tuple<reversed>(tpl,
std::make_index_sequence<std::tuple_size<std::remove_reference_t<Tpl>>::value>{},
std::forward<L>(lambda));
}

#ifdef SQLITE_ORM_FOLD_EXPRESSIONS_SUPPORTED
template<class Tpl, size_t... Idx, class L>
constexpr void iterate_tuple(std::index_sequence<Idx...>, L&& lambda) {
(lambda((std::tuple_element_t<Idx, Tpl>*)nullptr), ...);
}
#else
template<class Tpl, size_t... Idx, class L>
constexpr void iterate_tuple(std::index_sequence<Idx...>, L&& lambda) {
using Sink = int[sizeof...(Idx)];
(void)Sink{(lambda((std::tuple_element_t<Idx, Tpl>*)nullptr), 0)...};
}
#endif

template<class Tpl, class L>
constexpr void iterate_tuple(L&& lambda) {
iterate_tuple<Tpl>(std::make_index_sequence<std::tuple_size<Tpl>::value>{}, std::forward<L>(lambda));
}

template<template<class...> class Base, class L>
struct lambda_as_template_base : L {
#ifndef SQLITE_ORM_AGGREGATE_BASES_SUPPORTED
lambda_as_template_base(L&& lambda) : L{std::move(lambda)} {}
#endif
template<class... T>
decltype(auto) operator()(const Base<T...>& object) {
return L::operator()(object);
Expand Down
3 changes: 0 additions & 3 deletions dev/tuple_helper/tuple_transformer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ namespace sqlite_orm {
template<class Pack, template<class...> class Op>
using transform_tuple_t = typename tuple_transformer<Pack, Op>::type;

// note: applying a combiner like `plus_fold_integrals` needs fold expressions
#if defined(SQLITE_ORM_FOLD_EXPRESSIONS_SUPPORTED)
/*
* Apply a projection to a tuple's elements filtered by the specified indexes, and combine the results.
*
Expand Down Expand Up @@ -95,7 +93,6 @@ namespace sqlite_orm {
IdxSeq{},
project_nested_tuple_size<NestedProject>{},
std::integral_constant<size_t, 0u>{}));
#endif

template<class R, class Tpl, size_t... Idx, class Projection = polyfill::identity>
constexpr R create_from_tuple(Tpl&& tpl, std::index_sequence<Idx...>, Projection project = {}) {
Expand Down
6 changes: 3 additions & 3 deletions dev/udf_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace sqlite_orm {
std::allocator<UDF> allocator;
using traits = std::allocator_traits<decltype(allocator)>;

SQLITE_ORM_CONSTEXPR_LAMBDA_CPP17 auto deallocate = [](void* location) noexcept {
constexpr auto deallocate = [](void* location) noexcept {
std::allocator<UDF> allocator;
using traits = std::allocator_traits<decltype(allocator)>;
traits::deallocate(allocator, (UDF*)location, 1);
Expand All @@ -38,13 +38,13 @@ namespace sqlite_orm {
*/
template<class UDF>
std::pair<void* (*)(), xdestroy_fn_t> obtain_udf_allocator() {
SQLITE_ORM_CONSTEXPR_LAMBDA_CPP17 auto allocate = []() {
constexpr auto allocate = []() {
std::allocator<UDF> allocator;
using traits = std::allocator_traits<decltype(allocator)>;
return (void*)traits::allocate(allocator, 1);
};

SQLITE_ORM_CONSTEXPR_LAMBDA_CPP17 auto deallocate = [](void* location) noexcept {
constexpr auto deallocate = [](void* location) noexcept {
std::allocator<UDF> allocator;
using traits = std::allocator_traits<decltype(allocator)>;
traits::deallocate(allocator, (UDF*)location, 1);
Expand Down
Loading