mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-27 07:44:16 +08:00
Count parameter pack's elements via sizeof...(Ts)
This change removes redundant template functions, which duplicated the functionality of sizeof...() operator. Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
05f351484c
commit
3778a371fd
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -9,16 +9,6 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
template <typename Arg1>
|
||||
size_t countArgs(const Arg1 &arg1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
template <typename Arg1, typename... Rest>
|
||||
size_t countArgs(const Arg1 &arg1, const Rest &...rest) {
|
||||
return 1 + countArgs(rest...);
|
||||
}
|
||||
|
||||
template <typename NodeObjectType, typename... Args>
|
||||
int verifySequence(const NodeObjectType *base, int nodeNum, const NodeObjectType *last) {
|
||||
if (base == last) {
|
||||
@@ -58,7 +48,7 @@ int verifyFListOrder(const NodeObjectType *base, const NodeObjectType *first, co
|
||||
if (sequenceRet < 0) {
|
||||
return sequenceRet;
|
||||
}
|
||||
int totalReferenceNodes = (int)countArgs(first, rest...);
|
||||
int totalReferenceNodes = static_cast<int>(1 + sizeof...(rest));
|
||||
if (sequenceRet >= totalReferenceNodes) {
|
||||
// base defines longer sequence than expected
|
||||
return totalReferenceNodes - 1;
|
||||
|
||||
Reference in New Issue
Block a user