session and insert query builder progress
This commit is contained in:
@@ -8,24 +8,39 @@
|
||||
#include <memory>
|
||||
|
||||
namespace matador::object {
|
||||
struct null_object_ptr_t {
|
||||
constexpr null_object_ptr_t() = default;
|
||||
};
|
||||
|
||||
inline constexpr null_object_ptr_t nullobj{};
|
||||
|
||||
template <typename Type>
|
||||
class object_ptr {
|
||||
public:
|
||||
object_ptr()
|
||||
: proxy_(std::make_shared<object_proxy<Type>>()) {}
|
||||
object_ptr(null_object_ptr_t) {}
|
||||
explicit object_ptr(std::shared_ptr<Type> obj)
|
||||
: proxy_(std::make_shared<object_proxy<Type>>(obj)) {}
|
||||
explicit object_ptr(std::shared_ptr<object_proxy<Type>> obj)
|
||||
: proxy_(std::move(obj)) {}
|
||||
object_ptr(const object_ptr &other) = default;
|
||||
object_ptr(object_ptr &&other) noexcept = default;
|
||||
object_ptr &operator=(const object_ptr &other) = default;
|
||||
object_ptr &operator=(object_ptr &&other) = default;
|
||||
object_ptr& operator=(const object_ptr &other) = default;
|
||||
object_ptr& operator=(object_ptr &&other) = default;
|
||||
object_ptr& operator=(null_object_ptr_t) {
|
||||
proxy_.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const object_ptr &other) const {
|
||||
return get() == other.get();
|
||||
}
|
||||
bool operator==(null_object_ptr_t) const {
|
||||
return empty();
|
||||
}
|
||||
bool operator!=(const object_ptr &other) const { return !operator==(other); }
|
||||
bool operator!=(null_object_ptr_t) const { return !empty(); }
|
||||
|
||||
using value_type = Type;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user