Article View: comp.std.c++
Article #2249can publish non-type arg from template class?
From: Atman Binstock
Date: Thu, 19 Oct 1995 09:37
Date: Thu, 19 Oct 1995 09:37
31 lines
1309 bytes
1309 bytes
C++ allows you to publish class-type template arguments
to class templates:
template<class T> struct X {
typdef T the_type;
};
Will the C++ std allow a way to do this with non-type
template arguments?
The only two ways I can think of are:
template<int I> struct X {
enum { the_int = I };
};
Drawback: can't do floats, let alone user-class types
template<int I> struct X {
static const the_int = I;
};
Does this work?
Drawback: need to define the_int somewhere.
Will this work for an arbitrary user-defined class?
Thanks,
Atman Binstock
ajb@panix.com
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<464rmh$fhr@panix.com>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 19 Oct 95 09:37:19 GMT Approved: fjh@cs.mu.oz.au From: ajb@panix.com (Atman Binstock) Newsgroups: comp.std.c++ Subject: can publish non-type arg from template class? X-Original-Date: 19 Oct 1995 02:37:05 -0400 Organization: PANIX Public Access Internet and UNIX, NYC Message-ID: <464rmh$fhr@panix.com> X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMIYcX+EDnX0m9pzZAQGMjgF+Jp7eac3aKuxA+IYL1wbbNdm7yLHilnQF XPibNIC8ghi82uXoGUePqVso0aSHdtKB =kLem