[Bug c++/11489] [3.4 Regression] ICE on typecast of template-argument-derived value as template argument
bangerth at dealii dot org
gcc-bugzilla@gcc.gnu.org
Sat Jul 12 23:48:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11489
------- Additional Comments From bangerth at dealii dot org 2003-07-12 23:48 -------
Nathanael:
The code is ok, but you can only meaningfully instantiate the template with a
class that has a static const member named "value". Typically, you would
instantiate the template with classes that have "traits" character, for example
template <typename> struct is_integer { static const bool value = false; };
template <> struct is_integer<int> { static const bool value = true; };
template <typename T>
void f (T t) {
bar<is_integer<T> > b;
// do something with b
}
It's a very useful and powerful technique :-)
W.
More information about the Gcc-bugs
mailing list