C++11 Fun with initializer lists, arrays, and enumerations

后端 未结 5 1747
天涯浪人
天涯浪人 2021-01-03 03:27

Background

C++11 initializer lists can be used to initialize vectors and arrays with argument passing to constructors.

I have a piece of code below

5条回答
  •  [愿得一人]
    2021-01-03 04:01

    There isn't an automatic way to do this using initializer lists, but you could do it algorithmically if you know the first and last values of the enum by just using a for loop to insert the values.

提交回复
热议问题