cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/2003/01/04/09:46:21

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 17:25:38 +0300
Organization: VoronezhSvyazInform ISP News Server
Lines: 56
Message-ID: <av6qt3$1ku1$1@serv3.vsi.ru>
References: <av6mgq$cjiq1$1 AT ID-79865 DOT news DOT dfncis DOT de> <av6n2q$1ct4$1 AT serv3 DOT vsi DOT ru> <av6p7v$ciff4$1 AT ID-79865 DOT news DOT dfncis DOT de>
NNTP-Posting-Host: 62.16.120.98
X-Trace: serv3.vsi.ru 1041690339 54209 62.16.120.98 (4 Jan 2003 14:25:39 GMT)
X-Complaints-To: postmaster AT vsi DOT ru
NNTP-Posting-Date: Sat, 4 Jan 2003 14:25:39 +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:av6p7v$ciff4$1 AT ID-79865 DOT news DOT dfncis DOT de...
> "Ruslan Abdikeev" <ruslan AT vr1 DOT spb DOT ru> wrote in message news:av6n2q$1ct4$1 AT serv3 DOT vsi DOT ru...
> > "Alex Vinokur" <alexvn AT bigfoot DOT com> wrote in message news:av6mgq$cjiq1$1 AT ID-79865 DOT news DOT dfncis DOT de...
> [snip]
> > >
> > > int main ()
> > > {
> > >   basic_string<string> bs1;
> >
> > I'm sure you were intended basic_string<char> bs1;
>
> I intended exactly basic_string<string> bs1;
>
> basic_string<T> is a template class.
> So, I would like to basic_string<string>, basic_string<int>, basic_string<Any_Class>
>

Hence, my reasoning:

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

It is just impossible, because conforming specialisation of basic_string<XXX>
cannot be a POD.

   "This clause describes components for manipulating sequences of "characters",
    where characters may be of any POD (3.9) type." (21/1)

   "The header <string> defines a basic_string class template and its traits that can
    handle all char-like (clause 21) template arguments with several function
    signatures for manipulating varying-length sequences of char-like objects." (21.2/1)

   "For a char-like type charT, the template class basic_string [...]" (21.3/1)

basic_string<XXX> shall contain constructors, copy constructor,
destructor and assignment operators (21.3/6).

   "A POD-struct is an aggregate class that [...] has no user-defined copy assignment
    operator and no user-defined destructor." (9/4)

   "An aggregate is an array or a class (clause 9) with no user-defined constructors (12.1),
    no private or protected non-static members (clause 11), no base classes (clause 10),
    and no virtual functions (10.3)." (8.5.1/1)

HTH,

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