Code cleanup to use array.data() rather than &array[0].
These latter can cause MSVC debug asserts if the array is empty. With C++11 we'll be able to do this for std::vector later. This hopefully fixes an assert in the Cycles subdivision code.
This commit is contained in:
@@ -57,7 +57,7 @@ void EdgeDice::reserve(int num_verts)
|
||||
|
||||
Attribute *attr_vN = mesh->attributes.add(ATTR_STD_VERTEX_NORMAL);
|
||||
|
||||
mesh_P = &mesh->verts[0];
|
||||
mesh_P = mesh->verts.data();
|
||||
mesh_N = attr_vN->data_float3();
|
||||
}
|
||||
|
||||
|
@@ -214,7 +214,7 @@ void PackedPatchTable::pack(Far::PatchTable* patch_table, int offset)
|
||||
}
|
||||
|
||||
table.resize(total_size());
|
||||
uint* data = &table[0];
|
||||
uint* data = table.data();
|
||||
|
||||
uint* array = data;
|
||||
uint* index = array + num_arrays * PATCH_ARRAY_SIZE;
|
||||
@@ -259,7 +259,7 @@ void PackedPatchTable::pack(Far::PatchTable* patch_table, int offset)
|
||||
|
||||
void PackedPatchTable::copy_adjusting_offsets(uint* dest, int doffset)
|
||||
{
|
||||
uint* src = &table[0];
|
||||
uint* src = table.data();
|
||||
|
||||
/* arrays */
|
||||
for(int i = 0; i < num_arrays; i++) {
|
||||
|
@@ -43,7 +43,7 @@ namespace Far { struct PatchTable; }
|
||||
#define PATCH_NODE_SIZE 1
|
||||
|
||||
struct PackedPatchTable {
|
||||
vector<uint> table;
|
||||
array<uint> table;
|
||||
|
||||
size_t num_arrays;
|
||||
size_t num_indices;
|
||||
|
Reference in New Issue
Block a user