If I am building a library for C++. Is it OK if some functions could not accept in-place operation? would it affect the standard property of the library?
For example:
void do_somthing(object const& input, object& output);
int main(){
object a;
object b;
do_somthing(a, b);//OK
do_somthing(a, a);//wrong
}
If it is OK, how should I tell that? for example should I put an assertion? throw exception? Just put it in the documentation and let it produces undefined behavior if someone insists to call it?
Some clarification:
In the OpenCV library, some function like cv::Canny
can work in place like this:
cv::Canny(img,img,100,200);
However, cv::warpAffine
can not as it was written in the documentation.
Aucun commentaire:
Enregistrer un commentaire