On Fri, Sep 21, 2012 at 11:57 PM, Neil <[email protected]> wrote:
> That's not a very enlightening description of a use case... which overloads
> do you already have, and which one is the compiler using when you don't want
> it to?
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.
The person who did the nullptr conversion was apparently not OK with
the nullptr to 0 implicit conversion causing a warning, so I figure I
must not re-introduce that conversion.
On Fri, Sep 21, 2012 at 5:22 PM, Rafael Ávila de Espíndola
<[email protected]> wrote:
> In code that uses c++11 you can use
>
> typedef decltype(nullptr) foobar;
This seems to work. Thanks.
Now I have:
void operator=(const jArray<T,L>& other) {
delete[] arr;
arr = other.arr;
length = other.length;
}
#ifdef MOZ_HAVE_CXX11_NULLPTR
typedef decltype(nullptr) jArray_nullptr_t;
void operator=(jArray_nullptr_t zero) {
// Make assigning null to an array in Java delete the buffer in C++
delete[] arr;
arr = nullptr;
length = 0;
}
#else
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;
}
#endif
--
Henri Sivonen
[email protected]
http://hsivonen.iki.fi/
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform