| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4c967b7 commit c815f29
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -656,38 +656,6 @@ struct MallocedBuffer { | |||
| 656 | 656 | MallocedBuffer& operator=(const MallocedBuffer&) = delete; | |
| 657 | 657 | }; | |
| 658 | 658 | ||
| 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 | - | ||
| 691 | 659 | // Test whether some value can be called with (). | |
| 692 | 660 | template <typename T, typename = void> | |
| 693 | 661 | struct is_callable : std::is_function<T> { }; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments