加速C ++:[1,行]不是那么快 [英] Accelerated C++: [1,rows] Not so fast

查看:53
本文介绍了加速C ++:[1,行]不是那么快的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我终于开始阅读Andrew Koenig的加速C ++和

Barbara Moo。到目前为止我读过的内容中有很多好东西。即使

虽然它是_very_ basic,但它们提出了一些概念,我没有在其他地方遇到过
,或者解释我遇到过的方式添加

我的理解。有一些风格我可以用来讨论
问题,比如不能在if或

循环的主体周围使用大括号等等。


但有一点,我也要采取例外。他们断言

...... [0,行]中元素的数量是显而易见的(即行-0或行)

但是数量为[1,行中的元素[更少]。如果您同意

这些作者,请关闭计算机,并反思您学前班和幼儿园的年份。举起你的手,看看你的手指。记得? 一个,两个,三个......? ;-)

-

如果我们的假设是关于任何事情而不是关于某一个或多个特定事物,那么我们的推论构成数学。因此,数学可能被定义为我们永远不知道我们所讨论的是什么,以及我们所说的是否属实的主题。 - Bertrand

Russell

I''ve finally gotten around to reading Accelerated C++ by Andrew Koenig and
Barbara Moo. There''s a lot of good stuff in what I''ve read so far. Even
though it is _very_ basic, they present some concepts I have not
encountered elsewhere, or explain ones I have encountered in ways that add
to my understanding. There are a few points of style with which I take
issue, such as not consistently using braces around the body of an if or
loop, etc.

There is one point, however, I have to take exception too. They assert that
"...the number of elements in [0, rows) is obvious(i.e., rows -0, or rows)
but the number of elements in [1,rows[ is less so." If you agree with
these authors, please turn off the computer and reflect for a moment on
your preschool and kindergarden years. Hold up your hand and look at your
fingers. Remember? "One", "two", "three"....? ;-)
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell

推荐答案

" Steven T. Hatton" <苏****** @ setidava.kushan.aa>在消息中写道

新闻:Xf ******************** @ speakeasy.net ...
"Steven T. Hatton" <su******@setidava.kushan.aa> wrote in message
news:Xf********************@speakeasy.net...
但有一点,我也必须采取例外。他们声称
...... [0,行]中的元素数量是显而易见的(即行-0或行)
但是[1]中的元素数量,行[不那么如此。如果您同意这些作者的意见,请关闭计算机并反思您的幼儿园和幼儿园年份。握住你的手,看看你的手指。记得? 一个,两个,三个......? ; - )
There is one point, however, I have to take exception too. They assert
that
"...the number of elements in [0, rows) is obvious(i.e., rows -0, or rows)
but the number of elements in [1,rows[ is less so." If you agree with
these authors, please turn off the computer and reflect for a moment on
your preschool and kindergarden years. Hold up your hand and look at your
fingers. Remember? "One", "two", "three"....? ;-)




确实 - 人们早早养成了坏习惯。


如果你养成了代表范围的习惯存储该系列的第一个和最后一个

元素,我们多年教学的经验是,你有更多的可能遇到麻烦而不是你形成的

的习惯通过存储第一个和第一个元素来表示范围。


此外,一旦你从整数范围毕业到迭代器范围,

你不再有选择的事情,因为如果你坚持引用最后一个元素,就没有办法给b $ b代表一个空的范围

而不是过去的一个。



Indeed -- People form bad habits early.

If you are in the habit of representing ranges by storing the first and last
element of the range, our experience from years of teaching is that you are
much more likely to run into trouble than you are if you form the habit of
representing ranges by storing the first and one past the last element.

Moreover, once you graduate from ranges of integers to ranges of iterators,
you no longer have a choice in the matter, because there is no way to
represent an empty range if you insist on referring to the last element
rather than one past the last.


Andrew Koenig写道:

Andrew Koenig wrote:

手指。记得? 一个,两个,三个......? ; - )
fingers. Remember? "One", "two", "three"....? ;-)



确实 - 人们很早就养成了坏习惯。

如果你习惯通过存储第一个来表示范围而且
该范围的最后一个要素,我们多年教学的经验是,如果你形成了通过存储第一个和第一个来表示范围的习惯,你比你更容易遇到麻烦。最后
元素。

此外,一旦你从整数范围毕业到
迭代器的范围,你就不再有选择了,因为没有
如果你坚持引用最后一个
元素而不是最后一个元素,那么表示空范围的方式。



Indeed -- People form bad habits early.

If you are in the habit of representing ranges by storing the first and
last element of the range, our experience from years of teaching is that
you are much more likely to run into trouble than you are if you form the
habit of representing ranges by storing the first and one past the last
element.

Moreover, once you graduate from ranges of integers to ranges of
iterators, you no longer have a choice in the matter, because there is no
way to represent an empty range if you insist on referring to the last
element rather than one past the last.




我不同意你在说什么。从那个角度来看,我从未想过这个问题

。我只是接受了C,因此C ++工作的方式是因为它与硬件表示更加一致。我知道

如果我在使用C ++专门使用长期的
之后开始使用Mathematica,我可能会迷失方向。 Mathematica开始索引

为1,等等。 List的第0个元素是''List''。


我真的评论从0开始计算对我们的

思考的影响。在我开始使用计算机之前,我在矢量中使用了数学矩阵多年。

。现在从1

索引的想法似乎有些陌生。我有时想知道数学是否会从计算机科学中恢复过来。

-

如果我们的假设是关于任何东西而不是关于某些一个或多个

特定的东西,然后我们的推论构成数学。因此,数学可能被定义为我们永远不知道我们所讨论的是什么,以及我们所说的是否属实的主题。 - Bertrand

Russell



I don''t disagree with what you''re saying. I''ve never thought about the issue
from that perspective. I simply accepted that C and hence C++ works that
way because it''s more consistent with the hardware representation. I know
I can get pretty disoriented if I start working with Mathematica after a
long period of exclusively working with C++. Mathematica starts indexing
at 1, sort of. The zeroth element of a List is ''List''.

I was really commenting on the impact that counting from 0 has on our
thinking. I worked with vectors an matrices for years in mathematics
before I started working with computers. Now the idea of indexing from 1
seems a bit foreign. I sometimes wonder if mathematics will every recover
from computer science.
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell


" Steven T. Hatton" <苏****** @ setidava.kushan.aa>在消息中写道

新闻:Xf ******************** @ speakeasy.net ...
"Steven T. Hatton" <su******@setidava.kushan.aa> wrote in message
news:Xf********************@speakeasy.net...
我我终于开始阅读Andrew Koenig的加速C ++和Barbara Moo。到目前为止我读过的内容中有很多好东西。即使它是_very_ basic,它们也提供了我在其他地方没有遇到的一些概念,或者解释我遇到的方式,这些都是为了我的理解。
I''ve finally gotten around to reading Accelerated C++ by Andrew Koenig and
Barbara Moo. There''s a lot of good stuff in what I''ve read so far. Even
though it is _very_ basic, they present some concepts I have not
encountered elsewhere, or explain ones I have encountered in ways that add
to my understanding.



我曾经多次发现的一个评论是,初学者很难接受,但不够基本,尽管我不喜欢我知道它的目标是什么级别的b $ b。我还没读过。这里的书店没有它。

他们更喜欢库存30秒内学习C ++,或者不管它叫什么。


DW



One comment that I''ve come across many times is that it''s hard going for
beginners, i.e., not basic enough, though I don''t know what level it''s
aimed at. I have not actually read it. The bookshops here don''t have it.
They prefer to stock "Learn C++ in 30 seconds", or whatever it''s called.

DW


这篇关于加速C ++:[1,行]不是那么快的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆