社区
C++ 语言
帖子详情
《C++ templates》的Expression Templates一问
boodweb
2006-02-04 11:19:10
18.2中说Scalar必须用值传递,我怎么也搞不懂原因
有没有看明白的解释一下?
谢谢!
...全文
172
8
打赏
收藏
《C++ templates》的Expression Templates一问
18.2中说Scalar必须用值传递,我怎么也搞不懂原因 有没有看明白的解释一下? 谢谢!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
8 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
healer_kx
2006-02-07
打赏
举报
回复
其实只要能够生成计算表达式就可以了。关键在于那个double类型的萃取,是不是引用都是无所谓的。
healer_kx
2006-02-07
打赏
举报
回复
Sorry,我才看到你说得那个问题了。。。看来我真的是理解错了。
它的意思可能是说Scalar对象是在编译过程中产生的函数operaor * 的那个
return的A_Scalar<T>(s);它是一个临时对象。
用白话说,你是引用不住它的,(它在构造后就会失效)
我还得再理解一下。。。 。。。还有些问题没有想通呢。
healer_kx
2006-02-07
打赏
举报
回复
我把那一章的代码都敲了一遍。。。我这里是可以的。
要么是我没有理解你的意思。。。
我的MSN个人空间是http://spaces.msn.com/healerkx
上面的代码你可以在VC7上运行下。
顺便我们再讨论一下。
healer_kx
2006-02-07
打赏
举报
回复
我再看看,我怎么不觉得啊。看完了再答复您。
boodweb
2006-02-07
打赏
举报
回复
可是书上明明特别指出说会有问题啊……
boodweb
2006-02-06
打赏
举报
回复
楼上地可以详细解释一下么?
为什么书上那么实现就一定要值传递?
healer_kx
2006-02-06
打赏
举报
回复
可以,谁说一定是数了,当然了,这也需要你改变operator*的声明和实现了。
wshcdr
2006-02-06
打赏
举报
回复
UP
C++
Templates
(侯捷版1-10章).pdf
本书是
C++
模板编程的完全指南,旨在通过基本概念、常用技巧和应用实例3方面的有用资料,为读者打下
C++
模板知识的坚实基础。 全书共5个部分,22章。第1章全面介绍了本书的内容结构和相关情况。第1部分(第2~7章)以教程的风格介绍了模板的基本概念,第2部分(第8~13章)阐述了模板的语言细节,第3部分(第14~18章)介绍了
C++
模板所支持的基本设计技术,第4部分(第19~22章)深入探讨了各种使用模板的普通应用程序。附录部分是一处定义原则和重载解析的相关资料。 本书适合
C++
模板技术的初学者阅读,也可供有一定编程经验的
C++
程序员参考。
Functional Programming in
C++
Functional Programming in
C++
teaches developers the practical side of functional programming and the tools that
C++
provides to develop software in the functional style. This in-depth guide is full of useful diagrams that help you understand FP concepts and begin to think functionally. Well-written code is easier to test and reuse, simpler to parallelize, and less error prone. Mastering the functional style of programming can help you tackle the demands of modern apps and will lead to simpler
expression
of complex program logic, graceful error handling, and elegant concurrency.
C++
supports FP with
templates
, lambdas, and other core language features, along with many parts of the STL. Functional Programming in
C++
helps you unleash the functional side of your brain, as you gain a powerful new perspective on
C++
coding. You’ll discover dozens of examples, diagrams, and illustrations that break down the functional concepts you can apply in
C++
, including lazy evaluation, function objects and invokables, algebraic data types, and more. As you read, you’ll match FP techniques with practical scenarios where they offer the most benefit. What’s inside Writing safer code with no performance penalties Explicitly handling errors through the type system Extending
C++
with new control structures Composing tasks with DSLs
Exploring
C++
11(2nd Edition 2013)-master_
C++
11_
this source code is about
C++
11_master
Discovering Modern
C++
: An Course for Scientists, Engineers, and Programmers
Discovering Modern
C++
: An Intensive Course for Scientists, Engineers, and Programmers (
C++
In-Depth Series) By 作者: Peter Gottschling ISBN-10 书号: 0134383583 ISBN-13 书号: 9780134383583 Edition 版本: 1 出版日期: 2015-12-27 pages 页数: 480 内容简介: As scientific and engineering projects grow larger and more complex, it is increasingly likely that those projects will be written in
C++
. With embedded hardware growing more powerful, much of its software is moving to
C++
, too. Mastering
C++
gives you strong skills for programming at nearly every level, from “close to the hardware” to the highest-level abstractions. In short,
C++
is a language that scientific and technical practitioners need to know. Peter Gottschling’s Discovering Modern
C++
is an intensive introduction that guides you smoothly to sophisticated approaches based on advanced features. Gottschling introduces key concepts using examples from many technical problem domains, drawing on his extensive experience training professionals and teaching
C++
to students of physics, math, and engineering. This book is designed to help you get started rapidly and then master increasingly robust features, from lambdas to
expression
templates
. You’ll also learn how to take advantage of the powerful libraries available to
C++
programmers: both the Standard Template Library (STL) and scientific libraries for arithmetic, linear algebra, differential equations, and graphs. Throughout, Gottschling demonstrates how to write clear and expressive software using object orientation, generics, metaprogramming, and procedural techniques. By the time you’re finished, you’ll have mastered all the abstractions you need to write
C++
programs with exceptional quality and performance.
《ISO
C++
11》英文版
Working Draft, Standard for Programming Language C ++ 本书是英文版。
C++ 语言
65,208
社区成员
250,517
社区内容
发帖
与我相关
我的任务
C++ 语言
C++ 语言相关问题讨论,技术干货分享,前沿动态等
复制链接
扫一扫
分享
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
请不要发布与C++技术无关的贴子
请不要发布与技术无关的招聘、广告的帖子
请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下
试试用AI创作助手写篇文章吧
+ 用AI写文章