Skip to content

C++ Modern Template Techniques

License

Notifications You must be signed in to change notification settings

denismurphy/cpp-modern-template-techniques

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

C++ Modern Template Techniques

Here i explore the use of advanced template techniques in C++, including class template argument deduction, smart pointers, structs, classes, abstract classes, virtual functions, auto, lambda, and constexpr.

The goal of this repository is for me to learn about modern template techniques in C++ and to serve as a resource ot other C++ developers looking to improve their template programming skills.

Contents

The repo contains various examples that illustrate different advanced template techniques and their use cases. Each example is well commented and easy to understand.

Class Template Argument Deduction

C++17's class template argument deduction feature to deduce template arguments from constructor parameters.

Smart Pointers

Smart pointers to manage the lifetime of objects in class templates and structs.

Structs and Classes

Structs and classes in template programming being used together.

Abstract Classes and Virtual Functions

Combination of abstract classes and virtual functions in template programming.

Auto and Lambda

auto and lambda can be used in conjunction with templates to make code more concise and expressive.

Constexpr

constexpr to make template code more efficient at runtime and during compile-time.

How to Use

The examples in this repository are personal reference, with each example covering a specific concept.

basic understanding of template programming in C++ before diving into the example.

Contribute

I welcome contributions to this repository. If you have an example of an advanced template technique that you would like to add, please open a pull request.

Authors

  • Denis Murphy

License

This repository is licensed under the MIT license.