Использовать тип параметра функции в предке
От: szag  
Дата: 29.12.15 09:37
Оценка:
Есть вот такой код:
#include <boost/function_types/function_type.hpp>
#include <boost/function_types/parameter_types.hpp>
#include <boost/function_types/function_arity.hpp>
#include <boost/typeof/std/utility.hpp>
#include <vector>

template<class T>
class foo
{
public:
    typedef typename BOOST_TYPEOF(&T::f) f_type; // error C2039: 'f': is not a member of 'bar'
    typedef typename boost::function_types::parameter_types<f_type> parameter_types;
    typedef typename boost::mpl::at_c< typename parameter_types, 1>::type vec_type;

    std::vector<typename vec_type> vec;
};

class bar : public foo<bar>
{
public:
    void f (int i){}
};

int main()
{
    bar b;
    return 0;
}

и понятно почему ошибка — тип еще готов. Есть ли возможность победить?
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.