How can I use an array as map value?

后端 未结 8 1476
太阳男子
太阳男子 2020-12-01 08:04

I\'m trying to create a map, where the key is an int, and the value is an array as follows:

int red[3]   = {1,0,0};
int green[3] = {0,1,0};
int b         


        
8条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 08:42

    Arrays are not first class constructs in C++. They are not Copy Constructible nor Assignable which are requirements for values of std::map. You can use boost::array or std::vector.

提交回复
热议问题