Has anyone had trouble with the Clear procedure found in the Ada.Containers package? It seems to set the Container's length to zero, but once another element is added using the Append procedure, the contents of the Container reappear (i.e. they never get removed). I've tried both Ada.Containers.Doubly_Linked_Lists and Ada.Containers.Vectors. Both Containers have the same behavior. Any thoughts?
A:
It sounds to me like you found a bug in your compiler's implementation of that package. I'd report it.
T.E.D.
2009-09-23 21:17:00
A:
I figured it out. Silly Ada. You have to be careful how you reference data. Ada likes to return copies of data instead of references to it.
mike boldischar
2009-09-24 18:37:00
Actually, your Ada compiler can return data however it likes. If you *require* a reference passing mechanisim, you must either pass the parameter using the "access" method, or you should use pass a reference to the data type instead. I think the only exception is tagged types, which have to be passed by reference.
T.E.D.
2009-12-02 22:40:30