I am trying to develop 2 classes, Node and Connection, but I have no experience with templates in C ++ or C ++.
Node contains a list of connections and a connection contains 2 nodes. Therefore, I believe that Node has a template parameter that indicates what type of connections are in the list, and that the connection has a template parameter that indicates which types of nodes it contains.
How can I force in C ++ that Node contains connections of a general type, but these connections contain nodes of the Node class? The same question for the Connection class. I want to have a generic parameter for the type of nodes, but these shared nodes should contain a list with connections of the Connection class.
I tried several things, this is what I have at the moment:
template <template <template <class Conn> class Node> class Conn>
class Node {
};
Can someone help me?
Thanks in advance,
Jeff