Insert issue with arrays

前端 未结 1 482
有刺的猬
有刺的猬 2021-01-26 05:29

Iam new to vc++.Iam trying to write program using map::insert function in below code

int _tmain(int argc, _TCHAR* argv[]){
int arr[3] ={0,1,2};
map 

        
相关标签:
1条回答
  • 2021-01-26 06:04

    storing C array is not a good idea, use std::array instead.

    using Arr = std::array<int, 3>;
    Arr arr = { 0, 1, 2 };
    std::map <int, Arr> mymap;
    auto it = mymap.begin( );
    mymap.insert( it, std::make_pair( 1, arr ) );
    
    0 讨论(0)
提交回复
热议问题