#cpp
33 posts tagged cpp. All posts
C++ type traits: querying and transforming types at compile timeUse the <type_traits> header to inspect, compare and transform types at compile time, branch with if constexpr, and write your own trait with partial specialization.
C++ move semantics: rvalue references, move constructors and std::moveHow C++11 move semantics work: rvalue references, writing a move constructor and move assignment, what std::move really does, and the common gotchas.
WebAssembly for browser games: engines, toolchains and gotchasWhich engines and toolchains can ship a game to the browser as WebAssembly, a minimal Emscripten game loop, and the problems you hit when you deploy it.
Classic design patterns in modern C++: Singleton, factories, Builder, Adapter, Composite and DecoratorCompilable C++17 examples of nine Gang of Four creational and structural patterns, using std::unique_ptr for ownership instead of raw new and delete.
C++ operator overloading: member vs non-member operators and C++20 comparisonsHow to overload operators for your own C++ types: a complete Vector2 example, which operators must be members, defaulted == in C++20, and pitfalls.
C++ standard library containers and algorithms: an overview with examplesAn overview of the C++ standard containers and when to pick each, plus a runnable example using std::sort, binary search, std::erase_if and std::unordered_map.
Reading and writing CSV files in C++ with ifstream and ofstreamRead a CSV file line by line in C++, split fields correctly (including quoted commas), add a computed column and write the result to a new file.
C++ performance optimization: compiler flags, profiling, memory and cache-friendly codePractical ways to make C++ faster: optimization flags and PGO, profiling before changing code, avoiding allocations, cache-friendly layouts and parallel algorithms.
Pointers and references in C++: syntax, differences and when to use eachHow C++ pointers and references work, how they differ (null, reseating, syntax), and when to use each for parameters, optional values and ownership.
C++ interoperability with C, Python and Java: extern "C", pybind11, JNI and SWIGHow to call C++ from C, Python and Java using extern "C" wrappers, ctypes, pybind11, JNI, JNA, SWIG and Java's Foreign Function and Memory API.
Calling a JSON API with Drogon's HTTP client in C++A small C++ program that uses Drogon's HttpClient to fetch a random quote from the Tronald Dump API, with error handling and a clean shutdown.
C++ smart pointers: unique_ptr, shared_ptr and weak_ptr instead of new and deleteWhy raw new/delete is error-prone in C++ and how std::unique_ptr, std::shared_ptr and std::weak_ptr express ownership, with working examples.
Calling C++ from Swift: native interop and Objective-C++ wrappersHow to use C++ code from Swift: direct C++ interoperability since Swift 5.9 with SwiftPM or Xcode, and the older Objective-C++ wrapper approach.
Transcoding a video to H.264 with the FFmpeg libraries in C++A complete C++ program that uses FFmpeg's libavformat and libavcodec to decode a video stream and re-encode it to H.264 in an MP4 file.
Calling C and C++ code from Go with cgo and SWIGCall C functions from Go with cgo, wrap C++ behind an extern "C" shim, and let the go tool run SWIG for you to bind a C++ class.
C++ exceptions: throwing, catching and writing exception-safe codeHow C++ exceptions work: the standard exception hierarchy, throwing and catching, custom exception types, RAII, noexcept, and when std::expected fits better.
C++ libraries for game development: graphics, physics, audio and networkingGraphics, physics, audio and networking libraries for C++ games: OpenGL, Vulkan, Ogre, Bullet, Jolt, Box2D, OpenAL Soft, FMOD, ENet and RakNet, with their current status.
C++ libraries for scientific computing: Eigen, Armadillo, Boost.Math, Ceres, FFTW and moreA short tour of C++ (and C) libraries for scientific computing, covering what each one is for, its licence, and an Eigen example that solves a linear system.
C++ function objects (functors): operator(), standard functors and lambdasHow C++ function objects work, why algorithms like std::sort can inline them, and how to use the standard functors and lambdas in their place.
Image processing in the browser with WebAssembly: a Gaussian blur with OpenCV.jsUse OpenCV.js, OpenCV compiled to WebAssembly, to blur an image in the browser, plus where Wasm helps for audio and video and what it costs.
C++ multithreading basics: std::thread, mutexes, condition variables and std::asyncStarting threads in standard C++, protecting shared data with mutexes and atomics, a working producer-consumer queue, and std::async and std::jthread.
C++ debugging and profiling tools: GDB, LLDB, sanitizers, Valgrind, perf and VTuneWhich C++ debuggers and profilers to reach for on Linux, macOS and Windows, what each is good at, and the commands to get started with them.
C++ lambda expressions: syntax, captures, and generic lambdasHow C++ lambdas work, covering syntax, value and reference captures, init captures, mutable and generic lambdas, explicit return types, and use with STL algorithms.
C++ templates: function templates, class templates, specialization and variadic templatesHow C++ function and class templates work, when to specialise them, variadic templates with fold expressions, and constraining templates with C++20 concepts.
C++ virtual functions and runtime polymorphismHow virtual functions give C++ runtime polymorphism, why base classes need virtual destructors, abstract classes, and traps like slicing.
Modern C++ features from C++11 to C++20, with examplesThe C++11, C++14, C++17 and C++20 features you'll use most, from auto, lambdas and move semantics to concepts, ranges and coroutines, each with a compilable example.
Getting started with Boost in C++: installing, linking and a first exampleHow to install Boost, which libraries are header-only and which need linking, a tour of Asio, Regex, Filesystem, Spirit and Graph, and a Tokenizer example.
OpenCV in C++: images, video, and object detection with the dnn moduleSet up OpenCV with CMake, then load, resize, crop and rotate images, play video with VideoCapture, and run a MobileNet-SSD detector in C++.
Dear ImGui in C++: a minimal GLFW and OpenGL 3 setupWhat immediate mode GUIs are, which Dear ImGui files to add to your project, and a complete GLFW + OpenGL 3 program with a window, button and slider.
FFmpeg in C++: decoding video frames and remuxing files with libav*Use FFmpeg's libavformat and libavcodec from C++ to decode video frames and copy streams into a new container, using the current send/receive API.
OpenSSL 3 in C++: RSA keys, signatures, and AES-256-GCM encryptionUse OpenSSL 3's EVP API from C++ to generate an RSA key, sign and verify a message with SHA-256, and encrypt data with AES-256-GCM, tag check included.
POCO C++ Libraries: an HTTP client, threads, and directory listingInstall the POCO C++ Libraries with vcpkg or Conan, link them with CMake, and write an HTTP GET client, a threaded worker, and a recursive directory listing.
C++ Standard Library basics: vector, list, map, algorithms and file I/OShort, runnable examples of std::vector, std::list, std::map, std::sort, std::find, std::transform and file streams, plus the gotchas that trip people up.
© 2026 David Li · Home · Blog · RSS ·Classic site · Built with Astro, Starlight and three.js · Logos:Font Awesome Free (CC BY 4.0)