Skip to content

Commit c815f29

Browse files
tniessentargos
authored andcommitted
src: remove NonCopyableMaybe
I added this class in 823d86c in 2018 when we did not yet use `std::optional`. The last uses were removed in 5b9bf39, so remove it. Refs: #24234 Refs: #55368 PR-URL: #58168 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Daeyeon Jeong <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 4c967b7 commit c815f29

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

src/util.h

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -656,38 +656,6 @@ struct MallocedBuffer {
656656
MallocedBuffer& operator=(const MallocedBuffer&) = delete;
657657
};
658658

659-
template <typename T>
660-
class NonCopyableMaybe {
661-
public:
662-
NonCopyableMaybe() : empty_(true) {}
663-
explicit NonCopyableMaybe(T&& value)
664-
: empty_(false),
665-
value_(std::move(value)) {}
666-
667-
bool IsEmpty() const {
668-
return empty_;
669-
}
670-
671-
const T* get() const {
672-
return empty_ ? nullptr : &value_;
673-
}
674-
675-
const T* operator->() const {
676-
CHECK(!empty_);
677-
return &value_;
678-
}
679-
680-
T&& Release() {
681-
CHECK_EQ(empty_, false);
682-
empty_ = true;
683-
return std::move(value_);
684-
}
685-
686-
private:
687-
bool empty_;
688-
T value_;
689-
};
690-
691659
// Test whether some value can be called with ().
692660
template <typename T, typename = void>
693661
struct is_callable : std::is_function<T> { };

0 commit comments

Comments
 (0)