在 VBA 中模仿 std::map<string、std::list<string> >
Mimic std::map<string, std::list<string> > in VBA
我试图在 VBA 中模仿std::map<string, std::list<string> >
(这种情况非常具体,但实际上是 n 个类似 std::map<>
的容器中的任何集合)
我发现相当于std::map
将是一个Dictionary
,但是最后一部分呢?
不知何故,我在互联网上发现的最多的是可以将这样的数组元素添加到Dictionary
中,尽管没有任何关于在完成此操作后如何添加元素的见解:
Dim my_dictionary as Dictionary
Set my_dictionary = New Dictionary
my_dictionary.Add "KEY#1", Array("A", "B", "C")
'How would I add "D" here ?!
Sub Tester()
Dim d As Scripting.Dictionary
Dim arr, ub
Set d = New Scripting.Dictionary
d.Add "key1", Array("A", "B", "C")
Debug.Print Join(d("key1"))
arr = d("key1")
ub = UBound(arr) + 1
ReDim Preserve arr(0 To ub)
arr(ub) = "D"
d("key1") = arr
Debug.Print Join(d("key1"))
End Sub
相关文章:
- cppcheck在const std::string[]上引发警告
- 将std::string传递给WriteConsole API
- 为std::string的某个索引赋值
- 使用 std::string () const 函数启动线程或未来
- 当我们进行一些操作时,应该使用什么'std::string'或'std::stringstream'?
- 如何更改大小(std::string)
- std::string 的对象真的可以移动吗?
- SegFault 同时使用 std::string::operator+= 和函数作为参数
- 无法从 std::string 中提取C++ Unicode 符号
- std::string 构造函数如何处理固定大小的 char[]?
- 真的没有来自 std::string_view 的 std::string 的显式构造函数吗?
- 将C++ std::string 转换为 UTF-16-LE 编码的字符串
- 重载 + 自己的类和 std::string 的运算符
- 如何使用 std::string 作为 QHash 的键?
- 将日语 wstring 转换为 std::string
- 可以从std::string继承以提供类型一致性吗
- 构造函数采用std::string_view与std::string并移动
- 在共享缓冲区内存中创建 ::std::string 对象
- std::string.size() 未知行为
- Valgrind 在 std::string::swap 中报告 SIGILL