comp.lang.ada
 help / color / mirror / Atom feed
From: Jeff Carter <jrcarter@acm.org>
Subject: Re: ada.strings.unbounded "free" and "String_Access"
Date: 2000/03/08
Date: 2000-03-08T00:00:00+00:00	[thread overview]
Message-ID: <38C6D4DE.D482DA0C@acm.org> (raw)
In-Reply-To: 38c6de74@eeyore.callnetuk.com

Nick Roberts wrote:
> 
> The purpose is simply this: if Unbounded_String doesn't give you quite
> enough flexibility in certain parts of your code (e.g. you need more speed),
> you can use the type String_Access instead.
> 
> You may well employ the following strategy: convert value(s) of type
> Unbounded_String to type String_Access (using the To_String function and the
> 'new' allocator); operate on the String_Access object(s) as required;
> convert the result(s) back to type Unbounded_String (using the
> To_Unbounded_String function).

You don't need an access type for this (in Ada, you rarely need access
types at all). You can simply operate on the String returned by
To_String:

declare
   Value : [constant] String := To_String (Unbounded_Value);
begin
   -- Operate with/on Value
   Unbounded_Value := To_Unbounded_String (Value); -- if needed
end;

-- 
Jeff Carter
"You couldn't catch clap in a brothel, silly English K...niggets."
Monty Python & the Holy Grail




  reply	other threads:[~2000-03-08  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-07  0:00 ada.strings.unbounded "free" and "String_Access" Al Johnston
2000-03-08  0:00 ` Nick Roberts
2000-03-08  0:00   ` Jeff Carter [this message]
2000-03-10  0:00     ` Ted Dennison
2000-03-11  0:00   ` Robert A Duff
2000-03-13  0:00     ` Robert Dewar
2000-03-08  0:00 ` Robert A Duff
2000-03-09  0:00 ` Al Johnston
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox