Trying to fix shading

This commit is contained in:
Dynamitos
2023-12-03 00:29:02 +01:00
parent 6c156d3bc2
commit 178f48120d
12 changed files with 115 additions and 45 deletions
+10 -3
View File
@@ -137,7 +137,7 @@ public:
assert(_data != nullptr);
for (size_type i = 0; i < size; ++i)
{
_data[i] = value;
std::allocator_traits<allocator_type>::construct(allocator, &_data[i], value);
}
}
constexpr explicit Array(size_type size, const allocator_type& alloc = allocator_type())
@@ -147,9 +147,16 @@ public:
{
_data = allocateArray(size);
assert(_data != nullptr);
for (size_type i = 0; i < size; ++i)
if constexpr (std::is_integral_v<T> || std::is_floating_point_v<T>)
{
std::allocator_traits<allocator_type>::construct(allocator, &_data[i]);
std::memset(_data, 0, size * sizeof(T));
}
else
{
for (size_type i = 0; i < size; ++i)
{
std::allocator_traits<allocator_type>::construct(allocator, &_data[i]);
}
}
}
constexpr Array(std::initializer_list<T> init, const allocator_type& alloc = allocator_type())