Re: Unified Ada library
From: Hyman Rosen (hyrosen_at_mail.com)
Date: 04/19/04
- Next message: Björn Persson: "Re: Unified Ada library"
- Previous message: Dmitry A. Kazakov: "Re: No call for Ada (was Re: Announcing new scripting/prototyping language)"
- In reply to: Georg Bauhaus: "Re: Unified Ada library"
- Next in thread: Georg Bauhaus: "Re: Unified Ada library"
- Reply: Georg Bauhaus: "Re: Unified Ada library"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 19 Apr 2004 10:30:14 -0400
Georg Bauhaus wrote:
> Could you comment on the importance of iterators and generic
> algorithms in the template libraries?
You can write your algorithms for the most part as if you were
using pointers to iterate over arrays. Because no virtual
operations are involved, and because C++ compilers have been
taught that inlining template code is vital, the resulting
compiled code becomes very efficient. If the pointer-like code
attempts an operation that would be inefficent for some given
container (such as trying to subtract two iterators when they
refer to a linked list instead of an array), the code won't
compile because the operation isn't defined.
The idea was to have containers and algorithms that did not force
code to pay runtime abstraction penalties over use of plain arrays.
It was vital that code which used std::vector should be as efficient
as plain arrays for the things that plain arrays could do, otherwise
the community would have rejected the standard containers.
Not only that, having the algorithms look like array/pointer operations
allows them to be used on arrays as well as containers, since pointers
are iterators, and it comforts C programmers who can write code in the
style they are used to.
- Next message: Björn Persson: "Re: Unified Ada library"
- Previous message: Dmitry A. Kazakov: "Re: No call for Ada (was Re: Announcing new scripting/prototyping language)"
- In reply to: Georg Bauhaus: "Re: Unified Ada library"
- Next in thread: Georg Bauhaus: "Re: Unified Ada library"
- Reply: Georg Bauhaus: "Re: Unified Ada library"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|