Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2007-10-18 07:36:31


I don't think that meta-programming will help check you the values. This can
only be the case if the values are available (as const with external
linkage) at compile time.

If you need the checking pattern to be generated during the compilation than
take a look at boost::xpressive.

With Kind Regards,
Ovanes

On 10/18/07, Zeljko Vrba <zvrba_at_[hidden]> wrote:
>
> On Thu, Oct 18, 2007 at 09:04:39AM +0200, Ovanes Markarian wrote:
> >
> > Hello Zeljko,
> >
> > may be another approach? Why not using a template method and static
> concepts
> > inside a function, which ensure that a parameter is of correct type?
> >
> Hmm, I didn't quite get you. But I want to match both on *type* and
> *value*
> as shown in this rule:
>
> >
> > > | (Insn "addq", Reg "%rsp") -> (* do something *)
> >
>
> The type here is (Insn, Reg) [particular types of larger variants];
> each component is also matched on the particular value ("addq" and
> "%rsp" strings).
>
> >
> > > | (_, Imm x) -> (* any 1st item; the 2nd must be Imm type, and
>
> > > the x variable is bound to the value carried by the
> 2nd
> >
>
> The type here is doesn't matter and (Imm x) - this is a match only
> on type where the variable x gets bound to the value carried by
> the variant type.
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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