The plot thickens:
class Universe : std::tr1::enable_shared_from_this<Universe> {
const int answer;
public:
Universe (int a) : answer(a) {}
std::string get_answer() const;
void get_nothing() {}
virtual void blahblah(); // !!!
};
Universe u1(42);
foo (&Universe::get_answer, &u1);
Regarding my previous post on the definitions of foo,
if the class inherits from enable_shared_from this *and* contains a virtual function, then
this call to foo doesn't work, giving funny template errors in boost::result_of.
2>E:\boost_1_49\boost/utility/result_of.hpp(82): error C2825: 'F': must be a class or
namespace when followed by '::'
2> E:\boost_1_49\boost/utility/result_of.hpp(90) : see reference to class
template instantiation 'boost::detail::result_of_nested_result' being compiled
2> with
2> [
2> F=std::basic_string
(__thiscall thread_pool_tests::Universe::* &)(void) const,
2> FArgs=std::basic_string
(__thiscall thread_pool_tests::Universe::* &(thread_pool_tests::Universe *))(void) const
2> ]
2> E:\boost_1_49\boost/utility/detail/result_of_iterate.hpp(33) : see reference
to class template instantiation 'boost::detail::tr1_result_of_impl'
being compiled
2> with
2> [
2> F=std::basic_string
(__thiscall thread_pool_tests::Universe::* &)(void) const,
2> FArgs=std::basic_string
(__thiscall thread_pool_tests::Universe::* &(thread_pool_tests::Universe *))(void) const,
2> HasResultType=false
2> ]
2> E:\boost_1_49\boost/utility/detail/result_of_iterate.hpp(75) : see reference
to class template instantiation 'boost::tr1_result_of<F>' being compiled
2> with
2> [
2> F=std::basic_string
(__thiscall thread_pool_tests::Universe::* &(thread_pool_tests::Universe *))(void) const
2> ]
2> threadpoolTest.cpp(78) : see reference to class template instantiation
'boost::result_of<F>' being compiled
2> with
2> [
2> F=std::string (__thiscall thread_pool_tests::Universe::*
&(thread_pool_tests::Universe *))(void) const
2> ]
2>E:\boost_1_49\boost/utility/result_of.hpp(82): error C2516: 'F' : is not a legal base class
2> E:\boost_1_49\boost/utility/result_of.hpp(90) : see declaration of 'F'
2>E:\boost_1_49\boost/utility/result_of.hpp(82): error C2143: syntax error : missing ','
before '::'
2>E:\boost_1_49\boost/utility/result_of.hpp(82): error C2903: 'result' : symbol is neither
a class template nor a function template
2>E:\boost_1_49\boost/utility/result_of.hpp(82): error C2039: 'result' : is not a member
of '`global namespace''
2>E:\boost_1_49\boost/utility/result_of.hpp(82): error C2504: 'result' : base class undefined
2>E:\boost_1_49\boost/utility/result_of.hpp(82): error C2143: syntax error : missing ','
before '<'
2>threadpoolTest.cpp(78): error C2780:
'boost::unique_future::type> foo(F &&,A1 &&,A2 &&)' : expects 3
arguments - 2 provided
2> V⋯.h(243) : see declaration of 'vst::async'
2>threadpoolTest.cpp(78): error C2893: Failed to specialize function template
'boost::unique_future::type> vst::async(F &&,A1 &&)'
2> With the following template arguments:
2> 'std::string (__thiscall thread_pool_tests::Universe::* &)(void) const'
2> 'thread_pool_tests::Universe *'
2>threadpoolTest.cpp(78): error C2780: 'boost::unique_future<R> vst::async(F &&)' :
expects 1 arguments - 2 provided
2> with
2> [
2> R=
2> ]