Study c++ template and exception