I think I found the solution to my problem. If I add the following to my
program:
namespace boost
{
namespace detail
{
/** Fix for boost::result_of */
template
struct result_of
{
typedef R type;
};
/** Fix for boost::result_of */
template
struct result_of
{
typedef R type;
};
} //namespace detail
} //namespace boost
Then boost::result_of "learns" how to detect the result type of a member
function signature with no parameters. Now the question is: why is this
specialization not provided by boost? Should it be?
Thanks
-delfin
-----Original Message-----
From: boost-users-bounces@lists.boost.org [mailto:boost-users-
bounces@lists.boost.org] On Behalf Of Delfin Rojas
Sent: Wednesday, April 27, 2005 2:22 PM
To: boost-users@lists.boost.org
Subject: [Boost-users] Function pointers, result_of<> and
function_traits<>
Hello all,
I am trying to get the return type of a member function given its
signature.
Consider the following example from the boost result_of test:
struct X {};
int main
{
using namespace boost;
typedef int (X::*mem_func_ptr)(float);
BOOST_STATIC_ASSERT((is_same::type,
int>::value));
}
This test compiles/runs with no problems. Now, what I want is the return
type of a function with signature "int (X::*)()"
I added the following to the test:
typedef int (X::*empty_mem_func_ptr)();
BOOST_STATIC_ASSERT((is_same::type,
int>::value));
This does not compile. I get an error
boost_1_32_0\boost\utility\result_of.hpp(43) : error C2825: 'F::template':
cannot form a qualified name.
I tried to do this same thing with function_traits but it seems function
traits does not support member function pointers at all.
So this is all I have. If somebody can help me I would appreciate it.
Thanks
-delfin
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users