Little code size tweak using std::move in constructors.

This commit is contained in:
Jared Boone 2016-02-03 22:47:22 -08:00
parent cff314cbc8
commit af8c9609a8
2 changed files with 9 additions and 7 deletions

View File

@ -116,19 +116,21 @@ private:
template<typename ErrorFilter>
class ClockRecovery {
public:
using SymbolHandler = std::function<void(const float)>;
ClockRecovery(
const float sampling_rate,
const float symbol_rate,
ErrorFilter error_filter,
std::function<void(const float)> symbol_handler
) : symbol_handler { symbol_handler }
SymbolHandler symbol_handler
) : symbol_handler { std::move(symbol_handler) }
{
configure(sampling_rate, symbol_rate, error_filter);
}
ClockRecovery(
std::function<void(const float)> symbol_handler
) : symbol_handler { symbol_handler }
SymbolHandler symbol_handler
) : symbol_handler { std::move(symbol_handler) }
{
}
@ -155,7 +157,7 @@ private:
dsp::interpolation::LinearResampler resampler;
GardnerTimingErrorDetector timing_error_detector;
ErrorFilter error_filter;
std::function<void(const float)> symbol_handler;
const SymbolHandler symbol_handler;
void resampler_callback(const float interpolated_sample) {
timing_error_detector(interpolated_sample,

View File

@ -53,8 +53,8 @@ public:
const PreambleMatcher preamble_matcher,
const UnstuffMatcher unstuff_matcher,
const EndMatcher end_matcher,
const PayloadHandlerFunc payload_handler
) : payload_handler { payload_handler },
PayloadHandlerFunc payload_handler
) : payload_handler { std::move(payload_handler) },
preamble(preamble_matcher),
unstuff(unstuff_matcher),
end(end_matcher)