Boost.Function: How does the template param mechanism work?
My question is, given: boost::function< int (char, long) > func(&f); how is it possible to pass the (char,long)? (I tried to receive this in a template as a single template param, or as three , but neither worked) I have been studying the headers, but the indirection used (FTSE :) ) is making it hard for me to figure this one out. The reason I am asking I is I am trying to clean up the syntax of some template params and I would like to use this technique. i.e. I would like to write: struct A {}; struct B {}; struct C {}; struct D {}; struct E {}; struct F {}; typedef MyThingdef< (A,B), (C,D), (E,F) > splat; instead of typedef MyThingdef< A,B, C,D, E,F > splat; Any direction on things to research or dig into appreciated. Thanks Brian
On Jun 19, 2005, at 10:32 AM, Brian Braatz wrote:
My question is, given:
boost::function< int (char, long) > func(&f);
how is it possible to pass the (char,long)? (I tried to receive this in a template as a single template param, or as three , but neither worked)
int (char, long) is a function type, i.e., the type that the pointer
type int (*)(char, long) points to. You can pull apart a point type
using partial specialization:
template<typename> struct Honk;
template
I have been studying the headers, but the indirection used (FTSE :) ) is making it hard for me to figure this one out.
The implementation of Boost.Function is most definitely not a thing of beauty, but it gets the job done :) Doug
Douglas Gregor
On Jun 19, 2005, at 10:32 AM, Brian Braatz wrote:
My question is, given:
boost::function< int (char, long) > func(&f);
how is it possible to pass the (char,long)? (I tried to receive this in a template as a single template param, or as three , but neither worked)
int (char, long) is a function type, i.e., the type that the pointer type int (*)(char, long) points to. You can pull apart a point type using partial specialization:
template<typename> struct Honk;
template
struct Honk { }; Honk
h; // R = int, T1 = char, T2 = long I have been studying the headers, but the indirection used (FTSE :)
) is making it hard for me to figure this one out.
I am supposed to be giving a talk that covers some of the implementation techniques used in Boost.Function at the C++ Connections conference in Vegas,... if you can wait that long :) -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (3)
-
Brian Braatz
-
David Abrahams
-
Douglas Gregor