sdref: Constify sdevent
diff --git a/src/sdeventplus/internal/sdref.cpp b/src/sdeventplus/internal/sdref.cpp
index bbbbd3a..13720d1 100644
--- a/src/sdeventplus/internal/sdref.cpp
+++ b/src/sdeventplus/internal/sdref.cpp
@@ -8,7 +8,8 @@
{
template <typename T>
-SdRef<T>::SdRef(T* ref, Func take_ref, Func release_ref, SdEvent* sdevent) :
+SdRef<T>::SdRef(T* ref, Func take_ref, Func release_ref,
+ const SdEvent* sdevent) :
SdRef(take_ref(sdevent, ref), take_ref, release_ref, std::false_type(),
sdevent)
{
@@ -16,7 +17,7 @@
template <typename T>
SdRef<T>::SdRef(T* ref, Func take_ref, Func release_ref, std::false_type,
- SdEvent* sdevent) :
+ const SdEvent* sdevent) :
sdevent(sdevent),
take_ref(take_ref), release_ref(release_ref), ref(ref)
{
diff --git a/src/sdeventplus/internal/sdref.hpp b/src/sdeventplus/internal/sdref.hpp
index 0b1395f..c0c77fc 100644
--- a/src/sdeventplus/internal/sdref.hpp
+++ b/src/sdeventplus/internal/sdref.hpp
@@ -13,12 +13,12 @@
class SdRef
{
public:
- using Func = std::function<T*(SdEvent*, T*)>;
+ using Func = std::function<T*(const SdEvent*, T*)>;
SdRef(T* ref, Func take_ref, Func release_ref,
- SdEvent* sdevent = &sdevent_impl);
+ const SdEvent* sdevent = &sdevent_impl);
SdRef(T* ref, Func take_ref, Func release_ref, std::false_type,
- SdEvent* sdevent = &sdevent_impl);
+ const SdEvent* sdevent = &sdevent_impl);
virtual ~SdRef();
SdRef(const SdRef& other);
@@ -29,7 +29,7 @@
T* get() const;
private:
- SdEvent* sdevent;
+ const SdEvent* sdevent;
Func take_ref;
Func release_ref;
T* ref;