GUI2: praise auto

This commit is contained in:
Charles Dang 2018-05-30 11:03:59 +11:00
parent cc2cc29376
commit 31c4d09528
4 changed files with 6 additions and 14 deletions

View file

@ -35,8 +35,6 @@
#include "video.hpp"
#include "wml_exception.hpp"
#include <iterator>
namespace gui2
{

View file

@ -635,8 +635,7 @@ void distributor::keyboard_add_to_chain(widget* widget)
void distributor::keyboard_remove_from_chain(widget* w)
{
assert(w);
std::vector<widget*>::iterator itor = std::find(
keyboard_focus_chain_.begin(), keyboard_focus_chain_.end(), w);
auto itor = std::find(keyboard_focus_chain_.begin(), keyboard_focus_chain_.end(), w);
if(itor != keyboard_focus_chain_.end()) {
keyboard_focus_chain_.erase(itor);
@ -767,10 +766,7 @@ void distributor::signal_handler_notify_removal(dispatcher& w,
if(keyboard_focus_ == &w) {
keyboard_focus_ = nullptr;
}
const std::vector<widget*>::iterator itor
= std::find(keyboard_focus_chain_.begin(),
keyboard_focus_chain_.end(),
&w);
const auto itor = std::find(keyboard_focus_chain_.begin(), keyboard_focus_chain_.end(), &w);
if(itor != keyboard_focus_chain_.end()) {
keyboard_focus_chain_.erase(itor);
}

View file

@ -75,8 +75,7 @@ public:
*/
void disconnect_notifiee(notifiee<functor_t>& target)
{
typename std::map<notifiee<functor_t>*, functor_t>::iterator itor
= notifiees_.find(&target);
auto itor = notifiees_.find(&target);
if(itor != notifiees_.end()) {

View file

@ -88,8 +88,7 @@ static uint32_t timer_callback(uint32_t, void* id)
{
DBG_GUI_E << "Pushing timer event in queue.\n";
std::map<std::size_t, timer>::iterator itor
= get_timers().find(reinterpret_cast<std::size_t>(id));
auto itor = get_timers().find(reinterpret_cast<std::size_t>(id));
if(itor == get_timers().end()) {
return 0;
}
@ -144,7 +143,7 @@ bool remove_timer(const std::size_t id)
{
DBG_GUI_E << "Removing timer " << id << ".\n";
std::map<std::size_t, timer>::iterator itor = get_timers().find(id);
auto itor = get_timers().find(id);
if(itor == get_timers().end()) {
LOG_GUI_E << "Can't remove timer since it no longer exists.\n";
return false;
@ -175,7 +174,7 @@ bool execute_timer(const std::size_t id)
{
DBG_GUI_E << "Executing timer " << id << ".\n";
std::map<std::size_t, timer>::iterator itor = get_timers().find(id);
auto itor = get_timers().find(id);
if(itor == get_timers().end()) {
LOG_GUI_E << "Can't execute timer since it no longer exists.\n";
return false;