Boost logo

Boost :

Subject: [boost] Interest in specialized types
From: Henning Basold (h.basold_at_[hidden])
Date: 2010-08-22 11:49:39


  Hello,

in http://permalink.gmane.org/gmane.comp.lib.boost.devel/207794 Robert
Ramey talked about wrapping some POD to increase type safety. Some time
ago I used something similar to ensure that misuse of values can be
found by the compiler.

So I think that is something that can be generalized. The concept is to
wrap a type into a class and restrict the interface. This ensures that
values from one context (e.g. an id) can't be used in another context
(e.g. adding of number or as an id for other objects).

Attached is a very simple implementation where the needed concepts can
be specified as parameter. To distinguish for example between different
id types also a tag type can be specified.

Do you think this might be a useful utility? Or is there something
similar already available? I've searched the vault but did not find
anything.

Regards
Henning




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk