|
|
| 145 |
*/ |
145 |
*/ |
| 146 |
Ptr (Ptr const&o); |
146 |
Ptr (Ptr const&o); |
| 147 |
/** |
147 |
/** |
|
|
148 |
* Move the other Ptr into this new Ptr. |
| 149 |
* This new Ptr now owns the object and the previous instance |
| 150 |
* will no longer contain an underlying object. |
| 151 |
* |
| 152 |
* \param [in] o The other Ptr instance. |
| 153 |
*/ |
| 154 |
Ptr (Ptr &&o) noexcept; |
| 155 |
/** |
| 148 |
* Copy, removing \c const qualifier. |
156 |
* Copy, removing \c const qualifier. |
| 149 |
* |
157 |
* |
| 150 |
* \tparam U \deduced The underlying type of the \c const object. |
158 |
* \tparam U \deduced The underlying type of the \c const object. |
|
|
| 162 |
*/ |
170 |
*/ |
| 163 |
Ptr<T> &operator = (Ptr const& o); |
171 |
Ptr<T> &operator = (Ptr const& o); |
| 164 |
/** |
172 |
/** |
|
|
173 |
* Assignment operator by moving the underlying object. |
| 174 |
* The other Ptr will no longer reference an object. |
| 175 |
* |
| 176 |
* \param [in] o The other Ptr instance. |
| 177 |
* \return A reference to self. |
| 178 |
*/ |
| 179 |
Ptr<T> &operator = (Ptr && o) noexcept; |
| 180 |
/** |
| 165 |
* An rvalue member access. |
181 |
* An rvalue member access. |
| 166 |
* \returns A pointer to the underlying object. |
182 |
* \returns A pointer to the underlying object. |
| 167 |
*/ |
183 |
*/ |
|
|
| 743 |
Acquire (); |
759 |
Acquire (); |
| 744 |
} |
760 |
} |
| 745 |
template <typename T> |
761 |
template <typename T> |
|
|
762 |
Ptr<T>::Ptr (Ptr &&o) noexcept |
| 763 |
: m_ptr (o.m_ptr) |
| 764 |
{ |
| 765 |
o.m_ptr = nullptr; |
| 766 |
} |
| 767 |
template <typename T> |
| 746 |
template <typename U> |
768 |
template <typename U> |
| 747 |
Ptr<T>::Ptr (Ptr<U> const &o) |
769 |
Ptr<T>::Ptr (Ptr<U> const &o) |
| 748 |
: m_ptr (PeekPointer (o)) |
770 |
: m_ptr (PeekPointer (o)) |
|
|
| 777 |
} |
799 |
} |
| 778 |
|
800 |
|
| 779 |
template <typename T> |
801 |
template <typename T> |
|
|
802 |
Ptr<T> & |
| 803 |
Ptr<T>::operator = (Ptr && o) noexcept |
| 804 |
{ |
| 805 |
Ptr p(std::move(o)); |
| 806 |
std::swap(p.m_ptr, this->m_ptr); |
| 807 |
return *this; |
| 808 |
} |
| 809 |
|
| 810 |
template <typename T> |
| 780 |
T * |
811 |
T * |
| 781 |
Ptr<T>::operator -> () |
812 |
Ptr<T>::operator -> () |
| 782 |
{ |
813 |
{ |