C++20 and C++23 Highlights
C++20 and C++23 Highlights
Key modern language and library features worth adopting in current codebases.
C++20 and C++23 Highlights
Key modern language and library features worth adopting in current codebases.
consteval, constinit<=>)std::spanstd::jthreadstd::formatstd::source_locationstd::expectedstd::printstd::mdspanstd::optionaltemplate <typename T>
concept Incrementable = requires(T x) {
++x;
};
std::spanvoid process(std::span<const int> values);
std::span, and ranges early.std::optional<int> maybe_port;
std::variant<int, std::string> result;
std::expected<std::string, Error> loaded_name;
std::optional<T>: a value may be absent.std::variant<...>: one of several closed alternatives.std::expected<T, E>: either a value or a typed error.export module math;
export int add(int a, int b) { return a + b; }
task<int> compute() {
co_return 42;
}
[[nodiscard]] for error-prone APIs.<=> for value objects with natural ordering.std::span, std::string_view, std::expected, and std::jthread in new code when they match the design.