MCPcopy Create free account
hub / github.com/andreasfertig/programming-with-cpp20 / BCD

Class BCD

06.13-bcd1/main.cpp:6–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include <compare>
5
6class BCD {
7public:
8 BCD(int v, int significance)
9 : mSignificance{significance}
10 , mValue{Adjust(v)}
11 {}
12
13 operator int() const { return mValue; }
14
15 // #A Provide at least equality comparison
16 auto operator<=>(const BCD&) const = default;
17
18private:
19 int mSignificance; // #B The additional member just works
20 int mValue;
21
22 static int Adjust(int v);
23};
24
25int BCD::Adjust(int v)
26{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected