Just wrap it in a structure. You need to specify a name of this type in order to be able to refer to it.
template<class T> class Graph { std::map<T, const Graph<T>*> data; public:
In C ++ 11, you can also do this with a typedef template alias with a forward declaration:
namespace { template<class T> struct GraphWrap { class type; typedef std::map<T, const typename GraphWrap<T>::type*> type; }; } template<class T> using Graph = typename GraphWrap<T>::type;
Of course, using std::map here can be a little misleading, because you are using the key type parameter as the type of the container value. As Mooing Duck said, you seem to be modeling a directed graph where each node has at most one outgoing edge. If you want to do something with charts, there are graph libraries, if you do something else or just want to find out, then this is a different story.
source share