🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: de.comp.lang.c++
Article #497

Re: STL - ueber's Ziel hinaus ?

#497
From: Walter Sommergruber
Date: Sun, 01 Oct 1995 11:44
34 lines
1567 bytes
Hallo,

Alexander Ehrler  (ukci@rzstud1.rz.uni-karlsruhe.de) wrote on 01.10.95
about "STL - ueber's Ziel hinaus ?":

> Ich habe gestern die HP Version der STL ausprobiert und siehe da:
>
> 	vector< my_type > v(10);
> 	cout << v[100];
>
> keine Exception, keine "failed assertion", einfach ein satter Absturz.
>
> Aber das muss ja schliesslich so sein, denn (aus der Doku):
> "...just as regular pointers to an array guarantees that there is a pointer
> value pointing past the last element of the array, so for any iterator type
> there is an iterator value that points past the last element of a
> corresponding container..."
>
> Tatsachlich ist der Subskript-Operator so implementiert:
>    vector::operator[](size_type n)
>    {
>        return *(begin() + n);
>    }
>
> wobei begin() einen Iterator liefert. Keine bound checks.

Das darf ja wohl nicht wahr sein! Wozu soll die STL gut sein wenn nicht
einmal triviale bound-checks implementiert wurden? Kann mir das jemand
erklaeren ???
Wenn ich ein normales C-style Array wollte, wuerde ich es als solches
deklarieren und nicht die STL verwenden.
---
Walter Sommergruber
email: wsog@site71.ping.at
Technical Details
Message-ID: <5v2sxMIrnTB@site71.ping.at>
Path: arc1-ca.pugleaf.net!site71.ping.at!wsog
References: <44lvrp$a25@nz12.rz.uni-karlsruhe.de>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!site71.ping.at!wsog
Date: 01 Oct 1995 13:44:00 +0200
From: wsog@site71.ping.at (Walter Sommergruber)
Newsgroups: de.comp.lang.c++
Message-ID: <5v2sxMIrnTB@site71.ping.at>
References: <44lvrp$a25@nz12.rz.uni-karlsruhe.de>
Subject: Re: STL - ueber's Ziel hinaus ?
X-Newsreader: XP v3.02
X-Charset: ISO-8859-1
Organization: Sommergruber Software & Dienstleistungen