Hi Troy, This problem is now fixed in the CVS repository. Cheers, Philippe. -----Original Message----- From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Troy D. Straszheim Sent: Saturday, February 28, 2004 9:57 PM To: roottalk@pcroot.cern.ch Subject: [ROOT] template constructor Hey rooters - How about this: I would like to allow automatic type conversion via constructor. With these classes: struct C { }; struct A { A() { }; template <class U> A(const U& u) { cout << __PRETTY_FUNCTION__ << endl; } template <class U> void doit(const U& u) { cout << __PRETTY_FUNCTION__ << endl; } }; And the following linkdef: #pragma link C++ class A+; #pragma link C++ class C+; #pragma link C++ function A::A(const C&); #pragma link C++ function A::doit(const C&); My sesson reports the following: root [0] C c; root [1] A a; root [2] a.doit(c); void A::doit(const U&) [with U = C] root [3] A a2(c); Error: Can't call A::A(c) in current scope FILE:(tmpfile) LINE:1 Possible candidates are... filename line:size busy function type and name (in A) (compiled) 0:0 0 public: A A(void); (compiled) 0:0 0 public: A A(const A&); The template function doit() works, but the copy constructor does not. Any ideas? Cheers, Troy Straszheim
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET