Lucio Flores wrote:
So as an exercise, I'm trying to use a lambda expression that applies the first argument twice on it's second argument.
typedef mpl::apply<_1, mpl::apply<_1, _2>::type>::type twice_type;
Then I instance this lambda function on boost::add_pointer and int
typedef mpl::apply
, int>::type result_type; But using boost::is_same, I've found that result_type==int, not int** as expected. Can someone see why?
If you look closely, as it is defined, twice_type is actually the same
as mpl::_2. Once you "invoke" the ::type member typedef you're
evaluating the metafunction and no longer have a lambda.
Here's a simple function I find useful in debugging template meta-code:
template <class type>
inline void print()
{
class _ { _() {} };
_ printer;
}
use it thus:
int main()
{
typedef mpl::apply