Enum Class Improvements for C++17, C++20 and C++23 -- Bartlomiej Filipek
The evolution of the C++ language continues to bring powerful features that enhance code safety, readability, and maintainability. Among these improvements, we got changes and additions to enum class functionalities across C++17, C++20, and C++23. In this blog post, we’ll explore these advancements, focusing on initialization improvements in C++17, the introduction of the using enum keyword in C++20, and the std::to_underlying utility in C++23.
Enum Class Improvements for C++17, C++20 and C++23
by Bartlomiej Filipek
From the article:
Before diving into the enhancements, let’s briefly recap what enum class is. An enum class (scoped enumeration) provides a type-safe way of defining a set of named constants. Unlike traditional (unscoped) enums, enum class does not implicitly convert to integers or other types, preventing accidental misuse. Here’s a basic example:
#include <iostream>
enum class Color {
Red,
Green,
Blue
};
int main() {
Color color = Color::Red;
if (color == Color::Red)
std::cout << "The color is red.\n";
color = Color::Blue;
if (color == Color::Blue)
std::cout << "The color is blue.\n";
// std::cout << color; // error, no matching << operator
// int i = color; // error: cannot convert
}

The C++ language has two large categories of “don’t do that” known as undefined behavior and ill-formed program. What’s the difference?
Working with the filesystem can be a daunting task, but it doesn’t have to be. In this post, I’ll walk you through some of the most common filesystem operations using the powerful features introduced in C++17, as well as some new enhancements in C++20/23. Whether you’re creating directories, copying files, or managing permissions, these examples will help you understand and efficiently utilize the 