api: YAML JSON TOON Database
version: 1.0.0
format: yaml
dataset:
  id: 387
  slug: cpp-modern-features
  title: Modern C++ Features (C++11 through C++23)
  description: "Modern C++ features from C++11 to C++23: smart pointers, move semantics, lambdas, concepts, ranges, coroutines, and modules."
  category: Programming Languages
  category_slug: programming-languages
  tags: cpp,c++,modern-cpp,smart-pointers,lambdas,concepts,ranges,coroutines
  view_count: 1
  created_at: 1781275786
  updated_at: 1781275786
data:
  features:
    - name: Smart Pointers
      standard: C++11
      description: "Automatic memory management: unique_ptr (exclusive ownership), shared_ptr (reference counting), weak_ptr (non-owning observer)"
      example: "auto ptr = std::make_unique<Foo>();"
    - name: Move Semantics
      standard: C++11
      description: "Transfer resources instead of copying: rvalue references (&&), std::move, move constructors/assignment operators"
      example: "std::vector<int> v2 = std::move(v1);"
    - name: Lambda Expressions
      standard: C++11
      description: Anonymous functions with capture lists, mutable lambdas, generic lambdas (auto params in C++14)
      example: auto add = [capture](int x) { return x + offset; };
    - name: auto Type Deduction
      standard: C++11
      description: Compiler deduces type from initializer expression, reduces verbosity
      example: auto it = map.find(key); auto [key, val] = *it;
    - name: constexpr
      standard: C++11/14/17
      description: "Compile-time evaluation: C++11 (limited), C++14 (loops/branches), C++17 (if constexpr)"
      example: "constexpr int factorial(int n) { return n <= 1 ? 1 : n * factorial(n-1); }"
    - name: Range-based for
      standard: C++11
      description: Simplified iteration over containers and initializer lists
      example: "for (const auto& item : container) { /* ... */ }"
    - name: Structured Bindings
      standard: C++17
      description: Decompose tuples, pairs, and structs into named variables
      example: auto [name, age] = getPerson();
    - name: "std::optional"
      standard: C++17
      description: Type-safe alternative to nullable pointers, represents optional values
      example: "std::optional<std::string> findUser(int id);"
    - name: Concepts
      standard: C++20
      description: Named compile-time constraints on template parameters, better error messages
      example: "template<std::integral T> T add(T a, T b) { return a + b; }"
    - name: Ranges
      standard: C++20
      description: "Composable algorithms operating on ranges: views (lazy), actions (eager), pipe operator"
      example: "auto evens = numbers | std::views::filter([](int n){ return n%2==0; }) | std::views::take(10);"
    - name: Coroutines
      standard: C++20
      description: "Functions that can suspend and resume: co_await, co_yield, co_return"
      example: Generator<int> fib() { co_yield 0; co_yield 1; /* ... */ }
    - name: Modules
      standard: C++20
      description: "Replace #include with import/export for faster compilation and better encapsulation"
      example: import std; export module mylib;
