aboutsummaryrefslogtreecommitdiff
path: root/libbutl/utility.mxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-11-02 17:16:31 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-11-02 17:16:31 +0300
commitd9af320fbdfdadd70815d4f14a9116829dfabdf0 (patch)
tree38e407df0aa9f728eaaa4437d7baa87a8a9447ee /libbutl/utility.mxx
parent1bd2a072d44893b78eac97ee81edd24023918e06 (diff)
Generalize function_cast() to cast between incompatible function pointers
Diffstat (limited to 'libbutl/utility.mxx')
-rw-r--r--libbutl/utility.mxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/libbutl/utility.mxx b/libbutl/utility.mxx
index f944599..5d093ad 100644
--- a/libbutl/utility.mxx
+++ b/libbutl/utility.mxx
@@ -315,11 +315,12 @@ LIBBUTL_MODEXPORT namespace butl
F f_;
};
- // Cleanly cast dlsym() result (void*) to a function pointer.
+ // Cleanly cast between incompatible function types or dlsym() result
+ // (void*) to a function pointer.
//
- template <typename F>
+ template <typename F, typename P>
F
- function_cast (void*);
+ function_cast (P*);
// Call a function if there is an exception.
//