X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/dccf1b41e9c7b5a696f01abceaa2779fe65f154f..2618e74f3013e614762462ffb63bbe094fd1ae40:/include/xbt/exception.hpp diff --git a/include/xbt/exception.hpp b/include/xbt/exception.hpp index 9be76a2be6..7c826cd697 100644 --- a/include/xbt/exception.hpp +++ b/include/xbt/exception.hpp @@ -43,8 +43,7 @@ typedef std::vector Backtrace; class ThrowPoint { public: ThrowPoint() = default; - ThrowPoint(const char* file, int line, const char* function) : - file(file), line(line), function(function) {} + explicit ThrowPoint(const char* file, int line, const char* function) : file(file), line(line), function(function) {} const char* file = nullptr; int line = 0; const char* function = nullptr; @@ -62,7 +61,7 @@ class ThrowPoint { * You are not expected to inherit from it. Instead of you use should * @ref XBT_THROW an exception which will throw a subclass of your original * exception with those additional features. - * + * * However, you can try `dynamic_cast` an exception to this type in order to * get contextual information about the exception. */ @@ -73,16 +72,10 @@ public: procname_(xbt_procname()), pid_(xbt_getpid()) {} - WithContextException(Backtrace bt) : - backtrace_(std::move(bt)), - procname_(xbt_procname()), - pid_(xbt_getpid()) + explicit WithContextException(Backtrace bt) : backtrace_(std::move(bt)), procname_(xbt_procname()), pid_(xbt_getpid()) {} - WithContextException(ThrowPoint throwpoint, Backtrace bt) : - backtrace_(std::move(bt)), - procname_(xbt_procname()), - pid_(xbt_getpid()), - throwpoint_(throwpoint) + explicit WithContextException(ThrowPoint throwpoint, Backtrace bt) + : backtrace_(std::move(bt)), procname_(xbt_procname()), pid_(xbt_getpid()), throwpoint_(throwpoint) {} virtual ~WithContextException(); Backtrace const& backtrace() const @@ -104,9 +97,7 @@ template class WithContext : public E, public WithContextException { public: - - static_assert(!std::is_base_of::value, - "Trying to appli WithContext twice"); + static_assert(not std::is_base_of::value, "Trying to appli WithContext twice"); WithContext(E exception) : E(std::move(exception)) {} @@ -119,7 +110,7 @@ public: WithContext(E exception, WithContextException context) : E(std::move(exception)), WithContextException(std::move(context)) {} - ~WithContext() override {} + ~WithContext() override = default; }; /** Throw a C++ exception with some context