mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-12 14:59:44 +03:00
libcamera: base: bound_method: Simplify invokePack()
Use `if constexpr` instead of SFINAE to handle return values of type `void`. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
7dd548f678
commit
5646307b71
1 changed files with 7 additions and 13 deletions
|
@ -98,21 +98,15 @@ public:
|
|||
using PackType = BoundMethodPack<R, Args...>;
|
||||
|
||||
private:
|
||||
template<std::size_t... I, typename T = R>
|
||||
std::enable_if_t<!std::is_void<T>::value, void>
|
||||
invokePack(BoundMethodPackBase *pack, std::index_sequence<I...>)
|
||||
template<std::size_t... I>
|
||||
void invokePack(BoundMethodPackBase *pack, std::index_sequence<I...>)
|
||||
{
|
||||
PackType *args = static_cast<PackType *>(pack);
|
||||
args->ret_ = invoke(std::get<I>(args->args_)...);
|
||||
}
|
||||
[[maybe_unused]] auto *args = static_cast<PackType *>(pack);
|
||||
|
||||
template<std::size_t... I, typename T = R>
|
||||
std::enable_if_t<std::is_void<T>::value, void>
|
||||
invokePack(BoundMethodPackBase *pack, std::index_sequence<I...>)
|
||||
{
|
||||
/* args is effectively unused when the sequence I is empty. */
|
||||
PackType *args [[gnu::unused]] = static_cast<PackType *>(pack);
|
||||
invoke(std::get<I>(args->args_)...);
|
||||
if constexpr (!std::is_void_v<R>)
|
||||
args->ret_ = invoke(std::get<I>(args->args_)...);
|
||||
else
|
||||
invoke(std::get<I>(args->args_)...);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue