Chapter 29. Arithmetic Types

In section 13.3 we looked at extending the integer types provided by C++ in the form of the uinteger64 and sinteger64 types. What we'll be trying to see is whether we can create a type that can genuinely and completely integrate into the language such that it can be used as we would use any of the built-in integer types. (The imperfect results of these efforts are included on the CD.)

Class Definition

Before we get stuck into the minutiae, we'll just take a look at the class definition. I decided, in order to avoid confusion with the two extant member variables lowerVal and upperVal, to use protected inheritance and derive a new type UInteger64. This is so we can cheat and use a union of uinteger64 and a uint64_t in ...

Get Imperfect C++ Practical Solutions for Real-Life Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.