在 ATL 中使用 STL
我需要在 ATL COM 服务器内使用树结构。 我想到使用 stl::map<>为此目的如下。
BaseMap[k1,NextLevelMap[k2, NextLevelMap[k3, Value]]]
但我需要知道,在ATL内部使用这样的结构是否安全 以及使用地图进行调试支持的可能性。
谢谢
I need to use tree structure inside a ATL COM server.
I thought of using stl::map<> for this purpose as follows.
BaseMap[k1,NextLevelMap[k2, NextLevelMap[k3, Value]]]
But I need to know, whether using such a structure inside ATL is safe
and possibility of debugging support with maps.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
C++ 标准库类可以安全地与 ATL 一起使用 - ATL 甚至包括几个专门设计用于与遵循标准库约定的容器交互的类:
ICollectionOnSTLImpl
和CComEnumOnSTL
。调试也很好 - Visual Studio 调试器隐藏了标准容器的实现,而是显示了它们所包含内容的逻辑视图。
C++ standard library classes are safe to use with ATL - ATL even includes a couple of classes specifically designed to interface with containers following standard library conventions:
ICollectionOnSTLImpl
andCComEnumOnSTL
.Debugging is also fine - the Visual Studio debugger hides the implementation of the standard containers and instead shows a logical view of what they contain.
STL类就是普通的类,没有什么特别的。如果您处理多线程问题(称为“公寓”的东西),则可以在 COM 服务器中使用它们,因为 STL 类本身不是线程安全的。
您可以像调试所有其他类一样调试 STL 类,前提是您正确编译了项目 - 并启用了调试信息。
STL classes are ordinary classes, nothing special. You can use them in COM servers provided you take care of multithreading issues - the stuff called "apartments", since STL classes are not thread-safe by themselves.
You can debug STL classes just like all other classes provided you compile the project appropriately - with debug information enabled.