Mercurial > ~dholland > hg > ag > index.cgi
view oldclasslib/README.txt @ 6:607e3be6bad8
Adjust to the moving target called the C++ standard.
Apparently nowadays it's not allowed to define an explicit copy
constructor but not an assignment operator. Consequently, defining the
explicit copy constructor in terms of the implicit/automatic
assignment operator for general convenience no longer works.
Add assignment operators.
Caution: not tested with the IBM compiler, but there's no particular
reason it shouldn't work.
author | David A. Holland |
---|---|
date | Mon, 30 May 2022 23:46:22 -0400 |
parents | 13d2b8934445 |
children |
line wrap: on
line source
This is the "classlib" distributed with pre-open-source versions of AnaGram. It is old and not very well designed. It is still here, and sort of being maintained, because (1) some of the examples use it, and (2) somebody out there might even be using it. It should be considered deprecated. The examples will be migrated away from it over time; anyone using it in their own code should move to something else - whether AnaGram's own AGCLIB1 or the STL or whatever. ------------------------------------------------------------ Changes to oldclasslib since the AG 2.01 release: - Updated the syntax for friend template functions for the current (or at least recent) dialect of 'standard' C++. - Added const qualifications in various places to allow use of string constants. In current C++ string constants have type "const char *"; that was not the case when this code was written. - Added explicit calls to base class constructors even when they take no arguments; gcc 3.3 whines if you don't have these. - Removed the behavior where you can cast a stack<> to T* or a character_sink to char* to fetch the topmost element. Now you must call the top() method instead. Apparently the C++ standard says that having such a cast operator and also having operator[] is ambiguous, because you can convert the object to a pointer and apply [] to that as well as using the provided operator[] directly. This seems stupid bordering on insane, but when compilers start citing the standard at you there isn't much choice but to go along. - Added explicit assignment operator definitions in places where gcc 10.x now refuses to produce them automatically. Added missing "const" to some of the copy constructor arguments.