Re: GCC 4.0 Ada.Containers Cursor danger.



"Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx> wrote in message
news:ldco4pwrxop4$.1py0a7isiagea.dlg@xxxxxxxxxxxxx
....
> "All of the containers specify positions using a cursor,
> which is similar to an access type in that it designates an element."
>
> So? Is it position or access?

We don't say, on purpose. Its is not either, it has elements of both. It
doesn't matter anyway.

>It is not clear to me what the semantics a cursor has. Is it a location in
the container?
> Then that should be an index or position.

It's not a location, and it wouldn't make sense for it to be one (other than
for a Vector). A linked list position, for instance, would require a O(N)
walk through the list. Yuck.

> Is it a pointer to an individual element? Then that should be an access
type object.

No. A raw access type could never be checked, while a Cursor can (and IMHO,
should) be checked for problems.

> Cursor looks like an amorphous mixture inheriting disadvantages of both.

We don't say exactly what it is in part because it is different for the
different containers. But you still can use the same abstraction on any
container.

Randy.




.



Relevant Pages

  • Re: GCC 4.0 Ada.Containers Cursor danger.
    ... >> "All of the containers specify positions using a cursor, ... >>It is not clear to me what the semantics a cursor has. ... But it definitely refers to a location. ... Then that should be an access type object. ...
    (comp.lang.ada)
  • Re: OO Style with Ada Containers
    ... Ada.Containers can be compared to Java containers on the basis that ... cursor/iterator and this is different from both STL and Java (STL ... procedure Generic_Algorithm (C: Cursor); ...
    (comp.lang.ada)
  • Re: Rational for not making cursor tagged in Containers
    ... However, when it comes to Containers, I can not use this notation ... on cursor because it is not tagged. ... And yet, overhead was already paid. ...
    (comp.lang.ada)
  • Re: Rational for not making cursor tagged in Containers
    ... However, when it comes to Containers, I can not use this notation ... on cursor because it is not tagged. ... Why is the prefix notation not allowed ... I'm not a big fan of prefix notation, ...
    (comp.lang.ada)