|
That's due to poor developer skills, not because lists are superior.
|
|
|
|
|
There is that too but is not always the case. Some Microsoft technologies/concepts are giving you no choice. EF and MVC come to mind.
There is only one Vera Farmiga and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|
|
Which just adds strength to my statement.
|
|
|
|
|
vector for C++ just isn't the right choice, and indicates you are using C++ like C. virtual and template are both far better choices. Depending upon how you use the language, both of them can be supported with valid arguments, so I don't think either of them can be realistically picked over the other.
If you don't understand virtual , see the C++ tutorial in my sig. If you don't understand template , just see any of honey the codewitch's work. C++ becomes magic.
|
|
|
|
|
I wouldn't associate C++ with "virtual". Sure, it's a big part of the language concept, but not defines it. "Virtual" better fits with Java where everything is "virtual" by default. As for the templates, even C++ doesn't fully understand templates - at least until runtime. If you don't understand what I mean, think of separate template implementation and declaration. I know it's doable, but it doesn't feel natural.
There is only one Vera Farmiga and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|
|
So the word you are looking for is class . Not vector .
|
|
|
|
|
Again, not verry C++ specific. Same for structures.
There is only one Vera Farmiga and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|
|
|
Collections are also structures. You need to spend a little more time learning the basics.
There is only one Vera Farmiga and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|
|
So you are one of those annoying contrarians. Gotcha!
As an FYI, the definition of vector in my installation of VS2019 doesn't contain a single struct in the top-level definitions. No, a vector isn't a struct by C++'s definitions. It would be better described as an array of items. Or, to use your own word, a vector is a container.
|
|
|
|
|
hint: Data structures are not the same thing as the C-style structs.
There is only one Vera Farmiga and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|
|
You really want to be taken as an arrogant a**hole, evidently. Sorry to hear that. I will start tuning you out.
Best wishes,
David
|
|
|
|
|
My favorite .NET data structure is Dictionary<T> hands down. I always found the C++ equivalents (STL's map and MFC's CMap ) somewhat klunkier, mostly because of the template usage and resultant inscrutable compiler diagnostics.
Software Zen: delete this;
|
|
|
|
|
Yes, Dictionary is verry powerful when you search by key as it gives you O (log N) search, no duplications, ets. But if we go this path then DataTable is even more interesting. I also don't like how you can shoot yourself in the leg with the STL map. One assignment with missing reference operator and you are working with old data/copy.
There is only one Vera Farmiga and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|
|
STL map is pretty ok, but you need to know how to use it....
|
|
|
|
|
Yes. C++ demands more abstract thinking.
There is only one Vera Farmiga and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|
|
enum s are also way better in .net languages.
|
|
|
|
|
Sorry, the only language I know, which treats enum as enum is Modula2.
All languages who allow to assign an enum item a individual value don't treat enum as enum and it should be forbidden that these languages missuse the a type called enum.
|
|
|
|
|
Unsure what you are saying. Do you mean the ability to assign a value which isn't defined by the enum ? I can agree with not liking that.
|
|
|
|
|
My view, only: enumeration should be only enumeration. Means nobody should have the right to assign a specific value to any member of an enum.
enum {theFirst, theSecond} should always end theFirst= 0, theSecond= 1. Even they should not be addressed by an intgeger value. Like it is in e.g. Modula2.
And no one should be allowed to define theFirst= 1000
Sorry, I'm not native english and therefore I have problems to express me.
[Edit]
An enumeration where you can define element0= -100 or whatever and element1= 100 is not an enumeration for me
modified 4-Dec-22 18:14pm.
|
|
|
|
|
Ah, I see, but I disagree. I prefer to be able to specify the values. It's kinda important for "flags" type enumerated values.
Maybe there should be an Attribute which enables things -- yes, I know about the FlagsAttribute, but it really only affects how strings are formed or parsed, it has nothing to do with what values are defined or assigned.
public enum Option
{
None = 0
,
UTF8 = 1
,
ASCII = 2 | UTF8
,
All = ASCII
}
Maybe a "bare" enum would enforce a strict value assignment and the ability to specify the values would require the developer to activate other features.
|
|
|
|
|
I would've said Java class Object
But on the other hand I must admit that, when it comes to Java for me personally, a ten-foot-pole aint long enough
"If we don't change direction, we'll end up where we're going"
|
|
|
|
|
Javascript - "undefined".
|
|
|
|
|
Visual Basic -- nothing
Mmm, yeah, quite literally.
|
|
|
|
|
C++ for me would be template
I don't really use the STL that much due to working with tiny amounts of RAM.
To err is human. Fortune favors the monsters.
|
|
|
|