Topic: Const and non-const versions of templates.
Author: Dean Foster <foster@compstat.wharton.upenn.edu>
Date: 1999/04/01 Raw View
Is there a way of creating a template that will match const vs the non-const?
In other words, what I would like is:
template<class T>
class Foo
{
public:
f(){ cout << "non-const" << endl;};
};
and
template<class const T>
class Foo
{
public:
f(){cout << "const" << endl;};
};
Given this doesn't work and doesn't seem to be supported by the standard, is
there a work around?
thanks,
dean
(Dean Foster, Department of Statistics, Wharton, U of Penn)
---
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]