
18 Dec
2006
18 Dec
'06
3:47 p.m.
From: Ion Gazta?aga <igaztanaga@gmail.com>
To avoid wasting a bit of the internal size integer, we could define size() as "this->size_ - 1", so this->size_ == 0 could represent unknown size and this->size_== 1 an empty list, this->size_ == 2 a list with just 1 element and so on.
Clever, but such a design would fail code review if I were the project manager. This is way too likely to cause maintenance problems at some future time. Better to save the bit by defining size_ == MAXINT as unknown size, and all other values as the actual size. - James Jones Administrative Data Mgmt. Webmaster 375 Raritan Center Pkwy, Suite A Data Architect Edison, NJ 08837