Topic: uncalled class template members??
Author: maxtal@Physics.usyd.edu.au (John Max Skaller)
Date: 1995/04/03 Raw View
In article <3lf4gd$k2s@panix.com>, Atman Binstock <ajb@panix.com> wrote:
>
>Hi,
> Could someone tell me what the current draft standard says
>about uncalled class template members? Need they be checked before
>allowing instantiation of the class? For example, if Vector<T>::sort()
>uses operator<(const T&, const T&), can you make a Vector<X>, where X
>does not support operator<, if Vector<X>::sort() is never called?
Yes, you are supposed to be able to provided
Vector<X>::sort() is not _used_. That includes calling it,
but if it is virtual it is also considered "used".
Note quite a few compilers do not yet provide this
functionality.
--
JOHN (MAX) SKALLER, INTERNET:maxtal@suphys.physics.su.oz.au
Maxtal Pty Ltd,
81A Glebe Point Rd, GLEBE Mem: SA IT/9/22,SC22/WG21
NSW 2037, AUSTRALIA Phone: 61-2-566-2189
Author: tholaday@jpmorgan.com (Thomas Holaday,COMM)
Date: 1995/04/04 Raw View
In article 27135@mulga.cs.mu.OZ.AU, fjh@munta.cs.mu.OZ.AU (Fergus Henderson) writes:
>ajb@panix.com (Atman Binstock) writes:
>
>> Could someone tell me what the current draft standard says
>>about uncalled class template members?
>
>No. In fact the implementation _must not_ check them (other than
>syntax checking).
>
The draft standard seems to have it both ways for uncalled virtual methods:
An implementation shall not instantiate a function or a class that
does not require instantiation. However, virtual functions can be
instantiated for implementation purposes.
I'd read that as saying a compliant implementation can reject a class
with a problematical yet uncalled member function if that function is
virtual.
---
~THol()
Thomas Holaday
holaday_thomas@jpmorgan.com
tlhol@ibm.net
70407.534@compuserve.com
Author: tony@online.tmx.com.au (Tony Cook)
Date: 1995/04/04 Raw View
John Max Skaller (maxtal@Physics.usyd.edu.au) wrote:
: In article <3lf4gd$k2s@panix.com>, Atman Binstock <ajb@panix.com> wrote:
: > Could someone tell me what the current draft standard says
: >about uncalled class template members? Need they be checked before
: >allowing instantiation of the class? For example, if Vector<T>::sort()
: >uses operator<(const T&, const T&), can you make a Vector<X>, where X
: >does not support operator<, if Vector<X>::sort() is never called?
: Yes, you are supposed to be able to provided
: Vector<X>::sort() is not _used_. That includes calling it,
: but if it is virtual it is also considered "used".
What if you explicitly instantiate it?
// fuzzy on syntax here..
template Vector<X>;
--
Tony Cook - tony@online.tmx.com.au
100237.3425@compuserve.com
Author: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Date: 1995/04/02 Raw View
ajb@panix.com (Atman Binstock) writes:
> Could someone tell me what the current draft standard says
>about uncalled class template members? Need they be checked before
>allowing instantiation of the class?
No. In fact the implementation _must not_ check them (other than
syntax checking).
>For example, if Vector<T>::sort()
>uses operator<(const T&, const T&), can you make a Vector<X>, where X
>does not support operator<, if Vector<X>::sort() is never called?
Yes, you can.
--
Fergus Henderson - fjh@munta.cs.mu.oz.au
Author: ajb@panix.com (Atman Binstock)
Date: 1995/03/30 Raw View
Hi,
Could someone tell me what the current draft standard says
about uncalled class template members? Need they be checked before
allowing instantiation of the class? For example, if Vector<T>::sort()
uses operator<(const T&, const T&), can you make a Vector<X>, where X
does not support operator<, if Vector<X>::sort() is never called?
Thanks,
Atman Binstock