diff options
author | Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> | 2022-04-22 10:28:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-22 10:28:06 +0200 |
commit | c4ffc8e2f8508fb951920fc08cf9283927e7e9b8 (patch) | |
tree | b088776c9603a12ca61c370feff763088a9b6cc0 /src/libutil/ref.hh | |
parent | 35ca5fdf91852e24d677a08dd0d8dfa543150dd3 (diff) | |
parent | 484badfa096db4c001f66eccbe00b70471f2e767 (diff) |
Merge pull request #6218 from pennae/pos-symbol-tables
reduce the size of Attr from 3 pointers to 2 on 64 bit machines
Diffstat (limited to 'src/libutil/ref.hh')
-rw-r--r-- | src/libutil/ref.hh | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/libutil/ref.hh b/src/libutil/ref.hh index 347b81f73..f9578afc7 100644 --- a/src/libutil/ref.hh +++ b/src/libutil/ref.hh @@ -99,47 +99,4 @@ make_ref(Args&&... args) return ref<T>(p); } - -/* A non-nullable pointer. - This is similar to a C++ "& reference", but mutable. - This is similar to ref<T> but backed by a regular pointer instead of a smart pointer. - */ -template<typename T> -class ptr { -private: - T * p; - -public: - ptr<T>(const ptr<T> & r) - : p(r.p) - { } - - explicit ptr<T>(T * p) - : p(p) - { - if (!p) - throw std::invalid_argument("null pointer cast to ptr"); - } - - T* operator ->() const - { - return &*p; - } - - T& operator *() const - { - return *p; - } - - bool operator == (const ptr<T> & other) const - { - return p == other.p; - } - - bool operator != (const ptr<T> & other) const - { - return p != other.p; - } -}; - } |