Skip to content

Commit 9937b34

Browse files
committed
const -> constexpr in Struct
1 parent 61b7f6f commit 9937b34

File tree

1 file changed

+2
-2
lines changed
  • wpiutil/src/main/native/include/wpi/struct

1 file changed

+2
-2
lines changed

wpiutil/src/main/native/include/wpi/struct/Struct.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ inline T UnpackStruct(std::span<const uint8_t> data) {
147147
*/
148148
template <StructSerializable T, size_t Offset, size_t N>
149149
inline wpi::array<T, N> UnpackStructArray(std::span<const uint8_t> data) {
150-
const auto StructSize = Struct<std::remove_cvref_t<T>>::kSize;
150+
constexpr auto StructSize = Struct<std::remove_cvref_t<T>>::kSize;
151151
wpi::array<T, N> arr(wpi::empty_array);
152152
[&]<size_t... Is>(std::index_sequence<Is...>) {
153153
((arr[Is] = UnpackStruct<T, Offset + Is * StructSize>(data)), ...);
@@ -197,7 +197,7 @@ inline void PackStruct(std::span<uint8_t> data, T&& value) {
197197
template <size_t Offset, size_t N, StructSerializable T>
198198
inline void PackStructArray(std::span<uint8_t> data,
199199
const wpi::array<T, N>& arr) {
200-
const auto StructSize = Struct<std::remove_cvref_t<T>>::kSize;
200+
constexpr auto StructSize = Struct<std::remove_cvref_t<T>>::kSize;
201201
[&]<size_t... Is>(std::index_sequence<Is...>) {
202202
(PackStruct<Offset + Is * StructSize>(data, arr[Is]), ...);
203203
}(std::make_index_sequence<N>{});

0 commit comments

Comments
 (0)