나는 다음과 같이 특정 클래스 내에서 다양한 멤버 함수에 액세스하는 데 사용할 수있는 멤버 함수에 "일반"포인터를 정의하기 위해 노력하고있어 :포인터 :: 변형
class Security{
inline std::vector<double> member_function(const std::string &input_data_string){ return ... a vector<double>....;};
};
I을 boost :: variant를 사용하여 "OTHER"함수에 액세스하는 데 사용할 수있는 멤버 함수에 대한 일반적인 포인터를 정의하고 있습니다.
cannot convert from 'std::vector<_Ty> (__thiscall Security::*)(const std::string &)' to 'boost::variant<T0_,T1,T2,T3> (__thiscall Security::*)(boost::variant<T0_,T1,T2,T3>)'
1> with
1> [
1> _Ty=double
1> ]
1> and
1> [
1> T0_=std::string,
1> T1=double,
1> T2=std::vector<double>,
1> T3=std::vector<std::string>
1> ]
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
당신은 나에게 내가 뭘하는지 파악하는 데 도움이 시겠어요 :
typedef boost::variant<std::string,double, std::vector<double>, std::vector<std::string>> (Security::*ptr_sec_fn)(boost::variant<std::string,double, std::vector<double>, std::vector<std::string>>);
다음이 내가지고있어 오류입니다
ptr_sec_fn=&Security::member_function;
멤버 함수 포인터를 할당 여기서 뭐라구? 정말 고맙습니다.
대신에'boost :: function' 또는'std :: function'을 사용 해본 적이 있습니까? – AJG85
또한 boost :: bind와 boost :: phoenix :: bind를 보자. – Smash