nkr
A C++20 library with a custom meta-programming language.
nkr::negatable Namespace Reference

Negatable types are used to represent numbers that can be negated, i.e. set to a negative number. More...

Detailed Description

Negatable types are used to represent numbers that can be negated, i.e. set to a negative number.

The name "negatable" was chosen for two reasons:

  1. "Negatable" actually makes more sense. A "sign" is just a mathematical symbol, such a x for multiplication and + for addition. Just because a number is "signed" does not mean it is negatable, e.g. +1 simply means "positive 1" in a mathematical context. (In a C++ context, it is the operator to promote an integer type.) So the word "negatable" was chosen because it is obvious what you intend it to be capable of.
  2. signed is a C++ reserved word and cannot be used as a namespace name.
Note
Compare to nkr::positive.