9#ifndef FORTRAN_COMMON_INDIRECTION_H_
10#define FORTRAN_COMMON_INDIRECTION_H_
33 using element_type = A;
36 CHECK(p_ &&
"assigning null pointer to Indirection");
41 CHECK(p_ &&
"move construction of Indirection from null Indirection");
49 CHECK(that.p_ &&
"move assignment of null Indirection to Indirection");
56 A &value() {
return *p_; }
57 const A &value()
const {
return *p_; }
59 bool operator==(
const A &that)
const {
return *p_ == that; }
60 bool operator==(
const Indirection &that)
const {
return *p_ == *that.p_; }
62 template <
typename... ARGS>
63 static common::IfNoLvalue<
Indirection, ARGS...> Make(ARGS &&...args) {
64 return {
new A(std::move(args)...)};
74 using element_type = A;
78 CHECK(p_ &&
"assigning null pointer to Indirection");
84 CHECK(that.p_ &&
"copy construction of Indirection from null Indirection");
88 CHECK(p_ &&
"move construction of Indirection from null Indirection");
96 CHECK(that.p_ &&
"copy assignment of Indirection from null Indirection");
101 CHECK(that.p_ &&
"move assignment of null Indirection to Indirection");
108 A &value() {
return *p_; }
109 const A &value()
const {
return *p_; }
111 bool operator==(
const A &that)
const {
return *p_ == that; }
112 bool operator==(
const Indirection &that)
const {
return *p_ == *that.p_; }
114 template <
typename... ARGS>
115 static common::IfNoLvalue<
Indirection, ARGS...> Make(ARGS &&...args) {
116 return {
new A(std::move(args)...)};
132 : p_{that.p_}, deleter_{that.deleter_} {
138 deleter_ = that.deleter_;
147 A &operator*()
const {
return *p_; }
148 A *operator->()
const {
return p_; }
149 operator bool()
const {
return p_ !=
nullptr; }
150 A *get() {
return p_; }
151 auto get()
const {
return reinterpret_cast<std::add_const_t<A> *
>(p_); }
158 void Reset(A *p =
nullptr) {
164 void Reset(A *p,
void (*del)(A *)) {
171 void (*deleter_)(A *){
nullptr};
Definition: indirection.h:127
Definition: indirection.h:72
Definition: indirection.h:31
Definition: bit-population-count.h:20