Bug 1466449 addendum - Turn jArray from a struct to class and make it have a constructor from nullptr. r=smaug.

Simple adding a constructor from nullptr did not compile without turning
jArray all the way to a class instead of struct.
This commit is contained in:
Henri Sivonen 2018-11-07 18:14:28 +02:00 коммит произвёл Emilio Cobos Álvarez
Родитель 1aa4b36f30
Коммит 8c8503b03f
1 изменённых файлов: 26 добавлений и 1 удалений

Просмотреть файл

@ -48,9 +48,17 @@ struct staticJArray
};
template<class T, class L>
struct jArray
class autoJArray;
template<class T, class L>
class jArray
{
friend class autoJArray<T, L>;
private:
T* arr;
public:
L length;
static jArray<T, L> newJArray(L const len)
{
@ -77,6 +85,23 @@ struct jArray
arr = (T*)other.arr;
length = other.length;
}
MOZ_IMPLICIT jArray(decltype(nullptr))
: arr(nullptr)
, length(0)
{
}
jArray()
: arr(nullptr)
, length(0)
{
}
private:
jArray(T* aArr, L aLength)
: arr(aArr)
, length(aLength)
{
}
};
template<class T, class L>