Re: CArray
David Webber wrote:
"Giovanni Dicanio" <giovanni.dicanio@invalid.it> wrote in message
news:efai7qvHIHA.5208@TK2MSFTNGP04.phx.gbl...
Dave: you correctly answered OP's question, which asked about CArray.
What I don't like about CArray, is the fact that I need to write copy
ctor and operator=.
I write a copy constructor and an = operator for just about every class
I write as a matter of course. Even if not strictly needed. OK I
confess I'm a control freak :-)
I hate when I have to! :)
class CMyArray1 :: std::vector< CString >
{
}
I use to do this, still have an instance. But if it comes down to
wrapping a container:
class MyClass
(
//usually from a typedef
std::container< MyObj > obj
....
public:
(all the container interface below)
};
And the interface will look a lot like MFC with caps:
At(), Get(), Size(), and: Begin(), End()//which returns an iterator,
typically constant!
The idea is that the container is contained, it can't be misused and it
can be checked anyway I could think I would miss use it in debug build.
Just as if I would write for other users. Even in release it will return
'UNKNOWN' in some instances. So much cooler than a crash. It is not that
big a deal and it has made my debugging/release life so much easier.
Best, Dan.