From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Need a way to convert a constant to a variable
Date: Sat, 5 Aug 2017 17:41:20 +0200
Date: 2017-08-05T17:41:20+02:00 [thread overview]
Message-ID: <om4onb$evc$1@dont-email.me> (raw)
In-Reply-To: <om4hu2$1eb2$1@gioia.aioe.org>
On 08/05/2017 03:41 PM, Victor Porton wrote:
>
> Write a function with an "in" indefinite holder with a string, return
> chars_ptr corresponding to the string.
Your requirements are for an indefinite holder with a string, but your attempted
solution is for an indefinite holder with a char_array. I will assume you meant
an indefinite holder with a char_array.
> It looks like there is no solution of this in Ada 2012 :-(
with Ada.Containers.Indefinite_Holders;
with Interfaces.C.Strings;
package Conv is
package C_Str_Holders is new Ada.Containers.Indefinite_Holders
(Element_Type => Interfaces.C.Char_Array, "=" => Interfaces.C."=");
function To_Chars_Ptr (Item : C_Str_Holders.Holder)
return Interfaces.C.Strings.Chars_Ptr is
(Interfaces.C.Strings.New_Char_Array (Item.Element) );
end Conv;
This compiles fine, so clearly there is a way to do this without a language change.
--
Jeff Carter
"He didn't get that nose from playing ping-pong."
Never Give a Sucker an Even Break
110
---
This email has been checked for viruses by AVG.
http://www.avg.com
next prev parent reply other threads:[~2017-08-05 15:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-05 13:41 Need a way to convert a constant to a variable Victor Porton
2017-08-05 14:48 ` Dmitry A. Kazakov
2017-08-05 15:11 ` Victor Porton
2017-08-05 16:44 ` Dmitry A. Kazakov
2017-08-05 17:45 ` Victor Porton
2017-08-05 19:37 ` Dmitry A. Kazakov
2017-08-05 15:41 ` Jeffrey R. Carter [this message]
2017-08-05 16:25 ` Victor Porton
2017-08-05 20:12 ` Jeffrey R. Carter
2017-08-05 17:59 ` Per Sandberg
2017-08-15 20:05 ` Eryndlia Mavourneen
2017-08-15 20:07 ` Eryndlia Mavourneen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox