Boost logo

Boost Users :

From: Vjekoslav Brajkovic (balkan_at_[hidden])
Date: 2008-07-29 20:34:57


On Tue, 29 Jul 2008, Steven Watanabe wrote:
>
> How do you get the argument for the function?
> The integral key is only known at runtime, so the
> type of the argument must only be known at runtime, too.
> Am I missing something?

Here are the two lines:

   /*
    * Here, we associate the value with the known key
    * *boost::mpl::int_<1>*, which is known at the
    * compile time.
    */
   boost::fusion::at_key< int_<1> >(fmap) = _int_1_;

   /* And here we pass the argument. */
   boost::fusion::at_key< int_<1> >(fmap)(5);

As I have sad before, I'm not particularly familiar with MPL/Fusion, so
any clarifications are very welcome. For instance, the document specifies:
"It is named "fusion" because the library is reminiscent of the "fusion"
of compile time meta-programming with runtime programming.", but it does
not specify which part is compile and which is run-time.

Also the function arguments are irrelevant. Let's say I call:

   at_key< int_<1> >(fmap)();

I would like this to be translated into:

  _int_1_();

  -Vjeko


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