Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-07-05 18:07:36

Bronek Kozicki wrote:
> Peter Dimov wrote:
>> How does your compiler help you spot duplicate tags?
> compiler (or actually language) provides tools to organize names in
> open (namespaces) or closed (nested types) hierarchies. These tools
> so far worked rather well, allowing users to define unique names
> (where sane design and source code organization are in place).

You can (and should) use the same scoping mechanism with strings. Every C++
type has a string representation. Instead of class N::X, you can use "N::X"
or the more natural "N.X".

If you use the same "N.X" string for two distinct purposes, there will be a
problem; but you can also use the same N::X type for two different purposes,
and the compiler will not warn. Strings require a bit more discipline, but
not much.

Boost list run by bdawes at, gregod at, cpdaniel at, john at