5
로거 클래스에 std :: functions의 벡터를 만들려고합니다. 나는 그런 내 표준에 방법 :: 기능을 결합 할 때 다음을 이해하려고 노력하는 gfilt의 부가와 (인수가있는 함수 (문자열)에 대해 C++에서 std bind를 사용합니다.
그러나void add_string(string text);
, GCC :
NcursesWindow log_win("Logs",LINES-1,COLS/3,0,COLS*2/3);
std::function<void(std::string)> f = std::bind(&NcursesWindow::add_string,&log_win);
add_string 기능은 다음과 같이 정의되고 템플릿 오류)를 반환 : 당신 바인드 호출에 누락 string
매개 변수에 대한 자리
BD Software STL Message Decryptor v3.10 for gcc 2/3/4
In file included from ./inc/ncursesui.h:6:0,
from src/ncursesui.cpp:1:
functional: In static member function ‘static void _Function_handler<
void({basic_string<char>} ...), _Bind<
_Mem_fn<void (NcursesWindow::*)(basic_string<char>)>(
NcursesWindow)>
>::_M_invoke(const _Any_data &, {basic_string<char>} ...)’:
[STL Decryptor: Suppressed 1 more STL standard header message]
src/ncursesui.cpp:32:86: instantiated from here
functional:1778:2: erreur: no match for call to ‘(
_Bind<
_Mem_fn<void (NcursesWindow::*)(basic_string<char>)>(
NcursesWindow)>) (basic_string<char>)’
STL Decryptor reminders:
Use the /hdr:L option to see all suppressed standard lib headers
Use the /cand:L option to see all suppressed template candidates
'add_string()'은 (는)'NcursesWindows'의 멤버 함수입니까? – liwp
바인드 호출에 문자열 매개 변수가없는 자리 표시자가 있습니까? 부스트하면'bind (& NcursesWindow :: add_string, & log_win, _1) '이 필요합니다. – nabulke
예,이 함수 프로토 타입은 NcursesWindows에서 가져 왔습니다. – Tuxer