Skip to content

Commit 139be78

Browse files
committed
Minor refactoring
1 parent e5be9ab commit 139be78

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

include/scl/sync_send.h

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ concept sync = (is_sync<Args>::value && ...);
129129
// - OR a pointer to a non-member (global) function
130130
// - OR the type is sync
131131
template <typename T>
132-
struct is_send : std::integral_constant<
133-
bool,
132+
struct is_send : std::bool_constant<
134133
(! ((std::is_lvalue_reference_v<T>
135134
&& ! std::is_function_v<std::remove_cvref_t<T>>)
136135
|| (std::is_pointer_v<std::remove_extent_t<std::decay_t<T>>>
@@ -144,6 +143,37 @@ struct is_send : std::integral_constant<
144143
|| is_sync_v<T>)>
145144
{};
146145

146+
// This tries to mimic the logic in the reflection is_send_type function but has compile template errors...
147+
// template <typename T>
148+
// struct is_send_test :
149+
// std::bool_constant<std::conditional_t<std::is_function<std::remove_pointer_t<std::remove_cvref_t<T>>>::type,
150+
// std::false_type,
151+
// std::true_type>::type>
152+
// // std::negate<std::is_member_function_pointer<std::remove_cvref_t<T>>>,
153+
// // std::conditional<std::is_lvalue_reference_v<std::remove_extent_t<T>>
154+
// // || std::is_pointer_v<T>,
155+
// // std::false_type,
156+
// // std::conditional<std::is_arithmetic_v<T>,
157+
// // std::true_type,
158+
// // std::is_rvalue_reference<T>>>>::type>
159+
// {};
160+
//
161+
// static_assert(is_send_test<int>::value);
162+
163+
// bool,
164+
// (! ((std::is_lvalue_reference_v<T>
165+
// && ! std::is_function_v<std::remove_cvref_t<T>>)
166+
// || (std::is_pointer_v<std::remove_extent_t<std::decay_t<T>>>
167+
// && ! is_function_pointer_v<std::decay_t<T>>) // This shouldn't include non-member function pointers
168+
// || is_lambda_v<T>))
169+
// &&
170+
// (std::is_move_constructible_v<T>
171+
// || (is_function_pointer_v<std::decay_t<T>>
172+
// && ! std::is_member_function_pointer_v<std::decay_t<T>>)
173+
// || std::is_function_v<std::decay_t<T>>
174+
// || is_sync_v<T>)>
175+
// {};
176+
147177
// Test doing function first
148178
// template <typename T>
149179
// struct is_send : std::integral_constant<

include/scl/utils/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ foreach(test_file ${test_files})
1414
get_filename_component(name_without_extension "${test_file}" NAME_WE)
1515
icm_add_test(
1616
NAME ${name_without_extension}
17-
SOURCES ${test_file}
18-
)
17+
SOURCES ${test_file})
1918

2019
if(MATCHES ${test_file} fail_*)
2120
set_tests_properties(${name_without_extension} PROPERTIES

0 commit comments

Comments
 (0)