Andrei Alexandreco did one thing in the end I like the expected template pattern and it has been converted to Visual Studio 2010 because The compiler does not yet support extended unions. So I have written a unit test to check that everything works then I came to the point that I want to see that it was not a detection of a chopped exception but it was not.
I do not want to paste the full code here so I tried to minimize it:
#include & lt; Iostream & gt; #include & lt; String & gt; # Include & lt; Exceptions & gt; #include & lt; Typeinfo & gt; Class MyException: public std :: exception {public: MyException (): std :: exception () {} virtual const char * what () const {return "I came from myException"; }}; There is zero herefishing () {myexation (throw); } Template & lt; Class E & gt; Zero Detector (Constant E and Exception) (If (Typid (Exception)! = Typed (E)) {std :: cout << lt; & quot; Exception was cut off & quot; & lt; std :: endl; } And {std :: cout But the slicing action was not detected. The error is, does it work with VS-2010 or end The pattern does not work? (Just edit, because it did not like on GCC 4.7.2) Thanks a lot from long ago!
Your argument is wrong.Skyising from MyException changes the exception to the std :: exception, since you have to automatically select the same type as the argument to detect the type of template Going - this is guaranteed to be the same.
Instead, call it like this:
from detector & lt; MyException & gt; (East);
No comments:
Post a Comment