Mercurial > octave
diff liboctave/util/oct-shlib.h @ 28057:b3701ea5a48d
use std::function object for passing name mangler to search function
* oct-shlib.h, oct-shlib.cc (dynamic_library::name_mangler):
Use std::fucntion object instead of bare function pointer.
(dynamic_library::search): Pass mangler by const reference.
(dynamic_library::dynlib_reference::search): Pass mangler by const
reference. Change all derived classes.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 08 Feb 2020 15:32:55 -0500 |
parents | bd51beb6205e |
children | 02f0649f43d7 |
line wrap: on
line diff
--- a/liboctave/util/oct-shlib.h Mon Feb 10 18:48:24 2020 -0800 +++ b/liboctave/util/oct-shlib.h Sat Feb 08 15:32:55 2020 -0500 @@ -28,9 +28,10 @@ #include "octave-config.h" +#include <functional> #include <list> +#include <map> #include <string> -#include <map> #include "oct-time.h" #include "oct-refcount.h" @@ -43,7 +44,7 @@ { public: // FIXME: make this class private? - typedef std::string (*name_mangler) (const std::string&); + typedef std::function<std::string (const std::string&)> name_mangler; class dynlib_rep { @@ -68,7 +69,8 @@ virtual bool is_open (void) const { return false; } - virtual void * search (const std::string&, name_mangler = nullptr) + virtual void * search (const std::string&, + const name_mangler& = name_mangler ()) { return nullptr; } bool is_out_of_date (void) const; @@ -170,7 +172,8 @@ return removed_fcns; } - void * search (const std::string& nm, name_mangler mangler = nullptr) const + void * search (const std::string& nm, + const name_mangler& mangler = name_mangler ()) const { void *f = m_rep->search (nm, mangler); if (f)