《C++沉思录 英文版》PDF下载

  • 购买积分:13 如何计算积分?
  • 作  者:(美)AndrewKoening,(美)BarbaraE.Moo著
  • 出 版 社:北京:人民邮电出版社
  • 出版年份:2013
  • ISBN:9787115308511
  • 页数:380 页
图书介绍:本书基于作者在知名技术杂志发表的技术文章、世界各地发表的演讲以及斯坦福大学的课程讲义整理、写作而成,融聚了作者10多年C++程序生涯的真知灼见。可以帮助读者加强提高技术能力,成为C++程序设计的高手。

Chapter 0 Prelude 1

0.1 Firsttry 1

0.2 Doing it without classes 4

0.3 Whywasit easierinC++? 5

0.4 A bigger example 6

0.5 Conclusion 6

Part Ⅰ Motivation 9

Chapter1 WhyIuseC++ 11

1.1 The problem 11

1.2 History and context 12

1.3 Automatic software distribution 12

1.4 EnterC++ 15

1.5 Recycled software 20

1.6 Postscript 21

Chapter2 Why I work onC++ 23

2.1 The success of small projects 23

2.2 Abstraction 25

2.3 Machines should work for people 28

Chapter 3 Living in the real world 29

Part Ⅱ Classes and inheritance 35

Chapter 4 Checklist for class authors 37

Chapter 5 Surrogate classes 47

5.1 The problem 47

5.2 The classical solution 48

5.3 Virtual copy functions 49

5.4 Defining a surrogate class 50

5.5 Summary 53

Chapter 6 Handles:Part 1 55

6.1 The problem 55

6.2 A simple class 56

6.3 Attaching a handle 58

6.4 Getting at the object 58

6.5 Simple implementation 59

6.6 Use-counted handles 60

6.7 Copy on write 62

6.8 Discussion 63

Chapter 7 Handles:Part 2 67

7.1 Review 68

7.2 Separating the use count 69

7.3 Abstraction of use counts 70

7.4 Access functions and copy on write 73

7.5 Discussion 73

Chapter 8 An object-oriented program 75

8.1 The problem 75

8.2 An object-oriented solution 76

8.3 Handle classes 79

8.4 Extension 1:New operations 82

8.5 Extension 2:New node types 85

8.6 Reflections 86

Chapter 9 Analysis of a classroom exercise:Part 1 89

9.1 The problem 89

9.2 Designing the interface 91

9.3 A few loose ends 93

9.4 Testing the interface 94

9.5 Strategy 95

9.6 Tactics 96

9.7 Combining pictures 99

9.8 Conclusion 102

Chapter 10 Analysis of a classroom exercise:Part 2 103

10.1 Strategy 103

10.2 Exploiting the structure 116

10.3 Conclusion 119

Chapter 11 When not to use virtual functions 121

11.1 The case for 121

11.2 The case against 122

11.3 Destructors are special 127

11.4 Summary 129

Part Ⅲ Templates 131

Chapter 12 Designing a container class 133

12.1 What does it contain? 133

12.2 What does copying the container mean? 134

12.3 How do you get at container elements? 137

12.4 How do you distinguish reading from writing? 138

12.5 How do you handle container growth? 139

12.6 What operations does the container provide? 141

12.7 What do po you assume about the container element type? 141

12.8 Containers and inheritance 143

12.9 Designing an arraylike class 144

Chapter 13 Accessing container elements 151

13.1 Imitating a pointer 151

13.2 Getting at the data 153

13.3 Remaining problems 155

13.4 Pointer to const Array 159

13.5 Useful additions 161

Chapter 14 Iterators 167

14.1 Completing the Pointer class 167

14.2 What is an iterator? 170

14.3 Deleting an element 171

14.4 Deleting the container 172

14.5 Other design considerations 173

14.6 Discussion 174

Chapter 15 Sequences 175

15.1 The state of the art 175

15.2 A radical old idea 176

15.3 Well.maybe a few extras 181

15.4 Example of use 184

15.5 Maybe a few more 188

15.6 Food for thought 190

Chapter 16 Templates as interfaces 191

16.1 The problem 191

16.2 The first example 192

16.3 Separating the iteration 192

16.4 Iterating over arbitrary types 195

16.5 Adding other types 196

16.6 Abstracting the storage technique 196

16.7 The proof of the pudding 199

16.8 Summary 200

Chapter 17 Templates and generic algorithms 203

17.1 A specific example 204

17.2 Generalizing the element type 205

17.3 Postponing the count 205

17.4 Address independence 207

17.5 Searching a nonarray 208

17.6 Discussion 210

Chapter 18 Generic iterators 213

18.1 A different algorithm 213

18.2 Categories of requirements 215

18.3 Input iterators 216

18.4 Output iterators 216

18.5 Forward iterators 217

18.6 Bidirectional iterators 218

18.7 Random-access iterators 218

18.8 Inheritance? 220

18.9 Performance 220

18.10 Summary 221

Chapter 19 Using generic iterators 223

19.1 Iterator types 224

19.2 Virtual sequences 224

19.3 An output-stream iterator 227

19.4 An input-stream iterator 229

19.5 Discussion 232

Chapter 20 Iterator adaptors 233

20.1 An example 233

20.2 Directional asymmetry 235

20.3 Consistency and asymmetry 236

20.4 Automatic reversal 237

20.5 Discussion 240

Chapter 21 Function objects 241

21.1 An example 241

21.2 Function pointers 244

21.3 Function objects 246

21.4 Function-object templates 248

21.5 Hiding intermedlate types 249

21.6 One type covers many 250

21.7 Implementation 251

21.8 Discussion 253

Chapter 22 Function adaptors 255

22.1 Why function objects? 255

22.2 Function objects for built-in operators 256

22.3 Binders 257

22.4 A closer look 258

22.5 Interface inheritance 259

22.6 Using these classes 260

22.7 Discussion 261

Part Ⅳ Libraries 263

Chapter 23 Libraries in everyday use 265

23.1 The problem 265

23.2 Understanding the problem—part 1 267

23.3 Implementation—part 1 267

23.4 Understanding the problem—part 2 270

23.5 Implementation—part 2 270

23.6 Discussion 272

Chapter 24 An object lesson in library-interface design 275

24.1 Complications 276

24.2 Improving the interface 277

24.3 Taking stock 279

24.4 Writing the code 280

24.5 Conclusion 282

Chapter 25 Library design is language design 283

25.1 Character strings 283

25.2 Memory exhaustion 284

25.3 Copying 287

25.4 Hiding the implementation 290

25.5 Default constructor 292

25.6 Other operations 293

25.7 Substrings 295

25.8 Conclusion 296

Chapter 26 Language design is library design 297

26.1 Abstract data types 297

26.2 Libraries and abstract data types 299

26.3 Memory allocation 302

26.4 Memberwise assignment and initialization 303

26.5 Exception handling 305

26.6 Summary 306

Part Ⅴ Technique 307

Chapter 27 Classes that keep track of themselves 309

27.1 Design of a trace class 309

27.2 Creating dead code 312

27.3 Generating audit trails for objects 313

27.4 Verifying container behavior 315

27.5 Summary 320

Chapter 28 Allocating objects in clusters 321

28.1 The problem 321

28.2 Designing the solution 321

28.3 Implementation 324

28.4 Enter inheritance 326

28.5 Summary 327

Chapter 29 Applicators,manipulators,and function objects 329

29.1 The problem 329

29.2 A solution 332

29.4 Multiple arguments 334

29.5 An example 335

29.6 Abbreviations 337

29.7 Musings 338

29.8 Historical notes,references,and acknowledgments 339

Chapter30 Decoupling application libraries from input-output 341

30.1 The problem 341

30.2 Solution 1:Trickery and brute force 342

30.3 Solution 2:Abstract output 343

30.4 Solution 3:Trickery without brute force 345

30.5 Remarks 348