|
Boost Users : |
Subject: [Boost-users] [FunctionTypes] Getting functor/lambda parameters (VS2012)
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2013-06-23 16:44:21
Hi,
I'm using C++ compiler from the latest VS2012.
I'm trying this simple technique to determined type of
functor or lambda call parameter, it works well:
#include <boost/function_types/parameter_types.hpp>
int main()
{
auto foo = [](int) -> void {};
typedef decltype(foo) foo_type;
typedef boost::function_types::parameter_types
<
decltype(&foo_type::operator())
>::type parameter_types;
}
Next, I move the typedef into class template, in constructor body,
it works well too:
template <typename T>
struct A
{
A(T t)
{
typedef typename boost::function_types::parameter_types
<
decltype(&T::operator())
>::type parameter_types;
}
};
Finally, I move further with the technique, so I can access parameter types
within class template scope:
template <typename T>
struct B
{
typedef typename boost::function_types::parameter_types
<
decltype(&T::operator())
>::type parameter_types;
};
This example does compile with clang 3.4 (svn trunk) and GCC 4.8.1,
but it does not compile with Visual C++ 11.0.
Does anyone understand what C++11 feaure VS2012 is lacking
so it prevents compilation of the sample with B template above?
Here is complete .cpp file https://gist.github.com/mloskot/5846468
Best regards,
-- Mateusz Loskot, http://mateusz.loskot.net
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net