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
+17
View File
@@ -0,0 +1,17 @@
#ifndef COLLECTION_HPP
#define COLLECTION_HPP
#include <vector>
namespace matador::object {
template < class Type >
class collection {
public:
private:
};
}
#endif //COLLECTION_HPP
+14
View File
@@ -0,0 +1,14 @@
#ifndef DICTIONARY_HPP
#define DICTIONARY_HPP
namespace matador::object {
template < class Key, class Value >
class dictionary {
public:
private:
};
}
#endif //DICTIONARY_HPP
+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