Boost logo

Boost :

Subject: [boost] Using C++11 lambdas to replace Phoenix in MPL expressions
From: Augustus Saunders (infinite_8_monkey_at_[hidden])
Date: 2012-03-24 22:25:05

I use Phoenix to essentially turn code into types which can then be manipulated through MPL. I mostly use this to conditionally select algorithms or to include/exclude code at compile time,  based on some logic written with MPL.  I was interested in writing the code fragments using the new C++11 lambda expressions as it gives a more natural way to write code.  While you can get the type of a lambda expression with decltype, the problem I've run into is instantiating the resultant type in order to actually get the function to execute.  Lambdas have no default constructor, which makes sense, as there would be no way to deal with the capture variables. So I'm wondering if anybody can shed some light on manually instantiating lambdas.  I would think there is a way (possibly shady) to do this, at least for lambdas with no capture.  Then passing around lambda types as template parameters would be useful, which I think would lead to many interesting results. I only get the digest, so it I would appreciate it if you CC me on any response.  Thanks- Augustus

Boost list run by bdawes at, gregod at, cpdaniel at, john at