Commit aa516656 authored by Dominik Charousset's avatar Dominik Charousset

Change coding style: "! " -> "!"

parent 82e8830d
...@@ -8,7 +8,7 @@ build-gcc/* ...@@ -8,7 +8,7 @@ build-gcc/*
Makefile Makefile
bin/* bin/*
lib/* lib/*
manual/* manual
*.swp *.swp
bii/* bii/*
libcaf_core/caf/detail/build_config.hpp libcaf_core/caf/detail/build_config.hpp
...@@ -211,15 +211,6 @@ General ...@@ -211,15 +211,6 @@ General
- Keywords are always followed by a whitespace: `if (...)`, `template <...>`, - Keywords are always followed by a whitespace: `if (...)`, `template <...>`,
`while (...)`, etc. `while (...)`, etc.
- Leave a whitespace after `!` to make negations easily recognizable:
```cpp
if (! sunny())
stay_home();
else
go_outside();
```
- Opening braces belong to the same line: - Opening braces belong to the same line:
```cpp ```cpp
......
Subproject commit c6eee3dd511f670b5ef106b91e1a6cc7f39ac67e Subproject commit fab6e944be3b3d2575b5a893409ac825738e6461
...@@ -195,7 +195,7 @@ void caf_main(actor_system& system, const config& cfg) { ...@@ -195,7 +195,7 @@ void caf_main(actor_system& system, const config& cfg) {
auto pong_actor = system.spawn(pong); auto pong_actor = system.spawn(pong);
auto server_actor = system.middleman().spawn_server(server, cfg.port, auto server_actor = system.middleman().spawn_server(server, cfg.port,
pong_actor); pong_actor);
if (! server_actor) { if (!server_actor) {
std::cerr << "failed to spawn server: " std::cerr << "failed to spawn server: "
<< system.render(server_actor.error()) << endl; << system.render(server_actor.error()) << endl;
return; return;
...@@ -207,7 +207,7 @@ void caf_main(actor_system& system, const config& cfg) { ...@@ -207,7 +207,7 @@ void caf_main(actor_system& system, const config& cfg) {
auto ping_actor = system.spawn(ping, size_t{20}); auto ping_actor = system.spawn(ping, size_t{20});
auto io_actor = system.middleman().spawn_client(broker_impl, cfg.host, auto io_actor = system.middleman().spawn_client(broker_impl, cfg.host,
cfg.port, ping_actor); cfg.port, ping_actor);
if (! io_actor) { if (!io_actor) {
std::cerr << "failed to spawn client: " std::cerr << "failed to spawn client: "
<< system.render(io_actor.error()) << endl; << system.render(io_actor.error()) << endl;
return; return;
......
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
void caf_main(actor_system& system, const config& cfg) { void caf_main(actor_system& system, const config& cfg) {
auto server_actor = system.middleman().spawn_server(server, cfg.port); auto server_actor = system.middleman().spawn_server(server, cfg.port);
if (! server_actor) { if (!server_actor) {
cerr << "*** cannot spawn server: " cerr << "*** cannot spawn server: "
<< system.render(server_actor.error()) << endl; << system.render(server_actor.error()) << endl;
return; return;
......
...@@ -203,7 +203,7 @@ struct curl_state : base_state { ...@@ -203,7 +203,7 @@ struct curl_state : base_state {
void init(std::string m_name, std::string m_color) override { void init(std::string m_name, std::string m_color) override {
curl = curl_easy_init(); curl = curl_easy_init();
if (! curl) if (!curl)
throw std::runtime_error("Unable initialize CURL."); throw std::runtime_error("Unable initialize CURL.");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curl_state::callback); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curl_state::callback);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
...@@ -349,7 +349,7 @@ void caf_main(actor_system& system) { ...@@ -349,7 +349,7 @@ void caf_main(actor_system& system) {
auto master = self->spawn<detached>(curl_master); auto master = self->spawn<detached>(curl_master);
self->spawn<detached>(client, master); self->spawn<detached>(client, master);
// poll CTRL+C flag every second // poll CTRL+C flag every second
while (! shutdown_flag) while (!shutdown_flag)
std::this_thread::sleep_for(std::chrono::seconds(1)); std::this_thread::sleep_for(std::chrono::seconds(1));
aout(self) << color::cyan << "received CTRL+C" << color::reset_endl; aout(self) << color::cyan << "received CTRL+C" << color::reset_endl;
// shutdown actors // shutdown actors
......
...@@ -80,7 +80,7 @@ void caf_main(actor_system& system) { ...@@ -80,7 +80,7 @@ void caf_main(actor_system& system) {
// drain stack // drain stack
aout(self) << "stack: { "; aout(self) << "stack: { ";
bool stack_empty = false; bool stack_empty = false;
while (! stack_empty) { while (!stack_empty) {
self->request(st, std::chrono::seconds(10), pop_atom::value).receive( self->request(st, std::chrono::seconds(10), pop_atom::value).receive(
[&](int x) { [&](int x) {
aout(self) << x << " "; aout(self) << x << " ";
......
...@@ -111,7 +111,7 @@ private: ...@@ -111,7 +111,7 @@ private:
send(mm, connect_atom::value, host_, port_); send(mm, connect_atom::value, host_, port_);
return { return {
[=](ok_atom, node_id&, strong_actor_ptr& new_server, std::set<std::string>&) { [=](ok_atom, node_id&, strong_actor_ptr& new_server, std::set<std::string>&) {
if (! new_server) { if (!new_server) {
aout(this) << "*** received invalid remote actor" << endl; aout(this) << "*** received invalid remote actor" << endl;
return; return;
} }
...@@ -161,7 +161,7 @@ private: ...@@ -161,7 +161,7 @@ private:
// removes leading and trailing whitespaces // removes leading and trailing whitespaces
string trim(std::string s) { string trim(std::string s) {
auto not_space = [](char c) { return ! isspace(c); }; auto not_space = [](char c) { return !isspace(c); };
// trim left // trim left
s.erase(s.begin(), find_if(s.begin(), s.end(), not_space)); s.erase(s.begin(), find_if(s.begin(), s.end(), not_space));
// trim right // trim right
...@@ -238,11 +238,11 @@ void client_repl(actor_system& system, string host, uint16_t port) { ...@@ -238,11 +238,11 @@ void client_repl(actor_system& system, string host, uint16_t port) {
}; };
// read next line, split it, and feed to the eval handler // read next line, split it, and feed to the eval handler
string line; string line;
while (! done && std::getline(std::cin, line)) { while (!done && std::getline(std::cin, line)) {
line = trim(std::move(line)); // ignore leading and trailing whitespaces line = trim(std::move(line)); // ignore leading and trailing whitespaces
std::vector<string> words; std::vector<string> words;
split(words, line, is_any_of(" "), token_compress_on); split(words, line, is_any_of(" "), token_compress_on);
if (! message_builder(words.begin(), words.end()).apply(eval)) if (!message_builder(words.begin(), words.end()).apply(eval))
usage(); usage();
} }
} }
...@@ -262,7 +262,7 @@ public: ...@@ -262,7 +262,7 @@ public:
}; };
void caf_main(actor_system& system, const config& cfg) { void caf_main(actor_system& system, const config& cfg) {
if (! cfg.server_mode && cfg.port == 0) { if (!cfg.server_mode && cfg.port == 0) {
cerr << "*** no port to server specified" << endl; cerr << "*** no port to server specified" << endl;
return; return;
} }
...@@ -271,7 +271,7 @@ void caf_main(actor_system& system, const config& cfg) { ...@@ -271,7 +271,7 @@ void caf_main(actor_system& system, const config& cfg) {
// try to publish math actor at given port // try to publish math actor at given port
cout << "*** try publish at port " << cfg.port << endl; cout << "*** try publish at port " << cfg.port << endl;
auto expected_port = system.middleman().publish(calc, cfg.port); auto expected_port = system.middleman().publish(calc, cfg.port);
if (! expected_port) { if (!expected_port) {
std::cerr << "*** publish failed: " std::cerr << "*** publish failed: "
<< system.render(expected_port.error()) << endl; << system.render(expected_port.error()) << endl;
} else { } else {
......
...@@ -79,14 +79,14 @@ void caf_main(actor_system& system, const config& cfg) { ...@@ -79,14 +79,14 @@ void caf_main(actor_system& system, const config& cfg) {
auto name = cfg.name; auto name = cfg.name;
while (name.empty()) { while (name.empty()) {
cout << "please enter your name: " << flush; cout << "please enter your name: " << flush;
if (! getline(cin, name)) { if (!getline(cin, name)) {
cerr << "*** no name given... terminating" << endl; cerr << "*** no name given... terminating" << endl;
return; return;
} }
} }
auto client_actor = system.spawn(client, name); auto client_actor = system.spawn(client, name);
// evaluate group parameters // evaluate group parameters
if (! cfg.group_id.empty()) { if (!cfg.group_id.empty()) {
auto p = cfg.group_id.find(':'); auto p = cfg.group_id.find(':');
if (p == std::string::npos) { if (p == std::string::npos) {
cerr << "*** error parsing argument " << cfg.group_id cerr << "*** error parsing argument " << cfg.group_id
...@@ -95,7 +95,7 @@ void caf_main(actor_system& system, const config& cfg) { ...@@ -95,7 +95,7 @@ void caf_main(actor_system& system, const config& cfg) {
auto module = cfg.group_id.substr(0, p); auto module = cfg.group_id.substr(0, p);
auto group_uri = cfg.group_id.substr(p + 1); auto group_uri = cfg.group_id.substr(p + 1);
auto g = system.groups().get(module, group_uri); auto g = system.groups().get(module, group_uri);
if (! g) { if (!g) {
cerr << "*** unable to get group " << group_uri cerr << "*** unable to get group " << group_uri
<< " from module " << module << ": " << " from module " << module << ": "
<< system.render(g.error()) << endl; << system.render(g.error()) << endl;
...@@ -109,7 +109,7 @@ void caf_main(actor_system& system, const config& cfg) { ...@@ -109,7 +109,7 @@ void caf_main(actor_system& system, const config& cfg) {
vector<string> words; vector<string> words;
for (istream_iterator<line> i(cin); i != eof; ++i) { for (istream_iterator<line> i(cin); i != eof; ++i) {
auto send_input = [&] { auto send_input = [&] {
if (! i->str.empty()) if (!i->str.empty())
anon_send(client_actor, broadcast_atom::value, i->str); anon_send(client_actor, broadcast_atom::value, i->str);
}; };
words.clear(); words.clear();
...@@ -140,7 +140,7 @@ void caf_main(actor_system& system, const config& cfg) { ...@@ -140,7 +140,7 @@ void caf_main(actor_system& system, const config& cfg) {
} }
} }
}); });
if (! res) if (!res)
send_input(); send_input();
} }
// force actor to quit // force actor to quit
......
...@@ -52,7 +52,7 @@ calculator::behavior_type calculator_fun(calculator::pointer self) { ...@@ -52,7 +52,7 @@ calculator::behavior_type calculator_fun(calculator::pointer self) {
// removes leading and trailing whitespaces // removes leading and trailing whitespaces
string trim(std::string s) { string trim(std::string s) {
auto not_space = [](char c) { return ! isspace(c); }; auto not_space = [](char c) { return !isspace(c); };
// trim left // trim left
s.erase(s.begin(), find_if(s.begin(), s.end(), not_space)); s.erase(s.begin(), find_if(s.begin(), s.end(), not_space));
// trim right // trim right
...@@ -100,7 +100,7 @@ void client_repl(function_view<calculator> f) { ...@@ -100,7 +100,7 @@ void client_repl(function_view<calculator> f) {
void client(actor_system& system, const std::string& host, uint16_t port) { void client(actor_system& system, const std::string& host, uint16_t port) {
auto node = system.middleman().connect(host, port); auto node = system.middleman().connect(host, port);
if (! node) { if (!node) {
std::cerr << "*** connect failed: " std::cerr << "*** connect failed: "
<< system.render(node.error()) << std::endl; << system.render(node.error()) << std::endl;
return; return;
...@@ -110,7 +110,7 @@ void client(actor_system& system, const std::string& host, uint16_t port) { ...@@ -110,7 +110,7 @@ void client(actor_system& system, const std::string& host, uint16_t port) {
auto tout = std::chrono::seconds(30); // wait no longer than 30s auto tout = std::chrono::seconds(30); // wait no longer than 30s
auto worker = system.middleman().remote_spawn<calculator>(*node, type, auto worker = system.middleman().remote_spawn<calculator>(*node, type,
args, tout); args, tout);
if (! worker) { if (!worker) {
std::cerr << "*** remote spawn failed: " std::cerr << "*** remote spawn failed: "
<< system.render(worker.error()) << std::endl; << system.render(worker.error()) << std::endl;
return; return;
...@@ -124,7 +124,7 @@ void client(actor_system& system, const std::string& host, uint16_t port) { ...@@ -124,7 +124,7 @@ void client(actor_system& system, const std::string& host, uint16_t port) {
void server(actor_system& system, uint16_t port) { void server(actor_system& system, uint16_t port) {
auto res = system.middleman().open(port); auto res = system.middleman().open(port);
if (! res) { if (!res) {
std::cerr << "*** cannot open port: " std::cerr << "*** cannot open port: "
<< system.render(res.error()) << std::endl; << system.render(res.error()) << std::endl;
} }
......
...@@ -42,7 +42,7 @@ namespace caf { ...@@ -42,7 +42,7 @@ namespace caf {
template <class T> template <class T>
struct is_convertible_to_actor { struct is_convertible_to_actor {
static constexpr bool value = static constexpr bool value =
! std::is_base_of<statically_typed_actor_base, T>::value !std::is_base_of<statically_typed_actor_base, T>::value
&& (std::is_base_of<actor_proxy, T>::value && (std::is_base_of<actor_proxy, T>::value
|| std::is_base_of<local_actor, T>::value); || std::is_base_of<local_actor, T>::value);
}; };
...@@ -144,7 +144,7 @@ public: ...@@ -144,7 +144,7 @@ public:
/// Queries whether this object was constructed using /// Queries whether this object was constructed using
/// `unsafe_actor_handle_init` or is in moved-from state. /// `unsafe_actor_handle_init` or is in moved-from state.
bool unsafe() const { bool unsafe() const {
return ! ptr_; return !ptr_;
} }
/// @cond PRIVATE /// @cond PRIVATE
......
...@@ -81,7 +81,7 @@ struct is_non_null_handle<T*> { ...@@ -81,7 +81,7 @@ struct is_non_null_handle<T*> {
template <class T> template <class T>
struct is_strong_non_null_handle { struct is_strong_non_null_handle {
static constexpr bool value = ! is_weak_ptr<T>::value static constexpr bool value = !is_weak_ptr<T>::value
&& is_non_null_handle<T>::value; && is_non_null_handle<T>::value;
}; };
...@@ -102,7 +102,7 @@ public: ...@@ -102,7 +102,7 @@ public:
} }
template <class T, template <class T,
class = typename std::enable_if<! std::is_pointer<T>::value>::type> class = typename std::enable_if<!std::is_pointer<T>::value>::type>
To operator()(const T& x) const { To operator()(const T& x) const {
return x.get(); return x.get();
} }
...@@ -120,7 +120,7 @@ public: ...@@ -120,7 +120,7 @@ public:
} }
template <class T, template <class T,
class = typename std::enable_if<! std::is_pointer<T>::value>::type> class = typename std::enable_if<!std::is_pointer<T>::value>::type>
To* operator()(const T& x) const { To* operator()(const T& x) const {
return (*this)(x.get()); return (*this)(x.get());
} }
...@@ -138,7 +138,7 @@ public: ...@@ -138,7 +138,7 @@ public:
} }
template <class T, template <class T,
class = typename std::enable_if<! std::is_pointer<T>::value>::type> class = typename std::enable_if<!std::is_pointer<T>::value>::type>
actor_control_block* operator()(const T& x) const { actor_control_block* operator()(const T& x) const {
return x.get(); return x.get();
} }
...@@ -187,7 +187,7 @@ T actor_cast(U&& what) { ...@@ -187,7 +187,7 @@ T actor_cast(U&& what) {
constexpr bool from_raw = std::is_pointer<from_type>::value; constexpr bool from_raw = std::is_pointer<from_type>::value;
constexpr bool from_weak = is_weak_ptr<from_type>::value; constexpr bool from_weak = is_weak_ptr<from_type>::value;
// check whether this cast is legal // check whether this cast is legal
static_assert(! from_weak || ! is_strong_non_null_handle<T>::value, static_assert(!from_weak || !is_strong_non_null_handle<T>::value,
"casts from actor_addr to actor or typed_actor are prohibited"); "casts from actor_addr to actor or typed_actor are prohibited");
// calculate x and y // calculate x and y
......
...@@ -68,7 +68,7 @@ public: ...@@ -68,7 +68,7 @@ public:
template <class U> template <class U>
typename std::enable_if< typename std::enable_if<
! std::is_convertible<U, Bhvr>::value, !std::is_convertible<U, Bhvr>::value,
behavior behavior
>::type >::type
apply(detail::type_list<U>, Ts... xs) { apply(detail::type_list<U>, Ts... xs) {
...@@ -105,7 +105,7 @@ public: ...@@ -105,7 +105,7 @@ public:
template <class U> template <class U>
typename std::enable_if< typename std::enable_if<
! std::is_convertible<U, Bhvr>::value, !std::is_convertible<U, Bhvr>::value,
behavior behavior
>::type >::type
apply(detail::type_list<U>, Ts... xs) { apply(detail::type_list<U>, Ts... xs) {
...@@ -147,7 +147,7 @@ actor_factory make_actor_factory(F fun) { ...@@ -147,7 +147,7 @@ actor_factory make_actor_factory(F fun) {
using behavior_t = typename trait::behavior_type; using behavior_t = typename trait::behavior_type;
spawn_mode_token<trait::mode> tk; spawn_mode_token<trait::mode> tk;
message_verifier<typename trait::arg_types> mv; message_verifier<typename trait::arg_types> mv;
if (! mv(msg, tk)) if (!mv(msg, tk))
return {}; return {};
cfg.init_fun = [=](local_actor* x) -> behavior { cfg.init_fun = [=](local_actor* x) -> behavior {
CAF_ASSERT(cfg.host); CAF_ASSERT(cfg.host);
...@@ -159,7 +159,7 @@ actor_factory make_actor_factory(F fun) { ...@@ -159,7 +159,7 @@ actor_factory make_actor_factory(F fun) {
empty_type_erased_tuple dummy_; empty_type_erased_tuple dummy_;
auto& ct = msg.empty() ? dummy_ : const_cast<message&>(msg).content(); auto& ct = msg.empty() ? dummy_ : const_cast<message&>(msg).content();
auto opt = ct.apply(f); auto opt = ct.apply(f);
if (! opt) if (!opt)
return {}; return {};
return std::move(*opt); return std::move(*opt);
}; };
......
...@@ -350,12 +350,12 @@ public: ...@@ -350,12 +350,12 @@ public:
bool check_interface = true, bool check_interface = true,
const mpi* expected_ifs = nullptr) { const mpi* expected_ifs = nullptr) {
mpi tmp; mpi tmp;
if (check_interface && ! expected_ifs) { if (check_interface && !expected_ifs) {
tmp = message_types<Handle>(); tmp = message_types<Handle>();
expected_ifs = &tmp; expected_ifs = &tmp;
} }
auto res = dyn_spawn_impl(name, args, ctx, check_interface, expected_ifs); auto res = dyn_spawn_impl(name, args, ctx, check_interface, expected_ifs);
if (! res) if (!res)
return std::move(res.error()); return std::move(res.error());
return actor_cast<Handle>(std::move(*res)); return actor_cast<Handle>(std::move(*res));
} }
...@@ -464,7 +464,7 @@ public: ...@@ -464,7 +464,7 @@ public:
private: private:
template <class T> template <class T>
void check_invariants() { void check_invariants() {
static_assert(! std::is_base_of<prohibit_top_level_spawn_marker, T>::value, static_assert(!std::is_base_of<prohibit_top_level_spawn_marker, T>::value,
"This actor type cannot be spawned throught an actor system. " "This actor type cannot be spawned throught an actor system. "
"Probably you have tried to spawn a broker or opencl actor."); "Probably you have tried to spawn a broker or opencl actor.");
} }
...@@ -485,7 +485,7 @@ private: ...@@ -485,7 +485,7 @@ private:
: 0; : 0;
if (has_detach_flag(Os) || std::is_base_of<blocking_actor, C>::value) if (has_detach_flag(Os) || std::is_base_of<blocking_actor, C>::value)
cfg.flags |= abstract_actor::is_detached_flag; cfg.flags |= abstract_actor::is_detached_flag;
if (! cfg.host) if (!cfg.host)
cfg.host = dummy_execution_unit(); cfg.host = dummy_execution_unit();
auto res = make_actor<C>(next_actor_id(), node(), this, auto res = make_actor<C>(next_actor_id(), node(), this,
cfg, std::forward<Ts>(xs)...); cfg, std::forward<Ts>(xs)...);
......
...@@ -131,7 +131,7 @@ public: ...@@ -131,7 +131,7 @@ public:
template <class T, class... Ts> template <class T, class... Ts>
actor_system_config& add_actor_type(std::string name) { actor_system_config& add_actor_type(std::string name) {
using handle = typename infer_handle_from_class<T>::type; using handle = typename infer_handle_from_class<T>::type;
if (! std::is_same<handle, actor>::value) if (!std::is_same<handle, actor>::value)
add_message_type<handle>(name); add_message_type<handle>(name);
return add_actor_factory(std::move(name), make_actor_factory<T, Ts...>()); return add_actor_factory(std::move(name), make_actor_factory<T, Ts...>());
} }
...@@ -142,7 +142,7 @@ public: ...@@ -142,7 +142,7 @@ public:
template <class F> template <class F>
actor_system_config& add_actor_type(std::string name, F f) { actor_system_config& add_actor_type(std::string name, F f) {
using handle = typename infer_handle_from_fun<F>::type; using handle = typename infer_handle_from_fun<F>::type;
if (! std::is_same<handle, actor>::value) if (!std::is_same<handle, actor>::value)
add_message_type<handle>(name); add_message_type<handle>(name);
return add_actor_factory(std::move(name), make_actor_factory(std::move(f))); return add_actor_factory(std::move(name), make_actor_factory(std::move(f)));
} }
...@@ -178,7 +178,7 @@ public: ...@@ -178,7 +178,7 @@ public:
result = to_string(category); result = to_string(category);
result += ": "; result += ": ";
result += to_string(static_cast<T>(val)); result += to_string(static_cast<T>(val));
if (! ctx.empty()) { if (!ctx.empty()) {
result += " ("; result += " (";
result += ctx; result += ctx;
result += ")"; result += ")";
......
...@@ -162,7 +162,7 @@ public: ...@@ -162,7 +162,7 @@ public:
// nop // nop
} }
bool post() override { bool post() override {
return ! f(); return !f();
} }
}; };
cond rc{std::move(stmt)}; cond rc{std::move(stmt)};
......
...@@ -45,7 +45,7 @@ struct signatures_of { ...@@ -45,7 +45,7 @@ struct signatures_of {
template <class T> template <class T>
constexpr bool statically_typed() { constexpr bool statically_typed() {
return ! std::is_same< return !std::is_same<
none_t, none_t,
typename std::remove_pointer<T>::type::signatures typename std::remove_pointer<T>::type::signatures
>::value; >::value;
......
...@@ -28,7 +28,7 @@ namespace caf { ...@@ -28,7 +28,7 @@ namespace caf {
template <class State, class Base = typename State::actor_base> template <class State, class Base = typename State::actor_base>
class composable_behavior_based_actor : public stateful_actor<State, Base> { class composable_behavior_based_actor : public stateful_actor<State, Base> {
public: public:
static_assert(! std::is_abstract<State>::value, static_assert(!std::is_abstract<State>::value,
"State is abstract, please make sure to override all " "State is abstract, please make sure to override all "
"virtual operator() member functions"); "virtual operator() member functions");
......
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
# define CAF_IOS # define CAF_IOS
# else # else
# define CAF_MACOS # define CAF_MACOS
# if defined(CAF_GCC) && ! defined(_GLIBCXX_HAS_GTHREADS) # if defined(CAF_GCC) && !defined(_GLIBCXX_HAS_GTHREADS)
# define _GLIBCXX_HAS_GTHREADS # define _GLIBCXX_HAS_GTHREADS
# endif # endif
# endif # endif
......
...@@ -151,7 +151,7 @@ public: ...@@ -151,7 +151,7 @@ public:
// the INI parser accepts all integers as int64_t // the INI parser accepts all integers as int64_t
using cfg_type = using cfg_type =
typename std::conditional< typename std::conditional<
std::is_integral<T>::value && ! std::is_same<bool, T>::value, std::is_integral<T>::value && !std::is_same<bool, T>::value,
int64_t, int64_t,
T T
>::type; >::type;
......
...@@ -143,7 +143,7 @@ public: ...@@ -143,7 +143,7 @@ public:
template <class T> template <class T>
typename std::enable_if< typename std::enable_if<
std::is_integral<T>::value std::is_integral<T>::value
&& ! std::is_same<bool, T>::value, && !std::is_same<bool, T>::value,
error error
>::type >::type
apply(T& x) { apply(T& x) {
...@@ -185,7 +185,7 @@ public: ...@@ -185,7 +185,7 @@ public:
template <class T> template <class T>
typename std::enable_if< typename std::enable_if<
std::is_enum<T>::value std::is_enum<T>::value
&& ! detail::has_serialize<T>::value, && !detail::has_serialize<T>::value,
error error
>::type >::type
apply(T& x) { apply(T& x) {
...@@ -275,7 +275,7 @@ public: ...@@ -275,7 +275,7 @@ public:
// Applies this processor as Derived to `xs` in saving mode. // Applies this processor as Derived to `xs` in saving mode.
template <class D, class T> template <class D, class T>
static typename std::enable_if< static typename std::enable_if<
D::reads_state && ! detail::is_byte_sequence<T>::value, D::reads_state && !detail::is_byte_sequence<T>::value,
error error
>::type >::type
apply_sequence(D& self, T& xs) { apply_sequence(D& self, T& xs) {
...@@ -288,7 +288,7 @@ public: ...@@ -288,7 +288,7 @@ public:
// Applies this processor as Derived to `xs` in loading mode. // Applies this processor as Derived to `xs` in loading mode.
template <class D, class T> template <class D, class T>
static typename std::enable_if< static typename std::enable_if<
! D::reads_state && ! detail::is_byte_sequence<T>::value, !D::reads_state && !detail::is_byte_sequence<T>::value,
error error
>::type >::type
apply_sequence(D& self, T& xs) { apply_sequence(D& self, T& xs) {
...@@ -314,7 +314,7 @@ public: ...@@ -314,7 +314,7 @@ public:
// Optimized loading for contiguous byte sequences. // Optimized loading for contiguous byte sequences.
template <class D, class T> template <class D, class T>
static typename std::enable_if< static typename std::enable_if<
! D::reads_state && detail::is_byte_sequence<T>::value, !D::reads_state && detail::is_byte_sequence<T>::value,
error error
>::type >::type
apply_sequence(D& self, T& xs) { apply_sequence(D& self, T& xs) {
...@@ -328,8 +328,8 @@ public: ...@@ -328,8 +328,8 @@ public:
template <class T> template <class T>
typename std::enable_if< typename std::enable_if<
detail::is_iterable<T>::value detail::is_iterable<T>::value
&& ! detail::has_serialize<T>::value && !detail::has_serialize<T>::value
&& ! detail::is_inspectable<Derived, T>::value, && !detail::is_inspectable<Derived, T>::value,
error error
>::type >::type
apply(T& xs) { apply(T& xs) {
...@@ -378,7 +378,7 @@ public: ...@@ -378,7 +378,7 @@ public:
template <class T> template <class T>
typename std::enable_if< typename std::enable_if<
! std::is_empty<T>::value !std::is_empty<T>::value
&& detail::has_serialize<T>::value, && detail::has_serialize<T>::value,
error error
>::type >::type
...@@ -472,14 +472,14 @@ public: ...@@ -472,14 +472,14 @@ public:
template <class T, class... Ts> template <class T, class... Ts>
typename std::enable_if< typename std::enable_if<
! meta::is_annotation<T>::value !meta::is_annotation<T>::value
&& ! is_allowed_unsafe_message_type<T>::value, && !is_allowed_unsafe_message_type<T>::value,
error error
>::type >::type
operator()(T&& x, Ts&&... xs) { operator()(T&& x, Ts&&... xs) {
static_assert(Derived::reads_state static_assert(Derived::reads_state
|| (! std::is_rvalue_reference<T&&>::value || (!std::is_rvalue_reference<T&&>::value
&& ! std::is_const< && !std::is_const<
typename std::remove_reference<T>::type typename std::remove_reference<T>::type
>::value), >::value),
"a loading inspector requires mutable lvalue references"); "a loading inspector requires mutable lvalue references");
...@@ -505,7 +505,7 @@ private: ...@@ -505,7 +505,7 @@ private:
} }
template <class D, class T, class U, class F> template <class D, class T, class U, class F>
static typename std::enable_if<! D::reads_state, error>::type static typename std::enable_if<!D::reads_state, error>::type
convert_apply(D& self, T& x, U& storage, F assign) { convert_apply(D& self, T& x, U& storage, F assign) {
auto e = self.apply(storage); auto e = self.apply(storage);
if (e) if (e)
......
...@@ -56,7 +56,7 @@ public: ...@@ -56,7 +56,7 @@ public:
} }
inline behavior& back() { inline behavior& back() {
CAF_ASSERT(! empty()); CAF_ASSERT(!empty());
return elements_.back(); return elements_.back();
} }
......
...@@ -76,7 +76,7 @@ private: ...@@ -76,7 +76,7 @@ private:
template <class T> template <class T>
void delegate(T& x) { void delegate(T& x) {
auto rp = self_->make_response_promise(); auto rp = self_->make_response_promise();
if (! rp.pending()) { if (!rp.pending()) {
CAF_LOG_DEBUG("suppress response message: invalid response promise"); CAF_LOG_DEBUG("suppress response message: invalid response promise");
return; return;
} }
......
...@@ -34,7 +34,7 @@ public: ...@@ -34,7 +34,7 @@ public:
} }
template <class T> template <class T>
typename std::enable_if<! std::is_base_of<memory_managed, T>::value>::type typename std::enable_if<!std::is_base_of<memory_managed, T>::value>::type
operator()(T* ptr) const { operator()(T* ptr) const {
delete ptr; delete ptr;
} }
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <cassert> #include <cassert>
// GCC hack // GCC hack
#if defined(CAF_GCC) && ! defined(_GLIBCXX_USE_SCHED_YIELD) #if defined(CAF_GCC) && !defined(_GLIBCXX_USE_SCHED_YIELD)
#include <time.h> #include <time.h>
namespace std { namespace std {
namespace this_thread { namespace this_thread {
...@@ -45,7 +45,7 @@ inline void yield() noexcept { ...@@ -45,7 +45,7 @@ inline void yield() noexcept {
#endif #endif
// another GCC hack // another GCC hack
#if defined(CAF_GCC) && ! defined(_GLIBCXX_USE_NANOSLEEP) #if defined(CAF_GCC) && !defined(_GLIBCXX_USE_NANOSLEEP)
#include <time.h> #include <time.h>
namespace std { namespace std {
namespace this_thread { namespace this_thread {
......
...@@ -118,12 +118,12 @@ public: ...@@ -118,12 +118,12 @@ public:
} }
void push_back(const_reference what) { void push_back(const_reference what) {
CAF_ASSERT(! full()); CAF_ASSERT(!full());
data_[size_++] = what; data_[size_++] = what;
} }
void pop_back() { void pop_back() {
CAF_ASSERT(! empty()); CAF_ASSERT(!empty());
--size_; --size_;
} }
...@@ -194,22 +194,22 @@ public: ...@@ -194,22 +194,22 @@ public:
} }
reference front() { reference front() {
CAF_ASSERT(! empty()); CAF_ASSERT(!empty());
return data_[0]; return data_[0];
} }
const_reference front() const { const_reference front() const {
CAF_ASSERT(! empty()); CAF_ASSERT(!empty());
return data_[0]; return data_[0];
} }
reference back() { reference back() {
CAF_ASSERT(! empty()); CAF_ASSERT(!empty());
return data_[size_ - 1]; return data_[size_ - 1];
} }
const_reference back() const { const_reference back() const {
CAF_ASSERT(! empty()); CAF_ASSERT(!empty());
return data_[size_ - 1]; return data_[size_ - 1];
} }
......
...@@ -127,7 +127,7 @@ public: ...@@ -127,7 +127,7 @@ public:
embedded_storage new_embedded_storage() override { embedded_storage new_embedded_storage() override {
// allocate cache on-the-fly // allocate cache on-the-fly
if (! cache_) { if (!cache_) {
cache_.reset(new storage, false); // starts with ref count of 1 cache_.reset(new storage, false); // starts with ref count of 1
CAF_ASSERT(cache_->unique()); CAF_ASSERT(cache_->unique());
} }
...@@ -177,7 +177,7 @@ private: ...@@ -177,7 +177,7 @@ private:
template <class T> template <class T>
static inline memory_cache* get_or_set_cache_map_entry() { static inline memory_cache* get_or_set_cache_map_entry() {
auto mc = get_cache_map_entry(&typeid(T)); auto mc = get_cache_map_entry(&typeid(T));
if (! mc) { if (!mc) {
mc = new basic_memory_cache<T>; mc = new basic_memory_cache<T>;
add_cache_map_entry(&typeid(T), mc); add_cache_map_entry(&typeid(T), mc);
} }
......
...@@ -59,15 +59,15 @@ struct is_response_promise<delegated<Ts...>> : std::true_type { }; ...@@ -59,15 +59,15 @@ struct is_response_promise<delegated<Ts...>> : std::true_type { };
template <class T> template <class T>
struct optional_message_visitor_enable_tpl { struct optional_message_visitor_enable_tpl {
static constexpr bool value = static constexpr bool value =
! is_one_of< !is_one_of<
typename std::remove_const<T>::type, typename std::remove_const<T>::type,
none_t, none_t,
unit_t, unit_t,
skip_t, skip_t,
optional<skip_t> optional<skip_t>
>::value >::value
&& ! is_message_id_wrapper<T>::value && !is_message_id_wrapper<T>::value
&& ! is_response_promise<T>::value; && !is_response_promise<T>::value;
}; };
class optional_message_visitor : public static_visitor<optional<message>> { class optional_message_visitor : public static_visitor<optional<message>> {
......
...@@ -32,9 +32,9 @@ namespace detail { ...@@ -32,9 +32,9 @@ namespace detail {
/// performs an epsilon comparison. /// performs an epsilon comparison.
template <class T, typename U> template <class T, typename U>
typename std::enable_if< typename std::enable_if<
! std::is_floating_point<T>::value !std::is_floating_point<T>::value
&& ! std::is_floating_point<U>::value && !std::is_floating_point<U>::value
&& ! (std::is_same<T, U>::value && std::is_empty<T>::value), && !(std::is_same<T, U>::value && std::is_empty<T>::value),
bool bool
>::type >::type
safe_equal(const T& lhs, const U& rhs) { safe_equal(const T& lhs, const U& rhs) {
......
...@@ -72,7 +72,7 @@ public: ...@@ -72,7 +72,7 @@ public:
CAF_ASSERT(new_element != nullptr); CAF_ASSERT(new_element != nullptr);
pointer e = stack_.load(); pointer e = stack_.load();
for (;;) { for (;;) {
if (! e) { if (!e) {
// if tail is nullptr, the queue has been closed // if tail is nullptr, the queue has been closed
delete_(new_element); delete_(new_element);
return enqueue_result::queue_closed; return enqueue_result::queue_closed;
...@@ -95,19 +95,19 @@ public: ...@@ -95,19 +95,19 @@ public:
return true; return true;
auto ptr = stack_.load(); auto ptr = stack_.load();
CAF_ASSERT(ptr != nullptr); CAF_ASSERT(ptr != nullptr);
return ! is_dummy(ptr); return !is_dummy(ptr);
} }
/// Queries whether this queue is empty. /// Queries whether this queue is empty.
/// @warning Call only from the reader (owner). /// @warning Call only from the reader (owner).
bool empty() { bool empty() {
CAF_ASSERT(! closed()); CAF_ASSERT(!closed());
return cache_.empty() && ! head_ && is_dummy(stack_.load()); return cache_.empty() && !head_ && is_dummy(stack_.load());
} }
/// Queries whether this has been closed. /// Queries whether this has been closed.
bool closed() { bool closed() {
return ! stack_.load(); return !stack_.load();
} }
/// Queries whether this has been marked as blocked, i.e., /// Queries whether this has been marked as blocked, i.e.,
...@@ -142,7 +142,7 @@ public: ...@@ -142,7 +142,7 @@ public:
template <class F> template <class F>
void close(const F& f) { void close(const F& f) {
clear_cached_elements(f); clear_cached_elements(f);
if (! blocked() && fetch_new_data(nullptr)) if (!blocked() && fetch_new_data(nullptr))
clear_cached_elements(f); clear_cached_elements(f);
cache_.clear(f); cache_.clear(f);
} }
...@@ -152,7 +152,7 @@ public: ...@@ -152,7 +152,7 @@ public:
} }
~single_reader_queue() { ~single_reader_queue() {
if (! closed()) if (!closed())
close(); close();
} }
...@@ -203,8 +203,8 @@ public: ...@@ -203,8 +203,8 @@ public:
template <class Mutex, class CondVar> template <class Mutex, class CondVar>
void synchronized_await(Mutex& mtx, CondVar& cv) { void synchronized_await(Mutex& mtx, CondVar& cv) {
CAF_ASSERT(! closed()); CAF_ASSERT(!closed());
if (! can_fetch_more() && try_block()) { if (!can_fetch_more() && try_block()) {
std::unique_lock<Mutex> guard(mtx); std::unique_lock<Mutex> guard(mtx);
while (blocked()) while (blocked())
cv.wait(guard); cv.wait(guard);
...@@ -213,14 +213,14 @@ public: ...@@ -213,14 +213,14 @@ public:
template <class Mutex, class CondVar, class TimePoint> template <class Mutex, class CondVar, class TimePoint>
bool synchronized_await(Mutex& mtx, CondVar& cv, const TimePoint& timeout) { bool synchronized_await(Mutex& mtx, CondVar& cv, const TimePoint& timeout) {
CAF_ASSERT(! closed()); CAF_ASSERT(!closed());
if (! can_fetch_more() && try_block()) { if (!can_fetch_more() && try_block()) {
std::unique_lock<Mutex> guard(mtx); std::unique_lock<Mutex> guard(mtx);
while (blocked()) { while (blocked()) {
if (cv.wait_until(guard, timeout) == std::cv_status::timeout) { if (cv.wait_until(guard, timeout) == std::cv_status::timeout) {
// if we're unable to set the queue from blocked to empty, // if we're unable to set the queue from blocked to empty,
// than there's a new element in the list // than there's a new element in the list
return ! try_unblock(); return !try_unblock();
} }
} }
} }
...@@ -238,7 +238,7 @@ private: ...@@ -238,7 +238,7 @@ private:
// atomically sets stack_ back and enqueues all elements to the cache // atomically sets stack_ back and enqueues all elements to the cache
bool fetch_new_data(pointer end_ptr) { bool fetch_new_data(pointer end_ptr) {
CAF_ASSERT(! end_ptr || end_ptr == stack_empty_dummy()); CAF_ASSERT(!end_ptr || end_ptr == stack_empty_dummy());
pointer e = stack_.load(); pointer e = stack_.load();
// must not be called on a closed queue // must not be called on a closed queue
CAF_ASSERT(e != nullptr); CAF_ASSERT(e != nullptr);
...@@ -253,11 +253,11 @@ private: ...@@ -253,11 +253,11 @@ private:
CAF_ASSERT(e != reader_blocked_dummy()); CAF_ASSERT(e != reader_blocked_dummy());
if (is_dummy(e)) { if (is_dummy(e)) {
// only use-case for this is closing a queue // only use-case for this is closing a queue
CAF_ASSERT(! end_ptr); CAF_ASSERT(!end_ptr);
return false; return false;
} }
while (e) { while (e) {
CAF_ASSERT(! is_dummy(e)); CAF_ASSERT(!is_dummy(e));
auto next = e->next; auto next = e->next;
e->next = head_; e->next = head_;
head_ = e; head_ = e;
......
...@@ -49,7 +49,7 @@ typename std::conditional< ...@@ -49,7 +49,7 @@ typename std::conditional<
T&& T&&
>::type >::type
spawn_fwd(typename std::remove_reference<T>::type&& arg) noexcept { spawn_fwd(typename std::remove_reference<T>::type&& arg) noexcept {
static_assert(! std::is_lvalue_reference<T>::value, static_assert(!std::is_lvalue_reference<T>::value,
"silently converting an lvalue to an rvalue"); "silently converting an lvalue to an rvalue");
return static_cast<T&&>(arg); return static_cast<T&&>(arg);
} }
......
...@@ -107,7 +107,7 @@ public: ...@@ -107,7 +107,7 @@ public:
const std::vector<actor>& workers, const std::vector<actor>& workers,
mailbox_element_ptr& ptr, mailbox_element_ptr& ptr,
execution_unit* host) { execution_unit* host) {
if (! ptr->sender) if (!ptr->sender)
return; return;
actor_msg_vec xs; actor_msg_vec xs;
xs.reserve(workers.size()); xs.reserve(workers.size());
......
...@@ -112,7 +112,7 @@ private: ...@@ -112,7 +112,7 @@ private:
template <class T> template <class T>
enable_if_t< enable_if_t<
is_inspectable<stringification_inspector, T>::value is_inspectable<stringification_inspector, T>::value
&& ! has_to_string<T>::value> && !has_to_string<T>::value>
consume(T& x) { consume(T& x) {
inspect(*this, x); inspect(*this, x);
} }
...@@ -133,8 +133,8 @@ private: ...@@ -133,8 +133,8 @@ private:
template <class T> template <class T>
enable_if_t<is_iterable<T>::value enable_if_t<is_iterable<T>::value
&& ! is_inspectable<stringification_inspector, T>::value && !is_inspectable<stringification_inspector, T>::value
&& ! has_to_string<T>::value> && !has_to_string<T>::value>
consume(T& xs) { consume(T& xs) {
result_ += '['; result_ += '[';
for (auto& x : xs) { for (auto& x : xs) {
...@@ -177,11 +177,11 @@ private: ...@@ -177,11 +177,11 @@ private:
/// Fallback printing `<unprintable>`. /// Fallback printing `<unprintable>`.
template <class T> template <class T>
enable_if_t< enable_if_t<
! is_iterable<T>::value !is_iterable<T>::value
&& ! std::is_pointer<T>::value && !std::is_pointer<T>::value
&& ! is_inspectable<stringification_inspector, T>::value && !is_inspectable<stringification_inspector, T>::value
&& ! std::is_arithmetic<T>::value && !std::is_arithmetic<T>::value
&& ! has_to_string<T>::value> && !has_to_string<T>::value>
consume(T&) { consume(T&) {
result_ += "<unprintable>"; result_ += "<unprintable>";
} }
...@@ -204,7 +204,7 @@ private: ...@@ -204,7 +204,7 @@ private:
template <class T, class... Ts> template <class T, class... Ts>
void traverse(meta::omittable_if_empty_t, T& x, Ts&&... xs) { void traverse(meta::omittable_if_empty_t, T& x, Ts&&... xs) {
if (! x.empty()) { if (!x.empty()) {
sep(); sep();
consume(x); consume(x);
} }
...@@ -231,7 +231,7 @@ private: ...@@ -231,7 +231,7 @@ private:
} }
template <class T, class... Ts> template <class T, class... Ts>
enable_if_t<! meta::is_annotation<T>::value> traverse(T&& x, Ts&&... xs) { enable_if_t<!meta::is_annotation<T>::value> traverse(T&& x, Ts&&... xs) {
sep(); sep();
consume(deconst(x)); consume(deconst(x));
traverse(std::forward<Ts>(xs)...); traverse(std::forward<Ts>(xs)...);
......
...@@ -744,7 +744,7 @@ struct tl_filter_not<type_list<T...>, Pred> { ...@@ -744,7 +744,7 @@ struct tl_filter_not<type_list<T...>, Pred> {
using type = using type =
typename tl_filter_impl< typename tl_filter_impl<
type_list<T...>, type_list<T...>,
! Pred<T>::value... !Pred<T>::value...
>::type; >::type;
}; };
...@@ -758,7 +758,7 @@ struct tl_filter_type<type_list<T...>, Type> { ...@@ -758,7 +758,7 @@ struct tl_filter_type<type_list<T...>, Type> {
using type = using type =
typename tl_filter_impl< typename tl_filter_impl<
type_list<T...>, type_list<T...>,
! std::is_same<T, Type>::value... !std::is_same<T, Type>::value...
>::type; >::type;
}; };
...@@ -772,7 +772,7 @@ struct tl_filter_not_type<type_list<T...>, Type> { ...@@ -772,7 +772,7 @@ struct tl_filter_not_type<type_list<T...>, Type> {
using type = using type =
typename tl_filter_impl< typename tl_filter_impl<
type_list<T...>, type_list<T...>,
(! std::is_same<T, Type>::value)... (!std::is_same<T, Type>::value)...
>::type; >::type;
}; };
......
...@@ -55,7 +55,7 @@ private: ...@@ -55,7 +55,7 @@ private:
std::declval<T&>())); std::declval<T&>()));
public: public:
static constexpr bool value = ! std::is_same<result_type, std::false_type>::value; static constexpr bool value = !std::is_same<result_type, std::false_type>::value;
}; };
template <class T> template <class T>
...@@ -434,7 +434,7 @@ class has_static_type_name { ...@@ -434,7 +434,7 @@ class has_static_type_name {
private: private:
template <class U, template <class U,
class = typename std::enable_if< class = typename std::enable_if<
! std::is_member_pointer<decltype(&U::static_type_name)>::value !std::is_member_pointer<decltype(&U::static_type_name)>::value
>::type> >::type>
static std::true_type sfinae(int); static std::true_type sfinae(int);
......
...@@ -175,7 +175,7 @@ struct deduce_output_type_impl { ...@@ -175,7 +175,7 @@ struct deduce_output_type_impl {
Signatures, Signatures,
input_is<InputTypes>::template eval input_is<InputTypes>::template eval
>::type; >::type;
static_assert(! std::is_same<signature, none_t>::value, static_assert(!std::is_same<signature, none_t>::value,
"typed actor does not support given input"); "typed actor does not support given input");
using type = typename signature::output_types; using type = typename signature::output_types;
// generates the appropriate `delegated<...>` type from given signatures // generates the appropriate `delegated<...>` type from given signatures
......
...@@ -211,12 +211,12 @@ std::string to_string(const error& x); ...@@ -211,12 +211,12 @@ std::string to_string(const error& x);
/// @relates error /// @relates error
inline bool operator==(const error& x, none_t) { inline bool operator==(const error& x, none_t) {
return ! x; return !x;
} }
/// @relates error /// @relates error
inline bool operator==(none_t, const error& x) { inline bool operator==(none_t, const error& x) {
return ! x; return !x;
} }
/// @relates error /// @relates error
...@@ -244,13 +244,13 @@ inline bool operator!=(none_t, const error& x) { ...@@ -244,13 +244,13 @@ inline bool operator!=(none_t, const error& x) {
/// @relates error /// @relates error
template <class E, class = enable_if_has_make_error_t<E>> template <class E, class = enable_if_has_make_error_t<E>>
bool operator!=(const error& x, E y) { bool operator!=(const error& x, E y) {
return ! (x == y); return !(x == y);
} }
/// @relates error /// @relates error
template <class E, class = enable_if_has_make_error_t<E>> template <class E, class = enable_if_has_make_error_t<E>>
bool operator!=(E x, const error& y) { bool operator!=(E x, const error& y) {
return ! (x == y); return !(x == y);
} }
} // namespace caf } // namespace caf
......
...@@ -84,7 +84,7 @@ int exec_main(F fun, int argc, char** argv, ...@@ -84,7 +84,7 @@ int exec_main(F fun, int argc, char** argv,
// pass config to the actor system // pass config to the actor system
actor_system system{cfg}; actor_system system{cfg};
if (cfg.slave_mode) { if (cfg.slave_mode) {
if (! cfg.slave_mode_fun) { if (!cfg.slave_mode_fun) {
std::cerr << "cannot run slave mode, I/O module not loaded" << std::endl; std::cerr << "cannot run slave mode, I/O module not loaded" << std::endl;
return 1; return 1;
} }
......
...@@ -96,7 +96,7 @@ public: ...@@ -96,7 +96,7 @@ public:
expected& operator=(const expected& other) noexcept(nothrow_copy) { expected& operator=(const expected& other) noexcept(nothrow_copy) {
if (engaged_ && other.engaged_) if (engaged_ && other.engaged_)
value_ = other.value_; value_ = other.value_;
else if (! engaged_ && ! other.engaged_) else if (!engaged_ && !other.engaged_)
error_ = other.error_; error_ = other.error_;
else { else {
destroy(); destroy();
...@@ -108,7 +108,7 @@ public: ...@@ -108,7 +108,7 @@ public:
expected& operator=(expected&& other) noexcept(nothrow_move) { expected& operator=(expected&& other) noexcept(nothrow_move) {
if (engaged_ && other.engaged_) if (engaged_ && other.engaged_)
value_ = std::move(other.value_); value_ = std::move(other.value_);
else if (! engaged_ && ! other.engaged_) else if (!engaged_ && !other.engaged_)
error_ = std::move(other.error_); error_ = std::move(other.error_);
else { else {
destroy(); destroy();
...@@ -147,7 +147,7 @@ public: ...@@ -147,7 +147,7 @@ public:
} }
expected& operator=(caf::error e) noexcept { expected& operator=(caf::error e) noexcept {
if (! engaged_) if (!engaged_)
error_ = std::move(e); error_ = std::move(e);
else { else {
destroy(); destroy();
...@@ -182,7 +182,7 @@ public: ...@@ -182,7 +182,7 @@ public:
/// @copydoc cerror /// @copydoc cerror
caf::error& error() noexcept { caf::error& error() noexcept {
CAF_ASSERT(! engaged_); CAF_ASSERT(!engaged_);
return error_; return error_;
} }
...@@ -224,13 +224,13 @@ public: ...@@ -224,13 +224,13 @@ public:
/// Returns the contained error. /// Returns the contained error.
/// @pre `engaged() == false`. /// @pre `engaged() == false`.
const caf::error& cerror() const noexcept { const caf::error& cerror() const noexcept {
CAF_ASSERT(! engaged_); CAF_ASSERT(!engaged_);
return error_; return error_;
} }
/// @copydoc cerror /// @copydoc cerror
const caf::error& error() const noexcept { const caf::error& error() const noexcept {
CAF_ASSERT(! engaged_); CAF_ASSERT(!engaged_);
return error_; return error_;
} }
...@@ -270,7 +270,7 @@ private: ...@@ -270,7 +270,7 @@ private:
template <class T> template <class T>
auto operator==(const expected<T>& x, const expected<T>& y) auto operator==(const expected<T>& x, const expected<T>& y)
-> decltype(*x == *y) { -> decltype(*x == *y) {
return x && y ? *x == *y : (! x && ! y ? x.error() == y.error() : false); return x && y ? *x == *y : (!x && !y ? x.error() == y.error() : false);
} }
/// @relates expected /// @relates expected
...@@ -313,43 +313,43 @@ enable_if_has_make_error_t<E, bool> operator==(E x, const expected<T>& y) { ...@@ -313,43 +313,43 @@ enable_if_has_make_error_t<E, bool> operator==(E x, const expected<T>& y) {
template <class T> template <class T>
auto operator!=(const expected<T>& x, const expected<T>& y) auto operator!=(const expected<T>& x, const expected<T>& y)
-> decltype(*x == *y) { -> decltype(*x == *y) {
return ! (x == y); return !(x == y);
} }
/// @relates expected /// @relates expected
template <class T, class U> template <class T, class U>
auto operator!=(const expected<T>& x, const U& y) -> decltype(*x == y) { auto operator!=(const expected<T>& x, const U& y) -> decltype(*x == y) {
return ! (x == y); return !(x == y);
} }
/// @relates expected /// @relates expected
template <class T, class U> template <class T, class U>
auto operator!=(const T& x, const expected<U>& y) -> decltype(x == *y) { auto operator!=(const T& x, const expected<U>& y) -> decltype(x == *y) {
return ! (x == y); return !(x == y);
} }
/// @relates expected /// @relates expected
template <class T> template <class T>
bool operator!=(const expected<T>& x, const error& y) { bool operator!=(const expected<T>& x, const error& y) {
return ! (x == y); return !(x == y);
} }
/// @relates expected /// @relates expected
template <class T> template <class T>
bool operator!=(const error& x, const expected<T>& y) { bool operator!=(const error& x, const expected<T>& y) {
return ! (x == y); return !(x == y);
} }
/// @relates expected /// @relates expected
template <class T, class E> template <class T, class E>
enable_if_has_make_error_t<E, bool> operator!=(const expected<T>& x, E y) { enable_if_has_make_error_t<E, bool> operator!=(const expected<T>& x, E y) {
return ! (x == y); return !(x == y);
} }
/// @relates expected /// @relates expected
template <class T, class E> template <class T, class E>
enable_if_has_make_error_t<E, bool> operator!=(E x, const expected<T>& y) { enable_if_has_make_error_t<E, bool> operator!=(E x, const expected<T>& y) {
return ! (x == y); return !(x == y);
} }
/// The pattern `expected<void>` shall be used for functions that may generate /// The pattern `expected<void>` shall be used for functions that may generate
...@@ -391,7 +391,7 @@ public: ...@@ -391,7 +391,7 @@ public:
} }
explicit operator bool() const { explicit operator bool() const {
return ! error_; return !error_;
} }
const caf::error& error() const { const caf::error& error() const {
...@@ -422,7 +422,7 @@ auto to_string(const expected<T>& x) -> decltype(to_string(*x)) { ...@@ -422,7 +422,7 @@ auto to_string(const expected<T>& x) -> decltype(to_string(*x)) {
/// @experimental /// @experimental
#define CAF_EXP_THROW(var, expr) \ #define CAF_EXP_THROW(var, expr) \
auto CAF_UNIFYN(tmp_var_) = expr; \ auto CAF_UNIFYN(tmp_var_) = expr; \
if (! CAF_UNIFYN(tmp_var_)) \ if (!CAF_UNIFYN(tmp_var_)) \
CAF_RAISE_ERROR(to_string(CAF_UNIFYN(tmp_var_).error())); \ CAF_RAISE_ERROR(to_string(CAF_UNIFYN(tmp_var_).error())); \
auto& var = *CAF_UNIFYN(tmp_var_) auto& var = *CAF_UNIFYN(tmp_var_)
/// @endcond /// @endcond
......
...@@ -148,14 +148,14 @@ public: ...@@ -148,14 +148,14 @@ public:
} }
~function_view() { ~function_view() {
if (! impl_.unsafe()) if (!impl_.unsafe())
self_.~scoped_actor(); self_.~scoped_actor();
} }
function_view(function_view&& x) function_view(function_view&& x)
: timeout(x.timeout), : timeout(x.timeout),
impl_(std::move(x.impl_)) { impl_(std::move(x.impl_)) {
if (! impl_.unsafe()) { if (!impl_.unsafe()) {
new (&self_) scoped_actor(impl_.home_system()); //(std::move(x.self_)); new (&self_) scoped_actor(impl_.home_system()); //(std::move(x.self_));
x.self_.~scoped_actor(); x.self_.~scoped_actor();
} }
...@@ -197,16 +197,16 @@ public: ...@@ -197,16 +197,16 @@ public:
} }
void assign(type x) { void assign(type x) {
if (impl_.unsafe() && ! x.unsafe()) if (impl_.unsafe() && !x.unsafe())
new_self(x); new_self(x);
if (! impl_.unsafe() && x.unsafe()) if (!impl_.unsafe() && x.unsafe())
self_.~scoped_actor(); self_.~scoped_actor();
impl_.swap(x); impl_.swap(x);
} }
/// Checks whether this function view has an actor assigned to it. /// Checks whether this function view has an actor assigned to it.
explicit operator bool() const { explicit operator bool() const {
return ! impl_.unsafe(); return !impl_.unsafe();
} }
duration timeout; duration timeout;
...@@ -223,7 +223,7 @@ private: ...@@ -223,7 +223,7 @@ private:
} }
void new_self(const Actor& x) { void new_self(const Actor& x) {
if (! x.unsafe()) if (!x.unsafe())
new (&self_) scoped_actor(x->home_system()); new (&self_) scoped_actor(x->home_system());
} }
...@@ -234,7 +234,7 @@ private: ...@@ -234,7 +234,7 @@ private:
/// @relates function_view /// @relates function_view
template <class T> template <class T>
bool operator==(const function_view<T>& x, std::nullptr_t) { bool operator==(const function_view<T>& x, std::nullptr_t) {
return ! x; return !x;
} }
/// @relates function_view /// @relates function_view
...@@ -246,13 +246,13 @@ bool operator==(std::nullptr_t x, const function_view<T>& y) { ...@@ -246,13 +246,13 @@ bool operator==(std::nullptr_t x, const function_view<T>& y) {
/// @relates function_view /// @relates function_view
template <class T> template <class T>
bool operator!=(const function_view<T>& x, std::nullptr_t y) { bool operator!=(const function_view<T>& x, std::nullptr_t y) {
return ! (x == y); return !(x == y);
} }
/// @relates function_view /// @relates function_view
template <class T> template <class T>
bool operator!=(std::nullptr_t x, const function_view<T>& y) { bool operator!=(std::nullptr_t x, const function_view<T>& y) {
return ! (y == x); return !(y == x);
} }
/// Creates a new function view for `x`. /// Creates a new function view for `x`.
......
...@@ -74,7 +74,7 @@ public: ...@@ -74,7 +74,7 @@ public:
} }
inline bool operator!() const noexcept { inline bool operator!() const noexcept {
return ! ptr_; return !ptr_;
} }
static intptr_t compare(const abstract_group* lhs, const abstract_group* rhs); static intptr_t compare(const abstract_group* lhs, const abstract_group* rhs);
...@@ -112,14 +112,14 @@ public: ...@@ -112,14 +112,14 @@ public:
template <class... Ts> template <class... Ts>
void eq_impl(message_id mid, strong_actor_ptr sender, void eq_impl(message_id mid, strong_actor_ptr sender,
execution_unit* ctx, Ts&&... xs) const { execution_unit* ctx, Ts&&... xs) const {
CAF_ASSERT(! mid.is_request()); CAF_ASSERT(!mid.is_request());
if (ptr_) if (ptr_)
ptr_->enqueue(std::move(sender), mid, ptr_->enqueue(std::move(sender), mid,
make_message(std::forward<Ts>(xs)...), ctx); make_message(std::forward<Ts>(xs)...), ctx);
} }
inline bool subscribe(strong_actor_ptr who) const { inline bool subscribe(strong_actor_ptr who) const {
if (! ptr_) if (!ptr_)
return false; return false;
return ptr_->subscribe(std::move(who)); return ptr_->subscribe(std::move(who));
} }
...@@ -157,7 +157,7 @@ template <> ...@@ -157,7 +157,7 @@ template <>
struct hash<caf::group> { struct hash<caf::group> {
inline size_t operator()(const caf::group& x) const { inline size_t operator()(const caf::group& x) const {
// groups are singleton objects, the address is thus the best possible hash // groups are singleton objects, the address is thus the best possible hash
return ! x ? 0 : reinterpret_cast<size_t>(x.get()); return !x ? 0 : reinterpret_cast<size_t>(x.get());
} }
}; };
} // namespace std } // namespace std
......
...@@ -77,7 +77,7 @@ public: ...@@ -77,7 +77,7 @@ public:
private: private:
void advance() { void advance() {
x_ = xs_->next(); x_ = xs_->next();
if (! x_) if (!x_)
xs_ = nullptr; xs_ = nullptr;
} }
......
...@@ -122,7 +122,7 @@ public: ...@@ -122,7 +122,7 @@ public:
} }
bool operator!() const noexcept { bool operator!() const noexcept {
return ! ptr_; return !ptr_;
} }
explicit operator bool() const noexcept { explicit operator bool() const noexcept {
...@@ -166,13 +166,13 @@ private: ...@@ -166,13 +166,13 @@ private:
/// @relates intrusive_ptr /// @relates intrusive_ptr
template <class T> template <class T>
bool operator==(const intrusive_ptr<T>& x, std::nullptr_t) { bool operator==(const intrusive_ptr<T>& x, std::nullptr_t) {
return ! x; return !x;
} }
/// @relates intrusive_ptr /// @relates intrusive_ptr
template <class T> template <class T>
bool operator==(std::nullptr_t, const intrusive_ptr<T>& x) { bool operator==(std::nullptr_t, const intrusive_ptr<T>& x) {
return ! x; return !x;
} }
/// @relates intrusive_ptr /// @relates intrusive_ptr
......
...@@ -245,7 +245,7 @@ public: ...@@ -245,7 +245,7 @@ public:
typename detail::make_response_promise_helper<Ts...>::type typename detail::make_response_promise_helper<Ts...>::type
make_response_promise() { make_response_promise() {
auto& ptr = current_element_; auto& ptr = current_element_;
if (! ptr) if (!ptr)
return {}; return {};
auto& mid = ptr->mid; auto& mid = ptr->mid;
if (mid.is_answered()) if (mid.is_answered())
......
...@@ -90,7 +90,7 @@ public: ...@@ -90,7 +90,7 @@ public:
template <class T> template <class T>
line_builder& operator<<(const T& x) { line_builder& operator<<(const T& x) {
if (! str_.empty()) if (!str_.empty())
str_ += " "; str_ += " ";
std::stringstream ss; std::stringstream ss;
ss << x; ss << x;
...@@ -103,7 +103,7 @@ public: ...@@ -103,7 +103,7 @@ public:
line_builder& operator<<(const arg_wrapper<T>& x) { line_builder& operator<<(const arg_wrapper<T>& x) {
if (behind_arg_) if (behind_arg_)
str_ += ", "; str_ += ", ";
else if (! str_.empty()) else if (!str_.empty())
str_ += " "; str_ += " ";
str_ += x.name; str_ += x.name;
str_ += " = "; str_ += " = ";
......
...@@ -160,7 +160,7 @@ make_mailbox_element(strong_actor_ptr sender, message_id id, ...@@ -160,7 +160,7 @@ make_mailbox_element(strong_actor_ptr sender, message_id id,
/// @relates mailbox_element /// @relates mailbox_element
template <class T, class... Ts> template <class T, class... Ts>
typename std::enable_if< typename std::enable_if<
! std::is_same<typename std::decay<T>::type, message>::value !std::is_same<typename std::decay<T>::type, message>::value
|| (sizeof...(Ts) > 0), || (sizeof...(Ts) > 0),
mailbox_element_ptr mailbox_element_ptr
>::type >::type
......
...@@ -60,7 +60,7 @@ struct is_serializable_or_whitelisted { ...@@ -60,7 +60,7 @@ struct is_serializable_or_whitelisted {
/// @relates message /// @relates message
template <class T, class... Ts> template <class T, class... Ts>
typename std::enable_if< typename std::enable_if<
! std::is_same<message, typename std::decay<T>::type>::value !std::is_same<message, typename std::decay<T>::type>::value
|| (sizeof...(Ts) > 0), || (sizeof...(Ts) > 0),
message message
>::type >::type
......
...@@ -129,11 +129,11 @@ public: ...@@ -129,11 +129,11 @@ public:
>::type; >::type;
/* /*
static_assert(! std::is_same<pattern, detail::type_list<exit_msg>>::value, static_assert(!std::is_same<pattern, detail::type_list<exit_msg>>::value,
"exit_msg not allowed in message handlers, " "exit_msg not allowed in message handlers, "
"did you mean to use set_exit_handler()?"); "did you mean to use set_exit_handler()?");
static_assert(! std::is_same<pattern, detail::type_list<down_msg>>::value, static_assert(!std::is_same<pattern, detail::type_list<down_msg>>::value,
"down_msg not allowed in message handlers, " "down_msg not allowed in message handlers, "
"did you mean to use set_down_handler()?"); "did you mean to use set_down_handler()?");
*/ */
...@@ -163,7 +163,7 @@ public: ...@@ -163,7 +163,7 @@ public:
type_erased_tuple& xs) override { type_erased_tuple& xs) override {
detail::meta_elements<pattern> ms; detail::meta_elements<pattern> ms;
// check if try_match() reports success // check if try_match() reports success
if (! detail::try_match(xs, ms.arr.data(), ms.arr.size())) if (!detail::try_match(xs, ms.arr.data(), ms.arr.size()))
return match_case::no_match; return match_case::no_match;
typename detail::il_indices<decayed_arg_types>::type indices; typename detail::il_indices<decayed_arg_types>::type indices;
lfinvoker<std::is_same<result_type, void>::value, F> fun{fun_}; lfinvoker<std::is_same<result_type, void>::value, F> fun{fun_};
...@@ -191,7 +191,7 @@ inline bool operator<(const match_case_info& x, const match_case_info& y) { ...@@ -191,7 +191,7 @@ inline bool operator<(const match_case_info& x, const match_case_info& y) {
template <class F> template <class F>
typename std::enable_if< typename std::enable_if<
! std::is_base_of<match_case, F>::value, !std::is_base_of<match_case, F>::value,
std::tuple<trivial_match_case<F>> std::tuple<trivial_match_case<F>>
>::type >::type
to_match_case_tuple(F fun) { to_match_case_tuple(F fun) {
...@@ -224,7 +224,7 @@ typename std::enable_if< ...@@ -224,7 +224,7 @@ typename std::enable_if<
std::is_base_of<match_case, T>::value || std::is_base_of<match_case, U>::value std::is_base_of<match_case, T>::value || std::is_base_of<match_case, U>::value
>::type >::type
operator,(T, U) { operator,(T, U) {
static_assert(! std::is_same<T, T>::value, static_assert(!std::is_same<T, T>::value,
"this syntax is not supported -> you probably did " "this syntax is not supported -> you probably did "
"something like 'return (...)' instead of 'return {...}'"); "something like 'return (...)' instead of 'return {...}'");
} }
......
...@@ -302,7 +302,7 @@ public: ...@@ -302,7 +302,7 @@ public:
/// @cond PRIVATE /// @cond PRIVATE
/// @pre `! empty()` /// @pre `!empty()`
type_erased_tuple& content() { type_erased_tuple& content() {
CAF_ASSERT(vals_); CAF_ASSERT(vals_);
return *vals_; return *vals_;
......
...@@ -79,7 +79,7 @@ public: ...@@ -79,7 +79,7 @@ public:
template <class... Ts> template <class... Ts>
void assign(Ts... xs) { void assign(Ts... xs) {
static_assert(sizeof...(Ts) > 0, "assign without arguments called"); static_assert(sizeof...(Ts) > 0, "assign without arguments called");
static_assert(! detail::disjunction<may_have_timeout< static_assert(!detail::disjunction<may_have_timeout<
typename std::decay<Ts>::type>::value... typename std::decay<Ts>::type>::value...
>::value, "Timeouts are only allowed in behaviors"); >::value, "Timeouts are only allowed in behaviors");
impl_ = detail::make_behavior(xs...); impl_ = detail::make_behavior(xs...);
...@@ -112,7 +112,7 @@ public: ...@@ -112,7 +112,7 @@ public:
// using a behavior is safe here, because we "cast" // using a behavior is safe here, because we "cast"
// it back to a message_handler when appropriate // it back to a message_handler when appropriate
behavior tmp{std::forward<Ts>(xs)...}; behavior tmp{std::forward<Ts>(xs)...};
if (! tmp) { if (!tmp) {
return *this; return *this;
} }
if (impl_) if (impl_)
......
...@@ -89,7 +89,7 @@ public: ...@@ -89,7 +89,7 @@ public:
} }
inline bool is_request() const { inline bool is_request() const {
return valid() && ! is_response(); return valid() && !is_response();
} }
inline message_id response_id() const { inline message_id response_id() const {
......
...@@ -66,7 +66,7 @@ public: ...@@ -66,7 +66,7 @@ public:
template <class T0, class T1, class... Ts> template <class T0, class T1, class... Ts>
typename std::enable_if< typename std::enable_if<
! std::is_same<keep_behavior_t, typename std::decay<T0>::type>::value !std::is_same<keep_behavior_t, typename std::decay<T0>::type>::value
>::type >::type
become(T0&& x0, T1&& x1, Ts&&... xs) { become(T0&& x0, T1&& x1, Ts&&... xs) {
behavior_type bhvr{std::forward<T0>(x0), behavior_type bhvr{std::forward<T0>(x0),
......
...@@ -64,7 +64,7 @@ public: ...@@ -64,7 +64,7 @@ public:
typename detail::implicit_conversions< typename detail::implicit_conversions<
typename std::decay<Ts>::type typename std::decay<Ts>::type
>::type...>; >::type...>;
static_assert(! statically_typed<Subtype>() || statically_typed<Dest>(), static_assert(!statically_typed<Subtype>() || statically_typed<Dest>(),
"statically typed actors can only send() to other " "statically typed actors can only send() to other "
"statically typed actors; use anon_send() or request() when " "statically typed actors; use anon_send() or request() when "
"communicating with dynamically typed actors"); "communicating with dynamically typed actors");
...@@ -118,7 +118,7 @@ public: ...@@ -118,7 +118,7 @@ public:
typename detail::implicit_conversions< typename detail::implicit_conversions<
typename std::decay<Ts>::type typename std::decay<Ts>::type
>::type...>; >::type...>;
static_assert(! statically_typed<Subtype>() || statically_typed<Dest>(), static_assert(!statically_typed<Subtype>() || statically_typed<Dest>(),
"statically typed actors are only allowed to send() to other " "statically typed actors are only allowed to send() to other "
"statically typed actors; use anon_send() or request() when " "statically typed actors; use anon_send() or request() when "
"communicating with dynamically typed actors"); "communicating with dynamically typed actors");
......
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
/// Links this actor to `x`. /// Links this actor to `x`.
void link_to(const actor_addr& x) { void link_to(const actor_addr& x) {
auto ptr = actor_cast<strong_actor_ptr>(x); auto ptr = actor_cast<strong_actor_ptr>(x);
if (! ptr || ptr->get() == this) if (!ptr || ptr->get() == this)
return; return;
link_impl(establish_link_op, ptr->get()); link_impl(establish_link_op, ptr->get());
} }
...@@ -67,7 +67,7 @@ public: ...@@ -67,7 +67,7 @@ public:
template <class ActorHandle> template <class ActorHandle>
void link_to(const ActorHandle& x) { void link_to(const ActorHandle& x) {
auto ptr = actor_cast<abstract_actor*>(x); auto ptr = actor_cast<abstract_actor*>(x);
if (! ptr || ptr == this) if (!ptr || ptr == this)
return; return;
link_impl(establish_link_op, ptr); link_impl(establish_link_op, ptr);
} }
...@@ -75,7 +75,7 @@ public: ...@@ -75,7 +75,7 @@ public:
/// Unlinks this actor from `x`. /// Unlinks this actor from `x`.
void unlink_from(const actor_addr& x) { void unlink_from(const actor_addr& x) {
auto ptr = actor_cast<strong_actor_ptr>(x); auto ptr = actor_cast<strong_actor_ptr>(x);
if (! ptr || ptr->get() == this) if (!ptr || ptr->get() == this)
return; return;
link_impl(remove_link_op, ptr->get()); link_impl(remove_link_op, ptr->get());
} }
...@@ -84,7 +84,7 @@ public: ...@@ -84,7 +84,7 @@ public:
template <class ActorHandle> template <class ActorHandle>
void unlink_from(const ActorHandle& x) { void unlink_from(const ActorHandle& x) {
auto ptr = actor_cast<abstract_actor*>(x); auto ptr = actor_cast<abstract_actor*>(x);
if (! ptr || ptr == this) if (!ptr || ptr == this)
return; return;
link_impl(remove_link_op, ptr); link_impl(remove_link_op, ptr);
} }
......
...@@ -145,9 +145,9 @@ public: ...@@ -145,9 +145,9 @@ public:
data tmp; data tmp;
// write changes to tmp back to x at scope exit // write changes to tmp back to x at scope exit
auto sg = detail::make_scope_guard([&] { auto sg = detail::make_scope_guard([&] {
if (! tmp.valid()) if (!tmp.valid())
x.data_.reset(); x.data_.reset();
else if (! x || ! x.data_->unique()) else if (!x || !x.data_->unique())
x.data_ = make_counted<data>(tmp); x.data_ = make_counted<data>(tmp);
else else
*x.data_ = tmp; *x.data_ = tmp;
...@@ -164,12 +164,12 @@ private: ...@@ -164,12 +164,12 @@ private:
/// @relates node_id /// @relates node_id
inline bool operator==(const node_id& x, none_t) { inline bool operator==(const node_id& x, none_t) {
return ! x; return !x;
} }
/// @relates node_id /// @relates node_id
inline bool operator==(none_t, const node_id& x) { inline bool operator==(none_t, const node_id& x) {
return ! x; return !x;
} }
/// @relates node_id /// @relates node_id
...@@ -187,7 +187,7 @@ inline bool operator==(const node_id& lhs, const node_id& rhs) { ...@@ -187,7 +187,7 @@ inline bool operator==(const node_id& lhs, const node_id& rhs) {
} }
inline bool operator!=(const node_id& lhs, const node_id& rhs) { inline bool operator!=(const node_id& lhs, const node_id& rhs) {
return ! (lhs == rhs); return !(lhs == rhs);
} }
inline bool operator<(const node_id& lhs, const node_id& rhs) { inline bool operator<(const node_id& lhs, const node_id& rhs) {
......
...@@ -98,7 +98,7 @@ class optional { ...@@ -98,7 +98,7 @@ class optional {
/// Checks whether this object does not contain a value. /// Checks whether this object does not contain a value.
bool operator!() const { bool operator!() const {
return ! m_valid; return !m_valid;
} }
/// Returns the value. /// Returns the value.
...@@ -152,7 +152,7 @@ class optional { ...@@ -152,7 +152,7 @@ class optional {
template <class V> template <class V>
void cr(V&& x) { void cr(V&& x) {
CAF_ASSERT(! m_valid); CAF_ASSERT(!m_valid);
m_valid = true; m_valid = true;
new (&m_value) T(std::forward<V>(x)); new (&m_value) T(std::forward<V>(x));
} }
...@@ -189,7 +189,7 @@ class optional<T&> { ...@@ -189,7 +189,7 @@ class optional<T&> {
} }
bool operator!() const { bool operator!() const {
return ! m_value; return !m_value;
} }
T& operator*() { T& operator*() {
...@@ -254,7 +254,7 @@ class optional<void> { ...@@ -254,7 +254,7 @@ class optional<void> {
} }
bool operator!() const { bool operator!() const {
return ! m_value; return !m_value;
} }
private: private:
...@@ -308,31 +308,31 @@ auto to_string(const optional<T>& x) -> decltype(to_string(*x)) { ...@@ -308,31 +308,31 @@ auto to_string(const optional<T>& x) -> decltype(to_string(*x)) {
template <class T> template <class T>
bool operator==(const optional<T>& lhs, const optional<T>& rhs) { bool operator==(const optional<T>& lhs, const optional<T>& rhs) {
return static_cast<bool>(lhs) == static_cast<bool>(rhs) return static_cast<bool>(lhs) == static_cast<bool>(rhs)
&& (! lhs || *lhs == *rhs); && (!lhs || *lhs == *rhs);
} }
/// @relates optional /// @relates optional
template <class T> template <class T>
bool operator!=(const optional<T>& lhs, const optional<T>& rhs) { bool operator!=(const optional<T>& lhs, const optional<T>& rhs) {
return ! (lhs == rhs); return !(lhs == rhs);
} }
/// @relates optional /// @relates optional
template <class T> template <class T>
bool operator<(const optional<T>& lhs, const optional<T>& rhs) { bool operator<(const optional<T>& lhs, const optional<T>& rhs) {
return static_cast<bool>(rhs) && (! lhs || *lhs < *rhs); return static_cast<bool>(rhs) && (!lhs || *lhs < *rhs);
} }
/// @relates optional /// @relates optional
template <class T> template <class T>
bool operator<=(const optional<T>& lhs, const optional<T>& rhs) { bool operator<=(const optional<T>& lhs, const optional<T>& rhs) {
return ! (rhs < lhs); return !(rhs < lhs);
} }
/// @relates optional /// @relates optional
template <class T> template <class T>
bool operator>=(const optional<T>& lhs, const optional<T>& rhs) { bool operator>=(const optional<T>& lhs, const optional<T>& rhs) {
return ! (lhs < rhs); return !(lhs < rhs);
} }
/// @relates optional /// @relates optional
...@@ -346,13 +346,13 @@ bool operator>(const optional<T>& lhs, const optional<T>& rhs) { ...@@ -346,13 +346,13 @@ bool operator>(const optional<T>& lhs, const optional<T>& rhs) {
/// @relates optional /// @relates optional
template <class T> template <class T>
bool operator==(const optional<T>& lhs, none_t) { bool operator==(const optional<T>& lhs, none_t) {
return ! lhs; return !lhs;
} }
/// @relates optional /// @relates optional
template <class T> template <class T>
bool operator==(none_t, const optional<T>& rhs) { bool operator==(none_t, const optional<T>& rhs) {
return ! rhs; return !rhs;
} }
/// @relates optional /// @relates optional
...@@ -382,7 +382,7 @@ bool operator<(none_t, const optional<T>& rhs) { ...@@ -382,7 +382,7 @@ bool operator<(none_t, const optional<T>& rhs) {
/// @relates optional /// @relates optional
template <class T> template <class T>
bool operator<=(const optional<T>& lhs, none_t) { bool operator<=(const optional<T>& lhs, none_t) {
return ! lhs; return !lhs;
} }
/// @relates optional /// @relates optional
...@@ -432,19 +432,19 @@ bool operator==(const T& lhs, const optional<T>& rhs) { ...@@ -432,19 +432,19 @@ bool operator==(const T& lhs, const optional<T>& rhs) {
/// @relates optional /// @relates optional
template <class T> template <class T>
bool operator!=(const optional<T>& lhs, const T& rhs) { bool operator!=(const optional<T>& lhs, const T& rhs) {
return ! lhs || ! (*lhs == rhs); return !lhs || !(*lhs == rhs);
} }
/// @relates optional /// @relates optional
template <class T> template <class T>
bool operator!=(const T& lhs, const optional<T>& rhs) { bool operator!=(const T& lhs, const optional<T>& rhs) {
return ! rhs || ! (lhs == *rhs); return !rhs || !(lhs == *rhs);
} }
/// @relates optional /// @relates optional
template <class T> template <class T>
bool operator<(const optional<T>& lhs, const T& rhs) { bool operator<(const optional<T>& lhs, const T& rhs) {
return ! lhs || *lhs < rhs; return !lhs || *lhs < rhs;
} }
/// @relates optional /// @relates optional
...@@ -456,13 +456,13 @@ bool operator<(const T& lhs, const optional<T>& rhs) { ...@@ -456,13 +456,13 @@ bool operator<(const T& lhs, const optional<T>& rhs) {
/// @relates optional /// @relates optional
template <class T> template <class T>
bool operator<=(const optional<T>& lhs, const T& rhs) { bool operator<=(const optional<T>& lhs, const T& rhs) {
return ! lhs || ! (rhs < *lhs); return !lhs || !(rhs < *lhs);
} }
/// @relates optional /// @relates optional
template <class T> template <class T>
bool operator<=(const T& lhs, const optional<T>& rhs) { bool operator<=(const T& lhs, const optional<T>& rhs) {
return rhs && ! (rhs < lhs); return rhs && !(rhs < lhs);
} }
/// @relates optional /// @relates optional
...@@ -474,19 +474,19 @@ bool operator>(const optional<T>& lhs, const T& rhs) { ...@@ -474,19 +474,19 @@ bool operator>(const optional<T>& lhs, const T& rhs) {
/// @relates optional /// @relates optional
template <class T> template <class T>
bool operator>(const T& lhs, const optional<T>& rhs) { bool operator>(const T& lhs, const optional<T>& rhs) {
return ! rhs || *rhs < lhs; return !rhs || *rhs < lhs;
} }
/// @relates optional /// @relates optional
template <class T> template <class T>
bool operator>=(const optional<T>& lhs, const T& rhs) { bool operator>=(const optional<T>& lhs, const T& rhs) {
return lhs && ! (*lhs < rhs); return lhs && !(*lhs < rhs);
} }
/// @relates optional /// @relates optional
template <class T> template <class T>
bool operator>=(const T& lhs, const optional<T>& rhs) { bool operator>=(const T& lhs, const optional<T>& rhs) {
return ! rhs || ! (lhs < *rhs); return !rhs || !(lhs < *rhs);
} }
} // namespace caf } // namespace caf
......
...@@ -91,7 +91,7 @@ public: ...@@ -91,7 +91,7 @@ public:
resumable* dequeue(Worker* self) { resumable* dequeue(Worker* self) {
auto& parent_data = d(self->parent()); auto& parent_data = d(self->parent());
std::unique_lock<std::mutex> guard(parent_data.lock); std::unique_lock<std::mutex> guard(parent_data.lock);
parent_data.cv.wait(guard, [&] { return ! parent_data.queue.empty(); }); parent_data.cv.wait(guard, [&] { return !parent_data.queue.empty(); });
resumable* job = parent_data.queue.front(); resumable* job = parent_data.queue.front();
parent_data.queue.pop_front(); parent_data.queue.pop_front();
return job; return job;
......
...@@ -47,11 +47,11 @@ struct typed_mpi<detail::type_list<Is...>, ...@@ -47,11 +47,11 @@ struct typed_mpi<detail::type_list<Is...>,
static_assert(sizeof...(Ls) > 0, "template parameter pack Ls empty"); static_assert(sizeof...(Ls) > 0, "template parameter pack Ls empty");
using input_types = detail::type_list<Is...>; using input_types = detail::type_list<Is...>;
using output_types = detail::type_list<Ls...>; using output_types = detail::type_list<Ls...>;
static_assert(! detail::tl_exists< static_assert(!detail::tl_exists<
input_types, input_types,
is_illegal_message_element is_illegal_message_element
>::value >::value
&& ! detail::tl_exists< && !detail::tl_exists<
output_types, output_types,
is_illegal_message_element is_illegal_message_element
>::value, >::value,
......
...@@ -46,7 +46,7 @@ public: ...@@ -46,7 +46,7 @@ public:
/// Satisfies the promise by sending a non-error response message. /// Satisfies the promise by sending a non-error response message.
template <class T, class... Ts> template <class T, class... Ts>
typename std::enable_if< typename std::enable_if<
(sizeof...(Ts) > 0) || ! std::is_convertible<T, error>::value, (sizeof...(Ts) > 0) || !std::is_convertible<T, error>::value,
response_promise response_promise
>::type >::type
deliver(T&&x, Ts&&... xs) { deliver(T&&x, Ts&&... xs) {
...@@ -62,7 +62,7 @@ public: ...@@ -62,7 +62,7 @@ public:
/// Queries whether this promise is a valid promise that is not satisfied yet. /// Queries whether this promise is a valid promise that is not satisfied yet.
inline bool pending() const { inline bool pending() const {
return ! stages_.empty() || source_; return !stages_.empty() || source_;
} }
/// @cond PRIVATE /// @cond PRIVATE
......
...@@ -320,13 +320,13 @@ public: ...@@ -320,13 +320,13 @@ public:
/// Returns whether `true` if the behavior stack is not empty or /// Returns whether `true` if the behavior stack is not empty or
/// if outstanding responses exist, `false` otherwise. /// if outstanding responses exist, `false` otherwise.
inline bool has_behavior() const { inline bool has_behavior() const {
return ! bhvr_stack_.empty() return !bhvr_stack_.empty()
|| ! awaited_responses_.empty() || !awaited_responses_.empty()
|| ! multiplexed_responses_.empty(); || !multiplexed_responses_.empty();
} }
inline behavior& current_behavior() { inline behavior& current_behavior() {
return ! awaited_responses_.empty() ? awaited_responses_.front().second return !awaited_responses_.empty() ? awaited_responses_.front().second
: bhvr_stack_.back(); : bhvr_stack_.back();
} }
......
...@@ -105,7 +105,7 @@ protected: ...@@ -105,7 +105,7 @@ protected:
sh.ref(); // make sure reference count is high enough sh.ref(); // make sure reference count is high enough
} }
CAF_LOG_DEBUG("enqueue shutdown_helper into each worker"); CAF_LOG_DEBUG("enqueue shutdown_helper into each worker");
while (! alive_workers.empty()) { while (!alive_workers.empty()) {
(*alive_workers.begin())->external_enqueue(&sh); (*alive_workers.begin())->external_enqueue(&sh);
// since jobs can be stolen, we cannot assume that we have // since jobs can be stolen, we cannot assume that we have
// actually shut down the worker we've enqueued sh to // actually shut down the worker we've enqueued sh to
......
...@@ -177,7 +177,7 @@ public: ...@@ -177,7 +177,7 @@ public:
void init(actor_system_config& cfg) override { void init(actor_system_config& cfg) override {
super::init(cfg); super::init(cfg);
file_.open(cfg.scheduler_profiling_output_file); file_.open(cfg.scheduler_profiling_output_file);
if (! file_) if (!file_)
std::cerr << "[WARNING] could not open file \"" std::cerr << "[WARNING] could not open file \""
<< cfg.scheduler_profiling_output_file << cfg.scheduler_profiling_output_file
<< "\" (no profiler output will be generated)" << "\" (no profiler output will be generated)"
......
...@@ -43,7 +43,7 @@ void send_as(const Source& src, const Dest& dest, Ts&&... xs) { ...@@ -43,7 +43,7 @@ void send_as(const Source& src, const Dest& dest, Ts&&... xs) {
typename detail::implicit_conversions< typename detail::implicit_conversions<
typename std::decay<Ts>::type typename std::decay<Ts>::type
>::type...>; >::type...>;
static_assert(! statically_typed<Source>() || statically_typed<Dest>(), static_assert(!statically_typed<Source>() || statically_typed<Dest>(),
"statically typed actors can only send() to other " "statically typed actors can only send() to other "
"statically typed actors; use anon_send() or request() when " "statically typed actors; use anon_send() or request() when "
"communicating with dynamically typed actors"); "communicating with dynamically typed actors");
......
...@@ -120,7 +120,7 @@ constexpr bool has_lazy_init_flag(spawn_options opts) { ...@@ -120,7 +120,7 @@ constexpr bool has_lazy_init_flag(spawn_options opts) {
/// @cond PRIVATE /// @cond PRIVATE
constexpr bool is_unbound(spawn_options opts) { constexpr bool is_unbound(spawn_options opts) {
return ! has_monitor_flag(opts) && ! has_link_flag(opts); return !has_monitor_flag(opts) && !has_link_flag(opts);
} }
constexpr spawn_options make_unbound(spawn_options opts) { constexpr spawn_options make_unbound(spawn_options opts) {
......
...@@ -102,7 +102,7 @@ private: ...@@ -102,7 +102,7 @@ private:
} }
template <class T> template <class T>
typename std::enable_if<! std::is_constructible<State, T>::value>::type typename std::enable_if<!std::is_constructible<State, T>::value>::type
cr_state(T) { cr_state(T) {
new (&state_) State(); new (&state_) State();
} }
...@@ -123,7 +123,7 @@ private: ...@@ -123,7 +123,7 @@ private:
} }
template <class U> template <class U>
typename std::enable_if<! detail::has_name<U>::value, const char*>::type typename std::enable_if<!detail::has_name<U>::value, const char*>::type
get_name(const U&) const { get_name(const U&) const {
return Base::name(); return Base::name();
} }
......
...@@ -48,7 +48,7 @@ void split(Container& result, const std::string& str, const Delim& delims, ...@@ -48,7 +48,7 @@ void split(Container& result, const std::string& str, const Delim& delims,
while ((pos = str.find_first_of(delims, prev)) != std::string::npos) { while ((pos = str.find_first_of(delims, prev)) != std::string::npos) {
if (pos > prev) { if (pos > prev) {
auto substr = str.substr(prev, pos - prev); auto substr = str.substr(prev, pos - prev);
if (! substr.empty() || keep_all) { if (!substr.empty() || keep_all) {
result.push_back(std::move(substr)); result.push_back(std::move(substr));
} }
} }
......
...@@ -154,7 +154,7 @@ public: ...@@ -154,7 +154,7 @@ public:
return false; return false;
detail::meta_elements<detail::type_list<Ts...>> xs; detail::meta_elements<detail::type_list<Ts...>> xs;
for (size_t i = 0; i < xs.arr.size(); ++i) for (size_t i = 0; i < xs.arr.size(); ++i)
if (! detail::match_element(xs.arr[i], *this, i)) if (!detail::match_element(xs.arr[i], *this, i))
return false; return false;
return true; return true;
} }
...@@ -172,7 +172,7 @@ private: ...@@ -172,7 +172,7 @@ private:
template <class F, class R, class... Ts> template <class F, class R, class... Ts>
optional<R> apply(F& fun, detail::type_list<R>, optional<R> apply(F& fun, detail::type_list<R>,
detail::type_list<Ts...> tk) { detail::type_list<Ts...> tk) {
if (! match_elements<Ts...>()) if (!match_elements<Ts...>())
return none; return none;
detail::pseudo_tuple<typename std::decay<Ts>::type...> xs{*this}; detail::pseudo_tuple<typename std::decay<Ts>::type...> xs{*this};
return detail::apply_args(fun, detail::get_indices(tk), xs); return detail::apply_args(fun, detail::get_indices(tk), xs);
...@@ -181,7 +181,7 @@ private: ...@@ -181,7 +181,7 @@ private:
template <class F, class... Ts> template <class F, class... Ts>
optional<void> apply(F& fun, detail::type_list<void>, optional<void> apply(F& fun, detail::type_list<void>,
detail::type_list<Ts...> tk) { detail::type_list<Ts...> tk) {
if (! match_elements<Ts...>()) if (!match_elements<Ts...>())
return none; return none;
detail::pseudo_tuple<typename std::decay<Ts>::type...> xs{*this}; detail::pseudo_tuple<typename std::decay<Ts>::type...> xs{*this};
detail::apply_args(fun, detail::get_indices(tk), xs); detail::apply_args(fun, detail::get_indices(tk), xs);
......
...@@ -212,7 +212,7 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>, ...@@ -212,7 +212,7 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
/// Queries whether this object was constructed using /// Queries whether this object was constructed using
/// `unsafe_actor_handle_init` or is in moved-from state. /// `unsafe_actor_handle_init` or is in moved-from state.
bool unsafe() const { bool unsafe() const {
return ! ptr_; return !ptr_;
} }
/// @cond PRIVATE /// @cond PRIVATE
...@@ -284,7 +284,7 @@ bool operator==(const typed_actor<Xs...>& x, ...@@ -284,7 +284,7 @@ bool operator==(const typed_actor<Xs...>& x,
template <class... Xs, class... Ys> template <class... Xs, class... Ys>
bool operator!=(const typed_actor<Xs...>& x, bool operator!=(const typed_actor<Xs...>& x,
const typed_actor<Ys...>& y) noexcept { const typed_actor<Ys...>& y) noexcept {
return ! (x == y); return !(x == y);
} }
/// Returns a new actor that implements the composition `f.g(x) = f(g(x))`. /// Returns a new actor that implements the composition `f.g(x) = f(g(x))`.
......
...@@ -70,7 +70,7 @@ public: ...@@ -70,7 +70,7 @@ public:
void initialize() override { void initialize() override {
this->is_initialized(true); this->is_initialized(true);
auto bhvr = make_behavior(); auto bhvr = make_behavior();
CAF_LOG_DEBUG_IF(! bhvr, "make_behavior() did not return a behavior:" CAF_LOG_DEBUG_IF(!bhvr, "make_behavior() did not return a behavior:"
<< CAF_ARG(this->has_behavior())); << CAF_ARG(this->has_behavior()));
if (bhvr) { if (bhvr) {
// make_behavior() did return a behavior instead of using become() // make_behavior() did return a behavior instead of using become()
......
...@@ -53,7 +53,7 @@ public: ...@@ -53,7 +53,7 @@ public:
/// Satisfies the promise by sending a non-error response message. /// Satisfies the promise by sending a non-error response message.
template <class U, class... Us> template <class U, class... Us>
typename std::enable_if< typename std::enable_if<
(sizeof...(Us) > 0) || ! std::is_convertible<U, error>::value, (sizeof...(Us) > 0) || !std::is_convertible<U, error>::value,
typed_response_promise typed_response_promise
>::type >::type
deliver(U&& x, Us&&... xs) { deliver(U&& x, Us&&... xs) {
......
...@@ -59,7 +59,7 @@ struct variant_move_helper { ...@@ -59,7 +59,7 @@ struct variant_move_helper {
template <class T, class U, template <class T, class U,
bool Enable = std::is_integral<T>::value bool Enable = std::is_integral<T>::value
&& std::is_integral<U>::value && std::is_integral<U>::value
&& ! std::is_same<T, bool>::value> && !std::is_same<T, bool>::value>
struct is_equal_int_type { struct is_equal_int_type {
static constexpr bool value = sizeof(T) == sizeof(U) static constexpr bool value = sizeof(T) == sizeof(U)
&& std::is_signed<T>::value && std::is_signed<T>::value
...@@ -89,7 +89,7 @@ public: ...@@ -89,7 +89,7 @@ public:
static constexpr int max_type_id = sizeof...(Ts) - 1; static constexpr int max_type_id = sizeof...(Ts) - 1;
static_assert(! detail::tl_exists<types, std::is_reference>::value, static_assert(!detail::tl_exists<types, std::is_reference>::value,
"Cannot create a variant of references"); "Cannot create a variant of references");
variant& operator=(const variant& other) { variant& operator=(const variant& other) {
......
...@@ -128,7 +128,7 @@ public: ...@@ -128,7 +128,7 @@ public:
} }
bool operator!() const noexcept { bool operator!() const noexcept {
return ! ptr_; return !ptr_;
} }
explicit operator bool() const noexcept { explicit operator bool() const noexcept {
...@@ -149,7 +149,7 @@ public: ...@@ -149,7 +149,7 @@ public:
/// Tries to upgrade this weak reference to a strong reference. /// Tries to upgrade this weak reference to a strong reference.
intrusive_ptr<T> lock() const noexcept { intrusive_ptr<T> lock() const noexcept {
if (! ptr_ || ! intrusive_ptr_upgrade_weak(ptr_)) if (!ptr_ || !intrusive_ptr_upgrade_weak(ptr_))
return nullptr; return nullptr;
// reference count already increased by intrusive_ptr_upgrade_weak // reference count already increased by intrusive_ptr_upgrade_weak
return {ptr_, false}; return {ptr_, false};
...@@ -159,7 +159,7 @@ public: ...@@ -159,7 +159,7 @@ public:
/// Returns a pointer with increased strong reference count /// Returns a pointer with increased strong reference count
/// on success, `nullptr` otherwise. /// on success, `nullptr` otherwise.
pointer get_locked() const noexcept { pointer get_locked() const noexcept {
if (! ptr_ || ! intrusive_ptr_upgrade_weak(ptr_)) if (!ptr_ || !intrusive_ptr_upgrade_weak(ptr_))
return nullptr; return nullptr;
return ptr_; return ptr_;
} }
......
...@@ -244,7 +244,7 @@ void printer_loop(blocking_actor* self) { ...@@ -244,7 +244,7 @@ void printer_loop(blocking_actor* self) {
return nullptr; return nullptr;
}; };
auto flush = [&](actor_data* what, bool forced) { auto flush = [&](actor_data* what, bool forced) {
if (! what) if (!what)
return; return;
auto& line = what->current_line; auto& line = what->current_line;
if (line.empty() || (line.back() != '\n' && !forced)) if (line.empty() || (line.back() != '\n' && !forced))
...@@ -356,7 +356,7 @@ void abstract_coordinator::cleanup_and_release(resumable* ptr) { ...@@ -356,7 +356,7 @@ void abstract_coordinator::cleanup_and_release(resumable* ptr) {
auto dptr = static_cast<scheduled_actor*>(ptr); auto dptr = static_cast<scheduled_actor*>(ptr);
dummy_unit dummy{dptr}; dummy_unit dummy{dptr};
dptr->cleanup(make_error(exit_reason::user_shutdown), &dummy); dptr->cleanup(make_error(exit_reason::user_shutdown), &dummy);
while (! dummy.resumables.empty()) { while (!dummy.resumables.empty()) {
auto sub = dummy.resumables.back(); auto sub = dummy.resumables.back();
dummy.resumables.pop_back(); dummy.resumables.pop_back();
switch (sub->subtype()) { switch (sub->subtype()) {
......
...@@ -96,7 +96,7 @@ actor actor::splice_impl(std::initializer_list<actor> xs) { ...@@ -96,7 +96,7 @@ actor actor::splice_impl(std::initializer_list<actor> xs) {
actor_system* sys = nullptr; actor_system* sys = nullptr;
std::vector<strong_actor_ptr> tmp; std::vector<strong_actor_ptr> tmp;
for (auto& x : xs) { for (auto& x : xs) {
if (! sys) if (!sys)
sys = &(x->home_system()); sys = &(x->home_system());
tmp.push_back(actor_cast<strong_actor_ptr>(x)); tmp.push_back(actor_cast<strong_actor_ptr>(x));
} }
......
...@@ -44,9 +44,9 @@ actor_addr::actor_addr(actor_control_block* ptr, bool add_ref) ...@@ -44,9 +44,9 @@ actor_addr::actor_addr(actor_control_block* ptr, bool add_ref)
intptr_t actor_addr::compare(const actor_control_block* lhs, intptr_t actor_addr::compare(const actor_control_block* lhs,
const actor_control_block* rhs) { const actor_control_block* rhs) {
// invalid actors are always "less" than valid actors // invalid actors are always "less" than valid actors
if (! lhs) if (!lhs)
return rhs ? -1 : 0; return rhs ? -1 : 0;
if (! rhs) if (!rhs)
return 1; return 1;
// check for identity // check for identity
if (lhs == rhs) if (lhs == rhs)
......
...@@ -53,7 +53,7 @@ void actor_companion::enqueue(strong_actor_ptr src, message_id mid, ...@@ -53,7 +53,7 @@ void actor_companion::enqueue(strong_actor_ptr src, message_id mid,
} }
void actor_companion::launch(execution_unit*, bool, bool hide) { void actor_companion::launch(execution_unit*, bool, bool hide) {
is_registered(! hide); is_registered(!hide);
} }
void actor_companion::on_exit() { void actor_companion::on_exit() {
......
...@@ -83,7 +83,7 @@ bool operator==(const abstract_actor* x, const strong_actor_ptr& y) { ...@@ -83,7 +83,7 @@ bool operator==(const abstract_actor* x, const strong_actor_ptr& y) {
error load_actor(strong_actor_ptr& storage, execution_unit* ctx, error load_actor(strong_actor_ptr& storage, execution_unit* ctx,
actor_id aid, const node_id& nid) { actor_id aid, const node_id& nid) {
if (! ctx) if (!ctx)
return sec::no_context; return sec::no_context;
auto& sys = ctx->system(); auto& sys = ctx->system();
if (sys.node() == nid) { if (sys.node() == nid) {
...@@ -93,7 +93,7 @@ error load_actor(strong_actor_ptr& storage, execution_unit* ctx, ...@@ -93,7 +93,7 @@ error load_actor(strong_actor_ptr& storage, execution_unit* ctx,
return none; return none;
} }
auto prp = ctx->proxy_registry_ptr(); auto prp = ctx->proxy_registry_ptr();
if (! prp) if (!prp)
return sec::no_proxy_registry; return sec::no_proxy_registry;
// deal with (proxies for) remote actors // deal with (proxies for) remote actors
storage = prp->get_or_put(nid, aid); storage = prp->get_or_put(nid, aid);
...@@ -102,7 +102,7 @@ error load_actor(strong_actor_ptr& storage, execution_unit* ctx, ...@@ -102,7 +102,7 @@ error load_actor(strong_actor_ptr& storage, execution_unit* ctx,
error save_actor(strong_actor_ptr& storage, execution_unit* ctx, error save_actor(strong_actor_ptr& storage, execution_unit* ctx,
actor_id aid, const node_id& nid) { actor_id aid, const node_id& nid) {
if (! ctx) if (!ctx)
return sec::no_context; return sec::no_context;
auto& sys = ctx->system(); auto& sys = ctx->system();
// register locally running actors to be able to deserialize them later // register locally running actors to be able to deserialize them later
......
...@@ -56,7 +56,7 @@ actor_ostream& actor_ostream::flush() { ...@@ -56,7 +56,7 @@ actor_ostream& actor_ostream::flush() {
} }
void actor_ostream::redirect(abstract_actor* self, std::string fn, int flags) { void actor_ostream::redirect(abstract_actor* self, std::string fn, int flags) {
if (! self) if (!self)
return; return;
auto pr = self->home_system().scheduler().printer(); auto pr = self->home_system().scheduler().printer();
pr->enqueue(make_mailbox_element(nullptr, message_id::make(), {}, pr->enqueue(make_mailbox_element(nullptr, message_id::make(), {},
...@@ -74,7 +74,7 @@ void actor_ostream::redirect_all(actor_system& sys, std::string fn, int flags) { ...@@ -74,7 +74,7 @@ void actor_ostream::redirect_all(actor_system& sys, std::string fn, int flags) {
} }
void actor_ostream::init(abstract_actor* self) { void actor_ostream::init(abstract_actor* self) {
if (! self->get_flag(abstract_actor::has_used_aout_flag)) if (!self->get_flag(abstract_actor::has_used_aout_flag))
self->set_flag(true, abstract_actor::has_used_aout_flag); self->set_flag(true, abstract_actor::has_used_aout_flag);
} }
......
...@@ -54,7 +54,7 @@ namespace { ...@@ -54,7 +54,7 @@ namespace {
void broadcast_dispatch(actor_system&, actor_pool::uplock&, void broadcast_dispatch(actor_system&, actor_pool::uplock&,
const actor_pool::actor_vec& vec, const actor_pool::actor_vec& vec,
mailbox_element_ptr& ptr, execution_unit* host) { mailbox_element_ptr& ptr, execution_unit* host) {
CAF_ASSERT(! vec.empty()); CAF_ASSERT(!vec.empty());
auto msg = ptr->move_content_to_message(); auto msg = ptr->move_content_to_message();
for (auto& worker : vec) for (auto& worker : vec)
worker->enqueue(ptr->sender, ptr->mid, msg, host); worker->enqueue(ptr->sender, ptr->mid, msg, host);
......
...@@ -67,11 +67,11 @@ strong_actor_ptr actor_registry::get(actor_id key) const { ...@@ -67,11 +67,11 @@ strong_actor_ptr actor_registry::get(actor_id key) const {
void actor_registry::put(actor_id key, strong_actor_ptr val) { void actor_registry::put(actor_id key, strong_actor_ptr val) {
CAF_LOG_TRACE(CAF_ARG(key)); CAF_LOG_TRACE(CAF_ARG(key));
if (! val) if (!val)
return; return;
{ // lifetime scope of guard { // lifetime scope of guard
exclusive_guard guard(instances_mtx_); exclusive_guard guard(instances_mtx_);
if (! entries_.emplace(key, val).second) if (!entries_.emplace(key, val).second)
return; return;
} }
// attach functor without lock // attach functor without lock
......
...@@ -112,7 +112,7 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) { ...@@ -112,7 +112,7 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) {
[=](subscribe_atom, const std::string& key) { [=](subscribe_atom, const std::string& key) {
auto subscriber = actor_cast<strong_actor_ptr>(self->current_sender()); auto subscriber = actor_cast<strong_actor_ptr>(self->current_sender());
CAF_LOG_TRACE(CAF_ARG(key) << CAF_ARG(subscriber)); CAF_LOG_TRACE(CAF_ARG(key) << CAF_ARG(subscriber));
if (! subscriber) if (!subscriber)
return; return;
self->state.data[key].second.insert(subscriber); self->state.data[key].second.insert(subscriber);
auto& subscribers = self->state.subscribers; auto& subscribers = self->state.subscribers;
...@@ -127,7 +127,7 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) { ...@@ -127,7 +127,7 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) {
// unsubscribe from a key // unsubscribe from a key
[=](unsubscribe_atom, const std::string& key) { [=](unsubscribe_atom, const std::string& key) {
auto subscriber = actor_cast<strong_actor_ptr>(self->current_sender()); auto subscriber = actor_cast<strong_actor_ptr>(self->current_sender());
if (! subscriber) if (!subscriber)
return; return;
CAF_LOG_TRACE(CAF_ARG(key) << CAF_ARG(subscriber)); CAF_LOG_TRACE(CAF_ARG(key) << CAF_ARG(subscriber));
if (key == wildcard) { if (key == wildcard) {
...@@ -203,7 +203,7 @@ actor_system::actor_system(actor_system_config& cfg) ...@@ -203,7 +203,7 @@ actor_system::actor_system(actor_system_config& cfg)
using profiled_share = scheduler::profiled_coordinator<policy::work_sharing>; using profiled_share = scheduler::profiled_coordinator<policy::work_sharing>;
using profiled_steal = scheduler::profiled_coordinator<policy::work_stealing>; using profiled_steal = scheduler::profiled_coordinator<policy::work_stealing>;
// set scheduler only if not explicitly loaded by user // set scheduler only if not explicitly loaded by user
if (! sched) { if (!sched) {
enum sched_conf { enum sched_conf {
stealing = 0x0001, stealing = 0x0001,
sharing = 0x0002, sharing = 0x0002,
...@@ -304,7 +304,7 @@ const uniform_type_info_map& actor_system::types() const { ...@@ -304,7 +304,7 @@ const uniform_type_info_map& actor_system::types() const {
} }
std::string actor_system::render(const error& x) const { std::string actor_system::render(const error& x) const {
if (! x) if (!x)
return to_string(x); return to_string(x);
auto& xs = config().error_renderers; auto& xs = config().error_renderers;
auto i = xs.find(x.category()); auto i = xs.find(x.category());
...@@ -322,7 +322,7 @@ bool actor_system::has_middleman() const { ...@@ -322,7 +322,7 @@ bool actor_system::has_middleman() const {
} }
io::middleman& actor_system::middleman() { io::middleman& actor_system::middleman() {
if (! middleman_) if (!middleman_)
CAF_RAISE_ERROR("cannot access middleman: module not loaded"); CAF_RAISE_ERROR("cannot access middleman: module not loaded");
return *middleman_; return *middleman_;
} }
...@@ -332,7 +332,7 @@ bool actor_system::has_opencl_manager() const { ...@@ -332,7 +332,7 @@ bool actor_system::has_opencl_manager() const {
} }
opencl::manager& actor_system::opencl_manager() const { opencl::manager& actor_system::opencl_manager() const {
if (! opencl_manager_) if (!opencl_manager_)
CAF_RAISE_ERROR("cannot access opencl manager: module not loaded"); CAF_RAISE_ERROR("cannot access opencl manager: module not loaded");
return *opencl_manager_; return *opencl_manager_;
} }
...@@ -384,7 +384,7 @@ actor_system::dyn_spawn_impl(const std::string& name, message& args, ...@@ -384,7 +384,7 @@ actor_system::dyn_spawn_impl(const std::string& name, message& args,
return sec::unknown_type; return sec::unknown_type;
actor_config cfg{ctx ? ctx : &dummy_execution_unit_}; actor_config cfg{ctx ? ctx : &dummy_execution_unit_};
auto res = i->second(cfg, args); auto res = i->second(cfg, args);
if (! res.first) if (!res.first)
return sec::cannot_spawn_actor_from_arguments; return sec::cannot_spawn_actor_from_arguments;
if (check_interface && !assignable(res.second, *expected_ifs)) if (check_interface && !assignable(res.second, *expected_ifs))
return sec::unexpected_actor_messaging_interface; return sec::unexpected_actor_messaging_interface;
......
...@@ -187,7 +187,7 @@ actor_system_config& actor_system_config::parse(int argc, char** argv, ...@@ -187,7 +187,7 @@ actor_system_config& actor_system_config::parse(int argc, char** argv,
if (argc > 1) if (argc > 1)
args = message_builder(argv + 1, argv + argc).move_to_message(); args = message_builder(argv + 1, argv + argc).move_to_message();
// set default config file name if not set by user // set default config file name if not set by user
if (! ini_file_cstr) if (!ini_file_cstr)
ini_file_cstr = "caf-application.ini"; ini_file_cstr = "caf-application.ini";
std::string config_file_name; std::string config_file_name;
// CLI file name has priority over default file name // CLI file name has priority over default file name
...@@ -239,7 +239,7 @@ actor_system_config& actor_system_config::parse(message& args, ...@@ -239,7 +239,7 @@ actor_system_config& actor_system_config::parse(message& args,
using std::cout; using std::cout;
using std::endl; using std::endl;
args_remainder = std::move(res.remainder); args_remainder = std::move(res.remainder);
if (! res.error.empty()) { if (!res.error.empty()) {
cli_helptext_printed = true; cli_helptext_printed = true;
std::cerr << res.error << endl; std::cerr << res.error << endl;
return *this; return *this;
......
...@@ -59,7 +59,7 @@ void adapter::enqueue(mailbox_element_ptr x, execution_unit* context) { ...@@ -59,7 +59,7 @@ void adapter::enqueue(mailbox_element_ptr x, execution_unit* context) {
merger = merger_; merger = merger_;
fail_state = fail_state_; fail_state = fail_state_;
}); });
if (! decorated) { if (!decorated) {
bounce(x, fail_state); bounce(x, fail_state);
return; return;
} }
......
...@@ -117,7 +117,7 @@ optional<message> behavior_impl::invoke(message& xs) { ...@@ -117,7 +117,7 @@ optional<message> behavior_impl::invoke(message& xs) {
maybe_message_visitor f; maybe_message_visitor f;
// the following const-cast is safe, because invoke() is aware of // the following const-cast is safe, because invoke() is aware of
// copy-on-write and does not modify x if it's shared // copy-on-write and does not modify x if it's shared
if (! xs.empty()) if (!xs.empty())
invoke(f, *const_cast<message_data*>(xs.cvals().get())); invoke(f, *const_cast<message_data*>(xs.cvals().get()));
else else
invoke_empty(f); invoke_empty(f);
...@@ -134,7 +134,7 @@ match_case::result behavior_impl::invoke(detail::invoke_result_visitor& f, ...@@ -134,7 +134,7 @@ match_case::result behavior_impl::invoke(detail::invoke_result_visitor& f,
message& xs) { message& xs) {
// the following const-cast is safe, because invoke() is aware of // the following const-cast is safe, because invoke() is aware of
// copy-on-write and does not modify x if it's shared // copy-on-write and does not modify x if it's shared
if (! xs.empty()) if (!xs.empty())
return invoke(f, *const_cast<message_data*>(xs.cvals().get())); return invoke(f, *const_cast<message_data*>(xs.cvals().get()));
return invoke_empty(f); return invoke_empty(f);
} }
......
...@@ -27,13 +27,13 @@ namespace caf { ...@@ -27,13 +27,13 @@ namespace caf {
namespace detail { namespace detail {
void behavior_stack::pop_back() { void behavior_stack::pop_back() {
CAF_ASSERT(! elements_.empty()); CAF_ASSERT(!elements_.empty());
erased_elements_.push_back(std::move(elements_.back())); erased_elements_.push_back(std::move(elements_.back()));
elements_.pop_back(); elements_.pop_back();
} }
void behavior_stack::clear() { void behavior_stack::clear() {
if (! elements_.empty()) { if (!elements_.empty()) {
if (erased_elements_.empty()) { if (erased_elements_.empty()) {
elements_.swap(erased_elements_); elements_.swap(erased_elements_);
} else { } else {
......
...@@ -62,7 +62,7 @@ void blocking_actor::enqueue(mailbox_element_ptr ptr, execution_unit*) { ...@@ -62,7 +62,7 @@ void blocking_actor::enqueue(mailbox_element_ptr ptr, execution_unit*) {
auto mid = ptr->mid; auto mid = ptr->mid;
auto src = ptr->sender; auto src = ptr->sender;
// returns false if mailbox has been closed // returns false if mailbox has been closed
if (! mailbox().synchronized_enqueue(mtx_, cv_, ptr.release())) { if (!mailbox().synchronized_enqueue(mtx_, cv_, ptr.release())) {
if (mid.is_request()) { if (mid.is_request()) {
detail::sync_request_bouncer srb{exit_reason()}; detail::sync_request_bouncer srb{exit_reason()};
srb(src, mid); srb(src, mid);
...@@ -77,7 +77,7 @@ const char* blocking_actor::name() const { ...@@ -77,7 +77,7 @@ const char* blocking_actor::name() const {
void blocking_actor::launch(execution_unit*, bool, bool hide) { void blocking_actor::launch(execution_unit*, bool, bool hide) {
CAF_LOG_TRACE(CAF_ARG(hide)); CAF_LOG_TRACE(CAF_ARG(hide));
CAF_ASSERT(is_blocking()); CAF_ASSERT(is_blocking());
is_registered(! hide); is_registered(!hide);
home_system().inc_detached_threads(); home_system().inc_detached_threads();
std::thread([](strong_actor_ptr ptr) { std::thread([](strong_actor_ptr ptr) {
// actor lives in its own thread // actor lives in its own thread
...@@ -181,7 +181,7 @@ public: ...@@ -181,7 +181,7 @@ public:
public: public:
iterator advance_impl(iterator i) { iterator advance_impl(iterator i) {
while (i != e_) { while (i != e_) {
if (! i->marked) { if (!i->marked) {
i->marked = true; i->marked = true;
return i; return i;
} }
...@@ -220,7 +220,7 @@ public: ...@@ -220,7 +220,7 @@ public:
} }
bool await_value(bool reset_timeout) override { bool await_value(bool reset_timeout) override {
if (! rel_tout_.valid()) { if (!rel_tout_.valid()) {
self_->await_data(); self_->await_data();
return true; return true;
} }
...@@ -259,7 +259,7 @@ public: ...@@ -259,7 +259,7 @@ public:
bool at_end() override { bool at_end() override {
if (ptr_->at_end()) { if (ptr_->at_end()) {
if (! fallback_) if (!fallback_)
return true; return true;
ptr_ = fallback_; ptr_ = fallback_;
fallback_ = nullptr; fallback_ = nullptr;
...@@ -303,17 +303,17 @@ void blocking_actor::receive_impl(receive_cond& rcc, ...@@ -303,17 +303,17 @@ void blocking_actor::receive_impl(receive_cond& rcc,
// read incoming messages until we have a match or a timeout // read incoming messages until we have a match or a timeout
for (;;) { for (;;) {
// check loop pre-condition // check loop pre-condition
if (! rcc.pre()) if (!rcc.pre())
return; return;
// mailbox sequence is infinite, but at_end triggers the // mailbox sequence is infinite, but at_end triggers the
// transition from seq1 to seq2 if we iterated our cache // transition from seq1 to seq2 if we iterated our cache
if (seq.at_end()) if (seq.at_end())
CAF_RAISE_ERROR("reached the end of an infinite sequence"); CAF_RAISE_ERROR("reached the end of an infinite sequence");
// reset the timeout each iteration // reset the timeout each iteration
if (! seq.await_value(true)) { if (!seq.await_value(true)) {
// short-circuit "loop body" // short-circuit "loop body"
bhvr.nested.handle_timeout(); bhvr.nested.handle_timeout();
if (! rcc.post()) if (!rcc.post())
return; return;
continue; continue;
} }
...@@ -364,23 +364,23 @@ void blocking_actor::receive_impl(receive_cond& rcc, ...@@ -364,23 +364,23 @@ void blocking_actor::receive_impl(receive_cond& rcc,
seq.advance(); seq.advance();
if (seq.at_end()) if (seq.at_end())
CAF_RAISE_ERROR("reached the end of an infinite sequence"); CAF_RAISE_ERROR("reached the end of an infinite sequence");
if (! seq.await_value(false)) { if (!seq.await_value(false)) {
timed_out = true; timed_out = true;
} }
} }
} while (skipped && ! timed_out); } while (skipped && !timed_out);
if (timed_out) if (timed_out)
bhvr.nested.handle_timeout(); bhvr.nested.handle_timeout();
else else
seq.erase_and_advance(); seq.erase_and_advance();
// check loop post condition // check loop post condition
if (! rcc.post()) if (!rcc.post())
return; return;
} }
} }
void blocking_actor::await_data() { void blocking_actor::await_data() {
if (! has_next_message()) if (!has_next_message())
mailbox().synchronized_await(mtx_, cv_); mailbox().synchronized_await(mtx_, cv_);
} }
...@@ -404,7 +404,7 @@ size_t blocking_actor::attach_functor(const actor_addr& x) { ...@@ -404,7 +404,7 @@ size_t blocking_actor::attach_functor(const actor_addr& x) {
size_t blocking_actor::attach_functor(const strong_actor_ptr& ptr) { size_t blocking_actor::attach_functor(const strong_actor_ptr& ptr) {
using wait_for_atom = atom_constant<atom("waitFor")>; using wait_for_atom = atom_constant<atom("waitFor")>;
if (! ptr) if (!ptr)
return 0; return 0;
actor self{this}; actor self{this};
ptr->get()->attach_functor([=](const error&) { ptr->get()->attach_functor([=](const error&) {
......
...@@ -78,7 +78,7 @@ const char* config_option::type_name_visitor::operator()(atom_value) const { ...@@ -78,7 +78,7 @@ const char* config_option::type_name_visitor::operator()(atom_value) const {
} }
bool config_option::assign_config_value(size_t& x, int64_t& y) { bool config_option::assign_config_value(size_t& x, int64_t& y) {
if (y < 0 || ! unsigned_assign_in_range(x, y)) if (y < 0 || !unsigned_assign_in_range(x, y))
return false; return false;
x = static_cast<size_t>(y); x = static_cast<size_t>(y);
return true; return true;
......
...@@ -61,7 +61,7 @@ error::error(const error& x) : data_(x ? new data(*x.data_) : nullptr) { ...@@ -61,7 +61,7 @@ error::error(const error& x) : data_(x ? new data(*x.data_) : nullptr) {
error& error::operator=(const error& x) { error& error::operator=(const error& x) {
if (x) { if (x) {
if (! data_) if (!data_)
data_ = new data(*x.data_); data_ = new data(*x.data_);
else else
*data_ = *x.data_; *data_ = *x.data_;
...@@ -164,7 +164,7 @@ error error::apply(inspect_fun f) { ...@@ -164,7 +164,7 @@ error error::apply(inspect_fun f) {
} }
std::string to_string(const error& x) { std::string to_string(const error& x) {
if (! x) if (!x)
return "none"; return "none";
return deep_to_string(meta::type_name("error"), x.code(), x.category(), return deep_to_string(meta::type_name("error"), x.code(), x.category(),
meta::omittable_if_empty(), x.context()); meta::omittable_if_empty(), x.context());
......
...@@ -34,7 +34,7 @@ void event_based_actor::initialize() { ...@@ -34,7 +34,7 @@ void event_based_actor::initialize() {
CAF_LOG_TRACE("subtype =" << logger::render_type_name(typeid(*this)).c_str()); CAF_LOG_TRACE("subtype =" << logger::render_type_name(typeid(*this)).c_str());
is_initialized(true); is_initialized(true);
auto bhvr = make_behavior(); auto bhvr = make_behavior();
CAF_LOG_DEBUG_IF(! bhvr, "make_behavior() did not return a behavior:" CAF_LOG_DEBUG_IF(!bhvr, "make_behavior() did not return a behavior:"
<< CAF_ARG(has_behavior())); << CAF_ARG(has_behavior()));
if (bhvr) { if (bhvr) {
// make_behavior() did return a behavior instead of using become() // make_behavior() did return a behavior instead of using become()
......
...@@ -33,7 +33,7 @@ forwarding_actor_proxy::forwarding_actor_proxy(actor_config& cfg, actor mgr) ...@@ -33,7 +33,7 @@ forwarding_actor_proxy::forwarding_actor_proxy(actor_config& cfg, actor mgr)
} }
forwarding_actor_proxy::~forwarding_actor_proxy() { forwarding_actor_proxy::~forwarding_actor_proxy() {
if (! manager_.unsafe()) if (!manager_.unsafe())
anon_send(manager_, make_message(delete_atom::value, node(), id())); anon_send(manager_, make_message(delete_atom::value, node(), id()));
} }
...@@ -54,7 +54,7 @@ void forwarding_actor_proxy::forward_msg(strong_actor_ptr sender, ...@@ -54,7 +54,7 @@ void forwarding_actor_proxy::forward_msg(strong_actor_ptr sender,
<< CAF_ARG(mid) << CAF_ARG(msg)); << CAF_ARG(mid) << CAF_ARG(msg));
forwarding_stack tmp; forwarding_stack tmp;
shared_lock<detail::shared_spinlock> guard_(manager_mtx_); shared_lock<detail::shared_spinlock> guard_(manager_mtx_);
if (! manager_.unsafe()) if (!manager_.unsafe())
manager_->enqueue(nullptr, invalid_message_id, manager_->enqueue(nullptr, invalid_message_id,
make_message(forward_atom::value, std::move(sender), make_message(forward_atom::value, std::move(sender),
fwd ? *fwd : tmp, fwd ? *fwd : tmp,
......
...@@ -203,7 +203,7 @@ std::vector<iface_info> get_mac_addresses() { ...@@ -203,7 +203,7 @@ std::vector<iface_info> get_mac_addresses() {
size_t iterations = 0; size_t iterations = 0;
do { do {
addresses.reset((IP_ADAPTER_ADDRESSES*)malloc(addresses_len)); addresses.reset((IP_ADAPTER_ADDRESSES*)malloc(addresses_len));
if (! addresses) { if (!addresses) {
perror("Memory allocation failed for IP_ADAPTER_ADDRESSES struct"); perror("Memory allocation failed for IP_ADAPTER_ADDRESSES struct");
exit(1); exit(1);
} }
......
...@@ -31,7 +31,7 @@ constexpr char uuid_format[] = "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"; ...@@ -31,7 +31,7 @@ constexpr char uuid_format[] = "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF";
namespace { namespace {
inline void erase_trailing_newline(std::string& str) { inline void erase_trailing_newline(std::string& str) {
while (! str.empty() && (*str.rbegin()) == '\n') { while (!str.empty() && (*str.rbegin()) == '\n') {
str.resize(str.size() - 1); str.resize(str.size() - 1);
} }
} }
...@@ -93,7 +93,7 @@ struct columns_iterator : std::iterator<std::forward_iterator_tag, ...@@ -93,7 +93,7 @@ struct columns_iterator : std::iterator<std::forward_iterator_tag,
} }
columns_iterator& operator++() { columns_iterator& operator++() {
string line; string line;
if (! std::getline(*fs, line)) { if (!std::getline(*fs, line)) {
fs = nullptr; fs = nullptr;
} else { } else {
split(cols, line, is_any_of(" "), token_compress_on); split(cols, line, is_any_of(" "), token_compress_on);
......
...@@ -58,7 +58,7 @@ intptr_t group::compare(const group& other) const noexcept { ...@@ -58,7 +58,7 @@ intptr_t group::compare(const group& other) const noexcept {
error inspect(serializer& f, group& x) { error inspect(serializer& f, group& x) {
std::string mod_name; std::string mod_name;
auto ptr = x.get(); auto ptr = x.get();
if (! ptr) if (!ptr)
return f(mod_name); return f(mod_name);
mod_name = ptr->module().name(); mod_name = ptr->module().name();
auto e = f(mod_name); auto e = f(mod_name);
...@@ -72,11 +72,11 @@ error inspect(deserializer& f, group& x) { ...@@ -72,11 +72,11 @@ error inspect(deserializer& f, group& x) {
x = invalid_group; x = invalid_group;
return none; return none;
} }
if (! f.context()) if (!f.context())
return sec::no_context; return sec::no_context;
auto& sys = f.context()->system(); auto& sys = f.context()->system();
auto mod = sys.groups().get_module(module_name); auto mod = sys.groups().get_module(module_name);
if (! mod) if (!mod)
return sec::no_such_group_module; return sec::no_such_group_module;
return mod->load(f, x); return mod->load(f, x);
} }
......
...@@ -77,7 +77,7 @@ public: ...@@ -77,7 +77,7 @@ public:
std::pair<bool, size_t> add_subscriber(strong_actor_ptr who) { std::pair<bool, size_t> add_subscriber(strong_actor_ptr who) {
CAF_LOG_TRACE(CAF_ARG(who)); CAF_LOG_TRACE(CAF_ARG(who));
if (! who) if (!who)
return {false, subscribers_.size()}; return {false, subscribers_.size()};
exclusive_guard guard(mtx_); exclusive_guard guard(mtx_);
auto res = subscribers_.emplace(std::move(who)).second; auto res = subscribers_.emplace(std::move(who)).second;
...@@ -354,7 +354,7 @@ public: ...@@ -354,7 +354,7 @@ public:
if (e) if (e)
return e; return e;
CAF_LOG_DEBUG(CAF_ARG(identifier) << CAF_ARG(broker_ptr)); CAF_LOG_DEBUG(CAF_ARG(identifier) << CAF_ARG(broker_ptr));
if (! broker_ptr) { if (!broker_ptr) {
storage = invalid_group; storage = invalid_group;
return none; return none;
} }
......
...@@ -60,7 +60,7 @@ void local_actor::on_destroy() { ...@@ -60,7 +60,7 @@ void local_actor::on_destroy() {
// alternatively, we would have to use a reference-counted, // alternatively, we would have to use a reference-counted,
// heap-allocated logger // heap-allocated logger
CAF_SET_LOGGER_SYS(nullptr); CAF_SET_LOGGER_SYS(nullptr);
if (! is_cleaned_up()) { if (!is_cleaned_up()) {
on_exit(); on_exit();
cleanup(exit_reason::unreachable, nullptr); cleanup(exit_reason::unreachable, nullptr);
monitorable_actor::on_destroy(); monitorable_actor::on_destroy();
...@@ -69,14 +69,14 @@ void local_actor::on_destroy() { ...@@ -69,14 +69,14 @@ void local_actor::on_destroy() {
void local_actor::request_response_timeout(const duration& d, message_id mid) { void local_actor::request_response_timeout(const duration& d, message_id mid) {
CAF_LOG_TRACE(CAF_ARG(d) << CAF_ARG(mid)); CAF_LOG_TRACE(CAF_ARG(d) << CAF_ARG(mid));
if (! d.valid()) if (!d.valid())
return; return;
system().scheduler().delayed_send(d, ctrl(), ctrl(), mid.response_id(), system().scheduler().delayed_send(d, ctrl(), ctrl(), mid.response_id(),
make_message(sec::request_timeout)); make_message(sec::request_timeout));
} }
void local_actor::monitor(abstract_actor* ptr) { void local_actor::monitor(abstract_actor* ptr) {
if (! ptr) if (!ptr)
return; return;
ptr->attach(default_attachable::make_monitor(ptr->address(), address())); ptr->attach(default_attachable::make_monitor(ptr->address(), address()));
} }
...@@ -84,7 +84,7 @@ void local_actor::monitor(abstract_actor* ptr) { ...@@ -84,7 +84,7 @@ void local_actor::monitor(abstract_actor* ptr) {
void local_actor::demonitor(const actor_addr& whom) { void local_actor::demonitor(const actor_addr& whom) {
CAF_LOG_TRACE(CAF_ARG(whom)); CAF_LOG_TRACE(CAF_ARG(whom));
auto ptr = actor_cast<strong_actor_ptr>(whom); auto ptr = actor_cast<strong_actor_ptr>(whom);
if (! ptr) if (!ptr)
return; return;
default_attachable::observe_token tk{address(), default_attachable::monitor}; default_attachable::observe_token tk{address(), default_attachable::monitor};
ptr->get()->detach(tk); ptr->get()->detach(tk);
...@@ -101,7 +101,7 @@ message_id local_actor::new_request_id(message_priority mp) { ...@@ -101,7 +101,7 @@ message_id local_actor::new_request_id(message_priority mp) {
} }
mailbox_element_ptr local_actor::next_message() { mailbox_element_ptr local_actor::next_message() {
if (! is_priority_aware()) if (!is_priority_aware())
return mailbox_element_ptr{mailbox().try_pop()}; return mailbox_element_ptr{mailbox().try_pop()};
// we partition the mailbox into four segments in this case: // we partition the mailbox into four segments in this case:
// <-------- ! was_skipped --------> | <-------- was_skipped --------> // <-------- ! was_skipped --------> | <-------- was_skipped -------->
...@@ -111,7 +111,7 @@ mailbox_element_ptr local_actor::next_message() { ...@@ -111,7 +111,7 @@ mailbox_element_ptr local_actor::next_message() {
auto e = cache.separator(); auto e = cache.separator();
// read elements from mailbox if we don't have a high // read elements from mailbox if we don't have a high
// priority message or if cache is empty // priority message or if cache is empty
if (i == e || ! i->is_high_priority()) { if (i == e || !i->is_high_priority()) {
// insert points for high priority // insert points for high priority
auto hp_pos = i; auto hp_pos = i;
// read whole mailbox at once // read whole mailbox at once
...@@ -119,7 +119,7 @@ mailbox_element_ptr local_actor::next_message() { ...@@ -119,7 +119,7 @@ mailbox_element_ptr local_actor::next_message() {
while (tmp) { while (tmp) {
cache.insert(tmp->is_high_priority() ? hp_pos : e, tmp); cache.insert(tmp->is_high_priority() ? hp_pos : e, tmp);
// adjust high priority insert point on first low prio element insert // adjust high priority insert point on first low prio element insert
if (hp_pos == e && ! tmp->is_high_priority()) if (hp_pos == e && !tmp->is_high_priority())
--hp_pos; --hp_pos;
tmp = mailbox().try_pop(); tmp = mailbox().try_pop();
} }
...@@ -132,7 +132,7 @@ mailbox_element_ptr local_actor::next_message() { ...@@ -132,7 +132,7 @@ mailbox_element_ptr local_actor::next_message() {
} }
bool local_actor::has_next_message() { bool local_actor::has_next_message() {
if (! is_priority_aware()) if (!is_priority_aware())
return mailbox_.can_fetch_more(); return mailbox_.can_fetch_more();
auto& mbox = mailbox(); auto& mbox = mailbox();
auto& cache = mbox.cache(); auto& cache = mbox.cache();
...@@ -142,7 +142,7 @@ bool local_actor::has_next_message() { ...@@ -142,7 +142,7 @@ bool local_actor::has_next_message() {
void local_actor::push_to_cache(mailbox_element_ptr ptr) { void local_actor::push_to_cache(mailbox_element_ptr ptr) {
CAF_ASSERT(ptr != nullptr); CAF_ASSERT(ptr != nullptr);
CAF_LOG_TRACE(CAF_ARG(*ptr)); CAF_LOG_TRACE(CAF_ARG(*ptr));
if (! is_priority_aware() || ! ptr->is_high_priority()) { if (!is_priority_aware() || !ptr->is_high_priority()) {
mailbox().cache().insert(mailbox().cache().end(), ptr.release()); mailbox().cache().insert(mailbox().cache().end(), ptr.release());
return; return;
} }
...@@ -161,7 +161,7 @@ void local_actor::send_exit(const actor_addr& whom, error reason) { ...@@ -161,7 +161,7 @@ void local_actor::send_exit(const actor_addr& whom, error reason) {
} }
void local_actor::send_exit(const strong_actor_ptr& dest, error reason) { void local_actor::send_exit(const strong_actor_ptr& dest, error reason) {
if (! dest) if (!dest)
return; return;
dest->get()->eq_impl(message_id::make(), nullptr, context(), dest->get()->eq_impl(message_id::make(), nullptr, context(),
exit_msg{address(), std::move(reason)}); exit_msg{address(), std::move(reason)});
...@@ -185,7 +185,7 @@ void local_actor::initialize() { ...@@ -185,7 +185,7 @@ void local_actor::initialize() {
bool local_actor::cleanup(error&& fail_state, execution_unit* host) { bool local_actor::cleanup(error&& fail_state, execution_unit* host) {
CAF_LOG_TRACE(CAF_ARG(fail_state)); CAF_LOG_TRACE(CAF_ARG(fail_state));
if (! mailbox_.closed()) { if (!mailbox_.closed()) {
detail::sync_request_bouncer f{fail_state}; detail::sync_request_bouncer f{fail_state};
mailbox_.close(f); mailbox_.close(f);
} }
......
...@@ -137,7 +137,7 @@ logger::line_builder::line_builder() : behind_arg_(false) { ...@@ -137,7 +137,7 @@ logger::line_builder::line_builder() : behind_arg_(false) {
} }
logger::line_builder& logger::line_builder::operator<<(const std::string& str) { logger::line_builder& logger::line_builder::operator<<(const std::string& str) {
if (! str_.empty()) if (!str_.empty())
str_ += " "; str_ += " ";
str_ += str; str_ += str;
behind_arg_ = false; behind_arg_ = false;
...@@ -145,7 +145,7 @@ logger::line_builder& logger::line_builder::operator<<(const std::string& str) { ...@@ -145,7 +145,7 @@ logger::line_builder& logger::line_builder::operator<<(const std::string& str) {
} }
logger::line_builder& logger::line_builder::operator<<(const char* str) { logger::line_builder& logger::line_builder::operator<<(const char* str) {
if (! str_.empty()) if (!str_.empty())
str_ += " "; str_ += " ";
str_ += str; str_ += str;
behind_arg_ = false; behind_arg_ = false;
......
...@@ -62,7 +62,7 @@ void make_cache_map() { ...@@ -62,7 +62,7 @@ void make_cache_map() {
cache_map& get_cache_map() { cache_map& get_cache_map() {
pthread_once(&s_key_once, make_cache_map); pthread_once(&s_key_once, make_cache_map);
auto cache = reinterpret_cast<cache_map*>(pthread_getspecific(s_key)); auto cache = reinterpret_cast<cache_map*>(pthread_getspecific(s_key));
if (! cache) { if (!cache) {
cache = new cache_map; cache = new cache_map;
pthread_setspecific(s_key, cache); pthread_setspecific(s_key, cache);
// insert default types // insert default types
...@@ -81,7 +81,7 @@ thread_local std::unique_ptr<cache_map> s_key; ...@@ -81,7 +81,7 @@ thread_local std::unique_ptr<cache_map> s_key;
} // namespace <anonymous> } // namespace <anonymous>
cache_map& get_cache_map() { cache_map& get_cache_map() {
if (! s_key) { if (!s_key) {
s_key = std::unique_ptr<cache_map>(new cache_map); s_key = std::unique_ptr<cache_map>(new cache_map);
// insert default types // insert default types
std::unique_ptr<memory_cache> tmp(new basic_memory_cache<mailbox_element>); std::unique_ptr<memory_cache> tmp(new basic_memory_cache<mailbox_element>);
......
...@@ -45,8 +45,8 @@ merged_tuple::merged_tuple(data_type xs, mapping_type ys) ...@@ -45,8 +45,8 @@ merged_tuple::merged_tuple(data_type xs, mapping_type ys)
: data_(std::move(xs)), : data_(std::move(xs)),
type_token_(0xFFFFFFFF), type_token_(0xFFFFFFFF),
mapping_(std::move(ys)) { mapping_(std::move(ys)) {
CAF_ASSERT(! data_.empty()); CAF_ASSERT(!data_.empty());
CAF_ASSERT(! mapping_.empty()); CAF_ASSERT(!mapping_.empty());
// calculate type token // calculate type token
for (size_t i = 0; i < mapping_.size(); ++i) { for (size_t i = 0; i < mapping_.size(); ++i) {
type_token_ <<= 6; type_token_ <<= 6;
......
...@@ -165,7 +165,7 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs, ...@@ -165,7 +165,7 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
return s[0] == "help" return s[0] == "help"
|| std::find_if(s.begin() + 1, s.end(), has_short_help) != s.end(); || std::find_if(s.begin() + 1, s.end(), has_short_help) != s.end();
}; };
if (! no_help && std::none_of(xs.begin(), xs.end(), pred)) { if (!no_help && std::none_of(xs.begin(), xs.end(), pred)) {
xs.push_back(cli_arg{"help,h,?", "print this text"}); xs.push_back(cli_arg{"help,h,?", "print this text"});
} }
std::map<std::string, cli_arg*> shorts; std::map<std::string, cli_arg*> shorts;
...@@ -245,7 +245,7 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs, ...@@ -245,7 +245,7 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
// this short opt expects two arguments // this short opt expects two arguments
if (arg.size() > 2) { if (arg.size() > 2) {
// this short opt comes with a value (no space), e.g., -x2 // this short opt comes with a value (no space), e.g., -x2
if (! i->second->fun(arg.substr(2))) { if (!i->second->fun(arg.substr(2))) {
error = "invalid value for " + i->second->name + ": " + arg; error = "invalid value for " + i->second->name + ": " + arg;
return skip(); return skip();
} }
...@@ -268,7 +268,7 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs, ...@@ -268,7 +268,7 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
error = "missing argument to " + arg; error = "missing argument to " + arg;
return skip(); return skip();
} }
if (! j->second->fun(arg.substr(eq_pos + 1))) { if (!j->second->fun(arg.substr(eq_pos + 1))) {
error = "invalid value for " + j->second->name + ": " + arg; error = "invalid value for " + j->second->name + ": " + arg;
return skip(); return skip();
} }
...@@ -290,14 +290,14 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs, ...@@ -290,14 +290,14 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
} }
auto i = shorts.find(arg1.substr(0, 2)); auto i = shorts.find(arg1.substr(0, 2));
if (i != shorts.end()) { if (i != shorts.end()) {
if (! i->second->fun || arg1.size() > 2) { if (!i->second->fun || arg1.size() > 2) {
// this short opt either expects no argument or comes with a value // this short opt either expects no argument or comes with a value
// (no space), e.g., -x2, so we have to parse it with the // (no space), e.g., -x2, so we have to parse it with the
// one-argument form above // one-argument form above
return skip(); return skip();
} }
CAF_ASSERT(arg1.size() == 2); CAF_ASSERT(arg1.size() == 2);
if (! i->second->fun(arg2)) { if (!i->second->fun(arg2)) {
error = "invalid value for option " + i->second->name + ": " + arg2; error = "invalid value for option " + i->second->name + ": " + arg2;
return skip(); return skip();
} }
...@@ -383,7 +383,7 @@ message message::concat_impl(std::initializer_list<data_ptr> xs) { ...@@ -383,7 +383,7 @@ message message::concat_impl(std::initializer_list<data_ptr> xs) {
} }
error inspect(serializer& sink, message& msg) { error inspect(serializer& sink, message& msg) {
if (! sink.context()) if (!sink.context())
return sec::no_context; return sec::no_context;
// build type name // build type name
uint16_t zero = 0; uint16_t zero = 0;
...@@ -396,7 +396,7 @@ error inspect(serializer& sink, message& msg) { ...@@ -396,7 +396,7 @@ error inspect(serializer& sink, message& msg) {
for (size_t i = 0; i < n; ++i) { for (size_t i = 0; i < n; ++i) {
auto rtti = msg.cvals()->type(i); auto rtti = msg.cvals()->type(i);
auto ptr = types.portable_name(rtti); auto ptr = types.portable_name(rtti);
if (! ptr) { if (!ptr) {
std::cerr << "[ERROR]: cannot serialize message because a type was " std::cerr << "[ERROR]: cannot serialize message because a type was "
"not added to the types list, typeid name: " "not added to the types list, typeid name: "
<< (rtti.second ? rtti.second->name() : "-not-available-") << (rtti.second ? rtti.second->name() : "-not-available-")
...@@ -421,7 +421,7 @@ error inspect(serializer& sink, message& msg) { ...@@ -421,7 +421,7 @@ error inspect(serializer& sink, message& msg) {
} }
error inspect(deserializer& source, message& msg) { error inspect(deserializer& source, message& msg) {
if (! source.context()) if (!source.context())
return sec::no_context; return sec::no_context;
uint16_t zero; uint16_t zero;
std::string tname; std::string tname;
...@@ -451,7 +451,7 @@ error inspect(deserializer& source, message& msg) { ...@@ -451,7 +451,7 @@ error inspect(deserializer& source, message& msg) {
auto n = next(i); auto n = next(i);
tmp.assign(i, n); tmp.assign(i, n);
auto ptr = types.make_value(tmp); auto ptr = types.make_value(tmp);
if (! ptr) if (!ptr)
return make_error(sec::unknown_type, tmp); return make_error(sec::unknown_type, tmp);
err = ptr->load(source); err = ptr->load(source);
if (err) if (err)
......
...@@ -87,7 +87,7 @@ detail::dynamic_message_data* message_builder::data() { ...@@ -87,7 +87,7 @@ detail::dynamic_message_data* message_builder::data() {
// detach if needed, i.e., assume further non-const // detach if needed, i.e., assume further non-const
// operations on data_ can cause race conditions if // operations on data_ can cause race conditions if
// someone else holds a reference to data_ // someone else holds a reference to data_
if (! data_->unique()) { if (!data_->unique()) {
auto tmp = static_cast<detail::dynamic_message_data*>(data_.get())->copy(); auto tmp = static_cast<detail::dynamic_message_data*>(data_.get())->copy();
data_.reset(tmp.release(), false); data_.reset(tmp.release(), false);
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment