| 196 | |
| 197 | template<class T> |
| 198 | inline T* Foam::tmp<T>::ptr() const |
| 199 | { |
| 200 | if (isTmp()) |
| 201 | { |
| 202 | if (!ptr_) |
| 203 | { |
| 204 | FatalErrorInFunction |
| 205 | << typeName() << " deallocated" |
| 206 | << abort(FatalError); |
| 207 | } |
| 208 | |
| 209 | if (!ptr_->unique()) |
| 210 | { |
| 211 | FatalErrorInFunction |
| 212 | << "Attempt to acquire pointer to object referred to" |
| 213 | << " by multiple temporaries of type " << typeName() |
| 214 | << abort(FatalError); |
| 215 | } |
| 216 | |
| 217 | T* ptr = ptr_; |
| 218 | ptr_ = 0; |
| 219 | |
| 220 | return ptr; |
| 221 | } |
| 222 | else |
| 223 | { |
| 224 | return ptr_->clone().ptr(); |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | |
| 229 | template<class T> |
no test coverage detected