Ill-defined copy/move constructors/operators for DefaultSolver #49
Open
Description
The C++ class DefaultSolver
currently doesn't behave well when copied or moved.
Based on a quick scan of the C bindings, I don't think it's foreseen to be possible to copy a solver object. Hence, the copy constructor and operator should be deleted.
Moving a solver object is quite straightforward however, but the definition thereof is missing.
Tested implementation (nothing but standard boilerplate code):
template<typename T = double>
class DefaultSolver
{
...
DefaultSolver(const DefaultSolver &) = delete;
DefaultSolver(DefaultSolver &&other);
DefaultSolver &operator=(const DefaultSolver &) = delete;
DefaultSolver &operator=(DefaultSolver &&other);
...
};
template<typename T>
DefaultSolver<T>::DefaultSolver(DefaultSolver &&other) : handle(other.handle)
{
other.handle = nullptr;
}
template<typename T>
DefaultSolver<T> &DefaultSolver<T>::operator=(DefaultSolver &&other)
{
if (this != &other){
handle = other.handle;
other.handle = nullptr;
}
return *this;
}
Metadata
Assignees
Labels
No labels