, 프로그램은 표현 c ? x : y
의 x는 Visual C++ 2008boost :: bind는 조건식을 사용할 수 없습니까? I는 조건식을 주석 처리하면
#include <iostream>
#include <boost/bind.hpp>
#include <boost/thread.hpp>
typedef boost::function<void(int, int)> vii_t;
typedef boost::function<void(int)> vi_t;
void foo(int a, int b){}
void bar(int a){}
int main(int argc, char* argv[])
{
//vi_t test= true ? boost::bind(foo, _1, 100) : boost::bind(bar, _1);
vi_t test1 = boost::bind(foo, _1, 100);
vi_t test2 = boost::bind(bar, _1);
//test(1);
test1(1);
test2(1);
return 0;
}
예를 들면, _tmain 및 _TCHAR과 같은 컴파일러 관련 구문을 피할 수 있습니다. 'int main (int argc, char * argv [])'를 사용하십시오. –
컴파일러 오류를 게시 하시겠습니까? – thiton
덧붙여서, 표준 헤더 ('iostream')는 따옴표가 아니라 꺾쇠 괄호 안에 들어 있습니다 (예 :'#include',''iostream''이 아님) –