mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +00:00
[wpiutil] Change StringExtras split() to template (#7636)
It now calls back a function for each part rather than creating a SmallVector.
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
#include <string>
|
||||
|
||||
#include <wpi/SmallString.h>
|
||||
#include <wpi/SmallVector.h>
|
||||
#include <wpi/StringExtras.h>
|
||||
#include <wpi/print.h>
|
||||
#include <wpinet/uv/util.h>
|
||||
@@ -73,15 +72,8 @@ bool HALSimWS::Initialize() {
|
||||
const char* msgFilters = std::getenv("HALSIMWS_FILTERS");
|
||||
if (msgFilters != nullptr) {
|
||||
m_useMsgFiltering = true;
|
||||
|
||||
std::string_view filters(msgFilters);
|
||||
filters = wpi::trim(filters);
|
||||
wpi::SmallVector<std::string_view, 16> filtersSplit;
|
||||
|
||||
wpi::split(filters, filtersSplit, ',', -1, false);
|
||||
for (auto val : filtersSplit) {
|
||||
m_msgFilters[wpi::trim(val)] = true;
|
||||
}
|
||||
wpi::split(wpi::trim(msgFilters), ',', -1, false,
|
||||
[&](auto val) { m_msgFilters[wpi::trim(val)] = true; });
|
||||
} else {
|
||||
m_useMsgFiltering = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user