cpp-cheatsheet: A Comprehensive Modern C++ Reference Guide
This repository profile is provided by osrepos.com, an open source repository discovery platform.

Summary
The cpp-cheatsheet repository by mortennobel offers a concise and comprehensive reference for modern C++, covering C++11 and C++14 features. It serves as an invaluable resource for developers looking for quick syntax reminders and standard library usage. This cheatsheet is ideal for both learning and daily development tasks.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Introduction
The cpp-cheatsheet repository, maintained by mortennobel, provides a concise and comprehensive reference for modern C++. This cheatsheet is an invaluable resource for anyone working with C++, specifically focusing on features introduced in C++11 and C++14. It is based on Phillip M. Duxbury's C++ Cheatsheet and further edited by Morten Nobel-Jørgensen, with C++11 additions inspired by ISOCPP.org. The primary goal is to offer a clear, quick overview of essential C++ concepts and standard library components.
Installation
To make use of the cpp-cheatsheet, there is no traditional "installation" required as it is a documentation-based repository. You can access the full content directly on GitHub or clone the repository to have a local copy for offline reference.
To clone the repository, use the following command:
git clone https://github.com/mortennobel/cpp-cheatsheet.git
Once cloned, you can open the README.md file in your preferred markdown viewer or directly browse the content in your terminal.
Examples
The cheatsheet covers a wide range of C++ topics, from basic syntax to advanced features and standard library usage. Here are a few examples of the structured information you'll find:
Preprocessor
// Comment to end of line
/* Multi-line comment */
#include <stdio.h> // Insert standard header file
#include "myfile.h" // Insert file in current directory
#define X some text // Replace X with some text
#define F(a,b) a+b // Replace F(1,2) with 1+2
#define X \
some text // Multiline definition
#undef X // Remove definition
#if defined(X) // Conditional compilation (#ifdef X)
#else // Optional (#ifndef X or #if !defined(X))
#endif // Required after #if, #ifdef
Literals
255, 0377, 0xff // Integers (decimal, octal, hex)
2147483647L, 0x7fffffffl // Long (32-bit) integers
123.0, 1.23e2 // double (real) numbers
'a', '\141', '\x61' // Character (literal, octal, hex)
'\n', '\\', '\'', '\"' // Newline, backslash, single quote, double quote
"string\n" // Array of characters ending with newline and \0
"hello" "world" // Concatenated strings
true, false // bool constants 1 and 0
nullptr // Pointer type with the address of 0
Memory Management with shared_ptr
#include <memory> // Include memory (std namespace)
shared_ptr<int> x; // Empty shared_ptr to a integer on heap. Uses reference counting for cleaning up objects.
x = make_shared<int>(12); // Allocate value 12 on heap
shared_ptr<int> y = x; // Copy shared_ptr, implicit changes reference count to 2.
cout << *y; // Dereference y to print '12'
if (y.get() == x.get()) { // Raw pointers (here x == y)
cout << "Same";
}
y.reset(); // Eliminate one owner of object
if (y.get() != x.get()) {
cout << "Different";
}
if (y == nullptr) { // Can compare against nullptr (here returns true)
cout << "Empty";
}
y = make_shared<int>(15); // Assign new value
cout << *y; // Dereference x to print '15'
cout << *x; // Dereference x to print '12'
Why Use This
The cpp-cheatsheet is an excellent resource for several reasons:
- Comprehensive Coverage: It provides a broad overview of C++ syntax, standard library components, and modern features up to C++14.
- Quick Reference: Its concise format makes it perfect for quickly looking up syntax or function signatures during development or study.
- Educational Tool: Ideal for students learning C++ or experienced developers brushing up on specific topics.
- Modern C++ Focus: Explicitly highlights C++11 and C++14 additions, ensuring relevance for contemporary projects.
- Community Driven: The repository encourages comments and feedback, fostering continuous improvement.
Links
- GitHub Repository: https://github.com/mortennobel/cpp-cheatsheet
Related repositories
Similar repositories that may be relevant next.

async-javascript-cheatsheet: A Comprehensive Guide to Async/Await and Promises
July 17, 2026
The `async-javascript-cheatsheet` is a valuable resource offering a concise summary of promises and async/await concepts in JavaScript. This cheatsheet is derived from the 'Mastering Asynchronous JavaScript' course at Frontend Armory, providing a quick reference for developers. It's an excellent tool for anyone looking to quickly grasp or review asynchronous patterns.

ds-cheatsheets: Your Ultimate Collection of Data Science Cheatsheets
July 17, 2026
The ds-cheatsheets repository by FavioVazquez offers an extensive collection of quick reference guides for data science. It covers a broad spectrum of topics, including programming languages like Python and R, and advanced concepts in Machine Learning and Deep Learning. This resource is perfect for anyone needing a handy guide to navigate the complex world of data science.
Vim-Cheatsheet: Master Vim and Neovim with Essential Keyboard Shortcuts
July 16, 2026
The `vim-cheatsheet` repository by pawelborkar offers a comprehensive collection of shortcuts designed to help users become advanced Vim and Neovim practitioners. It covers a wide range of commands, from basic movement to complex window management and plugin usage. This resource is ideal for anyone looking to boost their productivity and efficiency within the Vim ecosystem.

PayloadsAllTheThings: Comprehensive Payloads for Web Application Security
January 28, 2026
PayloadsAllTheThings is a widely recognized GitHub repository offering a vast collection of payloads and bypass techniques. It is an essential resource for web application security, penetration testing, and CTF challenges. This repository helps security professionals and enthusiasts discover and exploit vulnerabilities effectively.
Source repository
Open the original repository on GitHub.