From -1112856613755005861
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,dde8aef4d690b866
X-Google-Attributes: gidf78e5,public
From: Francis Glassborow <francis@robinton.demon.co.uk>
Subject: Re: Problem with std::make_pair?
Date: 1999/08/02
Message-ID: <PPVmfCA3WMp3EwtJ@robinton.demon.co.uk>#1/1
X-Deja-AN: 508033308
Approved: Valentin Bonnard <bonnard@clipper.ens.fr>
References: <zdv176.933510565@zam229>
X-Original-Date: Sun, 1 Aug 1999 23:09:59 +0100
Organization: Southfield Microcomputer SS
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUAN6XaqqwEuYhIxRhxAQGregH/QCrKHG4Jt1MBtFgekSF3l0W3qIFyHHfh 1hA2N4QZ0VU2Z6VHz9f8vQrK6hopeUHJ39n3BOypWG7/Obh2JG9eSg== =Qw0D
Mime-Version: 1.0
Reply-To: Francis Glassborow <francisG@robinton.demon.co.uk>
Newsgroups: comp.std.c++

In article <zdv176.933510565@zam229>, B.Mohr <zdv176@zam229.zam.kfa-
juelich.de> writes
>  int main() {
>    std::pair<std::string, int> p("A", 1);        /*1*/
>    p = std::make_pair("B", 2);                   /*2*/
>    p = std::make_pair(std::string("B"), 2);      /*3*/
>  }
I am trying to work out why the fact that string literals are of type
array of const char has anything to do with this.  You have defined p to
be of type pair<std::string, int>  then you make a pair of type <(const
char)[2], int> and expect them to be assignable.  Why should they be,
with or without the const qualification?

Francis Glassborow      Journal Editor, Association of C & C++ Users
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]



