From ba25f019012b632f6af9f5addee5058ba6a4e077 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 6 Mar 2018 21:37:39 +0000 Subject: Wrap support for making unique ptrs from functions --- service/uptr.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 service/uptr.cpp (limited to 'service/uptr.cpp') diff --git a/service/uptr.cpp b/service/uptr.cpp new file mode 100644 index 0000000..1669a69 --- /dev/null +++ b/service/uptr.cpp @@ -0,0 +1,26 @@ +#include "uptr.h" +#include +#include +#include +#include +#include + +namespace MirrorSearch { + + std::string + failingFunction(void * const func) + { + char ** fn = backtrace_symbols(&func, 1); + BOOST_ASSERT(fn); + BOOST_ASSERT(*fn); + std::string funcName(*fn); + free(fn); + return funcName; + } + + void + defaultErrorHandler(const std::string & fn) + { + throw std::runtime_error("Fatal error in " + fn); + } +} -- cgit v1.2.3