Optimization and template parms

Andrew Borthwick borthwic@johnson.cs.nyu.edu
Mon Feb 2 11:32:00 GMT 1998


Hi,

     In the following method of a templated class:

template <bool c>
Foo<c>::f1() {
  if (c) {cout << "true" << endl;}
  else {cout << "false" << endl;}
}

      Would I be correct to assume that after instantiating the template, egcs
wouldn't emit any code for the if/else test because the test always succeeds for
Foo<true> and fails for Foo<false>?

Thanks,
Andrew Borthwick




More information about the Gcc mailing list