Boost logo

Boost Users :

Subject: Re: [Boost-users] Unique parameter values for interfaces
From: Peter Bartlett (pete_at_[hidden])
Date: 2009-05-06 05:35:55

Quoting Roman Perepelitsa <roman.perepelitsa_at_[hidden]>:

> 2009/5/6 Ryan McConnehey <mccorywork_at_[hidden]>
>> Roman Perepelitsa wrote:
>> template<typename S, *int N*>
>> struct ParameterValue
>> {
>> ParameterValue(S value_) : value(value_) {}
>> S value
>> };
>> typedef ParameterValue<std::string, *0*> ConfigName;
>> typedef ParameterValue<std::string, *1*> PathName;
>> Roman Perepelitsa.
>> Is is possible to have the number be generated automatically so that it
>> doesn't need to be defined by the user?
> I don't think so. If you want to protect yourself from accidentally using
> the same number with different types, you can try the following:
> [...]

In addition to tagging, you can also look into whether true_typedef is
suitable. Matthew Wilson's STLSoft has an implementation.

There is also a strong_typedef in Boost but I think it should be
regarded as implementation detail of the serialization library and
thus comes with caveats.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at