This code is just a prototype, how I'm expecting my output..
My program should be able to insert char by char to particular index of vector;
This program works fine for vector<vector<int>>
#include<bits/stdc++.h>
using namespace std;
int main()
{
vector<vector<string>>v;
for(auto i=0;i<5;i++)
v.emplace_back(vector<string>());
v[0].emplace_back('z');
v[1].emplace_back('r');
v[0].emplace_back('x');
v[1].emplace_back('g');
for(auto i:v){
for(auto j:i)
cout<<j<<" ";cout<<endl;}
return 0;
}
My Expected output:
z x
r g
Error:
no matching function for call to ‘std::__cxx11::basic_string<char>::basic_string(char)’ { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
Aucun commentaire:
Enregistrer un commentaire