From 7d79d5298f56c4768a90df629b689d1bc3ebbb31 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 17 Jan 2019 15:48:05 +0300 Subject: Add function_wrapper::cast() that cleanly cast to an incompatible function type --- odb/details/function-wrapper.ixx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'odb/details/function-wrapper.ixx') diff --git a/odb/details/function-wrapper.ixx b/odb/details/function-wrapper.ixx index d73d578..9ec19ec 100644 --- a/odb/details/function-wrapper.ixx +++ b/odb/details/function-wrapper.ixx @@ -36,5 +36,15 @@ namespace odb swap (const_cast&> (x)); return *this; } + + template + template + inline R function_wrapper:: + cast () const + { + union { F* f; R r; } r; + r.f = function; + return r.r; + } } } -- cgit v1.1