Boost logo

Boost Users :

Subject: Re: [Boost-users] Unique parameter values for interfaces
From: Andrew Sutton (andrew.n.sutton_at_[hidden])
Date: 2009-05-06 07:09:25


>
> 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;
>

You could use inheritance the use of numeric tagging.

template <typename T>
struct Param {
  T value;
};

struct ConfigName : Param<string> { };
struct PathName : Param<string> { };

Andrew Sutton
andrew.n.sutton_at_[hidden]



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net