Previous section   Next section

Imperfect C++ Practical Solutions for Real-Life Programming
By Matthew Wilson
Table of Contents
Chapter 29.  Arithmetic Types


29.11. Arithmetic Types: Coda

I hope you've enjoyed this trip into the dark side of what seems on the surface to be a trivial matter. We've seen just how refreshingly easy it was to define our assignment, comparison, and arithmetic operations given that we chose to allow conversion (non-explicit) construction.

Alas, that's as far as we were able to go with our emulation of built-in syntax. Any support for implicit truncation, promotion, or Boolean testing invalidates the arithmetic operations, and so cannot be used. Explicit casts, accessor member functions, and shims all provide reasonable workarounds but they're neither seamless nor attractive, and we can hardly call their use an unqualified victory.

But those are the breaks. This great language does its best to support our intents, but it can only be persuaded to go so far.


      Previous section   Next section