Topic: proposed standard string class


Author: matt@physics16.berkeley.edu (Matt Austern)
Date: 22 Jul 1994 00:27:51 GMT
Raw View
I understand the the standardization committee has approved a string
class as part of the forthcoming ANSI/ISO C++ standard.  Does anyone
know where I can find more details about that string class?

The main reason I ask is that Borland C++ 4.0 comes with a string
class; they say that it is based on this standard.  Unfortunately,
some of the features in their string class are clearly vendor-
specific extensions, and I can't find anything in the documentation
telling me which is which.  I'd like to write portable code, so I'd
like to avoid any features that aren't part of the proposed standard.

Thanks!
--
       Matt Austern                       "Se non e vero, e ben trovato"




Author: palmer@centerline.com (Mark Palmer)
Date: 22 Jul 1994 17:44:40 GMT
Raw View
In article 94Jul21172751@physics16.berkeley.edu, matt@physics16.berkeley.edu (Matt Austern) writes:
>I understand the the standardization committee has approved a string
>class as part of the forthcoming ANSI/ISO C++ standard.  Does anyone
>know where I can find more details about that string class?
>
>The main reason I ask is that Borland C++ 4.0 comes with a string
>class; they say that it is based on this standard.  Unfortunately,
>some of the features in their string class are clearly vendor-
>specific extensions, and I can't find anything in the documentation
>telling me which is which.  I'd like to write portable code, so I'd
>like to avoid any features that aren't part of the proposed standard.
>
>Thanks!
>--
>       Matt Austern                       "Se non e vero, e ben trovato"


Over a year ago a draft of this string class was available from somewhere.  Does anyone know where
I can get a source code copy of the approved class?  I'm pretty much looking for a place to ftp it
from.

Thanks.

-Mark




Author: maxtal@physics.su.OZ.AU (John Max Skaller)
Date: Sat, 23 Jul 1994 09:03:49 GMT
Raw View
In article <MATT.94Jul21172751@physics16.berkeley.edu> matt@physics.berkeley.edu writes:
>I understand the the standardization committee has approved a string
>class as part of the forthcoming ANSI/ISO C++ standard.  Does anyone
>know where I can find more details about that string class?
>
>The main reason I ask is that Borland C++ 4.0 comes with a string
>class; they say that it is based on this standard.  Unfortunately,
>some of the features in their string class are clearly vendor-
>specific extensions, and I can't find anything in the documentation
>telling me which is which.  I'd like to write portable code, so I'd
>like to avoid any features that aren't part of the proposed standard.

 Until we have a Standard, dont assume too much.
I think you can safely:

 default construct
 copy construct
 construct from C-string (null terminated char* thingo)
 assign
 assign from C-string
 concatenate using +
 subscript using []

To get the length, or do most other operation I recommend
you write your own functions. For example:

 int my_strlen(string s) { return s.length(); }

so that if the member 'length' gets changed to be 'no_of_chars'
you only have to make a change in one routine -- and one
you have control over.

--
        JOHN (MAX) SKALLER,         INTERNET:maxtal@suphys.physics.su.oz.au
 Maxtal Pty Ltd,      CSERVE:10236.1703
        6 MacKay St ASHFIELD,     Mem: SA IT/9/22,SC22/WG21
        NSW 2131, AUSTRALIA