Re: Is CArray best for this...



"Norbert Unterberg" <nunterberg@xxxxxxxxxxxxxxxxx> wrote in message
news:e36cXXUWIHA.4712@xxxxxxxxxxxxxxxxxxxxxxx

I often have cases where the size of the array is not known when you start
puting elements into it. Examples could be: parsing XML with a streaming
parser and adding some found elements in an array, storing the lines of a
text file, stroing the results of a database query (getting the size of a
query result can be an expensive operation) etc.


Fair enough. Setting the initial size to be as large as what can be
reasonably expected is what I do.


I disagree here. I do not see how in any way a std::vector can be
"foreign" to windows. The only MFC like thing about CArray/CList I see is
the naming convention. I can not remember any Windows/MFC API that expects
or returns CArray or CList.
On the contray, I think that CArray is more "foreign" as std::vector since
std::vector is part of the C++ standard and CArray is not. What do you
think is missing from std::vector to make it attractive to windows
developers?


Nothing is missing, but what is there appeals to computer scientists and not
necessarily to the domain-specific sensibilities of Windows app developers.
Iterators have strange syntax, some STL construct (forget which one) needs
to reference ".first" and ".second" is totally bizarre, etc. This is
completely acceptable, and even desireable, for computer scientists, but not
for app writers who are not interested in becoming experts in collections
per se, only in that they allow them to write their apps.


See, use std::vector and you do not need any work around.
The std containers and iterators look strange when you start using them,
but their concept is much better thought out than the MFC collections.

I thought the same when I first saw the std library, but I changed my mind
the better technology got me.


The thing of it is: these library writers have nothing else to do except
make a good performing, usable class. Is it asking too much for them to
make it sensible out of the box? Struggling to use it should not be the
required price to make one "change his mind." .NET provides collections
that make sense without necessarily becoming an expert in order to use them
and persuade one of their inherent superiority. So it's possible, but for
whatever reason, it is not a goal of STL, Boost, or from what I gather, any
of the other C++ constructs being worked on right now. It can be perceived
as arrogance on their part, and more and more that's what I'm seeing it as.

-- David


.



Relevant Pages

  • Re: A windows service question
    ... You'll also have to make sure it runs under the proper Windows ... I have developed a VB.net app in a module that queries a database, ... time data stored in the array with the current system time. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Windows.. its like coming home!
    ... gradual transition, especially in going from OS 9 to OS X. ... They needed something that could compete with Windows, ... mean by the "2 of every app" comment before - Apple took whatever apps ... I've found that because the Dock shows applications rather than windows, ...
    (comp.sys.mac.advocacy)
  • Re: Windows.. its like coming home!
    ... gradual transition, especially in going from OS 9 to OS X. ... They needed something that could compete with Windows, ... mean by the "2 of every app" comment before - Apple took whatever apps ... I've found that because the Dock shows applications rather than windows, ...
    (comp.sys.mac.advocacy)
  • Re: Frustration level with Windows -- ARG!
    ... I can have an app sieze and you can go take a ten ... That is MS-Outlook, not Windows. ... to the processes tab, not the applications tab. ... and it tries to stop them "gently" if it can, before resorting to kill -9. ...
    (comp.sys.mac.advocacy)
  • RE: Beginners Questions
    ... We do use Windows form on the presentation layer which is on ... terminal server and call web services on the business logic side. ... of using "proxy" authentication on SQL Server. ... > I have written an app with a Windows Forms UI that is deployed to clients ...
    (microsoft.public.dotnet.distributed_apps)