2012-09-06 4 views
0

에서 컴파일 오류 boost :: mpl을 사용하여 일부 템플릿 매개 변수 유형의 constness를 기반으로 일부 포인터 유형의 constness를 제어하려고합니다. 여기 내 시도는 다음과 같습니다boost :: mpl :: if_

컴파일러는 그러나이 말 거부
template<typename T> 
struct iter { 
    typedef typename boost::mpl::if_<boost::is_same<T, const list>, const sexpr *, sexpr *>::type pointer; 
}; 

:

sexpr.h:154: error: ISO C++ forbids declaration of `type name' with no type 
sexpr.h:154: error: template argument 2 is invalid 
sexpr.h:154: error: template argument 1 is invalid 
sexpr.h:154: error: `type' does not name a type 

모든 단서 무엇을 내가 잘못을?

감사합니다.

typedef typename boost::mpl::if_<boost::is_const<T>, const sexpr *, sexpr *>::type pointer; 

감사 :

+0

구조체 뒤에 세미콜론이 없으면 도움이됩니다. – chris

+0

나는이 글을 놓쳤다.하지만 나는 코드에서 그것을 가지고있다. –

+0

'list' 란 무엇입니까? –

답변

0

가 나는 is_const 사용하여 고정 할 수 있었다!

관련 문제