Discovering Modern C++: An Intensive Course for Scientists, Engineers, and Programmers, 1st edition

Published by Addison-Wesley Professional (December 17, 2015) © 2016

  • Peter Gottschling

Paperback

ISBN-13: 9780134383583
Discovering Modern C++: An Intensive Course for Scientists, Engineers, and Programmers
Published 2015

Details

  • A print text
  • Free shipping
  • Also available for purchase as an ebook from all major ebook resellers, including InformIT.com

This an intensive guide for anyone who needs to master the advanced features of C++ quickly. It introduces the powerful features of C++ 14 most useful for scientific and engineering applications, without assuming previous programming or C++ experience. Readers will 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, concurrency, and procedural techniques.

Preface xvii
Reasons to Learn C++ xvii

Reasons to Read This Book xviii

The Beauty and the Beast xviii

Languages in Science and Engineering xix

Typographical Conventions xx

Acknowledgments xxiii

About the Author xxv

Chapter 1: C++ Basics 1

1.1 Our First Program 1

1.2 Variables 3

1.3 Operators 10

1.4 Expressions and Statements 21

1.5 Functions 28

1.6 Error Handling 34

1.7 I/O 40

1.8 Arrays, Pointers, and References 47

1.9 Structuring Software Projects 58

1.10 Exercises 63

Chapter 2: Classes 65

2.1 Program for Universal Meaning Not for Technical Details 65

2.2 Members 67

2.3 Setting Values: Constructors and Assignments 72

2.4 Destructors 89

2.5 Method Generation Résumé 95

2.6 Accessing Member Variables 96

2.7 Operator Overloading Design 100

2.8 Exercises 104

Chapter 3: Generic Programming 107

3.1 Function Templates 107

3.2 Namespaces and Function Lookup 115

3.3 Class Templates 123

3.4 Type Deduction and Definition 131

3.5 A Bit of Theory on Templates: Concepts 136

3.6 Template Specialization 136

3.7 Non-Type Parameters for Templates 144

3.8 Functors 146

3.9 Lambda 154

3.10 Variadic Templates 159

3.11 Exercises 161

Chapter 4: Libraries 165

4.1 Standard Template Library 165

4.2 Numerics 186

4.3 Meta-programming 198

4.4 Utilities 202

4.5 The Time Is Now 209

4.6 Concurrency 211

4.7 Scientific Libraries Beyond the Standard 213

4.8 Exercises 215

Chapter 5: Meta-Programming 219

5.1 Let the Compiler Compute 219

5.2 Providing and Using Type Information 226

5.3 Expression Templates 245

5.4 Meta-Tuning: Write Your Own Compiler Optimization 253

5.5 Exercises 283

Chapter 6: Object-Oriented Programming 287

6.1 Basic Principles 287

6.2 Removing Redundancy 298

6.3 Multiple Inheritance 299

6.4 Dynamic Selection by Sub-typing 306

6.5 Conversion 308

6.6 CRTP 316

6.7 Exercises 320

Chapter 7: Scientific Projects 321

7.1 Implementation of ODE Solvers 321

7.2 Creating Projects 332

7.3 Some Final Words 345

Appendix A: Clumsy Stuff 347

A.1 More Good and Bad Scientific Software 347

A.2 Basics in Detail 353

A.3 Real-World Example: Matrix Inversion 362

A.4 Class Details 371

A.5 Method Generation 375

A.6 Template Details 386

A.7 Using std::vector in C++03 391

A.8 Dynamic Selection in Old Style 392

A.9 Meta-Programming Details 392

Appendix B: Programming Tools 403

B.1 gcc 403

B.2 Debugging 404

B.3 Memory Analysis 408

B.4 gnuplot 409

B.5 Unix, Linux, and Mac OS 411

Appendix C: Language Definitions 413

C.1 Value Categories 413

C.2 Operator Overview 413

C.3 Conversion Rules 416

Bibliography 419

Index 423

Need help? Get in touch