
I had to write an invoke metafunction because I couldn't seem to find one that looked like it was what I needed: template < typename MF > struct invoke { typedef typename MF::type type; }; I've looked through the documentation TOC: http://www.boost.org/doc/libs/1_42_0/libs/mpl/doc/refmanual/refmanual_toc.ht... Is there something I'm missing?

On 01/04/11 01:32, Noah Roberts wrote:
I had to write an invoke metafunction because I couldn't seem to find one that looked like it was what I needed:
template < typename MF > struct invoke { typedef typename MF::type type; };
I've looked through the documentation TOC: http://www.boost.org/doc/libs/1_42_0/libs/mpl/doc/refmanual/refmanual_toc.ht...
Is there something I'm missing?
http://www.boost.org/doc/libs/1_46_1/libs/mpl/doc/refmanual/apply.html

On 4/1/2011 12:33 AM, Joel Falcou wrote:
On 01/04/11 01:32, Noah Roberts wrote:
I had to write an invoke metafunction because I couldn't seem to find one that looked like it was what I needed:
template < typename MF > struct invoke { typedef typename MF::type type; };
I've looked through the documentation TOC: http://www.boost.org/doc/libs/1_42_0/libs/mpl/doc/refmanual/refmanual_toc.ht...
Is there something I'm missing?
http://www.boost.org/doc/libs/1_46_1/libs/mpl/doc/refmanual/apply.html
apply invokes a metafunction *class*.

2011/4/1 Noah Roberts
I had to write an invoke metafunction because I couldn't seem to find one that looked like it was what I needed:
template < typename MF > struct invoke { typedef typename MF::type type; };
I've looked through the documentation TOC: http://www.boost.org/doc/libs/1_42_0/libs/mpl/doc/refmanual/refmanual_toc.ht...
Is there something I'm missing?
How do you intend to use invoke? The way I understand it, invoke<MF> would be equivalent to MF itself. Regards, Kris

On 4/1/2011 9:28 AM, Krzysztof Czainski wrote:
2011/4/1 Noah Roberts
mailto:roberts.noah@gmail.com> I had to write an invoke metafunction because I couldn't seem to find one that looked like it was what I needed:
template < typename MF > struct invoke { typedef typename MF::type type; };
I've looked through the documentation TOC: http://www.boost.org/doc/libs/1_42_0/libs/mpl/doc/refmanual/refmanual_toc.ht...
Is there something I'm missing?
How do you intend to use invoke?
The way I understand it, invoke<MF> would be equivalent to MF itself.
No, it would be the 'type' definition inside of MF.

On 4/1/2011 9:28 AM, Krzysztof Czainski wrote:
2011/4/1 Noah Roberts
mailto:roberts.noah@gmail.com> I had to write an invoke metafunction because I couldn't seem to find one that looked like it was what I needed:
template < typename MF > struct invoke { typedef typename MF::type type; };
I've looked through the documentation TOC: http://www.boost.org/doc/libs/1_42_0/libs/mpl/doc/refmanual/refmanual_toc.ht...
Is there something I'm missing?
How do you intend to use invoke?
template < typename Sq > // Sq is full of metafunctions
struct do
{
typedef typename fold
<
Sq
, start_state
, funky
::type };

2011/4/1 Noah Roberts
How do you intend to use invoke? template < typename Sq > // Sq is full of metafunctions struct do { typedef typename fold < Sq , start_state , funky
,_1> ::type };
I would like to empasize here, that I'm no expert -- on the contrary, I'm
trying to learn bases of mpl ;-)
I don't understand your example above. I think 'do' cannot be a name of a
struct, and typedef typename fold<...>::type seems to be missing
something...
Did you mean:
struct do_
{
typedef typename fold
<
Sq
, start_state
, funky
::type type; };
Could you please explain, what funky does, and start_state too? I would like to see an example I can compile, and if my understanding is correct, make a simple modification to avoid the need for invoke. Regards, Kris

On 01/04/11 20:06, Noah Roberts wrote:
template < typename Sq > // Sq is full of metafunctions struct do { typedef typename fold < Sq , start_state , funky
,_1> ::type }; Oh getting the ::type out of a sequence of nullary metafunction :o Metafunction can be turned into metafunction class quite easily using mpl::quote.
http://www.boost.org/doc/libs/1_46_1/libs/mpl/doc/refmanual/quote.html

Hi Noah,
On Thu, 31 Mar 2011 18:32:13 -0500, Noah Roberts
I had to write an invoke metafunction because I couldn't seem to find one that looked like it was what I needed:
template < typename MF > struct invoke { typedef typename MF::type type; };
I've looked through the documentation TOC: http://www.boost.org/doc/libs/1_42_0/libs/mpl/doc/refmanual/refmanual_toc.ht...
Is there something I'm missing?
Nope, you are right, (embarrassingly) there is no such beast. Patches are welcome :). -- Aleksey Gurtovoy MetaCommunications Engineering
participants (4)
-
Aleksey Gurtovoy
-
Joel Falcou
-
Krzysztof Czainski
-
Noah Roberts