This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: a compiled error
- From: Oscar Fuentes <ofv at wanadoo dot es>
- To: "yugliu" <yugliu at 21cn dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 01 Jul 2002 03:15:02 +0200
- Subject: Re: a compiled error
- References: <afh97o$45r$1@main.gmane.org>
"yugliu" <yugliu@21cn.com> writes:
> hi , I catch the error when I used the function make_pair .
> my statement :
>
> multimap<int,string> m;
> m.insert(make_pair(2,"a"));
>
> my error:
>
> /usr/include/g++-3/stl_pair.h: In method `pair<int,char[2]>::pair(const int
> &, const char (&)[2])':
> /usr/include/g++-3/stl_pair.h:68: instantiated from `make_pair<int,
> char[2]>(const int &, const char (&)[2])'
> hello.cc:101: instantiated from here
> /usr/include/g++-3/stl_pair.h:44: incompatible types in assignment of `const
> char[2]' to `char[2]'
This:
#include <map>
#include <string>
int main() {
std::multimap<int, std::string> m;
m.insert( std::make_pair(2, "a") );
}
builds ok with gcc 3.1.
> How to solution !
Try upgrading you compiler or with
m.insert( make_pair(2, string("a")) );
--
Oscar