Modern C++ Features (C++11 through C++23)
Modern C++ features from C++11 to C++23: smart pointers, move semantics, lambdas, concepts, ranges, coroutines, and modules.
Modern C++ features from C++11 to C++23: smart pointers, move semantics, lambdas, concepts, ranges, coroutines, and modules.
| Name | Standard | Description | Example |
|---|---|---|---|
| Smart Pointers | C++11 | Automatic memory management: unique_ptr (exclusive ownership), shared_ptr (reference counting), weak_ptr (non-owning observer) | auto ptr = std::make_unique<Foo>(); |
| Move Semantics | C++11 | Transfer resources instead of copying: rvalue references (&&), std::move, move constructors/assignment operators | std::vector<int> v2 = std::move(v1); |
| Lambda Expressions | C++11 | Anonymous functions with capture lists, mutable lambdas, generic lambdas (auto params in C++14) | auto add = [capture](int x) { return x + offset; }; |
| auto Type Deduction | C++11 | Compiler deduces type from initializer expression, reduces verbosity | auto it = map.find(key); auto [key, val] = *it; |
| constexpr | C++11/14/17 | Compile-time evaluation: C++11 (limited), C++14 (loops/branches), C++17 (if constexpr) | constexpr int factorial(int n) { return n <= 1 ? 1 : n * factorial(n-1); } |
| Range-based for | C++11 | Simplified iteration over containers and initializer lists | for (const auto& item : container) { /* ... */ } |
| Structured Bindings | C++17 | Decompose tuples, pairs, and structs into named variables | auto [name, age] = getPerson(); |
| std::optional | C++17 | Type-safe alternative to nullable pointers, represents optional values | std::optional<std::string> findUser(int id); |
| Concepts | C++20 | Named compile-time constraints on template parameters, better error messages | template<std::integral T> T add(T a, T b) { return a + b; } |
| Ranges | C++20 | Composable algorithms operating on ranges: views (lazy), actions (eager), pipe operator | auto evens = numbers | std::views::filter([](int n){ return n%2==0; }) | std::views::take(10); |
| Coroutines | C++20 | Functions that can suspend and resume: co_await, co_yield, co_return | Generator<int> fib() { co_yield 0; co_yield 1; /* ... */ } |
| Modules | C++20 | Replace #include with import/export for faster compilation and better encapsulation | import std; export module mylib; |
The static files are identical to what the API returns, but with no rate limit and no server round trip. Use the API when you want a query and a content type; use the files when you want to cache one document.
curl "https://yjtoon.com/api/dataset/cpp-modern-features?format=toon"
const res = await fetch( "https://yjtoon.com/static-data/dataset/cpp-modern-features.toon" ); const toon = await res.text();
Rate limit: 120 requests per minute per IP, no key and no signup. API reference →