Home > Back-end >  Ask!!!!! Use a vector map nested, why to initialization error ahhh!
Ask!!!!! Use a vector map nested, why to initialization error ahhh!

Time:04-16


Really want to do... Want a key to store multiple value, think of another way, bosses for help!!!!! 1

CodePudding user response:

 
Map Level;//this?

CodePudding user response:

 # include & lt; Vector> 
# include & lt; Map>
# include & lt; Iostream>
using namespace std;
Int main () {
Vector Vi0;
Vector Vi1;
Map * & gt; Mipv;

Vi0. Push_back (0);
Vi0. Push_back (1);

Vi1. Push_back (2);
Vi1. Push_back (3);

Mipv [0]=& amp; Vi0;
Mipv [1]=& amp; Vi1;

Vector * pvi.
Pvi=mipv [0];
cout<* (pvi) [0] cout<* (pvi) [1] Pvi=mipv [1];
cout<* (pvi) [0] cout<* (pvi) [1]
return 0;
}

CodePudding user response:

The following code is no problem, you go wrong because certain other
 # include & lt; Map> 
# include & lt; Vector>
using namespace std;

Int main ()
{
Map m;
Vector V.
Valerie plame ush_back (1);
Valerie plame ush_back (2);
M [0]=v;
}

CodePudding user response:

reference 1st floor flying_music response:
 
Map Level;//this?


I remember now & gt;>> Like all can, don't know he version of c + + compiler

CodePudding user response:

references 4 floor panda! Reply:
Quote: refer to 1st floor flying_music response:
 
Map Level;//this?


I remember now & gt;>> As can be, don't know he used c + + compiler version

After September 11 is ok

CodePudding user response:

 # include & lt; Vector> 
# include & lt; Map>
# include & lt; Iostream>
using namespace std;
Int main () {
Vector Vi0;
Vector Vi1;
Map Mipv;

Vi0. Push_back (0);
Vi0. Push_back (1);

Vi1. Push_back (2);
Vi1. Push_back (3);

Mipv [0]=vi0;
Mipv [1]=vi1;

Vector vi;
Vi=mipv [0];
coutcoutVi=mipv [1];
coutcout
return 0;
}
  • Related