mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-12 23:09:45 +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...>;
|
using PackType = BoundMethodPack<R, Args...>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<std::size_t... I, typename T = R>
|
template<std::size_t... I>
|
||||||
std::enable_if_t<!std::is_void<T>::value, void>
|
void invokePack(BoundMethodPackBase *pack, std::index_sequence<I...>)
|
||||||
invokePack(BoundMethodPackBase *pack, std::index_sequence<I...>)
|
|
||||||
{
|
{
|
||||||
PackType *args = static_cast<PackType *>(pack);
|
[[maybe_unused]] auto *args = static_cast<PackType *>(pack);
|
||||||
args->ret_ = invoke(std::get<I>(args->args_)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<std::size_t... I, typename T = R>
|
if constexpr (!std::is_void_v<R>)
|
||||||
std::enable_if_t<std::is_void<T>::value, void>
|
args->ret_ = invoke(std::get<I>(args->args_)...);
|
||||||
invokePack(BoundMethodPackBase *pack, std::index_sequence<I...>)
|
else
|
||||||
{
|
invoke(std::get<I>(args->args_)...);
|
||||||
/* args is effectively unused when the sequence I is empty. */
|
|
||||||
PackType *args [[gnu::unused]] = static_cast<PackType *>(pack);
|
|
||||||
invoke(std::get<I>(args->args_)...);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue