Topic: Another possible usage for auto
Author: Olaf Krzikalla <Entwicklung@reico.de>
Date: Wed, 18 Apr 2001 17:45:41 GMT Raw View
Hi,
inspired by the thread relating to the 'auto' keyword some weeks ago I
remember another (totally different) idea for using 'auto'.
Often you need the compiler-generated assignmet-operator and copy-ctors.
If you have a large object with a lot of members, re-writing these
functions is tedious and error-prone. OTOH, if the compiler do the work,
it often generates these functions inline. This leads to large object
files and a lot of redundant code in the executable. (I don't know of a
compiler, which doesn't inline compiler-generated assignment-operators
and copy-ctors). So my suggestion is:
If you have a class A, then
A::A (const A& ) auto;
A& A::operator= (const A& ) auto;
acts like a definition of these functions but the body is
compiler-generated.
Best regards
Olaf Krzikalla
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]