Boost logo

Boost Users :

Subject: Re: [Boost-users] Unique parameter values for interfaces
From: Eugene Wee (crystalrecursion_at_[hidden])
Date: 2009-05-06 03:00:21


On Wed, May 6, 2009 at 2:12 PM, Ryan McConnehey <mccorywork_at_[hidden]> wrote:
> I realized later that this method doesn't prevent the swapping of a
> ConfigName with a PathName parameter.  Since both parameters are typedef to
> the same "type" of ParameterValue they're interchangeable.  Is there a boost
> class, library or C++ idiom that would provide what I'm looking for?  Since
> I'm going to be using this concept for other classes I build, I'd like
> something that would easily create parameter classes to use but not be
> interchangeable with other classes of the same type.  I know that I could do
> this with a macro but I'm leaving that for a last resort.

One way to do this is to simply define new types instead of using
typedef to create different aliases for the same type.

As for Boost, I guess that Boost.Parameter could help you allow your
users to avoid the mistake of mixing up the arguments by way of named
arguments.

Regards,
Eugene Wee


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