From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,703c4f68db81387d X-Google-Thread: 109fba,703c4f68db81387d X-Google-Thread: 115aec,703c4f68db81387d X-Google-Thread: f43e6,703c4f68db81387d X-Google-Attributes: gid103376,gid109fba,gid115aec,gidf43e6,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!newsfeed00.sul.t-online.de!t-online.de!tsicnews.teliasonera.com!news.otenet.gr!news.grnet.gr!newsfd02.forthnet.gr!not-for-mail From: Ioannis Vranos Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) Date: Sat, 26 Mar 2005 08:09:18 +0200 Organization: FORTHnet S.A., Atthidon 4, GR-17671 Kalithea, Greece, Tel: +30 2109559000, Fax: +30 2109559333, url: http://www.forthnet.gr Message-ID: <1111817359.869896@athnrd02> References: <1110284070.410136.205090@o13g2000cwo.googlegroups.com> <1110329098.642196@athnrd02> <1110361741.551255@athnrd02> <422edaec$0$26554$9b4e6d93@newsread4.arcor-online.net> <1111464133.508323@athnrd02> <423fe9df$0$11476$9b4e6d93@newsread2.arcor-online.net> <1111521825.653841@athnrd02> <424094b0$0$11481$9b4e6d93@newsread2.arcor-online.net> <1111568404.687226@athnrd02> <42416659$0$11476$9b4e6d93@newsread2.arcor-online.net> <1111611226.253249@athnrd02> <4241f47a$0$24073$9b4e6d93@newsread4.arcor-online.net> <1111627358.387482@athnrd02> <424222df$0$24057$9b4e6d93@newsread4.arcor-online.net> <1111632436.374702@athnrd02> <1111698643.735412.144620@l41g2000cwc.googlegroups.com> <424362cc$0$11478$9b4e6d93@newsread2.arcor-online.net> <1111717144.891831@athnrd02> <42446836$0$11463$9b4e6d93@newsread2.arcor-online.net> NNTP-Posting-Host: athnrd02.forthnet.gr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: athprx02.forthnet.gr 1111817360 27460 193.92.150.73 (26 Mar 2005 06:09:20 GMT) X-Complaints-To: abuse@forthnet.gr NNTP-Posting-Date: Sat, 26 Mar 2005 06:09:20 +0000 (UTC) User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en In-Reply-To: <42446836$0$11463$9b4e6d93@newsread2.arcor-online.net> Cache-Post-Path: newsfd02!unknown@ppp15-adsl-170.ath.forthnet.gr Xref: g2news1.google.com comp.lang.ada:10013 comp.lang.c++:47316 comp.realtime:1734 comp.software-eng:5350 Date: 2005-03-26T08:09:18+02:00 List-Id: Georg Bauhaus wrote: >> template > > > A solution will have this parameterization and checks: > > template > >> class Array: public vector >> { >> // Only provide definitions for operator at() and operator[] that >> // really *only* explicitly call the base ones with the proper index. >> // And the few constructors doing the same, *only* explicitly passing >> // the *same* arguments to the base constructors. > > // Check indexing precondition Index::contains(v) in at(v) and > // operator[](v). > >> }; > > >> I think it is *that* simple. > > > O.K., I'll wait. Unfortunately, I just tried to do it, however I have to use allocators, and I do not know allocators yet. It looks like each of my compilers uses its own one, different from the others, and when I used allocator_type instead I still got errors. Anyway, this has been my short progress. I could add run-time checks but did not proceed since I stuck with allocators. // Implementation-defined: // typedef implementation defined iterator; // See 23.1 // typedef implementation defined const_iterator; // See 23.1 // typedef implementation defined size_type; // See 23.1 // typedef implementation defined difference_type;// See 23.1 #include #include using namespace std; template class Varray: public std::vector { const A MIN, MAX; public: explicit Varray(const Allocator &al = Allocator(), const A min, const A max): vector(al), MIN(min), MAX(max) {} explicit Varray(size_type n, const T& value = T(), const Allocator &al = Allocator(), const A min, const A max): vector(n, value, al), MIN(min), MAX(max) {} template Varray(InputIterator first, InputIterator last, const Allocator &al = Allocator(), const A min, const A max): vector(first, last, al), MIN(min), MAX(max) {} // ==> To be implemented Varray(const Varray& x){} Varray() {} // ==> All the following to be implemented // Varray& operator=(const Varray& x) {} // template // void assign(InputIterator first, InputIterator last); // void assign(size_type n, const T& u); // Allocator get_allocator() const; // Only provide definitions for operator at() and operator[] that // really *only* explicitly call the base ones with the proper index. // Check indexing precondition Index::contains(v) in at(v) and // operator[](v). }; int main() { using namespace std; } -- Ioannis Vranos http://www23.brinkster.com/noicys