私は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;
今すぐ最後の2行がエラーを発生させる(私は明確にするため、いくつかのビットをトリミングしました)
error: 'cs_iterator' is a protected member of 'st_tree::detail::node_base...
cs_iteratorはそのクラスの保護されたメンバーですが、そのクラスは基本クラスなので、確かに動作するはずです。それはVisual Studioで行い、G ++のように見えます(問題#16に関するコメントから推測します)。
基本クラスの定義を:public node_base < ..から直接コピーして貼り付けようとしましたが、typedefの問題ではないことを確認するために同じエラーが発生します。
私が言ったように、このコードはVisual Studio 2013でコンパイルされ、うまく動作します。今ではVisual C++の文法についてかなり厳しいですが、Xcode/Clangに慣れてきましたが、私に神秘を抱かせてください。
アイデア?
簡単な 'struct base'と' struct Derived:Base'を使って短いテスト例でこれを再現できますか? – Arunmu