Investigate better approach to value to string-ish comparison

Open
#673 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp
Domain
backend

Research direction

Start by reading the value::operator== implementation shown in the issue and the existing overload for string. Investigate how comparisons with string-like values currently construct value objects and identify the relevant comparison tests or entry points. Done means the approach is agreed and documented with coverage for equivalent string comparisons without the unnecessary allocation.

Written by the indexing model from the issue text.

Description

Currently:

    friend
    bool
    operator==(
        value const& lhs,
        value const& rhs) noexcept
    {
        return lhs.equal(rhs);
    }

Thus, jv == "some string" is equivalent to jv == value("some string"), which allocates.
Consider adding an overload similar to one for string .

Dominant language
C++
Stars
478
Forks
110
Avg merge
8d 12h
Merged PRs (30d)
6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/json

All issues in boostorg/json

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.