Discovering Modern C++

Discovering Modern C++ book cover

Discovering Modern C++

$49.99

In stock
0 out of 5

$49.99

SKU: 09780134383583 Category:
Title Range Discount
Trade Discount 5 + 25%

Description

Teaches scientists, engineers, and new C++ programmers how to use modern C++ effectively for a variety of applications and problem domains.

  • Shows correct clean modern C++ code
  • Deals with how to use C++ well without assuming a lot of familiarity with the language
  • Includes concise coverage of the newest C++ 14 features

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.

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.

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

  • Teaches scientists, engineers, and new C++ programmers how to use modern C++ effectively for a variety of applications and problem domains.
  • Shows correct clean modern C++ code
  • Deals with how to use C++ well without assuming a lot of familiarity with the language
  • Includes concise coverage of the newest C++ 14 features

Peter Gottschling is founder of SimuNova, a company that works on developing the Matrix Template Library (MTL4) and offers C++ training. He is a member of the ISO C++ standards committee, vice-chair of Germany’s programming language standards committee, and founder of the C++ User Group in Dresden. He earned his Ph.D. in computer science at Technische Universität Dresden in 2002.

Additional information

Dimensions 0.95 × 7.40 × 9.10 in
Series

Imprint

Format

ISBN-13

ISBN-10

Author

BISAC

Subjects

professional, higher education, Employability, IT Professional, COM051070, Y-AA AW PROF – PROG LANGUAGES, variadic templates, Meta-Programming, numeric, Runge-Kutta Algorithms, Ordinary Differential Equations, Scientific Libraries, C++ for engineers, C++ for scientists