Null by default, optionally copyable, reassignable.
Does not have direct means for allocating data, and inconveniently requires
the definition of an external destructor.
+* `OwningReference<>`: A non-nullable `OwningPointer<>`.
* `Indirection<>`: A non-nullable pointer with ownership and
optional deep copy semantics; reassignable.
Often better than a reference (due to ownership) or `std::unique_ptr<>`
| `unique_ptr<>` | yes | yes | yes | yes | no | no |
| `shared_ptr<>` | yes | yes | yes | yes | shallowly | no |
| `OwningPointer<>` | yes | yes | yes | yes | optionally deeply | yes |
+| `OwningReference<>` | no | yes | yes | yes | optionally deeply | yes |
| `Indirection<>` | no | n/a | yes | yes | optionally deeply | no |
| `CountedReference<>` | yes | yes | yes | yes | shallowly | no |
that.p_ = tmp;
return *this;
}
+
+ A &value() { return *p_; }
+ const A &value() const { return *p_; }
A &operator*() { return *p_; }
const A &operator*() const { return *p_; }
A *operator->() { return p_; }
that.p_ = tmp;
return *this;
}
+
+ A &value() { return *p_; }
+ const A &value() const { return *p_; }
A &operator*() { return *p_; }
const A &operator*() const { return *p_; }
A *operator->() { return p_; }
return *this; \
} \
}
-}
#define DEFINE_OWNING_POINTER_COPY_FUNCTIONS(A) \
DEFINE_OWNING_POINTER_COPY_CONSTRUCTORS(A) \
#define DEFINE_OWNING_POINTER_SPECIAL_FUNCTIONS(A) \
DEFINE_OWNING_POINTER_DESTRUCTOR(A) \
DEFINE_OWNING_POINTER_COPY_FUNCTIONS(A)
-
+}
#endif // FORTRAN_COMMON_INDIRECTION_H_