C++ templates : the complete guide = C++ templates /

副标题:无

作   者:David Vandevoorde, Nicolai M. Josuttis著.

分类号:

ISBN:9787508319247

微信扫一扫,移动浏览光盘

简介

   [a href="http://www.china-pub.com/computers/common/info.asp?id=15689" target="_blank"]《c++ templates中文版》[/a][font color="#ff6600"] [/font][a href="http://www.china-pub.com/computers/common/info.asp?id=17741" target="_blank"]《c++ templates二合一捆绑销售(中文版&影印版)》[/a][font color="#ff6600"]    关于本书的评论:[/font]    c++社区确实非常需要这本书。很难想像还有其他人能比这本书的作者做得更好。我强烈推荐这本书。    ——thomas becker,zephyr associates,inc.    c++世界渴望已久的重量级著作。    ——marc briand,c/c++ users journal前主编    一句话,c++模板圣经已经写就,动手学吧。    ——maxim khesin,cvision technologies,llc,    本书最吸引我的地方就是它对模板的两个方面进行了深刻的阐述:模板的结构和用法。很少有对设计和使用同时进行论述的书籍。书中的示例都是一流的、简明的,并且进行了详细说明。    ——patrick mckillen,vision lnformation consuldng ltd.    本书介绍了有关模板的所有缺点和陷阱。每一个都是你不想知道,但却是保证模板使用效率所必需的。    ——dietmar kuhl,phaidros ease    [font color="#ff6600"]本书主要内容:[/font]    ·正确的模板行为    ·如何避开与模板相关的错误陷阱    ·从基础的到早前没有文字约定的惯用语法和技巧    ·如何在不对性能和安全性造成损害的前提下进行源代码重用    ·如何提高c++程序的效率    ·如何构建更具灵活性和可维护性的软件    模板是c++功能强大的特性之一,然而却常常被人们所忽视、误解与误用。本书将帮助软件设计师、工程师清晰理解为什么、何时及如何使用模板来构建及维护简洁、快速、灵活的高效软件。 本书是一本对基本概念和语言特性有着深刻见解的指南性书籍,同时也是一本包含内容广泛的参考性书籍。本书首先讲述了语言细节,然后对编码技巧进行了广泛的讨论,最后还对模板的高级应用进行了阐述、分析。贯串全书的示例阐明了抽象概念并演示了最优实践方法。本书将引导程序员全面完整地开发c++功能强大的特性——模板特性。 .        

目录

preface

acknowledgments

1 about this book

1.1 what you should know before reading this book

1.2 overall structure of the book

1.3 how to read this book

1.4 some remarks about programming style

1.5 the standard versus reality

1.6 example code and additional informations

1.7 feedback


part i: the basics

2 function templates

2.1 a first look at function templates

2.1.1 defining the template

2.1.2 using the template

2.2 argument deduction

2.3 template parameters

2.4 overloading function templates

2.5 summary

.

3 class templates

3.1 implementation of class template stack

3.1.1 declaration of class templates

3.1.2 implementation of member functions

3.2 use of class template stack

3.3 specializations of class templates

3.4 partial specialization

3.5 default template arguments

3.6 summary


4 nontype template parameters

4.1 nontype class template parameters

4.2 nontype function template parameters

4.3 restrictions for nontype template parameters

4.4 summary


5 tricky basics

5.1 keyword typename

5.2 using this-]

5.3 member templates

5.4 template template parameters

5.5 zero initialization

5.6 using string literals as arguments for function templates

5.7 summary


6 using templates in practice

6.1 the inclusion model

6.1.1 linker errors

6.1.2 templates in header files

6.2 explicit instantiation

6.2.1 example of explicit instantiation

6.2.2 combining the inclusion model and explicit instantiation

6.3 the separation model

6.3.1 the keyword export

6.3.2 limitations of the separation model

6.3.3 preparing for the separation model

6.4 templates and inline

6.5 precompiled headers

6.6 debugging templates

6.6.1 decoding the error novel

6.6.2 shallow instantiation

6.6.3 long symbols

6.6.4 tracers

6.6.5 oracles

6.6.6 archetypes

6.7 aftemotes

6.8 summary


7 basic template terminology

7.1 "class template" or "template class"?

7.2 instantiation and specialization

7.3 declarations versus definitions

7.4 the one-definition rule

7.5 template arguments versus template parameters


part ii: templates in depth fundamentals in depth

8.1 parameterized declarations

8.1.1 virtual member functions

8.1.2 linkage of templates

8.1.3 primary templates

8.2 template parameters

8.2.1 type parameters

8.2.2 nontype parameters

8.2.3 template template parameters

8.2.4 default template arguments

8.3 template arguments

8.3.1 function template arguments

8.3.2 type arguments

8.3.3 nontype arguments

8.3.4 template template arguments

8.3.5 equivalence

8.4 friends

8.4.1 friend functions

8.4.2 friend templates

8.5 aftemotes


9 names in templates

9.1 name taxonomy

9.2 looking up names

9.2.1 argument-dependent lookup

9.2.2 friend name injection

9.2.3 injected class names

9.3 parsing templates

9.3.1 context sensitivity in nontemplates

9.3.2 dependent names of types

9.3.3 dependent names of templates

9.3.4 dependent names in using-declarations

9.3.5 adl and explicit template arguments

9.4 derivation and class templates

9.4.1 nondependent base classes

9.4.2 dependent base classes

9.5 afternotes


10 instantiation

10.1 on-demand instantiation

10.2 lazy instantiation

10.3 the c++ instantiation model

10.3.1 two-phase lookup

10.3.2 points of instantiation

10.3.3 the inclusion and separation models

10.3.4 looking across translation units

10.3.5 examples

10.4 implementation schemes

10.4.1 greedy instantiation

10.4.2 queried instantiation

10.4.3 iterated instantiation

10.5 explicit instantiation

10.6 afternotes


11 template argument deduction

11.1 the deduction process

11.2 deduced contexts

11.3 special deduction situations

11.4 allowable argument conversions

11.5 class template parameters

11.6 default call arguments

11.7 the barton-nackman trick

11.8 afternotes


12 specialization and overloading

12.1 when "generic code" doesn't quite cut it

12.1.1 transparent customization

12.1.2 semantic transparency

12.2 overloading function templates

12.2.1 signatures

12.2.2 partial ordering of overloaded function templates

12.2.3 formal ordering rules

12.2.4 templates and nontemplates

12.3 explicit specialization

12.3.1 full class template specialization

12.3.2 full function template specialization

12.3.3 full member specialization

12.4 partial class template specialization

12.5 aftemotes


13 future directions

13.1 the angle bracket hack

13.2 relaxed typename rules

13.3 default function template arguments

13.4 string literal and floating-point template arguments

13.5 relaxed matching of template template parameters

13.6 typedef templates

13.7 partial specialization of function templates

13.8 the typeof operator

13.9 named template arguments

13.10 static properties

13.11 custom instantiation diagnostics

13.12 overloaded class templates

13.13 list parameters

13.14 layout control

13.15 initializer deduction

13.16 function expressions

13.17 afternotes


part iii: templates and design

14 the polymorphic power of templates

14.1 dynamic polymorphism

14.2 static polymorphism

14.3 dynamic versus static polymorphism

14.4 new forms of design patterns

14.5 generic programming

14.6 afternotes


15 traits and policy classes

15.1 an example: accumulating a sequence

15.1.1 fixed traits

15.1.2 value traits

15.1.3 parameterized traits

15.1.4 policies and policy classes

15.1.5 traits and policies: what's the difference?

15.1.6 member templates versus template template parameters

15.1.7 combining multiple policies and/or traits

15.1.8 accumulation with general iterators

15.2 type functions

15.2.1 determining element types

15.2.2 determining class types

15.2.3 references and qualifiers

15.2.4 promotion traits

15.3 policy traits

15.3.1 read-only parameter types

15.3.2 copying, swapping, and moving

15.4 afternotes


16 templates and inheritance

16.1 named template arguments

16.2 the empty base class optimization (ebco)

16.2.1 layout principles

16.2.2 members as base classes

16.3 the curiously recurring template pattern (crtp)

16.4 parameterized virtuality

16.5 afternotes


17 metaprograms

17.1 a first example of a metaprogram

17.2 enumeration values versus static constants

17.3 a second example: computing the square root

17.4 using induction variables

17.5 computational completeness

17.6 recursive instantiation versus recursive template arguments

17.7 using metaprograms to unroll loops

17.8 afternotes


18 expression templates

18.1 temporaries and split loops

18.2 encoding expressions in template arguments

18.2.1 operands of the expression templates

18.2.2 the array type

18.2.3 the operators

18.2.4 review

18.2.5 expression templates assignments

18.3 performance and limitations of expression templates

18.4 afternotes


part iv: advanced applications

19 type classification

19.1 determining fundamental types

19.2 determining compound types

19.3 identifying function types

19.4 enumeration classification with overload resolution

19.5 determining class types

19.6 putting it all together

19.7 afternotes


20 smart pointers

20.1 holders and trules

20.1.1 protecting against exceptions

20.1.2 holders

20.1.3 holders as members

20.1.4 resource acquisition is initialization

20.1.5 holder limitations

20.1.6 copying holders

20.1.7 copying holders across function calls

20.1.8 trules

20.2 reference counting

20.2.1 where is the counter?

20.2.2 concurrent counter access

20.2.3 destruction and deallocation

20.2.4 the countingptr template

20.2.5 a simple noninvasive counter

20.2.6 a simple invasive counter template

20.2.7 constness

20.2.8 implicit conversions

20.2.9 comparisons

20.3 afternotes


21 tuples

21.1 duos

21.2 recursive duos

21.2.1 number of fields

21.2.2 type of fields

21.2.3 value of fields

21.3 tuple construction

21.4 afternotes


22 function objects and callbacks

22.1 direct, indirect, and inline calls

22.2 pointers and references to functions

22.3 pointer-to-member functions

22.4 class type functors

22.4.1 a first example of class type functors

22.4.2 type of class type functors

22.5 specifying functors

22.5.1 functors as template type arguments

22.5.2 functors as function call arguments

22.5.3 combining function call parameters and template type parameters

22.5.4 functors as nontype template arguments

22.5.5 function pointer encapsulation

22.6 introspection

22.6.1 analyzing a functor type

22.6.2 accessing parameter types

22.6.3 encapsulating function pointers

22.7 function object composition

22.7.1 simple composition

22.7.2 mixed type composition

22.7.3 reducing the number of parameters

22.8 value binders

22.8.1 selecting the binding

22.8.2 bound signature

22.8.3 argument selection

22.8.4 convenience functions

22.9 functor operations: a complete implementation

22.10 afternotes


appendixes

a the one-definition rule

a.1 translation units

a.2 declarations and definitions

a.3 the one-definition rule in detail

a.3.1 one-per-program constraints

a.3.2 one-per-translation unit constraints

a.3.3 cross-translation unit equivalence constraints

b overload resolution

b.1 when does overload resolution kick in?

b.2 simplified overload resolution

b.2.1 the implied argument for member functions

b.2.2 refining the perfect match

b.3 overloading details

b.3.1 prefer nontemplates

b.3.2 conversion sequences

b.3.3 pointer conversions

b.3.4 functors and surrogate functions

b.3.5 other overloading contexts

bibliography

newsgroups

books and web sites

glossary

index


已确认勘误

次印刷

页码 勘误内容 提交人 修订印次

C++ templates : the complete guide = C++ templates /
    • 名称
    • 类型
    • 大小

    光盘服务联系方式: 020-38250260    客服QQ:4006604884

    意见反馈

    14:15

    关闭

    云图客服:

    尊敬的用户,您好!您有任何提议或者建议都可以在此提出来,我们会谦虚地接受任何意见。

    或者您是想咨询:

    用户发送的提问,这种方式就需要有位在线客服来回答用户的问题,这种 就属于对话式的,问题是这种提问是否需要用户登录才能提问

    Video Player
    ×
    Audio Player
    ×
    pdf Player
    ×
    Current View

    看过该图书的还喜欢

    some pictures

    解忧杂货店

    东野圭吾 (作者), 李盈春 (译者)

    loading icon