Skip to content

Commit

Permalink
Remove optional
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Jan 1, 2024
1 parent d33731d commit 96d106a
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions test/scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,6 @@ namespace detail {

inline bool is_whitespace(char c) { return c == ' ' || c == '\n'; }

template <typename T> class optional {
private:
T value_;
bool has_value_ = false;

public:
optional() = default;
optional(T value) : value_(std::move(value)), has_value_(true) {}

explicit operator bool() const { return has_value_; }

auto operator*() const -> const T& {
if (!has_value_) throw std::runtime_error("bad optional access");
return value_;
}
};

struct maybe_contiguous_range {
const char* begin;
const char* end;
Expand Down

0 comments on commit 96d106a

Please sign in to comment.