started with object proxy

This commit is contained in:
Sascha Kühl
2025-02-20 18:20:23 +01:00
parent dfb0d7c56a
commit 0eb1ae9fe8
4 changed files with 59 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
#ifndef OBJECT_PROXY_HPP
#define OBJECT_PROXY_HPP
#include <memory>
namespace matador::object {
class basic_object_proxy {
public:
virtual ~basic_object_proxy() = default;
virtual void *get() const = 0;
};
template<class Type>
class object_proxy : public basic_object_proxy {
public:
void *get() const override { return static_cast<Type *>(this)->get(); }
Type* operator->() const { return obj_.get(); }
private:
std::shared_ptr<Type> obj_{};
};
}
#endif //OBJECT_PROXY_HPP