Topic: Constructor as member template
Author: Carlo Pescio <pescio@acm.org>
Date: 1997/08/19 Raw View
[note for moderators: I've sent this two weeks ago. It didn't appear at my
newsserver or through a search at dejanews, so I'm posting it again...]
Alexandre Oliva <oliva@dcc.unicamp.br> writes:
>In [temp.arg.explicit], it says:
>
>4 [Note: because the explicit template argument list follows the func-
> tion template name, and because conversion member function templates
> and constructor member function templates are called without using a
> function name, there is no way to provide an explicit template argu-
> ment list for these function templates. ]
>This means all arguments to a constructor must be deducible; they
>cannot be specified explicitly.
Thanks for your answer, for some reasons I didn't notice that part!
Still, that leaves me with a bad feeling: a lack of immediate syntax is not
a reason to drop a useful feature. Syntactic matters can and should be
resolved when the underlying semantics is clear. Anybody here knows/remember
if there has been some discussion about that at ANSI/ISO meetings, and why
they have dropped explicit arguments in constructors?
Best Regards,
Carlo
+------------------------------------------------------------------------+
| Dr. Carlo Pescio Email: pescio@acm.org |
| Eptacom Consulting pescio@computer.org |
| Via B. Forte 2-3 pescio@programmers.net |
| 17100 Savona - ITALY pescio@tin.it |
| Fax: +39-19-854761 Home: http://www.programmers.net/artic/Pescio |
| http://space.tin.it/scienza/cpescio |
+------------------------------------------------------------------------+
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Author: Alexandre Oliva <oliva@dcc.unicamp.br>
Date: 1997/07/29 Raw View
Carlo Pescio writes:
> What is the current syntax for object definition when the
> constructor is a member template? I've been looking in the CD2, but
> couldn't find a clear answer.
In [temp.arg.explicit], it says:
4 [Note: because the explicit template argument list follows the func-
tion template name, and because conversion member function templates
and constructor member function templates are called without using a
function name, there is no way to provide an explicit template argu-
ment list for these function templates. ]
This means all arguments to a constructor must be deducible; they
cannot be specified explicitly.
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
Universidade Estadual de Campinas, SP, Brasil
---
[ 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 ]
Author: Carlo Pescio <pescio@acm.org>
Date: 1997/07/28 Raw View
What is the current syntax for object definition when the constructor is a
member template? I've been looking in the CD2, but couldn't find a clear answer.
In a class like that:
class C
{
public :
template< int i > f() ;
} ;
I can call f as follows (I guess; my compilers don't support the ".template"
syntax yet)
C c ;
c.template f< 10 >() ;
However, if my class is like:
class C
{
public :
template< int i > C() ;
} ;
What is the syntax to define objects of class C?
C< 10 > c ; // ?? probably not, at least not in my compilers...
Thanks in advance,
Carlo
+------------------------------------------------------------------------+
| Dr. Carlo Pescio Email: pescio@acm.org |
| Eptacom Consulting pescio@computer.org |
| Via B. Forte 2-3 pescio@programmers.net |
| 17100 Savona - ITALY pescio@tin.it |
| Fax: +39-19-854761 Home: http://www.programmers.net/artic/Pescio |
| http://space.tin.it/scienza/cpescio |
+------------------------------------------------------------------------+
---
[ 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 ]