Skip to content

Commit

Permalink
value_base::parse should not be const
Browse files Browse the repository at this point in the history
  • Loading branch information
artpaul committed Feb 4, 2023
1 parent 490f773 commit c8be1a9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions include/cxxopts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,12 +809,12 @@ class value_base : public std::enable_shared_from_this<value_base> {
}

/** Parses the given text into the value. */
void parse(const std::string& text) const {
void parse(const std::string& text) {
return do_parse(parse_ctx_, text);
}

/** Parses the default value. */
void parse() const {
void parse() {
return do_parse(parse_ctx_, default_value_);
}

Expand All @@ -823,8 +823,7 @@ class value_base : public std::enable_shared_from_this<value_base> {

virtual bool do_is_container() const noexcept = 0;

virtual void do_parse(const parse_context& ctx,
const std::string& text) const = 0;
virtual void do_parse(const parse_context& ctx, const std::string& text) = 0;

void set_default_and_implicit(const bool set_default) {
if (is_boolean()) {
Expand Down Expand Up @@ -891,8 +890,7 @@ class basic_value : public value_base {
return parser_type::is_container;
}

void do_parse(const parse_context& ctx,
const std::string& text) const override {
void do_parse(const parse_context& ctx, const std::string& text) override {
parser_type().parse(ctx, text, *store_);
}

Expand Down

0 comments on commit c8be1a9

Please sign in to comment.