Can I use MFC objects in STL containers?
- by Jesse Stimpson
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?