1

Why this work

    class DataRefsTree;

    class DataRefsTreeComparator {
    public:
        inline bool operator()(const DataRefsTree* inFirst, const DataRefsTree* inSecond) const;
    };

    class DataRefsTree : public DataTree<AbstractDataRef*, DataRefsTree, STreeHolderSet<DataRefsTree, DataRefsTreeComparator>> {
    public:

And this doesn't work

template <typename Data> class BaseTree;
    class BaseTreeComparartor {
    public:
        template <typename Data> inline bool operator()(const BaseTree<Data>* inFirst, const BaseTree<Data>* inSecond) const;
    };
    template <typename Data> class BaseTree :public DataTree<Data, BaseTree<Data>, STreeHolderSet<BaseTree<Data>, BaseTreeComparator>>;
    class DataRefsTree;
    class DataRefsTree :public BaseTree<AbstractDataRef> {

error class sasl::AbstractDataRef incomplete type is not allowed. How fix it?

  • this has nothing to do with template, it's a matter forward declaration. – Moia May 21 '20 at 10:26
  • 1
    In the second example how the compiler can define a `DataRefsTree` which inherit from `BaseTree`, if it doesn't know what `BaseTree` class is? – Moia May 21 '20 at 10:30

0 Answers0