mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
Fix: inline ESPHOME_DEBUG_ASSERT to avoid include order issue
This commit is contained in:
@@ -501,7 +501,9 @@ template<typename T, size_t MAX_CAPACITY = std::numeric_limits<uint16_t>::max()>
|
||||
/// falls back to element-wise copy for non-trivially copyable types (e.g. TemplatableValue).
|
||||
/// N is set by code generation; ESPHOME_DEBUG_ASSERT catches mismatches in debug/integration tests.
|
||||
template<typename T, size_t N> inline void init_array_from(std::array<T, N> &dest, std::initializer_list<T> src) {
|
||||
ESPHOME_DEBUG_ASSERT(src.size() == N);
|
||||
#ifdef ESPHOME_DEBUG
|
||||
assert(src.size() == N);
|
||||
#endif
|
||||
if constexpr (std::is_trivially_copyable_v<T>) {
|
||||
__builtin_memcpy(dest.data(), src.begin(), N * sizeof(T));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user