From fc3e9b8203a8b10b571e456e1760e9c3266c2ecd Mon Sep 17 00:00:00 2001 From: Anthony Calandra Date: Fri, 24 Mar 2017 23:20:04 -0400 Subject: [PATCH] Direct list initialization of enums. --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index bb41eea..d7f833b 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ C++17 includes the following new language features: - [selection statements with initializer](#selection-statements-with-initializer) - [constexpr if](#constexpr-if) - [utf-8 character literals](#utf-8-character-literals) +- [direct-list-initialization of enums](#direct-list-initialization-of-enums) C++17 includes the following new library features: - [std::variant](#stdvariant) @@ -266,6 +267,16 @@ A character literal that begins with `u8` is a character literal of type `char`. char x = u8'x'; ``` +### Direct List Initialization of Enums +Enums can now be initialized using braced syntax. +```c++ +enum byte : unsigned char {}; +byte b{0}; // OK +byte c{-1}; // ERROR +byte d = byte{1}; // OK +byte e = byte{256}; // ERROR +``` + ## C++17 Library Features ### std::variant