Skip to content

Instantly share code, notes, and snippets.

@Yepoleb
Created January 25, 2017 22:59
Show Gist options
  • Save Yepoleb/713e11012aeba5e44d7a5ddd5b5c3caf to your computer and use it in GitHub Desktop.
Save Yepoleb/713e11012aeba5e44d7a5ddd5b5c3caf to your computer and use it in GitHub Desktop.
#define _GLIBCXX_USE_CXX11_ABI 1
#include <ios>
#include <typeinfo>
#include <exception>
extern const std::type_info& old_abi_failure;
const std::type_info& new_abi_failure = typeid(std::ios::failure&);
bool is_ios_failure(std::exception& e) {
const std::type_info& e_type = typeid(e);
if (e_type.hash_code() == old_abi_failure.hash_code()) {
return true;
} else if (e_type.hash_code() == new_abi_failure.hash_code()) {
return true;
} else {
return false;
}
}
#define _GLIBCXX_USE_CXX11_ABI 0
#include <ios>
#include <typeinfo>
const std::type_info& old_abi_failure = typeid(std::ios::failure&);
void throw_failure()
{
throw std::ios::failure("stream");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment