MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / StatusOrData

Class StatusOrData

tensorflow/stream_executor/lib/statusor_internals.h:49–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47// TraitsBase specialization.
48template <typename T>
49class StatusOrData {
50 template <typename U>
51 friend class StatusOrData;
52
53 public:
54 StatusOrData() = delete;
55
56 StatusOrData(const StatusOrData& other) {
57 if (other.ok()) {
58 MakeValue(other.data_);
59 MakeStatus();
60 } else {
61 MakeStatus(other.status_);
62 }
63 }
64
65 StatusOrData(StatusOrData&& other) noexcept {
66 if (other.ok()) {
67 MakeValue(std::move(other.data_));
68 MakeStatus();
69 } else {
70 MakeStatus(std::move(other.status_));
71 }
72 }
73
74 template <typename U>
75 StatusOrData(const StatusOrData<U>& other) {
76 if (other.ok()) {
77 MakeValue(other.data_);
78 MakeStatus();
79 } else {
80 MakeStatus(other.status_);
81 }
82 }
83
84 template <typename U>
85 StatusOrData(StatusOrData<U>&& other) {
86 if (other.ok()) {
87 MakeValue(std::move(other.data_));
88 MakeStatus();
89 } else {
90 MakeStatus(std::move(other.status_));
91 }
92 }
93
94 explicit StatusOrData(const T& value) : data_(value) { MakeStatus(); }
95 explicit StatusOrData(T&& value) : data_(std::move(value)) { MakeStatus(); }
96
97 explicit StatusOrData(const Status& status) : status_(status) {
98 EnsureNotOk();
99 }
100 explicit StatusOrData(Status&& status) : status_(std::move(status)) {
101 EnsureNotOk();
102 }
103
104 StatusOrData& operator=(const StatusOrData& other) {
105 if (this == &other) return *this;
106 if (other.ok())

Callers

nothing calls this directly

Calls 2

AssignFunction · 0.50
okMethod · 0.45

Tested by

no test coverage detected