Henri Sivonen wrote:
I had
void operator=(const jArray<T,L>& other)
where jArray is a struct and
void operator=(L zero)
where L is in practice int32_t and argument zero is only ever 0.
void operator=(L zero) {
// Make assigning null to an array in Java delete the buffer in C++
NS_ASSERTION(!zero, "Non-zero integer assigned to jArray.");
delete[] arr;
arr = nullptr;
length = 0;
}
Tricky. If you don't get anywhere, here's my stab in the dark:
template<typename U>
void operator=(U zero) {
// Make assigning null to an array in Java delete the buffer in C++
delete[] arr;
arr = zero;
length = 0;
}
You could optionally assert that zero == nullptr.
--
Warning: May contain traces of nuts.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform