From 4526350199923651160
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f78e5,b83a4267f4ac775
X-Google-Attributes: gidf78e5,public
From: jkanze@otelo.ibmmail.com
Subject: Re: string/cow/algorithm
Date: 1998/08/13
Message-ID: <6quuui$tu0$1@nnrp1.dejanews.com>#1/1
X-Deja-AN: 380798906
X-NNTP-Posting-Host: 195.75.80.129
Content-Transfer-Encoding: quoted-printable
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <6qfr41$oue$1@pigpen.csrlink.net> <6qg3ld$r7o$1@shell7.ba.best.com> <6qgs0r$92e$1@pigpen.csrlink.net> <35ccc2b4.832003@news3.ibm.net> <6qn19u$sb0$1@pigpen.csrlink.net> <6qnj99$h2l$1@nnrp1.dejanews.com> <6qo3fq$dum$1@pigpen.csrlink.net>
X-UID: 0000000001
X-Status: $$$T
Content-Type: text/plain; charset=iso-8859-1
X-Http-User-Agent: Mozilla/4.03 [de] (WinNT; I)
Organization: Deja News - The Leader in Internet Discussion
X-Article-Creation-Date: Thu Aug 13 14:58:26 1998 GMT
Mime-Version: 1.0
X-MIME-Autoconverted: from 8bit to quoted-printable by earth.sun.com id HAA11473
Newsgroups: comp.std.c++
Originator: clamage@taumet


In article <6qo3fq$dum$1@pigpen.csrlink.net>,
  jpotter@falcon.lhup.edu (John Potter) wrote:
>
> The original question was the conformance of a string class which
> sorted the original string when a copy was sorted.  The answer was
> that the FDIS is different from the CD2 and the implementation is not
> conformant.  A following question asked about making a cow string
> class conformant.
>
> On writing a standard conformant string class.
>
> AllanW@my-dejanews.com wrote:
>
> : I think that using a proxy class should handle this fairly well
>
> Sorry.  Unless this has also changed from the CD2, it is required that
> string::operator[] return a T& and that string::iterator::operator*
> return a T&.  Proxies are expressly forbidden by these requirements.
>
> Perhaps one of the reasons that SGI decided against reference counting
> for their string as you indicated.

I thing that the problem was more linked with thread safety.  However, th=
e
requirement you just mentioned does make it more difficult (and less of
a win).

> But Mark wants to write a standard conformant reference counted cow
> string class.  Let's not tell him not to do it but offer some help in
> doing it.
>
> My interest was in what I can expect from a conformant string and that
> has been satisfied.  However, I am interested in any standard
> conformant techniques that may help Mark do a better job than the
> little relayed information which I posted.  Or maybe there are no
> better techniques.

I didn't see what has been posted, but basically, you have to isolate
(unshare) and lock (prevent further sharing) anytime you take non-const
reference or iterator.  The lock must be maintained until the next action
which invalidates the iterator.

--
James Kanze    +33 (0)1 39 23 84 71    mailto: kanze@gabi-soft.fr
        +49 (0)69 66 45 33 10    mailto: jkanze@otelo.ibmmail.com
GABI Software, 22 rue Jacques-Lemercier, 78000 Versailles, France
Conseils en informatique orient=E9e objet --
              -- Beratung in objektorientierter Datenverarbeitung

-----=3D=3D Posted via Deja News, The Leader in Internet Discussion =3D=3D=
-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


[ 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              ]




