Commit c5a3afac authored by Dominik Charousset's avatar Dominik Charousset

removed superfluous move operations

this patch removes all move operations for returning local
values from a function
parent 8faaf82a
...@@ -55,7 +55,7 @@ class default_message_queue : public ref_counted { ...@@ -55,7 +55,7 @@ class default_message_queue : public ref_counted {
inline value_type pop() { inline value_type pop() {
value_type result(std::move(m_impl.front())); value_type result(std::move(m_impl.front()));
m_impl.erase(m_impl.begin()); m_impl.erase(m_impl.begin());
return std::move(result); return result;
} }
private: private:
......
...@@ -115,7 +115,7 @@ inline actor_ptr fwd_aptr(const self_type& s) { ...@@ -115,7 +115,7 @@ inline actor_ptr fwd_aptr(const self_type& s) {
} }
inline actor_ptr fwd_aptr(actor_ptr ptr) { inline actor_ptr fwd_aptr(actor_ptr ptr) {
return std::move(ptr); return ptr;
} }
struct oss_wr { struct oss_wr {
......
...@@ -308,7 +308,7 @@ namespace cppa { ...@@ -308,7 +308,7 @@ namespace cppa {
* @returns A helper object providing <tt>operator(...)</tt>. * @returns A helper object providing <tt>operator(...)</tt>.
*/ */
inline detail::match_helper match(any_tuple what) { inline detail::match_helper match(any_tuple what) {
return std::move(what); return what;
} }
/** /**
......
...@@ -501,7 +501,7 @@ Result unroll_expr(PPFPs& fs, ...@@ -501,7 +501,7 @@ Result unroll_expr(PPFPs& fs,
/* recursively evaluate sub expressions */ { /* recursively evaluate sub expressions */ {
Result res = unroll_expr<Result>(fs, bitmask, long_constant<N-1>{}, Result res = unroll_expr<Result>(fs, bitmask, long_constant<N-1>{},
type_token, is_dynamic, ptr, tup); type_token, is_dynamic, ptr, tup);
if (res) return std::move(res); if (res) return res;
} }
if ((bitmask & (0x01 << N)) == 0) return none; if ((bitmask & (0x01 << N)) == 0) return none;
auto& f = get<N>(fs); auto& f = get<N>(fs);
...@@ -597,7 +597,7 @@ inline any_tuple& detach_if_needed(any_tuple& tup, std::true_type) { ...@@ -597,7 +597,7 @@ inline any_tuple& detach_if_needed(any_tuple& tup, std::true_type) {
inline any_tuple detach_if_needed(const any_tuple& tup, std::true_type) { inline any_tuple detach_if_needed(const any_tuple& tup, std::true_type) {
any_tuple cpy{tup}; any_tuple cpy{tup};
cpy.force_detach(); cpy.force_detach();
return std::move(cpy); return cpy;
} }
inline const any_tuple& detach_if_needed(const any_tuple& tup, std::false_type) { inline const any_tuple& detach_if_needed(const any_tuple& tup, std::false_type) {
......
...@@ -451,7 +451,7 @@ make_optional_variant(T value, Ts&&... args) { ...@@ -451,7 +451,7 @@ make_optional_variant(T value, Ts&&... args) {
template<typename... Ts> template<typename... Ts>
inline optional_variant<Ts...> make_optional_variant(optional_variant<Ts...> value) { inline optional_variant<Ts...> make_optional_variant(optional_variant<Ts...> value) {
return std::move(value); return value;
} }
} // namespace cppa } // namespace cppa
......
...@@ -49,7 +49,7 @@ inline actor_ptr eval_sopts(spawn_options opts, local_actor_ptr ptr) { ...@@ -49,7 +49,7 @@ inline actor_ptr eval_sopts(spawn_options opts, local_actor_ptr ptr) {
<< " of type " << detail::demangle(typeid(*ptr))); << " of type " << detail::demangle(typeid(*ptr)));
if (has_monitor_flag(opts)) self->monitor(ptr); if (has_monitor_flag(opts)) self->monitor(ptr);
if (has_link_flag(opts)) self->link_to(ptr); if (has_link_flag(opts)) self->link_to(ptr);
return std::move(ptr); return ptr;
} }
/** @endcond */ /** @endcond */
......
...@@ -46,7 +46,7 @@ inline string trim(std::string s) { ...@@ -46,7 +46,7 @@ inline string trim(std::string s) {
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
s.erase(find_if(s.rbegin(), s.rend(), not_space).base(), s.end()); s.erase(find_if(s.rbegin(), s.rend(), not_space).base(), s.end());
return std::move(s); return s;
} }
void client_bhvr(const string& host, uint16_t port, const actor_ptr& server) { void client_bhvr(const string& host, uint16_t port, const actor_ptr& server) {
......
...@@ -422,7 +422,7 @@ local_actor_ptr init_and_launch(broker_ptr ptr) { ...@@ -422,7 +422,7 @@ local_actor_ptr init_and_launch(broker_ptr ptr) {
mm->continue_reader(kvp.second.get()); mm->continue_reader(kvp.second.get());
}); });
} }
return move(ptr); return ptr;
} }
broker_ptr broker::from_impl(std::function<void (broker*)> fun, broker_ptr broker::from_impl(std::function<void (broker*)> fun,
......
...@@ -170,7 +170,7 @@ response_handle local_actor::make_response_handle() { ...@@ -170,7 +170,7 @@ response_handle local_actor::make_response_handle() {
auto n = m_current_node; auto n = m_current_node;
response_handle result{this, n->sender, n->mid.response_id()}; response_handle result{this, n->sender, n->mid.response_id()};
n->mid.mark_as_answered(); n->mid.mark_as_answered();
return std::move(result); return result;
} }
void local_actor::exec_behavior_stack() { void local_actor::exec_behavior_stack() {
......
...@@ -207,7 +207,7 @@ local_actor_ptr thread_pool_scheduler::exec(spawn_options os, scheduled_actor_pt ...@@ -207,7 +207,7 @@ local_actor_ptr thread_pool_scheduler::exec(spawn_options os, scheduled_actor_pt
exec_as_thread(is_hidden, p, [p] { exec_as_thread(is_hidden, p, [p] {
p->run_detached(); p->run_detached();
}); });
return std::move(p); return p;
} }
p->attach_to_scheduler(this, is_hidden); p->attach_to_scheduler(this, is_hidden);
if (p->has_behavior() || p->impl_type() == default_event_based_impl) { if (p->has_behavior() || p->impl_type() == default_event_based_impl) {
...@@ -216,7 +216,7 @@ local_actor_ptr thread_pool_scheduler::exec(spawn_options os, scheduled_actor_pt ...@@ -216,7 +216,7 @@ local_actor_ptr thread_pool_scheduler::exec(spawn_options os, scheduled_actor_pt
if (p->impl_type() != event_based_impl) m_queue.push_back(p.get()); if (p->impl_type() != event_based_impl) m_queue.push_back(p.get());
} }
else p->on_exit(); else p->on_exit();
return std::move(p); return p;
} }
local_actor_ptr thread_pool_scheduler::exec(spawn_options os, local_actor_ptr thread_pool_scheduler::exec(spawn_options os,
...@@ -274,7 +274,7 @@ local_actor_ptr thread_pool_scheduler::exec(spawn_options os, ...@@ -274,7 +274,7 @@ local_actor_ptr thread_pool_scheduler::exec(spawn_options os,
exec(os, p); exec(os, p);
} }
CPPA_REQUIRE(result != nullptr); CPPA_REQUIRE(result != nullptr);
return std::move(result); return result;
} }
} } // namespace cppa::detail } } // namespace cppa::detail
...@@ -785,7 +785,7 @@ class utim_impl : public uniform_type_info_map { ...@@ -785,7 +785,7 @@ class utim_impl : public uniform_type_info_map {
res.reserve(m_builtin_types.size() + m_user_types.size()); res.reserve(m_builtin_types.size() + m_user_types.size());
res.insert(res.end(), m_builtin_types.begin(), m_builtin_types.end()); res.insert(res.end(), m_builtin_types.begin(), m_builtin_types.end());
res.insert(res.end(), m_user_types.begin(), m_user_types.end()); res.insert(res.end(), m_user_types.begin(), m_user_types.end());
return std::move(res); return res;
} }
pointer insert(std::unique_ptr<uniform_type_info> uti) { pointer insert(std::unique_ptr<uniform_type_info> uti) {
......
...@@ -19,7 +19,7 @@ void cppa_inc_error_count() { ...@@ -19,7 +19,7 @@ void cppa_inc_error_count() {
string cppa_fill4(int value) { string cppa_fill4(int value) {
string result = to_string(value); string result = to_string(value);
while (result.size() < 4) result.insert(result.begin(), '0'); while (result.size() < 4) result.insert(result.begin(), '0');
return move(result); return result;
} }
const char* cppa_strip_path(const char* fname) { const char* cppa_strip_path(const char* fname) {
......
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