Skip to content

Commit de010c4

Browse files
committed
Delete orphan utility header file
The utility function `ArraySize` is used only in the header jni_bridge.h, no need to be put in a separated header file.
1 parent b3050ce commit de010c4

2 files changed

Lines changed: 17 additions & 34 deletions

File tree

native/include/common/utils.h

Lines changed: 0 additions & 33 deletions
This file was deleted.

native/include/jni/jni_bridge.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <string>
44

55
#include "common/logging.h"
6-
#include "common/utils.h"
76
#include "core/config_bridge.h"
87
#include "core/context.h"
98

@@ -15,6 +14,23 @@
1514

1615
namespace vector::native::jni {
1716

17+
/**
18+
* @brief Returns the number of elements in a statically-allocated C-style array.
19+
*
20+
* This is a compile-time constant.
21+
* Attempting to use this on a pointer will result in a compilation error,
22+
* preventing common mistakes.
23+
*
24+
* @tparam T The type of the array elements.
25+
* @tparam N The size of the array.
26+
* @param arr A reference to the array.
27+
* @return The number of elements in the array.
28+
*/
29+
template <typename T, size_t N>
30+
[[nodiscard]] constexpr inline size_t ArraySize(T (&)[N]) {
31+
return N;
32+
}
33+
1834
/**
1935
* @brief A helper function to get the obfuscated native bridge class signature prefix.
2036
*

0 commit comments

Comments
 (0)