From 99a03b21ce01c7f8414dfcdce189be74fd2495be Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 17 May 2020 23:35:25 +0000 Subject: [PATCH] Simplify serial:process_buffer self-selection filter Use std::enable_if, so that the second argument becomes part of the parameter pack instead of requiring explicit handling. --- common/include/serial.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/include/serial.h b/common/include/serial.h index c9f0b1ef1..771d39697 100644 --- a/common/include/serial.h +++ b/common/include/serial.h @@ -743,12 +743,12 @@ static void process_buffer(Accessor &&accessor, const message &m) } /* Require at least two arguments to prevent self-selection */ -template -static void process_buffer(Accessor &&accessor, A1 &&a1, A2 &&a2, An &&... an) +template +static typename std::enable_if<(sizeof...(An) > 0)>::type process_buffer(Accessor &&accessor, A1 &&a1, An &&... an) { detail::sequence({ (process_buffer(accessor, std::forward(a1)), - process_buffer(accessor, std::forward(a2)), static_cast(0)), + static_cast(0)), (process_buffer(accessor, std::forward(an)), static_cast(0))... }); }