Topic: user-defined conversions in template arg. deduction?
Author: bparker@gil.com.au (Brian Parker)
Date: 1997/04/16 Raw View
Hi all,
I posted this a while ago in comp.lang.c++.moderated and didn't get
any responses and so I thought I would repost in this group.
My question is- to what extent are user-defined conversions used when
doing template function argument deduction.
Page 14-38, 14.8.2 [temp.deduct], paragraph 10 states that-
"Conversions (4) will be performed on a function argument that
corresponds with a function parameter that contains only non-deducible
template parameters and explicitly specified template parameters.".
Does this mean that if argument deduction can't otherwise be done
(i.e. the function parameter contains only non-deducible template
parameters) then user-defined conversions will be tried to find a
deducible argument?
My particular concern is that I have a complex<double> array class in
which I want to distinguish between lvalue & rvalue usage when
subscripting. I therefore return a proxy class from the subscript
operator which has a conversion operator used when an rvalue is
needed. However, in Visual C++ 5.0 many library functions for complex
are template functions that take a complex<T> and when called with the
result of a subscripting operation, the proxy doesn't have its
conversion operator called and argument deduction fails. Is this just
a draft-non-conformance of VC 5.0?
Thanks,
Brian Parker (bparker@gil.com.au)
---
[ 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 ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]