We used to have lol::map::empty() to empty maps, but in std::map this method is called clear(). It sounds safe to harmonise between our types and have lol::array::clear() too.legacy
| @@ -347,10 +347,10 @@ BtPhysTest::~BtPhysTest() | |||||
| objects << m_physobj_list.last().m1; | objects << m_physobj_list.last().m1; | ||||
| m_physobj_list.pop(); | m_physobj_list.pop(); | ||||
| } | } | ||||
| m_ground_list.empty(); | |||||
| m_stairs_list.empty(); | |||||
| m_character_list.empty(); | |||||
| m_platform_list.empty(); | |||||
| m_ground_list.clear(); | |||||
| m_stairs_list.clear(); | |||||
| m_character_list.clear(); | |||||
| m_platform_list.clear(); | |||||
| while (objects.count()) | while (objects.count()) | ||||
| { | { | ||||
| @@ -75,7 +75,7 @@ LOLFX_RESOURCE_DECLARE(shinymvtexture); | |||||
| class TargetCamera | class TargetCamera | ||||
| { | { | ||||
| public: | public: | ||||
| void EmptyTargets() { m_targets.empty(); } | |||||
| void EmptyTargets() { m_targets.clear(); } | |||||
| void AddTarget(vec3 new_target) { m_targets << new_target; } | void AddTarget(vec3 new_target) { m_targets << new_target; } | ||||
| //This considers the box usage A to B as top-left to bottom-right | //This considers the box usage A to B as top-left to bottom-right | ||||
| void AddTarget(box3 new_target) | void AddTarget(box3 new_target) | ||||
| @@ -136,7 +136,7 @@ void EasyMeshLoadJob::RetrieveResult(class MeshViewer* app) | |||||
| { | { | ||||
| for (EasyMeshViewerObject* mesh : m_meshes) | for (EasyMeshViewerObject* mesh : m_meshes) | ||||
| app->AddViewerObj(mesh); | app->AddViewerObj(mesh); | ||||
| m_meshes.empty(); | |||||
| m_meshes.clear(); | |||||
| } | } | ||||
| //MeshViewer ------------------------------------------------------------------ | //MeshViewer ------------------------------------------------------------------ | ||||
| @@ -245,7 +245,7 @@ void MeshViewer::UpdateSceneSetup(bool only_destroy) | |||||
| //Delete previous setups | //Delete previous setups | ||||
| for (auto &key : m_ssetups) | for (auto &key : m_ssetups) | ||||
| delete key.second; | delete key.second; | ||||
| m_ssetups.empty(); | |||||
| m_ssetups.clear(); | |||||
| if (m_ssetup_file_status) | if (m_ssetup_file_status) | ||||
| { | { | ||||
| m_file_check->UnregisterFile(m_ssetup_file_status); | m_file_check->UnregisterFile(m_ssetup_file_status); | ||||
| @@ -305,8 +305,8 @@ void MeshViewer::TickGame(float seconds) | |||||
| //static array<std::string> mesh_names_str; | //static array<std::string> mesh_names_str; | ||||
| //Draw viewer objects | //Draw viewer objects | ||||
| m_menu_mesh_names_char.empty(); | |||||
| m_menu_mesh_names_str.empty(); | |||||
| m_menu_mesh_names_char.clear(); | |||||
| m_menu_mesh_names_str.clear(); | |||||
| for (ViewerObject* obj : m_objs) | for (ViewerObject* obj : m_objs) | ||||
| m_menu_mesh_names_str << obj->GetName(); | m_menu_mesh_names_str << obj->GetName(); | ||||
| for (auto const &str : m_menu_mesh_names_str) | for (auto const &str : m_menu_mesh_names_str) | ||||
| @@ -877,7 +877,7 @@ void MeshViewer::Update(float seconds) | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| m_ssetup->m_custom_cmd.empty(); | |||||
| m_ssetup->m_custom_cmd.clear(); | |||||
| #endif //ALL_FEATURES | #endif //ALL_FEATURES | ||||
| #if HAS_WEB | #if HAS_WEB | ||||
| @@ -58,7 +58,7 @@ bool SceneSetup::Shutdown(bool destroy) | |||||
| Ticker::Unref(m_lights[i]); | Ticker::Unref(m_lights[i]); | ||||
| if (destroy) | if (destroy) | ||||
| m_lights.empty(); | |||||
| m_lights.clear(); | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -49,10 +49,10 @@ struct RayCastResult | |||||
| } | } | ||||
| void Reset() | void Reset() | ||||
| { | { | ||||
| m_collider_list.empty(); | |||||
| m_hit_normal_list.empty(); | |||||
| m_hit_point_list.empty(); | |||||
| m_hit_fraction_list.empty(); | |||||
| m_collider_list.clear(); | |||||
| m_hit_normal_list.clear(); | |||||
| m_hit_point_list.clear(); | |||||
| m_hit_fraction_list.clear(); | |||||
| } | } | ||||
| array<EasyPhysic*> m_collider_list; | array<EasyPhysic*> m_collider_list; | ||||
| @@ -181,7 +181,7 @@ public: | |||||
| m_cur_fbo = VoronoiFbo; | m_cur_fbo = VoronoiFbo; | ||||
| else if (m_controller->WasKeyReleasedThisFrame(KEY_F3)) | else if (m_controller->WasKeyReleasedThisFrame(KEY_F3)) | ||||
| { | { | ||||
| voronoi_points.empty(); | |||||
| voronoi_points.clear(); | |||||
| if (mode == 0) | if (mode == 0) | ||||
| { | { | ||||
| int i = 4; | int i = 4; | ||||
| @@ -201,7 +201,7 @@ public: | |||||
| if (mode == 0) | if (mode == 0) | ||||
| { | { | ||||
| voronoi_points.empty(); | |||||
| voronoi_points.clear(); | |||||
| int maxi = 6; | int maxi = 6; | ||||
| for (int i = 0; i < maxi; ++i) | for (int i = 0; i < maxi; ++i) | ||||
| { | { | ||||
| @@ -536,7 +536,7 @@ public: | |||||
| void RegisterVertex(int vert_id, vec3 vert_coord); | void RegisterVertex(int vert_id, vec3 vert_coord); | ||||
| void RemoveVertex(int vert_id); | void RemoveVertex(int vert_id); | ||||
| bool GetMasterList(array<int> &ret_master_list) { ret_master_list = master_list; return ret_master_list.count() > 0; } | bool GetMasterList(array<int> &ret_master_list) { ret_master_list = master_list; return ret_master_list.count() > 0; } | ||||
| void Clear() { vertex_list.empty(); } | |||||
| void Clear() { vertex_list.clear(); } | |||||
| private: | private: | ||||
| //<VertexId, VertexLocation, VertexMasterId> | //<VertexId, VertexLocation, VertexMasterId> | ||||
| array<int, vec3, int> vertex_list; | array<int, vec3, int> vertex_list; | ||||
| @@ -174,8 +174,8 @@ void EasyMesh::MeshCsg(CSGUsage csg_operation) | |||||
| } | } | ||||
| } | } | ||||
| #endif | #endif | ||||
| vert_list.empty(); | |||||
| tri_list.empty(); | |||||
| vert_list.clear(); | |||||
| tri_list.clear(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -186,7 +186,7 @@ void EasyMesh::VerticesCleanup() | |||||
| //2: Remove all unused vertices | //2: Remove all unused vertices | ||||
| array<VertexData> old_vert = m_vert; | array<VertexData> old_vert = m_vert; | ||||
| int shift = 0; | int shift = 0; | ||||
| m_vert.empty(); | |||||
| m_vert.clear(); | |||||
| for (int i = 0; i < vert_ids.count(); ++i) | for (int i = 0; i < vert_ids.count(); ++i) | ||||
| { | { | ||||
| //Unused vertex, update the shift quantity instead of keeping it. | //Unused vertex, update the shift quantity instead of keeping it. | ||||
| @@ -88,8 +88,8 @@ GpuShaderData::GpuShaderData(uint16_t vert_decl_flags, Shader* shader, DebugRend | |||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
| GpuShaderData::~GpuShaderData() | GpuShaderData::~GpuShaderData() | ||||
| { | { | ||||
| m_shader_uniform.empty(); | |||||
| m_shader_attrib.empty(); | |||||
| m_shader_uniform.clear(); | |||||
| m_shader_attrib.clear(); | |||||
| } | } | ||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
| @@ -228,8 +228,8 @@ GpuEasyMeshData::GpuEasyMeshData() | |||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
| GpuEasyMeshData::~GpuEasyMeshData() | GpuEasyMeshData::~GpuEasyMeshData() | ||||
| { | { | ||||
| m_gpudatas.empty(); | |||||
| m_vdatas.empty(); | |||||
| m_gpudatas.clear(); | |||||
| m_vdatas.clear(); | |||||
| if (m_ibo) | if (m_ibo) | ||||
| delete m_ibo; | delete m_ibo; | ||||
| } | } | ||||
| @@ -397,12 +397,12 @@ void EasyMesh::SmoothMesh(int main_pass, int split_per_main_pass, int smooth_per | |||||
| while (smooth_pass--) | while (smooth_pass--) | ||||
| { | { | ||||
| master_list.empty(); | |||||
| master_list.clear(); | |||||
| if (vert_dict.GetMasterList(master_list)) | if (vert_dict.GetMasterList(master_list)) | ||||
| { | { | ||||
| for (int i = 0; i < master_list.count(); i++) | for (int i = 0; i < master_list.count(); i++) | ||||
| { | { | ||||
| connected_vert.empty(); | |||||
| connected_vert.clear(); | |||||
| if (vert_dict.FindConnectedVertices(master_list[i], m_indices, m_cursors.last().m2, connected_vert)) | if (vert_dict.FindConnectedVertices(master_list[i], m_indices, m_cursors.last().m2, connected_vert)) | ||||
| { | { | ||||
| //Calculate vertices sum | //Calculate vertices sum | ||||
| @@ -421,7 +421,7 @@ void EasyMesh::SmoothMesh(int main_pass, int split_per_main_pass, int smooth_per | |||||
| vec3 new_vert = (alpha * smooth_buf[smbuf][master_list[i] - m_cursors.last().m1] + vert_sum) / (alpha + n); | vec3 new_vert = (alpha * smooth_buf[smbuf][master_list[i] - m_cursors.last().m1] + vert_sum) / (alpha + n); | ||||
| //Set all matching vertices to new value | //Set all matching vertices to new value | ||||
| matching_ids.empty(); | |||||
| matching_ids.clear(); | |||||
| matching_ids << master_list[i]; | matching_ids << master_list[i]; | ||||
| vert_dict.FindMatchingVertices(master_list[i], matching_ids); | vert_dict.FindMatchingVertices(master_list[i], matching_ids); | ||||
| for (int j = 0; j < matching_ids.count(); j++) | for (int j = 0; j < matching_ids.count(); j++) | ||||
| @@ -388,7 +388,7 @@ void TickerData::GameThreadTick() | |||||
| } | } | ||||
| data->m_todolist = data->m_todolist_delayed; | data->m_todolist = data->m_todolist_delayed; | ||||
| data->m_todolist_delayed.empty(); | |||||
| data->m_todolist_delayed.clear(); | |||||
| /* Tick objects for the game loop */ | /* Tick objects for the game loop */ | ||||
| for (int g = Entity::GAMEGROUP_BEGIN; g < Entity::GAMEGROUP_END && !data->quit /* Stop as soon as required */; ++g) | for (int g = Entity::GAMEGROUP_BEGIN; g < Entity::GAMEGROUP_END && !data->quit /* Stop as soon as required */; ++g) | ||||
| @@ -165,7 +165,7 @@ void Renderer::DestroyAll() | |||||
| { | { | ||||
| for (Renderer* renderer : g_renderers) | for (Renderer* renderer : g_renderers) | ||||
| delete renderer; | delete renderer; | ||||
| g_renderers.empty(); | |||||
| g_renderers.clear(); | |||||
| } | } | ||||
| /* | /* | ||||
| @@ -982,7 +982,7 @@ void ShaderBuilder::Build(std::string& code) | |||||
| //Cleanup first | //Cleanup first | ||||
| for (int prog = 0; prog < ShaderProgram::MAX; prog++) | for (int prog = 0; prog < ShaderProgram::MAX; prog++) | ||||
| for (int var = 0; var < ShaderVariable::MAX; var++) | for (int var = 0; var < ShaderVariable::MAX; var++) | ||||
| m_parameters[prog][var].empty(); | |||||
| m_parameters[prog][var].clear(); | |||||
| //Start building | //Start building | ||||
| for (int prog = 0; prog < ShaderProgram::MAX; prog++) | for (int prog = 0; prog < ShaderProgram::MAX; prog++) | ||||
| @@ -131,7 +131,7 @@ void image::resize(ivec2 size) | |||||
| { | { | ||||
| for (auto &kv : m_data->m_pixels) | for (auto &kv : m_data->m_pixels) | ||||
| delete kv.second; | delete kv.second; | ||||
| m_data->m_pixels.empty(); | |||||
| m_data->m_pixels.clear(); | |||||
| m_data->m_format = PixelFormat::Unknown; | m_data->m_format = PixelFormat::Unknown; | ||||
| } | } | ||||
| @@ -61,7 +61,7 @@ bool KeyBinding::Unbind(const std::string& device_name, const std::string& key_n | |||||
| void KeyBinding::ClearBindings() | void KeyBinding::ClearBindings() | ||||
| { | { | ||||
| m_keybindings.empty(); | |||||
| m_keybindings.clear(); | |||||
| } | } | ||||
| /////////////////////////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////////////////////////// | ||||
| @@ -190,8 +190,8 @@ bool AxisBinding::UnbindKeys(const std::string& device_name, const std::string& | |||||
| void AxisBinding::ClearBindings() | void AxisBinding::ClearBindings() | ||||
| { | { | ||||
| m_axisbindings.empty(); | |||||
| m_keybindings.empty(); | |||||
| m_axisbindings.clear(); | |||||
| m_keybindings.clear(); | |||||
| } | } | ||||
| float AxisBinding::RetrieveCurrentValue() | float AxisBinding::RetrieveCurrentValue() | ||||
| @@ -390,8 +390,8 @@ void Controller::UnbindProfile() | |||||
| if (m_joystick_idx.find(axis.m_joy) != INDEX_NONE) | if (m_joystick_idx.find(axis.m_joy) != INDEX_NONE) | ||||
| GetAxis(axis.m_idx).UnbindJoystick(axis.m_joy, axis.m_name); | GetAxis(axis.m_idx).UnbindJoystick(axis.m_joy, axis.m_name); | ||||
| } | } | ||||
| m_joystick.empty(); | |||||
| m_joystick_idx.empty(); | |||||
| m_joystick.clear(); | |||||
| m_joystick_idx.clear(); | |||||
| m_mutex.unlock(); | m_mutex.unlock(); | ||||
| } | } | ||||
| @@ -302,7 +302,7 @@ private: | |||||
| //Extract elements | //Extract elements | ||||
| array<int> elements = m_tree[leaf].m_elements; | array<int> elements = m_tree[leaf].m_elements; | ||||
| elements.push_unique(AddElement(element)); | elements.push_unique(AddElement(element)); | ||||
| m_tree[leaf].m_elements.empty(); | |||||
| m_tree[leaf].m_elements.clear(); | |||||
| //Add children | //Add children | ||||
| for (size_t j = 0; j < child_nb; ++j) | for (size_t j = 0; j < child_nb; ++j) | ||||
| m_tree[leaf].m_children[j] = AddLeaf(leaf); | m_tree[leaf].m_children[j] = AddLeaf(leaf); | ||||
| @@ -331,8 +331,8 @@ public: | |||||
| bool FindElements(const TB& bbox, array<TE*>& elements) { return TestLeaf(0, GetAABB(), bbox, elements); } | bool FindElements(const TB& bbox, array<TE*>& elements) { return TestLeaf(0, GetAABB(), bbox, elements); } | ||||
| void Clear() | void Clear() | ||||
| { | { | ||||
| m_tree.empty(); | |||||
| m_elements.empty(); | |||||
| m_tree.clear(); | |||||
| m_elements.clear(); | |||||
| } | } | ||||
| //-- | //-- | ||||
| @@ -260,7 +260,7 @@ public: | |||||
| { | { | ||||
| for (auto door : m_doors) | for (auto door : m_doors) | ||||
| door->DisconnectRoom(this); | door->DisconnectRoom(this); | ||||
| m_doors.empty(); | |||||
| m_doors.clear(); | |||||
| } | } | ||||
| PortalRoom& operator<<(class PortalDoor<TE>* door) | PortalRoom& operator<<(class PortalDoor<TE>* door) | ||||
| @@ -294,8 +294,8 @@ public: | |||||
| delete door; | delete door; | ||||
| for (auto room : m_rooms) | for (auto room : m_rooms) | ||||
| delete room; | delete room; | ||||
| m_doors.empty(); | |||||
| m_rooms.empty(); | |||||
| m_doors.clear(); | |||||
| m_rooms.clear(); | |||||
| } | } | ||||
| //Visible room getter | //Visible room getter | ||||
| @@ -367,7 +367,7 @@ public: | |||||
| m_count = item_count; | m_count = item_count; | ||||
| } | } | ||||
| inline void empty() | |||||
| inline void clear() | |||||
| { | { | ||||
| remove(0, m_count); | remove(0, m_count); | ||||
| } | } | ||||
| @@ -45,7 +45,7 @@ MessageService::MessageService() | |||||
| MessageService::~MessageService() | MessageService::~MessageService() | ||||
| { | { | ||||
| m_bucket.empty(); | |||||
| m_bucket.clear(); | |||||
| } | } | ||||
| //Setup/Destroy | //Setup/Destroy | ||||
| @@ -131,7 +131,7 @@ bool MessageService::FetchAll(MessageBucket id, std::string& message, time_t& fi | |||||
| first_timestamp = bucket[0].m_timestamp; | first_timestamp = bucket[0].m_timestamp; | ||||
| for (int i = 0; i < bucket.count(); ++i) | for (int i = 0; i < bucket.count(); ++i) | ||||
| message += bucket[i].m_message; | message += bucket[i].m_message; | ||||
| bucket.empty(); | |||||
| bucket.clear(); | |||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| @@ -223,7 +223,7 @@ void NaClInputData::Tick(float seconds) | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| m_input_events.empty(); | |||||
| m_input_events.clear(); | |||||
| /* Handle mouse input */ | /* Handle mouse input */ | ||||
| if (IsViewportSizeValid()) | if (IsViewportSizeValid()) | ||||
| @@ -89,7 +89,7 @@ void SceneDisplay::DestroyAll() | |||||
| { | { | ||||
| for (SceneDisplay* display : m_scene_displays) | for (SceneDisplay* display : m_scene_displays) | ||||
| delete display; | delete display; | ||||
| m_scene_displays.empty(); | |||||
| m_scene_displays.clear(); | |||||
| } | } | ||||
| /* ------------------------------------------------ */ | /* ------------------------------------------------ */ | ||||
| @@ -374,9 +374,9 @@ void Scene::Reset() | |||||
| for (int i = 0; i < data->m_tile_api.m_bufs.count(); i++) | for (int i = 0; i < data->m_tile_api.m_bufs.count(); i++) | ||||
| delete data->m_tile_api.m_bufs[i]; | delete data->m_tile_api.m_bufs[i]; | ||||
| data->m_tile_api.m_bufs.empty(); | |||||
| data->m_tile_api.m_bufs.clear(); | |||||
| data->m_tile_api.m_lights.empty(); | |||||
| data->m_tile_api.m_lights.clear(); | |||||
| } | } | ||||
| //---- Primitive source stuff ------------------------------------------------- | //---- Primitive source stuff ------------------------------------------------- | ||||
| @@ -446,7 +446,7 @@ void Scene::ReleaseAllPrimitiveSources(uintptr_t key) | |||||
| oldies.reserve(SceneData::m_prim_sources[key].count()); | oldies.reserve(SceneData::m_prim_sources[key].count()); | ||||
| for (PrimitiveSource* source : SceneData::m_prim_sources[key]) | for (PrimitiveSource* source : SceneData::m_prim_sources[key]) | ||||
| oldies << source; | oldies << source; | ||||
| SceneData::m_prim_sources[key].empty(); | |||||
| SceneData::m_prim_sources[key].clear(); | |||||
| } | } | ||||
| SceneData::m_prim_mutex.unlock(); | SceneData::m_prim_mutex.unlock(); | ||||
| @@ -807,7 +807,7 @@ void Scene::render_tiles() // XXX: rename to Blit() | |||||
| tiles[i].m_tileset->Unbind(); | tiles[i].m_tileset->Unbind(); | ||||
| } | } | ||||
| tiles.empty(); | |||||
| tiles.clear(); | |||||
| shader->Unbind(); | shader->Unbind(); | ||||
| @@ -888,7 +888,7 @@ void Scene::render_lines(float seconds) | |||||
| data->m_line_api.m_vdecl->Unbind(); | data->m_line_api.m_vdecl->Unbind(); | ||||
| data->m_line_api.m_shader->Unbind(); | data->m_line_api.m_shader->Unbind(); | ||||
| //data->m_line_api.m_lines.empty(); | |||||
| //data->m_line_api.m_lines.clear(); | |||||
| delete vb; | delete vb; | ||||
| } | } | ||||
| @@ -23,7 +23,7 @@ void DefaultThreadManager::AddJob(ThreadJob* job) | |||||
| bool DefaultThreadManager::GetWorkResult(array<ThreadJob*>& results) | bool DefaultThreadManager::GetWorkResult(array<ThreadJob*>& results) | ||||
| { | { | ||||
| results += m_job_result; | results += m_job_result; | ||||
| m_job_result.empty(); | |||||
| m_job_result.clear(); | |||||
| return results.count() > 0; | return results.count() > 0; | ||||
| } | } | ||||
| @@ -140,7 +140,7 @@ void FileUpdateTester::TickGame(float seconds) | |||||
| m_frame_count = 0; | m_frame_count = 0; | ||||
| DispatchJob(m_job_done); | DispatchJob(m_job_done); | ||||
| m_job_done.empty(); | |||||
| m_job_done.clear(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -93,7 +93,7 @@ lolunit_declare_fixture(thread_test) | |||||
| bool GetWorkResult(array<ThreadJob*>& results) | bool GetWorkResult(array<ThreadJob*>& results) | ||||
| { | { | ||||
| results += m_job_result; | results += m_job_result; | ||||
| m_job_result.empty(); | |||||
| m_job_result.clear(); | |||||
| msg::info("%s GETWORKRESULT (%i)\n", GetName().c_str(), results.count()); | msg::info("%s GETWORKRESULT (%i)\n", GetName().c_str(), results.count()); | ||||
| return results.count() > 0; | return results.count() > 0; | ||||
| } | } | ||||
| @@ -148,7 +148,7 @@ std::string TileSet::GetName() const | |||||
| //New methods ----------------------------------------------------------------- | //New methods ----------------------------------------------------------------- | ||||
| void TileSet::clear_all() | void TileSet::clear_all() | ||||
| { | { | ||||
| m_tileset_data->m_tiles.empty(); | |||||
| m_tileset_data->m_tiles.clear(); | |||||
| } | } | ||||
| int TileSet::define_tile(ibox2 rect) | int TileSet::define_tile(ibox2 rect) | ||||