Re: Variables in for loop (style issue)
Anders J. Munch wrote:
> Thorsten Ottosen wrote:
>> Anders J. Munch wrote:
>>> There is no class definition for Vec3, which is really the key class
>>> here, so leaving it to the reader's imagination is not good enough.
>> Well, you can assume more than one thing about it. It originally was a
>> 3-dimensional vector, so a pack of 3 floats. But, and this is important,
>> it could just as well be a vector<T>.
>>> How is Photon created, there are no constructors? And
>>> finally, Photon does not have a single non-const operation?!
>> That is not relevant: if this fraction of the interface cannot be
>> emulated without const, then neither can the whole interface.
> You are leaving all your options open. Effectively you are asking to me
> to redesign, not just one single specific design with specific strengths
> and weaknesses, but every possible design that includes a class named
> Vec3 that stores three numbers and a class named Photon that stores a
I'm not asking you to redesign anything.
> How can I possibly do that? There are countless ways of
> designing such a pair of classes, depending on what your requirements
It's a pretty clear requirement: you have to return a Vec3 (either by
referrence or by value), and you have to preserve both encapsulation and
> Since you're the one trying to prove something by example, it is up to
> you to provide the example.
Come on. I've posted the analysis (twice) of why you can match either
efficiency or encapsulation, but not both. You constantly move away from
the real issue.
It's up to you to provide the counter argument that shows my analysis
could be wrong. If you can.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]