Migrate nullable C++ pointer returns to std::optional<T> in C++17
Replace nullable pointer returns with C++17 std::optional so callers must handle absence and avoid null-dereference bugs.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Replace nullable pointer returns with C++17 std::optional so callers must handle absence and avoid null-dereference bugs.
Learn how std::optional in C++17 gives inline, type‑safe nullable returns, see a worked example, and understand the trade‑offs before adopting it in your codebase.
Stop treating filesystem paths as plain strings. C++17's std::filesystem offers portable path objects and directory iteration without platform-specific code.
Passing const std::string& to read-only functions forces heap allocations from const char* callers. std::string_view removes that cost, but its non-owning lifetime semantics demand strict discipline.
Stop fighting with slashes and backslashes. Learn how C++17 std::filesystem provides a type-safe, portable way to handle paths and recursive directory traversal.
Decide whether to use std::optional or a sentinel value for representing missing data in C++, weighing safety, storage, and domain constraints.