35#ifndef HPP_UTIL_EXCEPTION_FACTORY_HH
36#define HPP_UTIL_EXCEPTION_FACTORY_HH
43struct ThrowException {};
45template <
typename exception>
46struct ExceptionFactory;
49template <
typename exception,
typename In>
50struct conditional_insertion_operator {
51 typedef ExceptionFactory<exception>& type;
53 static inline type run(ExceptionFactory<exception>& be,
const In& t) {
72template <
typename exception>
77 inline typename internal::conditional_insertion_operator<exception, T>::type
79 return internal::conditional_insertion_operator<exception, T>::run(*
this,
89template <
typename exception>
90struct conditional_insertion_operator<exception, ThrowException> {
91 typedef exception type;
93 static inline type run(ExceptionFactory<exception>& be,
94 const ThrowException&) {
95 return exception(be.ss.str().c_str());
109#define HPP_THROW(TYPE, MSG) \
110 throw ::hpp::ExceptionFactory<TYPE>() << MSG << ::hpp::ThrowException()
116#define HPP_THROW_WITH_LINEINFO(TYPE, MSG) \
117 HPP_THROW(TYPE, MSG << " at " << __FILE__ << ":" << __LINE__)
#define HPP_UTIL_DLLAPI
Definition config.hh:88
Definition assertion.hh:45
Class to ease exception creation.
Definition exception-factory.hh:73
std::stringstream ss
Definition exception-factory.hh:74