From 88df48a52dfbe39f2bef2ca0014633588808a990 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 12 Feb 2026 12:42:09 -0600 Subject: [PATCH] Add TODO for std::trivially_relocatable when available --- esphome/components/wifi/wifi_component.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/esphome/components/wifi/wifi_component.cpp b/esphome/components/wifi/wifi_component.cpp index 52188b2621..1f02a1d870 100644 --- a/esphome/components/wifi/wifi_component.cpp +++ b/esphome/components/wifi/wifi_component.cpp @@ -1336,6 +1336,9 @@ void WiFiComponent::start_scanning() { // on some implementations). This was not possible before PR#13472 replaced // std::string with CompactString, since std::string's internal layout is // implementation-defined and may use self-referential pointers. +// +// TODO: If C++ standardizes std::trivially_relocatable, add the assertion for +// WiFiScanResult/CompactString here to formally express the memcpy safety guarantee. template static void insertion_sort_scan_results(VectorType &results) { // memcpy-based sort requires no self-referential pointers or virtual dispatch. // These static_asserts guard the assumptions. If any fire, the memcpy sort