Further boost cleanup

* Removed more unnecessary includes
* Used std::swap instead of boost::swap in fake_unit_ptr. This is since unit_ptr (the type of `unit_` here)
  is now just a shared_ptr instead of a boost::intrusive_ptr.
* Used std::gcd instead of boost::integer::gcd
This commit is contained in:
Charles Dang 2021-01-23 23:46:20 +11:00
parent de8ad232d4
commit 0c2134a645
7 changed files with 8 additions and 41 deletions

View File

@ -22,8 +22,6 @@
#include "preferences/general.hpp" #include "preferences/general.hpp"
#include "preferences/game.hpp" #include "preferences/game.hpp"
#include <boost/range/algorithm/find_if.hpp>
static lg::log_domain log_engine("engine"); static lg::log_domain log_engine("engine");
#define ERR_NG LOG_STREAM(err, log_engine) #define ERR_NG LOG_STREAM(err, log_engine)
#define LOG_NG LOG_STREAM(info, log_engine) #define LOG_NG LOG_STREAM(info, log_engine)

View File

@ -41,9 +41,6 @@
#include <type_traits> #include <type_traits>
#include <memory> #include <memory>
#include <boost/exception/exception.hpp>
#include <boost/range/iterator_range.hpp>
class enum_tag; class enum_tag;
/** /**

View File

@ -19,8 +19,6 @@
#include "units/unit.hpp" #include "units/unit.hpp"
#include "units/ptr.hpp" #include "units/ptr.hpp"
#include <boost/swap.hpp>
fake_unit_ptr::fake_unit_ptr() : unit_(), my_manager_(nullptr) {} fake_unit_ptr::fake_unit_ptr() : unit_(), my_manager_(nullptr) {}
fake_unit_ptr::fake_unit_ptr(const internal_ptr & u) : unit_(u), my_manager_(nullptr) {} fake_unit_ptr::fake_unit_ptr(const internal_ptr & u) : unit_(u), my_manager_(nullptr) {}
fake_unit_ptr::fake_unit_ptr(const internal_ptr & u, fake_unit_manager * mgr) : unit_(u), my_manager_(nullptr) fake_unit_ptr::fake_unit_ptr(const internal_ptr & u, fake_unit_manager * mgr) : unit_(u), my_manager_(nullptr)
@ -40,7 +38,7 @@ fake_unit_ptr::fake_unit_ptr(fake_unit_ptr && ptr)
} }
void fake_unit_ptr::swap (fake_unit_ptr & o) { void fake_unit_ptr::swap (fake_unit_ptr & o) {
boost::swap(unit_, o.unit_); std::swap(unit_, o.unit_);
std::swap(my_manager_, o.my_manager_); std::swap(my_manager_, o.my_manager_);
} }

View File

@ -57,13 +57,8 @@
#include "gui/widgets/toggle_button.hpp" #include "gui/widgets/toggle_button.hpp"
#include "gui/widgets/window.hpp" #include "gui/widgets/window.hpp"
#if BOOST_VERSION >= 106700
#include <boost/integer/common_factor_rt.hpp>
#else
#include <boost/math/common_factor_rt.hpp>
#endif
#include <functional> #include <functional>
#include <numeric>
namespace gui2 namespace gui2
{ {
@ -142,12 +137,7 @@ void preferences_dialog::set_resolution_list(menu_button& res_list)
config option; config option;
option["label"] = formatter() << res.x << font::unicode_multiplication_sign << res.y; option["label"] = formatter() << res.x << font::unicode_multiplication_sign << res.y;
#if BOOST_VERSION >= 106700 const int div = std::gcd(12, 4);
const int div = boost::integer::gcd(res.x, res.y);
#else
const int div = boost::math::gcd(res.x, res.y);
#endif
const int x_ratio = res.x / div; const int x_ratio = res.x / div;
const int y_ratio = res.y / div; const int y_ratio = res.y / div;

View File

@ -29,12 +29,7 @@
#include "wml_exception.hpp" #include "wml_exception.hpp"
#include <functional> #include <functional>
#include <numeric>
#if BOOST_VERSION >= 106700
#include <boost/integer/common_factor_rt.hpp>
#else
#include <boost/math/common_factor_rt.hpp>
#endif
#define LOG_SCOPE_HEADER get_control_type() + " [" + id() + "] " + __func__ #define LOG_SCOPE_HEADER get_control_type() + " [" + id() + "] " + __func__
#define LOG_HEADER LOG_SCOPE_HEADER + ':' #define LOG_HEADER LOG_SCOPE_HEADER + ':'
@ -265,12 +260,7 @@ void slider::set_value_range(int min_value, int max_value)
int diff = max_value - min_value; int diff = max_value - min_value;
int old_value = get_value(); int old_value = get_value();
#if BOOST_VERSION >= 106700 step_size_ = std::gcd(diff, step_size_);
step_size_ = boost::integer::gcd(diff, step_size_);
#else
step_size_ = boost::math::gcd(diff, step_size_);
#endif
minimum_value_ = min_value; minimum_value_ = min_value;
slider_set_item_last(diff / step_size_); slider_set_item_last(diff / step_size_);
@ -289,11 +279,8 @@ void slider::set_step_size(int step_size)
const int range_diff = get_item_count() - 1; const int range_diff = get_item_count() - 1;
const int old_value = get_value(); const int old_value = get_value();
#if BOOST_VERSION >= 106700 step_size_ = std::gcd(range_diff, step_size);
step_size_ = boost::integer::gcd(range_diff, step_size);
#else
step_size_ = boost::math::gcd(range_diff, step_size);
#endif
slider_set_item_last(range_diff / step_size_); slider_set_item_last(range_diff / step_size_);
set_value(old_value); set_value(old_value);

View File

@ -21,12 +21,11 @@
#include "log.hpp" #include "log.hpp"
#include <boost/date_time.hpp>
#include <map> #include <map>
#include <sstream> #include <sstream>
#include <ctime> #include <ctime>
#include <mutex> #include <mutex>
#include <iomanip>
namespace { namespace {

View File

@ -35,8 +35,6 @@
#include "units/types.hpp" #include "units/types.hpp"
#include "whiteboard/side_actions.hpp" #include "whiteboard/side_actions.hpp"
#include <boost/dynamic_bitset.hpp>
static lg::log_domain log_engine("engine"); static lg::log_domain log_engine("engine");
#define DBG_NG LOG_STREAM(debug, log_engine) #define DBG_NG LOG_STREAM(debug, log_engine)
#define LOG_NG LOG_STREAM(info, log_engine) #define LOG_NG LOG_STREAM(info, log_engine)