The question is related to a talk by Stefanus Du Toit on hourglass pattern. Its a great talk, really helpful for library writers.
Youtube Link: https://youtu.be/PVYdHDm0q6Y
Slideshare Link: http://ift.tt/1AGuMgW
Ok here is the question:
Say I have to pass a std::vector<MyObject>
across the library boundary. What is the best way to do this using hourglass pattern. I am concerned about the performance as well as keeping a clean interface. Given below is a set of example interfaces that I want to implement.
Clientside C++ interface:
void MyLibraryClass::DoSomething(const std::vector<MyObject>& objs);
C Interface:
???? (Not sure what is the best practice here)
Internall library C++ interface:
MyInternalLibraryClass::DoSomething(const std::vector<MyObjectImpl>& objs);
Hope this explains my question.
Aucun commentaire:
Enregistrer un commentaire