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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d2f0af5e440b367f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-13 19:54:14 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-pas-nf2!newsfeed.earthlink.net!newsfeed.news2me.com!cyclone1.gnilink.net!spamkiller2.gnilink.net!nwrdny01.gnilink.net.POSTED!53ab2750!not-for-mail From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5a) Gecko/20030708 Thunderbird/0.1a X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: proposal for new assignment operators References: <3EF9CD5F.6030608@cogeco.ca> <3doRhIgUmUYX@eisner.encompasserve.org> <3F038B77.2F2E41B7@adaworks.com> <1ec946d1.0307070736.2eb5e820@posting.google.com> <3F1209CF.C3907A61@adaworks.com> In-Reply-To: <3F1209CF.C3907A61@adaworks.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Mon, 14 Jul 2003 02:54:13 GMT NNTP-Posting-Host: 162.84.202.76 X-Complaints-To: abuse@verizon.net X-Trace: nwrdny01.gnilink.net 1058151253 162.84.202.76 (Sun, 13 Jul 2003 22:54:13 EDT) NNTP-Posting-Date: Sun, 13 Jul 2003 22:54:13 EDT Xref: archiver1.google.com comp.lang.ada:40249 Date: 2003-07-14T02:54:13+00:00 List-Id: Richard Riehle wrote: > Limited types are not defined as part of the C++ standard. One can, of > course, do as you have with your example. I rather doubt it is as common > as one would find in Ada. Well, for one thing, the standard input and output streams are of such a limited type. There are many objects for which assignment would be meaningless or destructive, and this idiom appears in most every moderately advanced book about C++. > Container types, perhaps not those you have created, are often designed > as limited types. There are different points-of-view on this. I recall > a PhD dissertation from OSU on this subject where the dissertation > recommended that all types for a container be limited, even the generic > formal parameters. But this is not how Ada arrays work, so why should other containers work that way? In C++, the standard containers all support assignment, with the semantics of making the target of the assignment compare equal to the source after the assignment happens (which means that the two containers will have the same size, and the elements will compare equal). > Exactly. This is one reason for not providing assignment over a limited > type. Instead, we typically create a copy procedure and declare the > name of that copy procedure as specifically as possible. In C++, that procedure is just called "operator=". We can program assignment from arbitrary source types if we choose, by using templates.