This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/11489] [3.4 Regression] ICE on typecast of template-argument-derived value as template argument


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]