Skip to content
Guest
← All References
C++ ISO C++17 / C++20 (g++, clang++)

Modern C++ Quick Reference

Essential Modern C++ (C++17/20) patterns: const references, std::vector, STL algorithms, RAII, smart pointers, and templates.

auto ptr = std::make_unique<T>(args...);

Everyday Modern C++

FeaturePurposeExample
const T&Zero-copy read-only parametervoid log(const std::string& msg)
std::vector<T>Dynamic contiguous arraystd::vector<int> v = {1, 2, 3};
Range-based forClean container iterationfor (const auto& x : v) { ... }
Lambda [](...){}Inline function object[](int n) { return n > 0; }
constexprCompile-time constantconstexpr int MAX_USERS = 100;

RAII, Smart Pointers & Templates

FeaturePurposeExample
Member initializerDirect field initializationUser(int id) : id_(id) {}
const methodGuarantees no object mutationint id() const { return id_; }
std::unique_ptrExclusive RAII heap ownershipauto p = std::make_unique<Node>();
template <typename T>Zero-cost generic codetemplate <typename T> T add(T a, T b)

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind