Skip to content

Commit abb2a46

Browse files
author
埃博拉酱
committed
修复Map和Set类容器的某些erase方法在SAM架构未完全定义的问题
1 parent bc2ae5b commit abb2a46

File tree

5 files changed

+33
-14
lines changed

5 files changed

+33
-14
lines changed

examples/UnitTests/Contains.cpp

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

examples/UnitTests/MapSet.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
#include <map>
3+
#include <set>
4+
#include <unordered_map>
5+
#include <unordered_set>
6+
7+
#include <functional>
8+
//move_only_function的指针比较特殊,容易出错
9+
10+
void MapSet()
11+
{
12+
std::map<std::move_only_function<void()const>*,char>M;
13+
M.contains(0);
14+
M.erase(0);
15+
std::set<std::move_only_function<void()const>*>S;
16+
S.contains(0);
17+
S.erase(0);
18+
std::unordered_map<std::move_only_function<void()const>*,char>UM;
19+
UM.contains(0);
20+
UM.erase(0);
21+
std::unordered_set<std::move_only_function<void()const>*>US;
22+
US.contains(0);
23+
US.erase(0);
24+
}

examples/UnitTests/Span.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

22
#include <span>
3-
void SpanTest(char C) {
3+
void Span(char C) {
44
std::span<char>{&C, 1};
55
}

examples/UnitTests/UnitTests.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ void setup() {
6464
std::vector<TestStruct> TestVector;
6565
TestVector.emplace_back(1, 1);
6666
}
67+
void Functional();
68+
extern std::unique_ptr<char[]> UPI;
69+
void Span(char C);
70+
void MapSet();
6771
void loop() {
6872
FF();
73+
Functional();
74+
Span(UPI[0]);
75+
MapSet();
6976
}

src/c++98/tree.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef ARDUINO_ARCH_AVR
1+
#ifndef ARDUINO_ARCH_ESP32
22
// RB tree utilities implementation -*- C++ -*-
33

44
// Copyright (C) 2003-2024 Free Software Foundation, Inc.

0 commit comments

Comments
 (0)