나는 here의 트리 컨테이너 클래스를 사용하고 있습니다.템플릿 - 기본 클래스의 보호 된 typedef 액세스
Visual Studio 2013에서는 모든 것이 괜찮습니다 (하나의 사소한 수정 이후).하지만 내 응용 프로그램은 크로스 플랫폼이므로 Xcode 7.2.1 (Clang 1.0)에서 컴파일되도록 노력하고 있습니다. 모든 지옥 느슨한 휴식.
많은 오류가 있습니다. 내가보고 있었고, 추측 할 수없는 일이입니다 ..
template <typename Tree, typename Data, typename Compare>
struct node_ordered
: public node_base< Tree,
node_ordered<Tree, Data, Compare>,
multiset< node_ordered<Tree, Data, Compare>*,
ptr_less_data<Compare>,
typename Tree::allocator_type>
>
{
typedef Tree tree_type;
typedef typename Tree::allocator_type allocator_type;
typedef node_ordered<Tree, Data, Compare> node_type;
typedef multiset<node_type*, ptr_less_data<Compare>, allocator_type> cs_type;
typedef node_base<Tree, node_type, cs_type> base_type;
typedef typename base_type::iterator iterator;
typedef typename base_type::const_iterator const_iterator;
protected:
typedef typename base_type::cs_iterator cs_iterator;
typedef typename base_type::cs_const_iterator cs_const_iterator;
이제 마지막 두 줄은 오류를 생성 (나는 명확성을 위해 일부 비트를 손질 한)
error: 'cs_iterator' is a protected member of 'st_tree::detail::node_base...
cs_iterator가 해당 클래스의 보호 된 멤버이지만 클래스는 기본 클래스이므로 반드시 작동해야합니다. 그것은 Visual Studio에서하고, G ++에서 보일 것입니다. (저는이 문제를 16 번 문제와 관련하여 추론합니다).
public class node_base < ..에서 직접 기본 클래스 정의를 복사하여 붙여 넣으려고했지만 typedef에 문제가 없는지 확인하고 동일한 오류가 발생합니다.
내가 말했듯이이 코드는 Visual Studio 2013에서 올바르게 컴파일되고 작동합니다. 이제는 Xcode/Clang에 익숙해 져 있는데 Visual C++의 구문에 대해서는 다소 엄격합니다.하지만이 오류는) 나를 신비화시켜 줘.
아이디어가 있으십니까?
간단한 'struct base'와'struct Derived : Base'를 사용하여 짧은 테스트 예제로 이것을 재현 할 수 있습니까? – Arunmu