Article View: comp.std.c++
Article #3503Q: default constructor for fundamental types?
From: Dirk Herrmann
Date: Mon, 26 Feb 1996 17:24
Date: Mon, 26 Feb 1996 17:24
31 lines
1522 bytes
1522 bytes
Sorry if this has been discussed before.
When using templates, it appears that there should be
default constructors for the fundamental data types.
Example:
template <class T>
X {
public:
X() : t() {};
X(const T& tt) : t(tt) {};
private:
T t;
}
As far as i know, the default constructor of
e.g. X<int> would not compile since there is no default
constructor for an int value.
It seems to be a pity that this would not be allowed.
--
Dirk Herrmann
---
[ To submit articles: Try just posting with your newsreader. 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
]
Technical Details
Message-ID:
<4glrdc$dqo@ra.ibr.cs.tu-bs.de>Path:
arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austernShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern From: dirk@sallust.ida.ing.tu-bs.de (Dirk Herrmann) Newsgroups: comp.std.c++ Subject: Q: default constructor for fundamental types? Date: 26 Feb 1996 09:24:07 PST Organization: TU Braunschweig, Informatik (Bueltenweg), Germany Approved: austern@isolde.mti.sgi.com Message-ID: <4glrdc$dqo@ra.ibr.cs.tu-bs.de> NNTP-Posting-Host: isolde.mti.sgi.com X-Original-Date: 24 Feb 1996 01:59:08 GMT X-Newsreader: TIN [version 1.2 PL2] X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUBMTHsyky4NqrwXLNJAQGISgH/XdWyYTiKkXMhNszr+SBKzhZbaQstrHCH gtqTNybiimiq2ZBFRHp2KHRCBtMq5OWUiFpeUoQSLJbnwKM3T9TOHQ== =CTEk Originator: austern@isolde.mti.sgi.com