Re: Please help with testing & improving a StringValue class
* Alf P. Steinbach:
...
An 01 version of StringValue is now available at
<url: http://home.no.net/alfps/cpp/lib/alfs_v01.zip>.
Seems I've partially rediscovered the joy of coding...
Old features:
* A StringValue can be constructed from a literal in constant
time with no dynamic allocation.
* A StringValue can be constructed from a pointer and deletion
operation (functor or function) in constant time, with no O(n)
copying.
* A StringValue can be copied and assigned in constant time with
no dynamic allocation.
* A StringValue can be safely constructed in other ways, including
from a 'char const*' and from a 'std::string', but then involving
O(n) copying and dynamic allocation.
* A StringValue can be freely copied and assigned, but the value
can not be modified.
New features:
* A license reference (Boost license) is included in every file,
resulting from comments by Roland Pibinger (thanks).
* operator==, operator< added,
resulting from comments by Barry <dhb52@2000.com> (thanks).
* Implicit conversion to 'char const*' /removed/, because
* StringValue is now a subclass of a new class StringValueOrNull,
which supports passing null-values around. A StringValue is
therefore implicitly convertible to StringValueOrNull. A
StringValueOrNull value can only be explicitly converted to pure
StringValue, then with checking of nullvalue & possible exception.
* Support for << and >> stream i/o added (because of removal of
implicit conversion to 'char const*').
Planned features:
+ In order to be useful in Windows programming, a wchar_t version is
needed, i.e. templatization on the character type.
Comments, ideas, criticism etc. welcome!
Cheers, & hope this can be interesting,
- Alf