Character Array as a value in C++ map

后端 未结 4 1233
一个人的身影
一个人的身影 2021-01-05 13:38

I want to define something like

Map myMap;

The above declaration is accepted by c++ compiler and no error is thrown bu

4条回答
  •  -上瘾入骨i
    2021-01-05 14:39

    I understand your performance requirements (since I do similar things too), but using character arrays in that way is rather unsafe.

    If you have access to C++11 you could use std::array. Then you could define your map like:

    map > myMap;
    

    If you cannot use C++11, then you could use boost::array.

提交回复
热议问题