Hi
Med builds are failing with
medfile_int_wrap.cc:11272:30: error: no matching function for call to
'std::vector<double, std::allocator<double>
>::erase(SwigValueWrapper<__gnu_cxx::__normal_iterator<double*,
std::vector<double, std::allocator<double> > > >&)'
result = (arg1)->erase(arg2);
A standalone version which fails to compile (ignoring the fact that arg2 is not
initialized):
---------------------
#include <vector>
typedef double med_float;
template<typename T> class SwigValueWrapper {
struct SwigMovePointer {
T *ptr;
SwigMovePointer(T *p) : ptr(p) { }
~SwigMovePointer() { delete ptr; }
SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0;
delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
} pointer;
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
SwigValueWrapper(const SwigValueWrapper<T>& rhs);
public:
SwigValueWrapper() : pointer(0) { }
SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t));
pointer = tmp; return *this; }
operator T&() const { return *pointer.ptr; }
T *operator&() { return pointer.ptr; }
};
template <typename T> T SwigValueInit() {
return T();
}
int main() {
std::vector< med_float > arg1;
SwigValueWrapper< std::vector< double >::iterator > arg2;
arg1.erase(arg2);
};
---------------------
GCC 5 compiles the code. GCC6 seems to require an explicit cast, even though
std::vector<double>::iterator it = arg2;
works. GCC bug?
Thanks
asndro
Show replies by date