Skip to main content
1 of 2
1201ProgramAlarm
  • 7.8k
  • 2
  • 23
  • 39

You're passing fundamental types by const reference. These are better off just being passed by value. So you'd get things like

explicit address(uint32_t value);
reference operator[](int index) noexcept(false);

Your prefix increment and decrement operators should return a reference to the incremented value.

address operator++();
address operator--();

This will allow expressions like addr = ++other_addr;. (Note that, since you're in the address class, you can just name the class, you don't need to specify scope with ::ip::address).

Your postfix increment and decrement operators have a bug, because they return a reference to a local variable. The return types should be a value.

address operator++(int);
address operator--(int);

For readability and clarity, expressions mixing shifts and bit masking should use parentheses:

data_[0] = (value >> 24) & 0xFF;
1201ProgramAlarm
  • 7.8k
  • 2
  • 23
  • 39