comp.lang.ada
 help / color / mirror / Atom feed
* Convert between different container types
@ 2017-09-11 21:19 Victor Porton
  2017-09-11 21:20 ` Victor Porton
  2017-09-11 21:36 ` Simon Wright
  0 siblings, 2 replies; 4+ messages in thread
From: Victor Porton @ 2017-09-11 21:19 UTC (permalink / raw)


What is the easiest way to convert between different container types, for 
example between Ada.Containers.Doubly_Linked_Lists and 
Ada.Containers.Indefinite_Vectors as well as between these types and plain 
old Ada arrays?

-- 
Victor Porton - http://portonvictor.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Convert between different container types
  2017-09-11 21:19 Convert between different container types Victor Porton
@ 2017-09-11 21:20 ` Victor Porton
  2017-10-02 23:29   ` Randy Brukardt
  2017-09-11 21:36 ` Simon Wright
  1 sibling, 1 reply; 4+ messages in thread
From: Victor Porton @ 2017-09-11 21:20 UTC (permalink / raw)


Victor Porton wrote:

> What is the easiest way to convert between different container types, for
> example between Ada.Containers.Doubly_Linked_Lists and
> Ada.Containers.Indefinite_Vectors as well as between these types and plain
> old Ada arrays?

Sorry, typo: I would instead consider the case when both containers are 
indefinite or both are not indefinite.

-- 
Victor Porton - http://portonvictor.org


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Convert between different container types
  2017-09-11 21:19 Convert between different container types Victor Porton
  2017-09-11 21:20 ` Victor Porton
@ 2017-09-11 21:36 ` Simon Wright
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Wright @ 2017-09-11 21:36 UTC (permalink / raw)


Victor Porton <porton@narod.ru> writes:

> What is the easiest way to convert between different container types, for 
> example between Ada.Containers.Doubly_Linked_Lists and 
> Ada.Containers.Indefinite_Vectors as well as between these types and plain 
> old Ada arrays?

for El of A loop
   B.Append (El);
end loop;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Convert between different container types
  2017-09-11 21:20 ` Victor Porton
@ 2017-10-02 23:29   ` Randy Brukardt
  0 siblings, 0 replies; 4+ messages in thread
From: Randy Brukardt @ 2017-10-02 23:29 UTC (permalink / raw)


You can use stream operations Read and Write to convert between two similar 
containers, including between an unbounded and bounded container of the same 
kind (vector, list, map, etc.). Other containers are too different 
internally to be convertable; you'll have to write your own conversion 
routine as suggested by someone else.

                                Randy.

"Victor Porton" <porton@narod.ru> wrote in message 
news:op6uo0$suu$1@gioia.aioe.org...
> Victor Porton wrote:
>
>> What is the easiest way to convert between different container types, for
>> example between Ada.Containers.Doubly_Linked_Lists and
>> Ada.Containers.Indefinite_Vectors as well as between these types and 
>> plain
>> old Ada arrays?
>
> Sorry, typo: I would instead consider the case when both containers are
> indefinite or both are not indefinite.
>
> -- 
> Victor Porton - http://portonvictor.org 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-02 23:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11 21:19 Convert between different container types Victor Porton
2017-09-11 21:20 ` Victor Porton
2017-10-02 23:29   ` Randy Brukardt
2017-09-11 21:36 ` Simon Wright

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