Can I use MFC objects in STL containers?
Posted
by Jesse Stimpson
on Stack Overflow
See other posts from Stack Overflow
or by Jesse Stimpson
Published on 2010-05-05T22:20:03Z
Indexed on
2010/05/05
22:28 UTC
Read the original article
Hit count: 158
The following code doesn't compile for me in MSVC2005:
std::vector<CMenu> vec(10);
CMenu
is an MFC menu object (such as a context menu). Through some testing I learned that CMenu
does not have a public copy constructor.
To do what I wanted to do, I needed to use a dynamic array.
CMenu* menus = new CMenu[10];
// ...
delete [] menus;
Of course, now I've lost all the benefits of using an STL container.
Do I have any other options?
© Stack Overflow or respective owner