Skip to content

Commit 5656c74

Browse files
tniessenaduh95
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 d56a5e4 commit 5656c74

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
@@ -655,38 +655,6 @@ struct MallocedBuffer{
655655
MallocedBuffer& operator=(const MallocedBuffer&) = delete;
656656
};
657657

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

0 commit comments

Comments
(0)