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,635cd9622b25ae59 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!130.59.10.21.MISMATCH!kanaga.switch.ch!news-zh.switch.ch!switch.ch!cernne03.cern.ch!cern.ch!news From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Type safety, C++ and code generation Date: Tue, 02 May 2006 17:05:17 +0200 Organization: CERN - European Laboratory for Particle Physics Message-ID: References: <1146143954.169807.207080@t31g2000cwb.googlegroups.com> <1146148380.102042.119860@y43g2000cwc.googlegroups.com> <2051047.MTAq1HeU7p@linux1.krischik.com> <1146576797.106931.267280@i40g2000cwc.googlegroups.com> NNTP-Posting-Host: abpc10883.cern.ch Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sunnews.cern.ch 1146582316 3139 (None) 137.138.37.241 X-Complaints-To: news@sunnews.cern.ch User-Agent: Mozilla Thunderbird 1.0.8-1.4.1.SL (X11/20060424) X-Accept-Language: en-us, en In-Reply-To: <1146576797.106931.267280@i40g2000cwc.googlegroups.com> Xref: g2news2.google.com comp.lang.ada:4014 Date: 2006-05-02T17:05:17+02:00 List-Id: REH wrote: >>>class R1 : ranged_type {}; >>>class R2 : ranged_type {}; >>>class R3 : ranged_type {}; >>> >>>to create new types. >> >>Except that those new types would be problematic to use with operations >>that are already defined for ranged_type (especially those which return >>ranged_type), because there is no implicit conversion to the derived class. > > That's not true. operators are usually defined using references. As written above: "especially those which return ranged_type". // some operation on the range type (can be a template) ranged_type foo() {/* ... */} // some "new type" class R : ranged_type {}; R r = foo(); // bang! -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/