[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c++

vector of map

raj s

9/10/2008 9:07:00 AM

How to create a vector consisting map as the element say like this
vector<map<int,char>>
3 Answers

anon

9/10/2008 9:14:00 AM

0

raj s wrote:
> How to create a vector consisting map as the element say like this
> vector<map<int,char>>

#include <map>
#include <vector>

int main()
{
std::vector< std::map< int, char > > a;

std::map< int, char > b;
a.push_back( b );
}

aman.c++

9/10/2008 10:28:00 AM

0

On Sep 10, 2:07 pm, raj s <yesr...@gmail.com> wrote:
> How to create a vector consisting map as the element say like this
> vector<map<int,char>>

Assuming you've provided the appropriate #include and namespace in
your program, your current compiler would be complaining about the >>
brackets.
You just need to provide a space between them like so:
vector<map<int,char> >

However if you pick a compiler that is C++0x / TR1 compliant yours
(vector<map<int,char>>) would be valid syntax.

regards,
Aman Angrish.

Pete Becker

9/10/2008 12:02:00 PM

0

On 2008-09-10 06:28:06 -0400, "aman.c++" <aman.cpp@gmail.com> said:

>
> However if you pick a compiler that is C++0x / TR1 compliant yours
> (vector<map<int,char>>) would be valid syntax.

Just C++0x. TR1 didn't change the syntax for templates.

--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)