Part-1 - Modern C++
Presentation of syntax and library for Modern C++.
Evolution of C++
Quick recap how C++ have evolved over the years and what we and others mean with the phrase "Modern C++".
- Stroustrup
- Evolution of Classic C++
- Evulution of Modern C++
- What is Modern C++, anyway
- Recommended online resources
Syntax Enhancements in C++ 11/14
Presentation of the most important syntactic improvements of the language.
- Automatic type inference
- Java-style for-each loop
- Uniform initializer syntax
- Strongly types enums
- Compile time constant expressions
- Null pointer literal
- Unicode support
- Raw strings
- Multi-line strings
- RightValue references
- Move semantics
Lambda Expressions
The most exciting syntax enhancement in Modern C++ is without doubt, lambda expressions. In this chapter we present all th details.
- What is a lambda expression
- Basic syntax
- Capture of local variables in the surrounding scope
- Writing functions that accept lambda expressions
Part-2 - C++ Language Topics
Review and discussion of common language topics.
More about Constructors & Members
Review of how to use constructors and declare class members.
- Constructor chaining
- Different ways of initialize member variables
- Friends
- Inline friend non-member functions
- Move constructor
- Move operator
- Understanding move-semantics
- Compiler generated members
- How to enforce compiler generated members
- How to omit compiler generated members
- Using override and final function modifiers
- Type conversion constructor
- How to prevent implicit type conversion
- Type conversion operator
- Base class visibility
- Default visibility of structs
- How to emulate Java style interfaces
More about Templates
Review of how to declare and use template functions and classes.
- What is a template
- Function templates
- Explicit type instantiatiion of functions
- Template classes
- Template methods
- Template parameters
- Template specialization
- Type aliases
- Type traits
- Using decltype()
- Variadic templates
- Recursive templates
More about Operator Overloading
Review of how to implement and use operator overloading.
- What is operator overloading
- Overloadable operators
- Cannot change the arity
- Cannot change the precedence
- Overloading of arithmetic operators
- Overloading of relational operators
- Overloading of increment operators
- Overloading of the index operator
- Overloading of the arraw operator
- Overloading of the function call operator
Heap Allocated Objects
Review of the new/delete operators and how to use the placement variant of new.
- The new & delete operators
- The new & delete operators for arrays
- The placement variant of new and how to use it
- Overloading new & delete for your own class
Part-3 - Standard Libray
Presentation of the standard library in C++ 11/14/17.
Text Strings & Regexes
Discussions about the string class and how to work with regex objects.
- The std::string class
- String API
- Useful functions/operators
- Type conversion functions
- String search
- Character oriented functions
- What is SSO (Short String Optimization)
- Working with legacy C/C++ code, using text strings
- Raw strings
- Using a regex object
- Regex match operation
- Regex replace operation
- Implementing split and join for text strings and list of strings
Helper Types
Presentation of some minor but still useful classes.
- Using pair
- Using tuple
- Min/Max values of scalar types
- Math functions
- Complex numbers
- Numeric array
- Rational numbers
- The chrono types
- Durations
- Time units
- Time literals
- Clocks
- Random number generation
- Supported stochastic distributions
- Random number engines
Container Types
Presentation of all container types in the standar library.
- What is a sequence container
- Typical methods of a sequence container
- vector<T>
- deque<T>
- array<T,N>
- list<T>
- forward_list<T>
- What is an associative container
- Implicit binary tree vs. hash table
- Typical methods of an associative container
- set<T>
- unordered_set<T>
- multiset<T>
- map<K,V>
- unordered_map<K,V>
- What is a container adapter
- stack<T>
- queue<T>
- priority_queue<T>
- Container block allocators
- User-defined allocator
Iterators & Intervals
Presentation of the important concept of an interval and how this is represented by two iterators.
- What is an iterator
- What is an interval
- Iterator categories
- (In/Out)put iterators
- Forward iterators
- Bidirectional iterators
- Random access iterators
- End-point adapters
- I/O iterators
- Iterator adaptors
- Using a back-inserter
Algorithms
Presentation of STL algorithms used to operator on intervals, hence containers.
- The STL architecture
- Overview of STL algorithms
- Different ways of providing the business logic to an algorithm function
- Understand function suffixes
- Using functions that take predicates
- Using the transform() function
- Using the accumulate() function
- Sorting
- Different ways to populate a container
I/O Streams & Files
Presentation of the stream sub-library.
- The streams abstraction in C++
- Class ostream, ofstream, ostringstream
- Class istream, ifstream, istringstream
- Manipulators
- Bi-directional binary I/O
- Stream position
- Stream status
- Understanding the typed input idiom
- The line-oriented input idiom
- The word-oriented input idiom
- The character-oriented input idiom
Part-4 - Idioms & Techniques
Discussion of some advanced topics of C++ usage.
Smart Pointers
Discussion and implementation of the smart pointer concept and presentation of the smart pointer support in the standard library.
- What is a smart pointer and which are the benefits
- Basic implementation
- Using a transfer class to make the compiler happy
- To delete or not delete, that's question
- Different smart pointer concepts
- UniquePtr<T>
- CopyPtr<T>
- RefCountPtr<T>
- Smart pointers in C++ 11
- unique_ptr<T>
- shared_ptr<T>
- weak_ptr<T>
Common C++ Idioms
Discussion and implementation of a set of well-proven common idioms inC++.
- What is an idiom
- Understanding the for-each loop
- Supporting for-each in your own classes
- Implementation of class Range
- Implementation of class LineSlurper
- Understanding static initializers
- Supporting static initializers in your own classes
- Overriding the index operator
- How to differentiate between read and write for operator[]
- Understaing the RAII idiom
- Mutex locks
- Debug tracing
Translating C++ into C
Discussion of how C++ is represented internally and how you can see that C++ is just a thin compile-time layer around C.
- How the member variables of a class is represented
- How member functions are represented
- Understanding name-mangling
- How method invocation is represented
- How operators are represented
- How constructors/destructors are represented
- How class hierachies are represented
- How virtual methods are represented and works in run-time
- How lambda expressions are represented
- How expceptions are represented
Standards & Guidlines
Presentation of the standarization work and the official guidelines for Modern C++
- The standardization process
- A new C++ standard every third year
- Online compilers and why they are of use
- The C++ Core Guidelines
- GSL - The Guidelins Support Library