diff options
author | Marcus Müller <mmueller@gnuradio.org> | 2019-08-17 17:41:00 +0200 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2019-08-22 15:05:58 +0200 |
commit | c6cb3bbc35153a9635d69eddab0d252f7441b854 (patch) | |
tree | f9ab04c336fa6f228ce0c7b90c3722955a1aa53f /gr-blocks/lib/nop_impl.cc | |
parent | bcf35e64b5662f716e0de59e95fdd9ffb02238a7 (diff) |
Use emplace_back(params) instead of push_back(type(params))
This is C++11: you can convert
std::vector<complextype> vec;
vec.push_back(complextype(foo, bar, baz));
by
std::vector<complextype> vec;
vec.emplace_back(foo, bar, baz);
which saves one unnecessary copy.
This mostly happened in rpc code.
The automated clang-tidy check failed miserably, so most of this was
done by hand.
Diffstat (limited to 'gr-blocks/lib/nop_impl.cc')
-rw-r--r-- | gr-blocks/lib/nop_impl.cc | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/gr-blocks/lib/nop_impl.cc b/gr-blocks/lib/nop_impl.cc index f079886e03..db216d97a4 100644 --- a/gr-blocks/lib/nop_impl.cc +++ b/gr-blocks/lib/nop_impl.cc @@ -69,19 +69,18 @@ int nop_impl::general_work(int noutput_items, void nop_impl::setup_rpc() { #ifdef GR_CTRLPORT - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<nop, int>(alias(), - "test", - &nop::ctrlport_test, - pmt::mp(-256), - pmt::mp(255), - pmt::mp(0), - "", - "Simple testing variable", - RPC_PRIVLVL_MIN, - DISPNULL))); + d_rpc_vars.emplace_back(new rpcbasic_register_get<nop, int>(alias(), + "test", + &nop::ctrlport_test, + pmt::mp(-256), + pmt::mp(255), + pmt::mp(0), + "", + "Simple testing variable", + RPC_PRIVLVL_MIN, + DISPNULL)); - d_rpc_vars.push_back( + d_rpc_vars.emplace_back( rpcbasic_sptr(new rpcbasic_register_set<nop, int>(alias(), "test", &nop::set_ctrlport_test, |