N
Noah Roberts
Axter said:The purpose of the dynamic_2d_array, is to give a dynamic version of a
static size C-style array.
It's no more or no less safer then using a static C-Style array, and
therefore, no more horrid then using a static size C-Style array.
Actually it is. As you said, it offers nothing over using a C array
and therefor is pointless extra code that serves no purpose.
If you need something that requires bounds checking, then you should
not use it.
The class is not intended for that purpose.
It should at least provide access to the bounds it is tracking so
clients don't have to wrap it in a class that does.
These are example skeleton classes. They don't have to be complete.
They don't even qualify as "example skeleton classes" and that is at
least not how the first is being advertized.
They just need enough to get the point across as to how to get a [][]
interface.
In a piss poor and dangerous manner.
I heard this from most programmers, who don't have the experience in
actually testing this theory out.
I've conducted test, shows your above comment to be false.
Interesting, then why do you yourself make it?
Besides, if your tests are anything like your example code then they
are completely meaningless. If they test your example code they are
equally so.
The implementations I posted as examples, are reasonable for their
purpose.
I pointed out several reasons they are not...you haven't answered those
reasons.
And again, they're no more dangerous then using static size C-Style
arrays.
Correct. They are also no less so. In fact the first one provides
absolutely no benefits over a simple array whatsoever. The second
provides no benefits over vector<vector<>> and in fact removes access
to important information that would be available by just using
vector said:It's incorrect to believe that all code requires bounds checking.
And I never said it was.
That's why the C++ standard doesn't require that STL have bounds
checking.
If' it's good for the standard, then it's good for a skeleton example
implementation.
Every single container class in the standard library has a size()
member function and in fact at least one of the containers does provide
bounds checking. Another initializes new contents on access to a non
existant index... All STL container classes also provide several
protective abstractions surrounding the internal implementation
including iterators and reference proxies. Yes, if you know what a
particular implementation looks like you can get past those as they are
only typedefs but still, it is an abstraction that can be used in a
safe and consistant manner. Your classes don't do any of these
things...your classes are sluts.
Yes, these classes are a far cry short of the STL.
Following an FAQ blindly, is a mistake.
This C++ FAQ is created by one person, and he is no more or no less
prone to mistakes then any other experience programmer.
Yes, following the FAQ blindly is a mistake. I've seen several
examples of implementing [][] that are not the newbie hackery that
yours is. I prefer to listen until I find a compelling reason not
to...your reasoning and your examples are far from compelling and in
fact are compelling arguments for the FAQ as your forcing of [][] on
this concept has led you to create monsters.
IMHO, this FAQ is wrong, and I posted alternative skeleton examples
that can be used as a template for user's custom matrix class.
Well, I've given several reasons why they don't qualify for that. They
need major revisions.
IMHO, your nonconstructive comments do a disservice to the C++
community and to this newsgroup.
You may see them as noncunstructive if you want. I am not surprised as
you continue to pass these off as "expert guidance" and so wouldn't
want to hear that they actually exemplify several horrendous beginner
mistakes but whatever.