I am trying to implement a custom container class. Basically it could be a vector, list, map etc but I want to use the following syntax to assign attributes to the elements.
For example:
Container C;
e = C.add_element()
f = C.add_element()
// The attributes work like a map
Attribute<string> label(C);
label[e] = "element e";
// The attributes are initialized on every element. Empty string in this case.
string aux = label[f];
The syntax and behavior is inspired in LEMON graph library (http://ift.tt/1po5ttp). I tried to use their source to learn how to implement this, but it was not easy, as the library is very complex and has lots of interrelated templates and classes. Can someone point me some basic tips to implement this? Thanks.
Aucun commentaire:
Enregistrer un commentaire