remove pos<T>
it's no longer needed now that positions aren't really pointers any more.
This commit is contained in:
parent
8168a4cf4a
commit
8adaa6acb5
1 changed files with 0 additions and 43 deletions
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue