hsf-training / hsf-training/cpluspluscourse

About operators exercise

Open
#439 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
TeX
Stars
313
Forks
104
PR merge metrics
No merged PRs in 30d

Description

I found it too too long. Few suggestions to better focus on operators only:

  • Provide in the original code the normalize() function and std::gcd stuff.
  • Provide int the original code the constructors, public attributes, constructors, assign method, and externals functions such as multiply, add, compare (returning -1,0,1 ?), print.
  • Ask to replace the functions with operators: =, +, *, <=>, <<
  • Then ask to add, reusing previous ones: !=, +=, *=.
  • Show that with <=> implemented, then <, <=, >, >= are automatically infered ?
  • Optionally, make all the assignments returning *this, like in operator<<, and explain this permit chaining.
  • Optionally, make them move the operators as inline friend functions, and make attributes private.
  • Optionnaly, discuss the pros and cons of making the unary constructor explicit.

Contributor guide

No contributing guide indexed for this repository

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

Start by locating the operators exercise and reviewing its current instructions, especially the existing normalize() and std::gcd material. Compare the exercise with the proposed operator-focused sequence, including constructors, arithmetic and comparison operators, compound assignments, chaining, and optional design discussions; done means the exercise is shorter and its operator scope is clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.