Boost logo

Boost Users :

Subject: [Boost-users] boost parameter - overloading on keyword "signature"
From: e r (erwann.rogard_at_[hidden])
Date: 2008-09-08 21:25:56


hello,

i have something like this:

*hpp :

namespace tag{
    template<typename Id>
    struct sequence{
        static ::boost::parameter::keyword<
            a_<Id> >& a;
        static ::boost::parameter::keyword<
            b_<Id> >& b;

        static ::boost::parameter::keyword<
            arg_method_<Id> >& arg_method;
    };
}

namespace sequence_arg{
    struct method{};
    struct a:public method{};
    struct b:public method{};
}

class sequence{
  public:
        template<typename Id,typename ArgPack>
        sequence(const Id& id,const ArgPack&args){
fill_elements(id,args,args[tag::sequence<Id>::arg_method]);
}

 private:
        template<typename Id,typename ArgPack>
        void fill_elements(
            const Id& id,
            const ArgPack& args,
            sequence_arg::a method
        );
        template<typename Id,typename ArgPack>
        void fill_elements(
            const Id& id,
            const ArgPack& args,
            sequence_arg::b method
        );
};

*.cpp :

sequence seq(
  id(),
  (
  tag::sequence::a = a_value,
  tag::sequence::arg_method = sequence_arg::a()
  )
);

So far so good except there is redundancy of information about which
method to use, so I'm looking for a way to be able to call say

sequence seq(
  id(),
  (
  tag::sequence::a = a_value
  )
)

Any suggestion?


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