#ifndef H_CORAL_DEBUG
#define H_CORAL_DEBUG

#include <sstream>
#include <string>
#include <exception>

namespace coral {

	template <typename T1, typename T2>
	inline T1 throwing_cast(T2 t2) {
		T1 t = dynamic_cast<T1>(t2);
		if (!t) {
			std::ostringstream s;
			s << "Could not throw " << typeid(T2).name()
			  << " to a " << typeid(T1).name()
			  << " at " << __FILE__ << "#" << __LINE__
			  << "!" << std::endl;
			throw std::logic_error(s.str());
		}
		return t;
	}
}


#endif

