Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
a9e0780f
Commit
a9e0780f
authored
Aug 10, 2023
by
Shariar Azad Riday
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor remaining std::$pred<>::value to std::$pred_v<>
parent
8ce060cf
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
49 additions
and
54 deletions
+49
-54
libcaf_core/caf/actor_factory.hpp
libcaf_core/caf/actor_factory.hpp
+2
-3
libcaf_core/caf/config_value.hpp
libcaf_core/caf/config_value.hpp
+5
-6
libcaf_core/caf/config_value_reader.cpp
libcaf_core/caf/config_value_reader.cpp
+1
-1
libcaf_core/caf/deduce_mpi.hpp
libcaf_core/caf/deduce_mpi.hpp
+1
-1
libcaf_core/caf/detail/init_fun_factory.hpp
libcaf_core/caf/detail/init_fun_factory.hpp
+1
-1
libcaf_core/caf/detail/parser/read_signed_integer.hpp
libcaf_core/caf/detail/parser/read_signed_integer.hpp
+1
-2
libcaf_core/caf/detail/parser/read_unsigned_integer.hpp
libcaf_core/caf/detail/parser/read_unsigned_integer.hpp
+2
-2
libcaf_core/caf/detail/print.hpp
libcaf_core/caf/detail/print.hpp
+1
-1
libcaf_core/caf/detail/spawn_fwd.hpp
libcaf_core/caf/detail/spawn_fwd.hpp
+1
-1
libcaf_core/caf/detail/squashed_int.hpp
libcaf_core/caf/detail/squashed_int.hpp
+1
-1
libcaf_core/caf/detail/stringification_inspector.hpp
libcaf_core/caf/detail/stringification_inspector.hpp
+1
-1
libcaf_core/caf/detail/type_traits.hpp
libcaf_core/caf/detail/type_traits.hpp
+9
-10
libcaf_core/caf/detail/typed_actor_util.hpp
libcaf_core/caf/detail/typed_actor_util.hpp
+2
-3
libcaf_core/caf/expected.hpp
libcaf_core/caf/expected.hpp
+4
-6
libcaf_core/caf/inspector_access.hpp
libcaf_core/caf/inspector_access.hpp
+1
-1
libcaf_core/caf/load_inspector.hpp
libcaf_core/caf/load_inspector.hpp
+1
-1
libcaf_core/caf/load_inspector_base.hpp
libcaf_core/caf/load_inspector_base.hpp
+1
-1
libcaf_core/caf/mtl.hpp
libcaf_core/caf/mtl.hpp
+2
-2
libcaf_core/caf/node_id.cpp
libcaf_core/caf/node_id.cpp
+3
-1
libcaf_core/caf/optional.hpp
libcaf_core/caf/optional.hpp
+2
-4
libcaf_core/caf/save_inspector.hpp
libcaf_core/caf/save_inspector.hpp
+1
-1
libcaf_test/caf/test/dsl.hpp
libcaf_test/caf/test/dsl.hpp
+2
-0
libcaf_test/caf/test/unit_test.hpp
libcaf_test/caf/test/unit_test.hpp
+4
-4
No files found.
libcaf_core/caf/actor_factory.hpp
View file @
a9e0780f
...
...
@@ -142,9 +142,8 @@ actor_factory_result dyn_spawn_class(actor_config& cfg, message& msg) {
template
<
class
T
,
class
...
Ts
>
actor_factory
make_actor_factory
()
{
static_assert
(
detail
::
conjunction
<
std
::
is_lvalue_reference
<
Ts
>::
value
...
>::
value
,
"all Ts must be lvalue references"
);
static_assert
(
detail
::
conjunction
<
std
::
is_lvalue_reference_v
<
Ts
>
...
>::
value
,
"all Ts must be lvalue references"
);
static_assert
(
std
::
is_base_of_v
<
local_actor
,
T
>
,
"T is not derived from local_actor"
);
return
&
dyn_spawn_class
<
T
,
Ts
...
>
;
...
...
libcaf_core/caf/config_value.hpp
View file @
a9e0780f
...
...
@@ -290,7 +290,7 @@ private:
void
set
(
T
x
)
{
if
constexpr
(
detail
::
is_config_value_type_v
<
T
>
)
{
data_
=
std
::
move
(
x
);
}
else
if
constexpr
(
std
::
is_integral
<
T
>::
value
)
{
}
else
if
constexpr
(
std
::
is_integral
_v
<
T
>
)
{
data_
=
static_cast
<
int64_t
>
(
x
);
}
else
if
constexpr
(
std
::
is_convertible
<
T
,
const
char
*>::
value
)
{
data_
=
std
::
string
{
x
};
...
...
@@ -365,7 +365,7 @@ expected<T> get_as(const config_value& x, inspector_access_type::builtin) {
return
to_string
(
x
);
}
else
if
constexpr
(
std
::
is_same_v
<
T
,
bool
>
)
{
return
x
.
to_boolean
();
}
else
if
constexpr
(
std
::
is_integral
<
T
>::
value
)
{
}
else
if
constexpr
(
std
::
is_integral
_v
<
T
>
)
{
if
(
auto
result
=
x
.
to_integer
())
{
if
(
detail
::
bounds_checker
<
T
>::
check
(
*
result
))
return
static_cast
<
T
>
(
*
result
);
...
...
@@ -374,7 +374,7 @@ expected<T> get_as(const config_value& x, inspector_access_type::builtin) {
}
else
{
return
std
::
move
(
result
.
error
());
}
}
else
if
constexpr
(
std
::
is_floating_point
<
T
>::
value
)
{
}
else
if
constexpr
(
std
::
is_floating_point
_v
<
T
>
)
{
if
(
auto
result
=
x
.
to_real
())
{
if
constexpr
(
sizeof
(
T
)
>=
sizeof
(
config_value
::
real
))
{
return
*
result
;
...
...
@@ -419,10 +419,9 @@ get_as_tuple(const config_value::list& x, std::index_sequence<Is...>) {
template
<
class
T
>
expected
<
T
>
get_as
(
const
config_value
&
x
,
inspector_access_type
::
tuple
)
{
static_assert
(
!
std
::
is_array
<
T
>::
value
,
"cannot return an array from a function"
);
static_assert
(
!
std
::
is_array_v
<
T
>
,
"cannot return an array from a function"
);
if
(
auto
wrapped_values
=
x
.
to_list
())
{
static
constexpr
size_t
n
=
std
::
tuple_size
<
T
>::
value
;
static
constexpr
size_t
n
=
std
::
tuple_size
_v
<
T
>
;
if
(
wrapped_values
->
size
()
==
n
)
return
get_as_tuple
<
T
>
(
*
wrapped_values
,
std
::
make_index_sequence
<
n
>
{});
else
...
...
libcaf_core/caf/config_value_reader.cpp
View file @
a9e0780f
...
...
@@ -406,7 +406,7 @@ bool pull(config_value_reader& reader, T& x) {
using
internal_type
=
std
::
conditional_t
<
std
::
is_floating_point_v
<
T
>
,
config_value
::
real
,
T
>
;
auto
assign
=
[
&
x
](
auto
&
result
)
{
if
constexpr
(
std
::
is_floating_point
<
T
>::
value
)
{
if
constexpr
(
std
::
is_floating_point
_v
<
T
>
)
{
x
=
static_cast
<
T
>
(
result
);
}
else
{
x
=
result
;
...
...
libcaf_core/caf/deduce_mpi.hpp
View file @
a9e0780f
...
...
@@ -42,7 +42,7 @@ struct dmi<typed_response_promise<Out...>(In...)> {
// -- dmfou = deduce_mpi_function_object_unboxing
template
<
class
T
,
bool
isClass
=
std
::
is_class
<
T
>
::
value
>
template
<
class
T
,
bool
isClass
=
std
::
is_class
_v
<
T
>
>
struct
dmfou
;
// case #1a: const member function pointer
...
...
libcaf_core/caf/detail/init_fun_factory.hpp
View file @
a9e0780f
...
...
@@ -47,7 +47,7 @@ class init_fun_factory_helper final : public init_fun_factory_helper_base {
public:
using
args_pointer
=
std
::
shared_ptr
<
Tuple
>
;
static
constexpr
bool
args_empty
=
std
::
tuple_size
<
Tuple
>::
value
==
0
;
static
constexpr
bool
args_empty
=
std
::
tuple_size
_v
<
Tuple
>
==
0
;
init_fun_factory_helper
(
F
fun
,
args_pointer
args
)
:
fun_
(
std
::
move
(
fun
)),
args_
(
std
::
move
(
args
))
{
...
...
libcaf_core/caf/detail/parser/read_signed_integer.hpp
View file @
a9e0780f
...
...
@@ -28,8 +28,7 @@ template <class State, class Consumer>
void
read_signed_integer
(
State
&
ps
,
Consumer
&&
consumer
)
{
using
consumer_type
=
typename
std
::
decay
<
Consumer
>::
type
;
using
value_type
=
typename
consumer_type
::
value_type
;
static_assert
(
std
::
is_integral
<
value_type
>::
value
&&
std
::
is_signed
<
value_type
>::
value
,
static_assert
(
std
::
is_integral_v
<
value_type
>
&&
std
::
is_signed_v
<
value_type
>
,
"expected a signed integer type"
);
value_type
result
=
0
;
// Computes the result on success.
...
...
libcaf_core/caf/detail/parser/read_unsigned_integer.hpp
View file @
a9e0780f
...
...
@@ -28,8 +28,8 @@ template <class State, class Consumer>
void
read_unsigned_integer
(
State
&
ps
,
Consumer
&&
consumer
)
{
using
consumer_type
=
typename
std
::
decay
<
Consumer
>::
type
;
using
value_type
=
typename
consumer_type
::
value_type
;
static_assert
(
std
::
is_integral
<
value_type
>::
value
&&
std
::
is_unsigned
<
value_type
>::
value
,
static_assert
(
std
::
is_integral
_v
<
value_type
>
&&
std
::
is_unsigned
_v
<
value_type
>
,
"expected an unsigned integer type"
);
value_type
result
=
0
;
// Computes the result on success.
...
...
libcaf_core/caf/detail/print.hpp
View file @
a9e0780f
...
...
@@ -133,7 +133,7 @@ std::enable_if_t<std::is_integral_v<T>> print(Buffer& buf, T x) {
char
stack_buffer
[
24
];
char
*
p
=
stack_buffer
;
// Convert negative values into positives as necessary.
if
constexpr
(
std
::
is_signed
<
T
>::
value
)
{
if
constexpr
(
std
::
is_signed
_v
<
T
>
)
{
if
(
x
==
std
::
numeric_limits
<
T
>::
min
())
{
using
namespace
std
::
literals
;
// The code below would fail for the smallest value, because this value
...
...
libcaf_core/caf/detail/spawn_fwd.hpp
View file @
a9e0780f
...
...
@@ -40,7 +40,7 @@ typename std::conditional<
spawn_fwd_convert
<
typename
std
::
remove_reference
<
T
>::
type
>::
value
,
actor
,
T
&&>::
type
spawn_fwd
(
typename
std
::
remove_reference
<
T
>::
type
&&
arg
)
noexcept
{
static_assert
(
!
std
::
is_lvalue_reference
<
T
>::
value
,
static_assert
(
!
std
::
is_lvalue_reference
_v
<
T
>
,
"silently converting an lvalue to an rvalue"
);
return
static_cast
<
T
&&>
(
arg
);
}
...
...
libcaf_core/caf/detail/squashed_int.hpp
View file @
a9e0780f
...
...
@@ -50,7 +50,7 @@ struct squashed_int {
template
<
class
T
>
using
squashed_int_t
=
typename
squashed_int
<
T
>::
type
;
template
<
class
T
,
bool
=
std
::
is_integral
<
T
>
::
value
>
template
<
class
T
,
bool
=
std
::
is_integral
_v
<
T
>
>
struct
squash_if_int
{
using
type
=
T
;
};
...
...
libcaf_core/caf/detail/stringification_inspector.hpp
View file @
a9e0780f
...
...
@@ -91,7 +91,7 @@ public:
template
<
class
Integral
>
std
::
enable_if_t
<
std
::
is_integral_v
<
Integral
>
,
bool
>
value
(
Integral
x
)
{
if
constexpr
(
std
::
is_signed
<
Integral
>::
value
)
if
constexpr
(
std
::
is_signed
_v
<
Integral
>
)
return
int_value
(
static_cast
<
int64_t
>
(
x
));
else
return
int_value
(
static_cast
<
uint64_t
>
(
x
));
...
...
libcaf_core/caf/detail/type_traits.hpp
View file @
a9e0780f
...
...
@@ -146,7 +146,7 @@ struct is_primitive {
static
constexpr
bool
value
=
std
::
is_convertible_v
<
T
,
std
::
string
>
||
std
::
is_convertible_v
<
T
,
std
::
u16string
>
||
std
::
is_convertible_v
<
T
,
std
::
u32string
>
||
std
::
is_arithmetic
<
T
>::
value
;
||
std
::
is_arithmetic
_v
<
T
>
;
};
/// Checks whether `T1` is comparable with `T2`.
...
...
@@ -327,9 +327,9 @@ struct has_apply_operator {
// matches (IsFun || IsMemberFun)
template
<
class
T
,
bool
IsFun
=
std
::
is_function
<
T
>
::
value
=
std
::
is_function
_v
<
T
>
||
std
::
is_function
<
typename
std
::
remove_pointer
<
T
>::
type
>::
value
||
std
::
is_member_function_pointer
<
T
>::
value
,
||
std
::
is_member_function_pointer
_v
<
T
>
,
bool
HasApplyOp
=
has_apply_operator
<
T
>::
value
>
struct
get_callable_trait_helper
{
using
type
=
callable_trait
<
T
>
;
...
...
@@ -422,7 +422,7 @@ struct type_at<0, T0, Ts...> {
};
// Checks whether T has a member variable named `name`.
template
<
class
T
,
bool
IsScalar
=
std
::
is_scalar
<
T
>
::
value
>
template
<
class
T
,
bool
IsScalar
=
std
::
is_scalar
_v
<
T
>
>
class
has_name
{
private:
// a simple struct with a member called `name`
...
...
@@ -556,15 +556,14 @@ constexpr bool is_expected_v = is_expected<T>::value;
// Checks whether `T` and `U` are integers of the same size and signedness.
// clang-format off
template
<
class
T
,
class
U
,
bool
Enable
=
std
::
is_integral
<
T
>
::
value
&&
std
::
is_integral
<
U
>::
value
bool
Enable
=
std
::
is_integral
_v
<
T
>
&&
std
::
is_integral
_v
<
U
>
&&
!
std
::
is_same_v
<
T
,
bool
>
&&
!
std
::
is_same_v
<
U
,
bool
>>
// clang-format on
struct
is_equal_int_type
{
static
constexpr
bool
value
=
sizeof
(
T
)
==
sizeof
(
U
)
&&
std
::
is_signed
<
T
>::
value
==
std
::
is_signed
<
U
>::
value
;
&&
std
::
is_signed_v
<
T
>
==
std
::
is_signed_v
<
U
>
;
};
template
<
class
T
,
typename
U
>
...
...
@@ -865,7 +864,7 @@ template <class T>
struct
is_stl_tuple_type
{
template
<
class
U
>
static
auto
sfinae
(
U
*
)
->
decltype
(
std
::
integral_constant
<
bool
,
std
::
tuple_size
<
U
>::
value
>=
0
>
{});
->
decltype
(
std
::
integral_constant
<
bool
,
std
::
tuple_size
<
U
>::
value
>
{});
template
<
class
U
>
static
auto
sfinae
(...)
->
std
::
false_type
;
...
...
@@ -1003,7 +1002,7 @@ constexpr bool accepts_opaque_value_v
/// convertible to one of STL's string types.
template
<
class
T
,
bool
IsLoading
>
struct
is_builtin_inspector_type
{
static
constexpr
bool
value
=
std
::
is_arithmetic
<
T
>::
value
;
static
constexpr
bool
value
=
std
::
is_arithmetic
_v
<
T
>
;
};
template
<
bool
IsLoading
>
...
...
libcaf_core/caf/detail/typed_actor_util.hpp
View file @
a9e0780f
...
...
@@ -125,9 +125,8 @@ struct is_normalized_signature {
};
template
<
class
T
>
constexpr
bool
is_decayed
=
!
std
::
is_reference
<
T
>::
value
&&
!
std
::
is_const
<
T
>::
value
&&
!
std
::
is_volatile
<
T
>::
value
;
constexpr
bool
is_decayed
=
!
std
::
is_reference_v
<
T
>
&&
!
std
::
is_const_v
<
T
>
&&
!
std
::
is_volatile_v
<
T
>
;
template
<
class
...
Out
,
class
...
In
>
struct
is_normalized_signature
<
result
<
Out
...
>
(
In
...)
>
{
...
...
libcaf_core/caf/expected.hpp
View file @
a9e0780f
...
...
@@ -53,14 +53,12 @@ public:
// -- static member variables ------------------------------------------------
/// Stores whether move construct and move assign never throw.
static
constexpr
bool
nothrow_move
=
std
::
is_nothrow_move_constructible
<
T
>::
value
&&
std
::
is_nothrow_move_assignable
<
T
>::
value
;
static
constexpr
bool
nothrow_move
=
std
::
is_nothrow_move_constructible_v
<
T
>
&&
std
::
is_nothrow_move_assignable_v
<
T
>
;
/// Stores whether copy construct and copy assign never throw.
static
constexpr
bool
nothrow_copy
=
std
::
is_nothrow_copy_constructible
<
T
>::
value
&&
std
::
is_nothrow_copy_assignable
<
T
>::
value
;
static
constexpr
bool
nothrow_copy
=
std
::
is_nothrow_copy_constructible_v
<
T
>
&&
std
::
is_nothrow_copy_assignable_v
<
T
>
;
/// Stores whether swap() never throws.
static
constexpr
bool
nothrow_swap
=
std
::
is_nothrow_swappable_v
<
T
>
;
...
...
libcaf_core/caf/inspector_access.hpp
View file @
a9e0780f
...
...
@@ -240,7 +240,7 @@ bool save(Inspector& f, T& x) {
template
<
class
Inspector
,
class
T
>
bool
save
(
Inspector
&
f
,
const
T
&
x
)
{
if
constexpr
(
!
std
::
is_function
<
T
>::
value
)
{
if
constexpr
(
!
std
::
is_function
_v
<
T
>
)
{
return
save
(
f
,
as_mutable_ref
(
x
),
inspect_access_type
<
Inspector
,
T
>
());
}
else
{
// Only inspector such as the stringification_inspector are going to accept
...
...
libcaf_core/caf/load_inspector.hpp
View file @
a9e0780f
...
...
@@ -343,7 +343,7 @@ public:
template
<
class
T
>
static
auto
field
(
std
::
string_view
name
,
T
&
x
)
{
static_assert
(
!
std
::
is_const
<
T
>::
value
);
static_assert
(
!
std
::
is_const
_v
<
T
>
);
return
field_t
<
T
>
{
name
,
&
x
};
}
...
...
libcaf_core/caf/load_inspector_base.hpp
View file @
a9e0780f
...
...
@@ -105,7 +105,7 @@ public:
template
<
class
T
>
[[
nodiscard
]]
bool
apply
(
T
&
x
)
{
static_assert
(
!
std
::
is_const
<
T
>::
value
);
static_assert
(
!
std
::
is_const
_v
<
T
>
);
return
detail
::
load
(
dref
(),
x
);
}
...
...
libcaf_core/caf/mtl.hpp
View file @
a9e0780f
...
...
@@ -21,9 +21,9 @@ class event_based_mtl {
public:
// -- sanity checks ----------------------------------------------------------
static_assert
(
std
::
is_nothrow_copy_assignable
<
Adapter
>::
value
);
static_assert
(
std
::
is_nothrow_copy_assignable
_v
<
Adapter
>
);
static_assert
(
std
::
is_nothrow_move_assignable
<
Adapter
>::
value
);
static_assert
(
std
::
is_nothrow_move_assignable
_v
<
Adapter
>
);
// -- constructors, destructors, and assignment operators --------------------
...
...
libcaf_core/caf/node_id.cpp
View file @
a9e0780f
...
...
@@ -28,6 +28,8 @@
#include <random>
#include <sstream>
#include <string_view>
#include <tuple>
namespace
{
...
...
@@ -181,7 +183,7 @@ node_id make_node_id(uint32_t process_id,
std
::
optional
<
node_id
>
make_node_id
(
uint32_t
process_id
,
std
::
string_view
host_hash
)
{
using
id_type
=
hashed_node_id
::
host_id_type
;
if
(
host_hash
.
size
()
!=
std
::
tuple_size
<
id_type
>::
value
*
2
)
if
(
host_hash
.
size
()
!=
std
::
tuple_size
_v
<
id_type
>
*
2
)
return
std
::
nullopt
;
detail
::
parser
::
ascii_to_int
<
16
,
uint8_t
>
xvalue
;
id_type
host_id
;
...
...
libcaf_core/caf/optional.hpp
View file @
a9e0780f
...
...
@@ -45,8 +45,7 @@ public:
}
}
optional
(
optional
&&
other
)
noexcept
(
std
::
is_nothrow_move_constructible
<
T
>::
value
)
optional
(
optional
&&
other
)
noexcept
(
std
::
is_nothrow_move_constructible_v
<
T
>
)
:
m_valid
(
false
)
{
if
(
other
.
m_valid
)
{
cr
(
std
::
move
(
other
.
m_value
));
...
...
@@ -70,8 +69,7 @@ public:
}
optional
&
operator
=
(
optional
&&
other
)
noexcept
(
std
::
is_nothrow_destructible
<
T
>::
value
&&
std
::
is_nothrow_move_assignable
<
T
>::
value
)
{
std
::
is_nothrow_destructible_v
<
T
>&&
std
::
is_nothrow_move_assignable_v
<
T
>
)
{
if
(
m_valid
)
{
if
(
other
.
m_valid
)
m_value
=
std
::
move
(
other
.
m_value
);
...
...
libcaf_core/caf/save_inspector.hpp
View file @
a9e0780f
...
...
@@ -239,7 +239,7 @@ public:
template
<
class
T
>
static
auto
field
(
std
::
string_view
name
,
T
&
x
)
{
static_assert
(
!
std
::
is_const
<
T
>::
value
);
static_assert
(
!
std
::
is_const
_v
<
T
>
);
return
field_t
<
T
>
{
name
,
std
::
addressof
(
x
)};
}
...
...
libcaf_test/caf/test/dsl.hpp
View file @
a9e0780f
...
...
@@ -12,8 +12,10 @@
#include "caf/config.hpp"
#include "caf/init_global_meta_objects.hpp"
#include <tuple>
#include <type_traits>
CAF_PUSH_WARNINGS
/// The type of `_`.
...
...
libcaf_test/caf/test/unit_test.hpp
View file @
a9e0780f
...
...
@@ -105,10 +105,10 @@ struct inequality_operator {
static
constexpr
bool
default_value
=
true
;
template
<
class
T
,
class
U
,
typename
std
::
enable_if
<
(
std
::
is_floating_point_v
<
T
>
||
std
::
is_floating_point
<
U
>::
value
)
&&
detail
::
is_comparable_v
<
T
,
U
>
,
int
>::
type
typename
std
::
enable_if
<
(
std
::
is_floating_point_v
<
T
>
||
std
::
is_floating_point_v
<
U
>
)
&&
detail
::
is_comparable_v
<
T
,
U
>
,
int
>::
type
=
0
>
bool
operator
()(
const
T
&
x
,
const
U
&
y
)
const
{
equality_operator
f
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment