summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/ppmf.h
diff options
context:
space:
mode:
author andreasnaive <andreasnaive@gmail.com>2019-03-25 22:44:58 +0100
committer andreasnaive <andreasnaive@gmail.com>2019-03-25 22:44:58 +0100
commitc24473ddff715ecec2e258a6eb38960cf8c8e98e (patch)
tree8ea44b6396a6129913c0aac13859b5de9965e972 /src/lib/netlist/plib/ppmf.h
parent009cba4fb8102102168ef32870892438327f3705 (diff)
parent598cd5227223c3b04ca31f0dbc1981256d9ea3ff (diff)
conflict resolution (nw)
Diffstat (limited to 'src/lib/netlist/plib/ppmf.h')
-rw-r--r--src/lib/netlist/plib/ppmf.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/lib/netlist/plib/ppmf.h b/src/lib/netlist/plib/ppmf.h
index dc151d5d6a6..9c5329cccde 100644
--- a/src/lib/netlist/plib/ppmf.h
+++ b/src/lib/netlist/plib/ppmf.h
@@ -10,9 +10,8 @@
#include "pconfig.h"
-#include <utility>
#include <cstdint>
-
+#include <utility>
/*
*
@@ -70,7 +69,8 @@ namespace plib {
using generic_function = void (*)();
template<typename MemberFunctionType>
- mfp(MemberFunctionType mftp)
+ mfp(MemberFunctionType mftp) // NOLINT(cppcoreguidelines-pro-type-member-init)
+
: m_function(0), m_this_delta(0), m_size(sizeof(mfp))
{
*reinterpret_cast<MemberFunctionType *>(this) = mftp;
@@ -82,7 +82,7 @@ namespace plib {
mfp mfpo(mftp);
//return mfpo.update_after_bind<FunctionType>(object);
generic_function rfunc(nullptr);
- generic_class *robject = reinterpret_cast<generic_class *>(object);
+ auto robject = reinterpret_cast<generic_class *>(object);
mfpo.convert_to_generic(rfunc, robject);
func = reinterpret_cast<FunctionType>(rfunc);
object = reinterpret_cast<ObjectType *>(robject);
@@ -95,7 +95,8 @@ namespace plib {
if (PHAS_PMF_INTERNAL == 1)
{
// apply the "this" delta to the object first
- generic_class * o_p_delta = reinterpret_cast<generic_class *>(reinterpret_cast<std::uint8_t *>(object) + m_this_delta);
+ // NOLINTNEXTLINE(clang-analyzer-core.UndefinedBinaryOperatorResult)
+ auto o_p_delta = reinterpret_cast<generic_class *>(reinterpret_cast<std::uint8_t *>(object) + m_this_delta);
// if the low bit of the vtable index is clear, then it is just a raw function pointer
if (!(m_function & 1))
@@ -241,23 +242,28 @@ namespace plib {
{
public:
class generic_class;
+
+ template <class C>
+ using MemberFunctionType = R (C::*)(Targs...);
+
pmfp() : pmfp_base<R, Targs...>(), m_obj(nullptr) {}
- template<typename MemberFunctionType, typename O>
- pmfp(MemberFunctionType mftp, O *object)
+ template<typename O>
+ pmfp(MemberFunctionType<O> mftp, O *object)
: pmfp_base<R, Targs...>()
{
this->set(mftp, object);
}
- template<typename MemberFunctionType, typename O>
- void set(MemberFunctionType mftp, O *object)
+
+ template<typename O>
+ void set(MemberFunctionType<O> mftp, O *object)
{
this->set_base(mftp, object);
m_obj = reinterpret_cast<generic_class *>(object);
}
- inline R operator()(Targs... args)
+ inline R operator()(Targs ... args)
{
return this->call(m_obj, std::forward<Targs>(args)...);
}
@@ -269,6 +275,6 @@ namespace plib {
};
-}
+} // namespace plib
#endif /* PPMF_H_ */