home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c++:16821 comp.std.c++:1613
- Newsgroups: comp.lang.c++,comp.std.c++
- Path: sparky!uunet!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watmath!xjzhu
- From: xjzhu@math.uwaterloo.ca (Xiaojun Zhu)
- Subject: Can we refer to A<T, S> when we are constructing A<S, T>? A challenge!
- Message-ID: <By78zI.D8L@math.uwaterloo.ca>
- Keywords: template, argument switching
- Organization: University of Waterloo
- Date: Tue, 24 Nov 1992 02:45:17 GMT
- Lines: 35
-
- I have an interesting question for you C++ experts out there.
-
- Q: Can we refer to A<T, S> when we are constructing A<S, T>?
-
- I had experimented it with AT&T C++ V3.0 and the fun part is probably not
- to give you the answer.
-
- Please answer the following questions before resorting to your compiler.
- (out of your knowledge)
-
- Q1: Should we be allowed to use or not to use?
-
- Q2: Why or why not?
-
- template<class S, class T>
- class A
- {
- S _s;
- T _t;
- public:
- //...
- // the following function is trying to switch a._s and a._t
- // to give me an A<T, S> object.
- friend A<T,S>& SWITCH(A<S,T>& a); // interesting place
-
- };
-
-
- --------------------------------------------------------------
- A template version of my signature class is under repair.
- Symptom: It dies without a warning if I use certain class
- as an argument.
-
- xjzhu@math.uwaterloo.ca
- --------------------------------------------------------------
-