why not peek() instead? something like this: try { error_func_(get<string>(peek(-1))); pop();} catch(bad_get&) { error_func_("No error message"); }