On Thu, 2007-06-07 at 18:31 +0200, DU VIGNAUD DE VILLEFORT FRANCOIS
GASAPRD PHI wrote:
> Here is an example of the code I tried to write:
>
> class A {
> public:
> template <class T>
> A() { ... }
> };
>
>
> void main() {
> shared_ptr<A> a (new A<X>());
> }
It doesn't work. The compiler parses A<X>() as the constructor of a
template class A, not the template constructor of a class A.
You can write template constructors, but only in cases such as:
class A {
public:
template <class T>
A(const T& t) { ... }
};
void main() {
X x;
shared_ptr<A> a (new A(x));
}
where the <X> is not there and the template specialization is deduced
from the type of the argument.
What were A and X?
Later,
Luigi
----------------------------------------
There's no sense in being precise when you don't even know what you're
talking about.
-- John von Neumann
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev