delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/01/04/08:46:04

From: "Ruslan Abdikeev" <ruslan AT vr1 DOT spb DOT ru>
Newsgroups: comp.lang.c++,comp.os.msdos.djgpp,gnu.g++.help
Subject: Re: Problem with basic_string
Date: Sat, 4 Jan 2003 16:20:25 +0300
Organization: VoronezhSvyazInform ISP News Server
Lines: 34
Message-ID: <av6n2q$1ct4$1@serv3.vsi.ru>
References: <av6mgq$cjiq1$1 AT ID-79865 DOT news DOT dfncis DOT de>
NNTP-Posting-Host: 62.16.120.98
X-Trace: serv3.vsi.ru 1041686426 45988 62.16.120.98 (4 Jan 2003 13:20:26 GMT)
X-Complaints-To: postmaster AT vsi DOT ru
NNTP-Posting-Date: Sat, 4 Jan 2003 13:20:26 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Alex Vinokur" <alexvn AT bigfoot DOT com> wrote in message news:av6mgq$cjiq1$1 AT ID-79865 DOT news DOT dfncis DOT de...
>
> I have some problem with basic_string.
> What is wrong ?
>
> // File t1.cpp
> #include <string>
> using namespace std;
>
> int main ()
> {
>   basic_string<string> bs1;

I'm sure you were intended basic_string<char> bs1;

You cannot use basic_string<string>, because
std::string is NOT a char-like type (which shall be POD).

>   bs1 += "ABC";

Actually, if it was possible to instantiate basic_string<string>,
it would be an equivalent to
     bs1 += string("ABC");
that is, for ordinary strings (basic_string<char>), an equivalent to
     bs1 += 'a';

Hope it helps,
Sincerely,

Ruslan Abdikeev
Brainbench MVP for Visual C++
http://www.brainbench.com


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019