What’s New in C++23 - Sy Brand - CppCon 2022

Explore the latest features and improvements in C++23, including flexible printing, improved coroutines, and enhanced error handling, with Sy Brand's expert insights at CppCon 2022.

Key takeaways
  • New features in C++23:
    • std::print allows for more flexible printing with format specifiers
    • std::generator is a new coroutine feature
    • std::span is improved with operator overloading
    • std::views have new functionality, including zip, transform, and chunk
    • std::optional and std::expected have improved APIs
    • std::multiple_view is a new feature for working with multidimensional arrays
    • std::byte_swap is a new function for swapping byte order
    • std::attribute allows for adding attributes to lambdas
    • std::std::stack_trace is a new feature for debugging
  • Coroutines in C++23:
    • std::generator is a coroutine that can be resumed and paused
    • Coroutines have improved language support
  • Memory management:
    • std::unique_ptr is used as a smart pointer
    • std::shared_ptr is used for shared ownership
  • Code organization:
    • Code can be organized into modules using import and std modules
    • std::compat module imports C API names into the global namespace
  • Error handling:
    • std::optional and std::expected have improved error handling
    • std::expected allows for more detailed error information