Using STL in a forms application

  • Thread starter Thread starter Bob Beauchaine
  • Start date Start date
B

Bob Beauchaine

I found out the hard way that I can't include an STL container in a
form object, and spent a half day trying to locate authoritative
documentation on exactly why. So far I've concluded from indirect
evidence (no thanks to the online help) that what I want to do cannot
be done. I have experimented with using pointers to STL containers as
members of managed classes, and on the surface this seems to work.

So what are people with more .NET experience than me doing to solve
this? I will trash my compiler long before I set aside one of the
single largest productivity gains in the C++ language ever to be
invented, and continue to curse Mircosoft for its inability to provide
an improve user interface rendering tool for standard C++ users, and
my employer for foisting it upon me, but at the end of the day I still
have to get my job done.

So what is the best way to create forms applications for the user
interface that continue to use the STL to accomplish the Real Work?
 
There are .NET versions of most of the stuff in the STL; otherwise, use
pointers or wrappers to stuff. I've tended to package as much of our
unmanaged code into unmanaged classes and keep pointers to those in the
managed ones, and it works fine. If you're putting UI components into STL
containers you probably want to look at the .NET containers, since you'll
avoid going backwards and forwards between managed/unmanaged components.
Otherwise, if you're just using .NET for the UI and are happy with using
Win32 / MFC, why change?

Steve
 
Back
Top