Cleaned up usage of iterator range pairs where possible

Also moved the iterable_pair.hpp include out of config.hpp and into the files that use this functionality.
This commit is contained in:
Charles Dang 2016-11-30 07:58:10 +11:00
parent a7daa12b3a
commit ab66dcd06d
6 changed files with 9 additions and 3 deletions

View file

@ -30,6 +30,8 @@
#include "utils/functional.hpp" #include "utils/functional.hpp"
#include <boost/range/adaptor/reversed.hpp>
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(push) #pragma warning(push)
//silence "inherits via dominance" warnings //silence "inherits via dominance" warnings
@ -307,7 +309,7 @@ public:
virtual void recalculate() const virtual void recalculate() const
{ {
///@todo 1.9 optimize in case of an aspect which returns variant ///@todo 1.9 optimize in case of an aspect which returns variant
for (const typename aspect_type<T>::typesafe_ptr &f : make_pair(facets_.rbegin(),facets_.rend())) { for(const auto& f : boost::adaptors::reverse(facets_)) {
if (f->active()) { if (f->active()) {
this->value_ = std::shared_ptr<T>(f->get_ptr()); this->value_ = std::shared_ptr<T>(f->get_ptr());
this->valid_ = true; this->valid_ = true;

View file

@ -47,7 +47,6 @@
#include "exceptions.hpp" #include "exceptions.hpp"
#include "tstring.hpp" #include "tstring.hpp"
#include "utils/iterable_pair.hpp"
#ifdef HAVE_CXX14 #ifdef HAVE_CXX14
# ifdef __clang__ // Check this first, because clang also defines __GNUC__ # ifdef __clang__ // Check this first, because clang also defines __GNUC__

View file

@ -39,8 +39,10 @@
#include "replay.hpp" #include "replay.hpp"
#include "gettext.hpp" #include "gettext.hpp"
#include <vector>
#include "utils/functional.hpp" #include "utils/functional.hpp"
#include "utils/iterable_pair.hpp"
#include <vector>
static lg::log_domain log_chat_log("chat_log"); static lg::log_domain log_chat_log("chat_log");
#define DBG_CHAT_LOG LOG_STREAM(debug, log_chat_log) #define DBG_CHAT_LOG LOG_STREAM(debug, log_chat_log)

View file

@ -30,6 +30,7 @@
#include "units/abilities.hpp" #include "units/abilities.hpp"
#include "units/animation.hpp" #include "units/animation.hpp"
#include "util.hpp" #include "util.hpp"
#include "utils/iterable_pair.hpp"
#include "gui/auxiliary/typed_formula.hpp" #include "gui/auxiliary/typed_formula.hpp"
#include "gui/dialogs/loading_screen.hpp" #include "gui/dialogs/loading_screen.hpp"

View file

@ -41,6 +41,7 @@
#include "map/map.hpp" #include "map/map.hpp"
#include "resources.hpp" #include "resources.hpp"
#include "units/unit.hpp" #include "units/unit.hpp"
#include "utils/iterable_pair.hpp"
namespace wb namespace wb
{ {

View file

@ -33,6 +33,7 @@
#include "team.hpp" #include "team.hpp"
#include "units/unit.hpp" #include "units/unit.hpp"
#include "units/animation_component.hpp" #include "units/animation_component.hpp"
#include "utils/iterable_pair.hpp"
namespace wb { namespace wb {