I have a boost::tuple made of pointers (the number of pointers is not known upfront being template metaprogramming).
For example:
boost::tuple<int*, Foo*, std::string*> mytuple
Is there a way to initialize the pointers to 0 ?
I have tried creating a predicate such as:
struct Nullify
{
template <class TypePtr>
void operator()(TypePtr& ptr) const
{
ptr = 0
}
};
boost::fusion::for_each(mytuple, Nullify());
But I get error: no matching function for call to...
Ideally, if possible, I would like to use a boost::lambda within the for_each loop directly with no separate struct. (I'm using c++03)
eg. to nullify
boost::fusion::for_each(mytuple, boost::lambda::_1 = 0);
eg. to delete
boost::fusion::for_each(mytuple, delete boost::lambda::_1);