
Quoting Roman Perepelitsa <roman.perepelitsa@gmail.com>:
2009/5/6 Ryan McConnehey <mccorywork@gmail.com>
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.