Question

I have the following:

// TreeMap.h

template<class K, class V>
class TreeMap {
public:
    enum Color {
        BLACK,
        RED
    }; 

    class TreeMapNode {
        K& key;
        V& value;
        Color c; 
    public:
        TreeMapNode(K&,V&);
        TreeMapNode(std::pair<K,V>);
        K& getKey(void); 
        V& getValue(void);
        Color getColor(void); 

        void setColor(Color); 
    };
private:
    TreeMapNode* root; 
    static TreeMapNode nil; 

// TreeMap.cpp

template<class K, class V>
TreeMap<K,V>::TreeMapNode* TreeMap<K,V>::nil (NULL);

I can't seem to get the syntax of initializing the static TreeMap::nil member correctly. I eventually want the TreeMap::nil member to be an empty TreeMap::TreeMapNode (sentinel node).

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top