Mail Archives: djgpp/2003/01/04/09:46:21
"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 -