MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / UniqueInt

Class UniqueInt

oneflow/maybe/just_test.cpp:226–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224
225TEST(Just, WithMsg) {
226 struct UniqueInt {
227 int x;
228
229 void drop() { x = -333; }
230
231 explicit UniqueInt(int x) : x{x} {}
232 UniqueInt(const UniqueInt& i) = delete;
233 UniqueInt(UniqueInt&& i) noexcept : x{i.x} { i.drop(); } // NOLINT
234 UniqueInt& operator=(const UniqueInt& i) = delete;
235 UniqueInt& operator=(UniqueInt&& i) noexcept {
236 x = i.x;
237 i.drop();
238 return *this;
239 }
240 ~UniqueInt() { drop(); }
241 };
242
243 using Error = simple::StackedError<std::string>;
244 using MaybeInt = Maybe<UniqueInt, Error>;

Callers

nothing calls this directly

Calls 1

dropMethod · 0.80

Tested by

no test coverage detected