I have a class template that takes two parameters: one is a type name and the other is a logical one, which determines whether the class will throw an exception if an error occurs.
MyClass.h:
template<typename T, bool signal>
class MyClass {
void Method1(args) {
}
void Method2(args) {
}
void throwMethod() {
if (signal) throw (some exception);
}
};
main.cpp:
#include "MyClass.h"
void main(int argc, const char * argv[]) {
MyClass<int, true> instThrow;
MyClass<int, false> instNoThrow;
}
, , , AT ALL. : (Method1, Method2) , ( ) ( ) throwMethod ( ) , , Method1 Method2.
, Apple LLVM compiler 3.0