$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Hugo Duncan (hugoduncan_at_[hidden])
Date: 2003-10-09 14:34:03
Hugo Duncan <hugoduncan_at_[hidden]> wrote:
> I'm looking for the following MPL functionality and wondering if it
> already exists somewhere.
Ok, so the attatched code allows me to write the following.
struct myfn
{
template < typename U >
void operator()(const boost::mpl::identity<U>&)
{
std::cout << typeid(U).name() << std::endl;
}
};
int main()
{
typedef boost::mpl::vector<double, float> my_typelist;
for (int i=0; i<2; ++i)
ieg::switcher<my_typelist>(myfn(),i);
}
The implementation with for_each is very inefficient, using a
local counter. There must be a better way...
BTW, what do you call a class with a templated operator(), like myfn above?
#include
$include_dir="/home/hyper-archives/boost/include";
include("$include_dir/msg-footer.inc");
?>