nodejs / nodejs/node-addon-api

Adopt C++20 defaulted comparisons (operator== / <=>)

Open
#1,748 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

blocked SemVer-major
Dominant language
C++
Stars
2.4k
Forks
499
Avg merge
2d 11h
Merged PRs (30d)
2

Description

Several node-addon-api types define operator== and operator!= as an explicit pair, where the != is always return !operator==(other);. In C++20 the compiler synthesizes a != b from operator==, so the hand-written != overloads become redundant and can be removed. Where the comparison is plain memberwise equality, operator== itself can be = defaulted.

Regarding <=>, the only plausible type is Maybe<T> where T is ordered.

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.

Research direction

Locate the node-addon-api types that define explicit operator== and operator!= pairs, then inspect Maybe for ordered comparisons. Confirm which equality operators are plain memberwise comparisons and which T types are ordered. Done means redundant != overloads are removed and eligible == or <=> operators are defaulted without changing comparison behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.