about
10/16/2022
C++ Story Repo
C++ Story Repository
Prologue
Chap 1. - Models
Chap 2. - Language Survey
Chap 3. - Data
Chap 4. - Operations
Chap 5. - Classes
Chap 6. - Class Relationships
Chap 7. - Templates
Chap 8. - Template Metaprogramming
Chap 9. - Libraries
Chap 10. - Stream Libraries
Chap 11. - STL Libraries
Chap 12. - Other Interesting Topics
Code Contents:
All of the code here has been implemented using Visual Studio, so each item below has a visual studio project. Every one of them need the C++17 language option set. That should already be part of the project settings, but if something fails to compile, please check the language option.
-
Chapter1-C++ Models
-
Chapter1-Structure
Demo with two components and an executive. One of the components provides an interface and object factory. -
Chapter1-MemoryModel
Illustrates use of static, stack, and heap memory. Also illustrates stack based resource management. -
Chapter1-Classes
Develops small point class and demonstrates it is a value type.
-
Chapter1-Structure
-
Chapter2-Survey
-
Chapter2-Survey
Mostly small examples used to support Chapter2 discussions:
Elementary examples of Arrays and Pointers, STL containers, new Optional type, casts, and template function overloads. -
Chapter2-overloading
Simple overloading demonstration that is repeated using std::optional type. -
Chapter2-overriding
Uses SWDev, Dev, TeamLead, and ProjectMgr classes to demonstrate overriding. -
Chapter2-Person
Class that models a person with stats properties.
-
Chapter2-Survey
-
Chapter3-Data
-
Chapter3-Data
Demonstratons of initialization, structured binding, float granularity -
Chapter3-sizes
Uses displayType function to explore sizes of fundamental and library types. -
Chapter3-init
Illustrates uniform initialization with many small examples. -
Chapter3-STL (uses DirWalker)
Illustrates quickly building interesting data structures using the STL containers and iterators.
-
Chapter3-Data
-
Chapter4-Operations
-
Chapter4-QuickExample
Illustrates dispatching functions and callbacks -
Chapter4-Coercion
Illustrates narrowing and numeric conversions of fundamental types -
Chapter4-CopyOperations
demonstrates copy syntax and operation for fundamental types and structs -
Chapter4-AssignmentOperations
demonstrates assignment syntax and operation for fundamental types and structs -
Chapter4-functions
Illustrates functions, function pointers, methods, method pointers, functors, and std::invoke. -
Chapter4-CallableObjects
Illustrates functions, function pointers, methods, method pointers, functors, and std::invoke. Similar to Chapter3-functions but with different examples. -
Chapter4-Logger
Illustrates new logger design -
Chapter4-ReturnValueOptimization
Demonstrates how and when RVO works. -
Chapter4-STL
Demonstrates use of lambda with copy_if algorithm
-
Chapter4-QuickExample
-
Chapter5-Classes
-
Chapter5-QuickExample
Demonstrates tiny logger. -
Chapter5-classes
Demonstrates three variations of a point class used to discuss class-related design.
Develops Anatomy class illustrating important class methods, e.g. Copy and move construction, copy and move assignment, destructor, etc.
-
Chapter5-QuickExample
-
Chapter6-Class Relationships
-
Chapter6-QuickExample
Demonstrates extending existing classes through inheritance. -
Chapter6-ClassLayout
Demonstrates how compound classes are layed out in memory. -
Chapter6-Polymorphism
Shows how virtual methods are bound to a derived class instance when invoked using a base class pointer or reference. -
Chapter6-PeopleHierarchy
A thorough walkthrough of the use and behaviors of class hierarchies.
-
Chapter6-QuickExample
-
Chapter7-Templates
-
Chapter7-QuickExample
Demonstrates lazy translation of templates. -
Chapter7-CodeFragments
Demonstrates class template specialization. -
Chapter7-TemplateFunctions
Basic syntax demo with overload resolution example. -
Chapter7-TemplateClasses
Basic syntax demo. -
Chapter7-SFINAE
Illustrates template function overload resolution. -
Chapter7-TemplateSpecialization
Logger with formatting and timer options. -
Chapter7-TypeTransformation
Illustrates type transformations when passed as arguments to a function. Uses Boost::type_index.hpp.
-
Chapter7-QuickExample
-
Chapter8-Template Metaprogramming
-
Chapter8-QuickExample
Shows how to display a std::tuple. -
Chapter8-Display
Developes very flexible functions for display using Template Metaprogramming. These were used throughout the CppStory chapters to show the effects of code constructs. This project uses custom type traits developed in Chapter7-TypeTraits (see below). -
Chapter8-TemplateSpecialization
Uses constexpr if to simplify demo logger from Chapter 6. -
Chapter8-VariadicFunctions
Presents several variadic function demonstrations. -
Chapter8-VariadicMixins
Defines derived class that gracefully accepts any finite number of mixin base classes. -
Chapter8-VariadicClassComp
Defines class that gracefully accepts any finite number of member type instances. -
Chapter8-FoldExpression
Illustrates variadic folding over binary operators. -
Chapter8-CustomTypeTraits
Illustrates simple construction of type traits. Will fail if user supplies template arguments that have defaults. -
Chapter8-TypeTraits
Demonstrates the construction of, with a bit more effort, very strong trait operations that deal well with defaulted arguments.
-
Chapter8-QuickExample
- Chapter9-Libraries
- Chapter10-Streams
-
Chapter11-STL
-
Chapter11-STL_Demos
Demonstrates containers, iterators, and algorithms -
Chapter11-ModifiedSTL_Demos
Demonstrates making STL code more readable by hiding iterators and more.
-
Chapter11-STL_Demos