Commit 54c7c6e2 authored by Dominik Charousset's avatar Dominik Charousset Committed by Dominik Charousset

Fix noexcept warnings

parent 5788c498
......@@ -161,13 +161,13 @@ inline bool operator!=(std::nullptr_t, const actor_addr& x) {
} // namespace caf
// allow actor_addr to be used in hash maps
namespace std {
template <>
struct hash<caf::actor_addr> {
inline size_t operator()(const caf::actor_addr& ref) const {
size_t operator()(const caf::actor_addr& ref) const noexcept {
return static_cast<size_t>(ref.id());
}
};
} // namespace std
} // namespace std
......@@ -231,22 +231,20 @@ typename Inspector::result_type inspect(Inspector& f, weak_actor_ptr& x) {
} // namespace caf
// allow actor pointers to be used in hash maps
namespace std {
template <>
struct hash<caf::strong_actor_ptr> {
inline size_t operator()(const caf::strong_actor_ptr& ptr) const {
size_t operator()(const caf::strong_actor_ptr& ptr) const noexcept {
return ptr ? static_cast<size_t>(ptr->id()) : 0;
}
};
template <>
struct hash<caf::weak_actor_ptr> {
inline size_t operator()(const caf::weak_actor_ptr& ptr) const {
size_t operator()(const caf::weak_actor_ptr& ptr) const noexcept {
return ptr ? static_cast<size_t>(ptr->id()) : 0;
}
};
} // namespace std
......@@ -203,11 +203,10 @@ namespace std {
template <>
struct hash<caf::atom_value> {
size_t operator()(caf::atom_value x) const {
size_t operator()(caf::atom_value x) const noexcept {
hash<uint64_t> f;
return f(static_cast<uint64_t>(x));
}
};
} // namespace std
......@@ -148,12 +148,13 @@ std::string to_string(const group& x);
} // namespace caf
namespace std {
template <>
struct hash<caf::group> {
inline size_t operator()(const caf::group& x) const {
size_t operator()(const caf::group& x) const noexcept {
// groups are singleton objects, the address is thus the best possible hash
return !x ? 0 : reinterpret_cast<size_t>(x.get());
}
};
} // namespace std
} // namespace std
......@@ -59,21 +59,19 @@ public:
// -- constructors, destructors, and assignment operators -------------------
drr_cached_queue(policy_type p)
: list_(p),
deficit_(0),
cache_(std::move(p)) {
drr_cached_queue(policy_type p) noexcept
: list_(p), deficit_(0), cache_(std::move(p)) {
// nop
}
drr_cached_queue(drr_cached_queue&& other)
drr_cached_queue(drr_cached_queue&& other) noexcept
: list_(std::move(other.list_)),
deficit_(other.deficit_),
cache_(std::move(other.cache_)) {
// nop
}
drr_cached_queue& operator=(drr_cached_queue&& other) {
drr_cached_queue& operator=(drr_cached_queue&& other) noexcept {
list_ = std::move(other.list_);
deficit_ = other.deficit_;
cache_ = std::move(other.cache_);
......
......@@ -46,15 +46,15 @@ public:
// -- constructors, destructors, and assignment operators --------------------
drr_queue(policy_type p) : super(std::move(p)), deficit_(0) {
drr_queue(policy_type p) noexcept : super(std::move(p)), deficit_(0) {
// nop
}
drr_queue(drr_queue&& other) : super(std::move(other)), deficit_(0) {
drr_queue(drr_queue&& other) noexcept : super(std::move(other)), deficit_(0) {
// nop
}
drr_queue& operator=(drr_queue&& other) {
drr_queue& operator=(drr_queue&& other) noexcept {
super::operator=(std::move(other));
return *this;
}
......
......@@ -62,7 +62,7 @@ public:
// -- constructors, destructors, and assignment operators -------------------
task_queue(policy_type p)
task_queue(policy_type p) noexcept
: old_last_(nullptr),
new_head_(nullptr),
policy_(std::move(p)) {
......
......@@ -52,7 +52,8 @@ public:
using queue_type = typename queue_map_type::mapped_type;
template <class... Ps>
wdrr_dynamic_multiplexed_queue(policy_type p) : policy_(p) {
wdrr_dynamic_multiplexed_queue(policy_type p) noexcept
: policy_(std::move(p)) {
// nop
}
......
......@@ -147,7 +147,7 @@ namespace std {
template <>
struct hash<counting_string> {
inline size_t operator()(const counting_string& ref) const {
size_t operator()(const counting_string& ref) const noexcept {
hash<string> f;
return f(ref.str());
}
......
......@@ -33,9 +33,15 @@ namespace {
struct inode : singly_linked<inode> {
int value;
inode(int x = 0) : value(x) {
inode(int x = 0) noexcept : value(x) {
// nop
}
inode() noexcept : inode(0) {
// nop
}
};
std::string to_string(const inode& x) {
......@@ -53,7 +59,9 @@ struct inode_policy {
using unique_pointer = std::unique_ptr<mapped_type, deleter_type>;
static inline task_size_type task_size(const mapped_type&) noexcept {
inode_policy() noexcept = default;
static task_size_type task_size(const mapped_type&) noexcept {
return 1;
}
};
......@@ -62,6 +70,7 @@ using queue_type = drr_cached_queue<inode_policy>;
struct fixture {
inode_policy policy;
queue_type queue{policy};
template <class Queue>
......
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