Skip to content

Commit 8dec8db

Browse files
committed
Used conservative type trait value syntax again
... Originating from testing with legacy compilers, but good for code quality as long as the library supports early C++14 compilers. Some might have problems with variable templates
1 parent ef8a2ca commit 8dec8db

28 files changed

+486
-440
lines changed

dev/alias.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ namespace sqlite_orm {
4747

4848
template<class T>
4949
SQLITE_ORM_INLINE_VAR constexpr bool
50-
is_operator_argument_v<T, std::enable_if_t<polyfill::is_specialization_of_v<T, alias_column_t>>> = true;
50+
is_operator_argument_v<T, std::enable_if_t<polyfill::is_specialization_of<T, alias_column_t>::value>> =
51+
true;
5152

5253
struct basic_table;
5354

@@ -134,7 +135,7 @@ namespace sqlite_orm {
134135

135136
template<class T>
136137
SQLITE_ORM_INLINE_VAR constexpr bool
137-
is_operator_argument_v<T, std::enable_if_t<polyfill::is_specialization_of_v<T, alias_holder>>> = true;
138+
is_operator_argument_v<T, std::enable_if_t<polyfill::is_specialization_of<T, alias_holder>::value>> = true;
138139

139140
#ifdef SQLITE_ORM_WITH_CPP20_ALIASES
140141
template<char A, char... X>
@@ -154,7 +155,7 @@ namespace sqlite_orm {
154155
* using als = alias_u<User>;
155156
* select(alias_column<als>(column<User>(&User::id)))
156157
*/
157-
template<class A, class C, std::enable_if_t<internal::is_table_alias_v<A>, bool> = true>
158+
template<class A, class C, std::enable_if_t<internal::is_table_alias<A>::value, bool> = true>
158159
constexpr auto alias_column(C field) {
159160
using namespace ::sqlite_orm::internal;
160161
using aliased_type = type_t<A>;
@@ -172,7 +173,7 @@ namespace sqlite_orm {
172173
* using als = alias_u<User>;
173174
* select(alias_column<als>(&User::id))
174175
*/
175-
template<class A, class F, class O, std::enable_if_t<internal::is_table_alias_v<A>, bool> = true>
176+
template<class A, class F, class O, std::enable_if_t<internal::is_table_alias<A>::value, bool> = true>
176177
constexpr auto alias_column(F O::*field) {
177178
using namespace ::sqlite_orm::internal;
178179
using aliased_type = type_t<A>;

dev/ast/where.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace sqlite_orm {
3131
};
3232

3333
template<class T>
34-
SQLITE_ORM_INLINE_VAR constexpr bool is_where_v = polyfill::is_specialization_of_v<T, where_t>;
34+
SQLITE_ORM_INLINE_VAR constexpr bool is_where_v = polyfill::is_specialization_of<T, where_t>::value;
3535

3636
template<class T>
3737
struct is_where : polyfill::bool_constant<is_where_v<T>> {};

dev/ast_iterator.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ namespace sqlite_orm {
150150
};
151151

152152
template<class T>
153-
struct ast_iterator<T,
154-
std::enable_if_t<polyfill::disjunction_v<is_binary_condition<T>, is_binary_operator<T>>>> {
153+
struct ast_iterator<
154+
T,
155+
std::enable_if_t<polyfill::disjunction<is_binary_condition<T>, is_binary_operator<T>>::value>> {
155156
using node_type = T;
156157

157158
template<class L>
@@ -533,7 +534,7 @@ namespace sqlite_orm {
533534
// note: not strictly necessary as there's no binding support for USING;
534535
// we provide it nevertheless, in line with on_t.
535536
template<class T>
536-
struct ast_iterator<T, std::enable_if_t<polyfill::is_specialization_of_v<T, using_t>>> {
537+
struct ast_iterator<T, std::enable_if_t<polyfill::is_specialization_of<T, using_t>::value>> {
537538
using node_type = T;
538539

539540
template<class L>
@@ -662,9 +663,9 @@ namespace sqlite_orm {
662663
*/
663664
template<class T>
664665
struct ast_iterator<T,
665-
std::enable_if_t<polyfill::disjunction_v<polyfill::is_specialization_of<T, alias_holder>,
666-
polyfill::is_specialization_of<T, literal_holder>,
667-
is_column_alias<T>>>> {
666+
std::enable_if_t<polyfill::disjunction<polyfill::is_specialization_of<T, alias_holder>,
667+
polyfill::is_specialization_of<T, literal_holder>,
668+
is_column_alias<T>>::value>> {
668669
using node_type = T;
669670

670671
template<class L>

dev/column_names_getter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace sqlite_orm {
3434
table.for_each_column([qualified = !context.skip_table_name,
3535
&tableName = table.name,
3636
&collectedExpressions](const column_identifier& column) {
37-
if(is_alias_v<T>) {
37+
if(is_alias<T>::value) {
3838
collectedExpressions.push_back(quote_identifier(alias_extractor<T>::extract()) + "." +
3939
quote_identifier(column.name));
4040
} else if(qualified) {
@@ -46,7 +46,7 @@ namespace sqlite_orm {
4646
});
4747
} else {
4848
collectedExpressions.reserve(collectedExpressions.size() + 1);
49-
if(is_alias_v<T>) {
49+
if(is_alias<T>::value) {
5050
collectedExpressions.push_back(quote_identifier(alias_extractor<T>::extract()) + ".*");
5151
} else if(!context.skip_table_name) {
5252
const basic_table& table = pick_table<mapped_type_proxy_t<T>>(context.db_objects);

dev/column_pointer.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ namespace sqlite_orm {
2222
};
2323

2424
template<class T>
25-
SQLITE_ORM_INLINE_VAR constexpr bool is_column_pointer_v = polyfill::is_specialization_of_v<T, column_pointer>;
25+
SQLITE_ORM_INLINE_VAR constexpr bool is_column_pointer_v =
26+
polyfill::is_specialization_of<T, column_pointer>::value;
2627

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

3031
template<class T>
31-
SQLITE_ORM_INLINE_VAR constexpr bool is_operator_argument_v<T, std::enable_if_t<is_column_pointer_v<T>>> = true;
32+
SQLITE_ORM_INLINE_VAR constexpr bool is_operator_argument_v<T, std::enable_if_t<is_column_pointer<T>::value>> =
33+
true;
3234
}
3335

3436
/**

dev/conditions.h

Lines changed: 53 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -844,114 +844,116 @@ namespace sqlite_orm {
844844
// Intentionally place operators for types classified as arithmetic or general operator arguments in the internal namespace
845845
// to facilitate ADL (Argument Dependent Lookup)
846846
namespace internal {
847-
template<class T,
848-
std::enable_if_t<polyfill::disjunction_v<std::is_base_of<negatable_t, T>, is_operator_argument<T>>,
849-
bool> = true>
847+
template<
848+
class T,
849+
std::enable_if_t<polyfill::disjunction<std::is_base_of<negatable_t, T>, is_operator_argument<T>>::value,
850+
bool> = true>
850851
negated_condition_t<T> operator!(T arg) {
851852
return {std::move(arg)};
852853
}
853854

854855
template<class L,
855856
class R,
856-
std::enable_if_t<polyfill::disjunction_v<std::is_base_of<arithmetic_t, L>,
857-
std::is_base_of<arithmetic_t, R>,
858-
is_operator_argument<L>,
859-
is_operator_argument<R>>,
857+
std::enable_if_t<polyfill::disjunction<std::is_base_of<arithmetic_t, L>,
858+
std::is_base_of<arithmetic_t, R>,
859+
is_operator_argument<L>,
860+
is_operator_argument<R>>::value,
860861
bool> = true>
861862
less_than_t<unwrap_expression_t<L>, unwrap_expression_t<R>> operator<(L l, R r) {
862863
return {get_from_expression(std::forward<L>(l)), get_from_expression(std::forward<R>(r))};
863864
}
864865

865866
template<class L,
866867
class R,
867-
std::enable_if_t<polyfill::disjunction_v<std::is_base_of<arithmetic_t, L>,
868-
std::is_base_of<arithmetic_t, R>,
869-
is_operator_argument<L>,
870-
is_operator_argument<R>>,
868+
std::enable_if_t<polyfill::disjunction<std::is_base_of<arithmetic_t, L>,
869+
std::is_base_of<arithmetic_t, R>,
870+
is_operator_argument<L>,
871+
is_operator_argument<R>>::value,
871872
bool> = true>
872873
less_or_equal_t<unwrap_expression_t<L>, unwrap_expression_t<R>> operator<=(L l, R r) {
873874
return {get_from_expression(std::forward<L>(l)), get_from_expression(std::forward<R>(r))};
874875
}
875876

876877
template<class L,
877878
class R,
878-
std::enable_if_t<polyfill::disjunction_v<std::is_base_of<arithmetic_t, L>,
879-
std::is_base_of<arithmetic_t, R>,
880-
is_operator_argument<L>,
881-
is_operator_argument<R>>,
879+
std::enable_if_t<polyfill::disjunction<std::is_base_of<arithmetic_t, L>,
880+
std::is_base_of<arithmetic_t, R>,
881+
is_operator_argument<L>,
882+
is_operator_argument<R>>::value,
882883
bool> = true>
883884
greater_than_t<unwrap_expression_t<L>, unwrap_expression_t<R>> operator>(L l, R r) {
884885
return {get_from_expression(std::forward<L>(l)), get_from_expression(std::forward<R>(r))};
885886
}
886887

887888
template<class L,
888889
class R,
889-
std::enable_if_t<polyfill::disjunction_v<std::is_base_of<arithmetic_t, L>,
890-
std::is_base_of<arithmetic_t, R>,
891-
is_operator_argument<L>,
892-
is_operator_argument<R>>,
890+
std::enable_if_t<polyfill::disjunction<std::is_base_of<arithmetic_t, L>,
891+
std::is_base_of<arithmetic_t, R>,
892+
is_operator_argument<L>,
893+
is_operator_argument<R>>::value,
893894
bool> = true>
894895
greater_or_equal_t<unwrap_expression_t<L>, unwrap_expression_t<R>> operator>=(L l, R r) {
895896
return {get_from_expression(std::forward<L>(l)), get_from_expression(std::forward<R>(r))};
896897
}
897898

898899
template<class L,
899900
class R,
900-
std::enable_if_t<polyfill::disjunction_v<std::is_base_of<arithmetic_t, L>,
901-
std::is_base_of<arithmetic_t, R>,
902-
std::is_base_of<condition_t, L>,
903-
std::is_base_of<condition_t, R>,
904-
is_operator_argument<L>,
905-
is_operator_argument<R>>,
901+
std::enable_if_t<polyfill::disjunction<std::is_base_of<arithmetic_t, L>,
902+
std::is_base_of<arithmetic_t, R>,
903+
std::is_base_of<condition_t, L>,
904+
std::is_base_of<condition_t, R>,
905+
is_operator_argument<L>,
906+
is_operator_argument<R>>::value,
906907
bool> = true>
907908
is_equal_t<unwrap_expression_t<L>, unwrap_expression_t<R>> operator==(L l, R r) {
908909
return {get_from_expression(std::forward<L>(l)), get_from_expression(std::forward<R>(r))};
909910
}
910911

911912
template<class L,
912913
class R,
913-
std::enable_if_t<polyfill::disjunction_v<std::is_base_of<arithmetic_t, L>,
914-
std::is_base_of<arithmetic_t, R>,
915-
std::is_base_of<condition_t, L>,
916-
std::is_base_of<condition_t, R>,
917-
is_operator_argument<L>,
918-
is_operator_argument<R>>,
914+
std::enable_if_t<polyfill::disjunction<std::is_base_of<arithmetic_t, L>,
915+
std::is_base_of<arithmetic_t, R>,
916+
std::is_base_of<condition_t, L>,
917+
std::is_base_of<condition_t, R>,
918+
is_operator_argument<L>,
919+
is_operator_argument<R>>::value,
919920
bool> = true>
920921
is_not_equal_t<unwrap_expression_t<L>, unwrap_expression_t<R>> operator!=(L l, R r) {
921922
return {get_from_expression(std::forward<L>(l)), get_from_expression(std::forward<R>(r))};
922923
}
923924

924925
template<class L,
925926
class R,
926-
std::enable_if_t<polyfill::disjunction_v<std::is_base_of<condition_t, L>,
927-
std::is_base_of<condition_t, R>,
928-
is_operator_argument<L>,
929-
is_operator_argument<R>>,
927+
std::enable_if_t<polyfill::disjunction<std::is_base_of<condition_t, L>,
928+
std::is_base_of<condition_t, R>,
929+
is_operator_argument<L>,
930+
is_operator_argument<R>>::value,
930931
bool> = true>
931932
and_condition_t<unwrap_expression_t<L>, unwrap_expression_t<R>> operator&&(L l, R r) {
932933
return {get_from_expression(std::forward<L>(l)), get_from_expression(std::forward<R>(r))};
933934
}
934935

935-
template<
936-
class L,
937-
class R,
938-
std::enable_if_t<polyfill::disjunction_v<std::is_base_of<condition_t, L>, std::is_base_of<condition_t, R>>,
939-
bool> = true>
936+
template<class L,
937+
class R,
938+
std::enable_if_t<
939+
polyfill::disjunction<std::is_base_of<condition_t, L>, std::is_base_of<condition_t, R>>::value,
940+
bool> = true>
940941
or_condition_t<unwrap_expression_t<L>, unwrap_expression_t<R>> operator||(L l, R r) {
941942
return {get_from_expression(std::forward<L>(l)), get_from_expression(std::forward<R>(r))};
942943
}
943944

944-
template<class L,
945-
class R,
946-
std::enable_if_t<polyfill::conjunction_v<
947-
polyfill::disjunction<std::is_base_of<conc_string, L>,
948-
std::is_base_of<conc_string, R>,
949-
is_operator_argument<L>,
950-
is_operator_argument<R>>,
951-
// exclude conditions
952-
polyfill::negation<polyfill::disjunction<std::is_base_of<condition_t, L>,
953-
std::is_base_of<condition_t, R>>>>,
954-
bool> = true>
945+
template<
946+
class L,
947+
class R,
948+
std::enable_if_t<polyfill::conjunction<
949+
polyfill::disjunction<std::is_base_of<conc_string, L>,
950+
std::is_base_of<conc_string, R>,
951+
is_operator_argument<L>,
952+
is_operator_argument<R>>,
953+
// exclude conditions
954+
polyfill::negation<polyfill::disjunction<std::is_base_of<condition_t, L>,
955+
std::is_base_of<condition_t, R>>>>::value,
956+
bool> = true>
955957
conc_t<unwrap_expression_t<L>, unwrap_expression_t<R>> operator||(L l, R r) {
956958
return {get_from_expression(std::forward<L>(l)), get_from_expression(std::forward<R>(r))};
957959
}

dev/constraints.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ namespace sqlite_orm {
427427
template<class T>
428428
SQLITE_ORM_INLINE_VAR constexpr bool is_foreign_key_v =
429429
#if SQLITE_VERSION_NUMBER >= 3006019
430-
polyfill::is_specialization_of_v<T, foreign_key_t>;
430+
polyfill::is_specialization_of<T, foreign_key_t>::value;
431431
#else
432432
false;
433433
#endif
@@ -444,7 +444,7 @@ namespace sqlite_orm {
444444
template<class T>
445445
SQLITE_ORM_INLINE_VAR constexpr bool is_generated_always_v =
446446
#if SQLITE_VERSION_NUMBER >= 3031000
447-
polyfill::is_specialization_of_v<T, generated_always_t>;
447+
polyfill::is_specialization_of<T, generated_always_t>::value;
448448
#else
449449
false;
450450
#endif

0 commit comments

Comments
 (0)