Removed duplicate [] operator for atArray.

Fixed warning C4312 from << operator.
This commit is contained in:
gir489 2020-05-01 08:44:35 -04:00
parent 3c94c7f832
commit 59aa1c6de2

View File

@ -175,12 +175,11 @@ namespace rage
return m_count; return m_count;
} }
T& operator[](std::uint16_t index) T& operator[](std::uint16_t index) const
{ {
return m_data[index]; return m_data[index];
} }
#pragma warning(disable:4312)
friend std::ostream& operator<<(std::ostream& o, const atArray<T>& j) friend std::ostream& operator<<(std::ostream& o, const atArray<T>& j)
{ {
o << "Array Size: " << j.size() << std::endl; o << "Array Size: " << j.size() << std::endl;
@ -188,7 +187,7 @@ namespace rage
{ {
T item = j[i]; T item = j[i];
if (std::is_pointer<T>()) if (std::is_pointer<T>())
o << "\tArray Pointer: " << HEX_TO_UPPER(item) << " Item: [" << HEX_TO_UPPER(*(std::uint64_t*)item) << "]"; // C4312 for 64-bit targets o << "\tArray Pointer: " << HEX_TO_UPPER(item) << " Item: [" << HEX_TO_UPPER(*(T*)item) << "]";
else else
o << "\tArray Item: " << item; o << "\tArray Item: " << item;
if (i != j.size() - 1) if (i != j.size() - 1)
@ -196,12 +195,7 @@ namespace rage
} }
return o; return o;
} }
#pragma warning(default:4312)
const T& operator[](std::uint16_t index) const
{
return m_data[index];
}
private: private:
T* m_data; T* m_data;
std::uint16_t m_size; std::uint16_t m_size;