Template array initialization with a list of values

前端 未结 5 1227
一向
一向 2021-01-14 14:14

In standard c++ we can write :

int myArray[5] = {12, 54, 95, 1, 56};

I would like to write the same thing with a template :



        
5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-14 14:44

    This becomes possible in C++0x using initializer lists. Currently, there is no way to do this.

    The closest you can get without this is to use Boost.Assign.

提交回复
热议问题