From 1e5e071734e551fb81d0bc068535b828ad5a3172 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Tue, 5 Apr 2016 22:57:47 -0400 Subject: [PATCH] BOOST_STATIC_ASSERT -> static_assert --- src/display.cpp | 2 +- src/gui/auxiliary/field.hpp | 8 +++----- src/gui/auxiliary/formula.hpp | 4 +--- src/gui/core/timer.cpp | 4 +--- src/serialization/unicode.hpp | 1 - src/units/types.cpp | 3 +-- src/utils/reference_counter.hpp | 3 +-- 7 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index 8196908faadc..79d8a52a1c7a 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -1300,7 +1300,7 @@ inline display::drawing_buffer_key::drawing_buffer_key(const map_location &loc, SHIFT_Y = BITS_FOR_X_PARITY + SHIFT_X_PARITY, SHIFT_LAYER_GROUP = BITS_FOR_Y + SHIFT_Y }; - BOOST_STATIC_ASSERT(SHIFT_LAYER_GROUP + BITS_FOR_LAYER_GROUP == sizeof(key_) * 8); + static_assert(SHIFT_LAYER_GROUP + BITS_FOR_LAYER_GROUP == sizeof(key_) * 8, "Bit field too small"); // the parity of x must be more significant than the layer but less significant than y. // Thus basically every row is split in two: First the row containing all the odd x diff --git a/src/gui/auxiliary/field.hpp b/src/gui/auxiliary/field.hpp index 20ef5e5385fd..e7acae114e1a 100644 --- a/src/gui/auxiliary/field.hpp +++ b/src/gui/auxiliary/field.hpp @@ -31,8 +31,6 @@ #include "gui/widgets/window.hpp" #include "wml_exception.hpp" -#include - namespace gui2 { @@ -289,7 +287,7 @@ class tfield : public tfield_ , callback_load_value_(callback_load_value) , callback_save_value_(callback_save_value) { - BOOST_STATIC_ASSERT((!boost::is_same::value)); + static_assert((!boost::is_same::value), "Second template argument cannot be tcontrol"); } /** @@ -313,7 +311,7 @@ class tfield : public tfield_ , callback_load_value_(std::function()) , callback_save_value_(std::function()) { - BOOST_STATIC_ASSERT((!boost::is_same::value)); + static_assert((!boost::is_same::value), "Second template argument cannot be tcontrol"); } /** @@ -340,7 +338,7 @@ class tfield : public tfield_ , callback_load_value_(std::function()) , callback_save_value_(std::function()) { - BOOST_STATIC_ASSERT((boost::is_same::value)); + static_assert((boost::is_same::value), "Second template argument must be tcontrol"); } /** Inherited from tfield_. */ diff --git a/src/gui/auxiliary/formula.hpp b/src/gui/auxiliary/formula.hpp index 9d7a4ef43240..cbe4b9ed47cf 100644 --- a/src/gui/auxiliary/formula.hpp +++ b/src/gui/auxiliary/formula.hpp @@ -24,8 +24,6 @@ #include "util.hpp" #include "tstring.hpp" -#include - #include namespace gui2 @@ -235,7 +233,7 @@ tformula::execute(const game_logic::map_formula_callable& /*variables*/ { // Every type needs its own execute function avoid instantiation of the // default execute. - BOOST_STATIC_ASSERT(sizeof(T) == 0); + static_assert(sizeof(T) == 0, "tformula: Missing execute specialization"); return T(); } diff --git a/src/gui/core/timer.cpp b/src/gui/core/timer.cpp index 97f325e43212..ab31805cf59b 100644 --- a/src/gui/core/timer.cpp +++ b/src/gui/core/timer.cpp @@ -17,8 +17,6 @@ #include "events.hpp" #include "gui/core/log.hpp" -#include - #include #include @@ -115,7 +113,7 @@ size_t add_timer(const Uint32 interval, const std::function& callback, const bool repeat) { - BOOST_STATIC_ASSERT(sizeof(size_t) == sizeof(void*)); + static_assert(sizeof(size_t) == sizeof(void*), "Pointer and size_t are not the same size"); DBG_GUI_E << "Adding timer.\n"; diff --git a/src/serialization/unicode.hpp b/src/serialization/unicode.hpp index c02b75a55b94..cb024d7e8b7a 100644 --- a/src/serialization/unicode.hpp +++ b/src/serialization/unicode.hpp @@ -21,7 +21,6 @@ #include "ucs4_convert_impl.hpp" #include "unicode_cast.hpp" -#include #include #include diff --git a/src/units/types.cpp b/src/units/types.cpp index 8582df2df7ff..36fb6064f6bf 100644 --- a/src/units/types.cpp +++ b/src/units/types.cpp @@ -34,7 +34,6 @@ #include "gui/auxiliary/formula.hpp" #include "gui/dialogs/loadscreen.hpp" -#include #include static lg::log_domain log_config("config"); @@ -830,7 +829,7 @@ MAKE_ENUM (ALIGNMENT_FEMALE_VARIATION, std::string unit_type::alignment_description(ALIGNMENT align, unit_race::GENDER gender) { - BOOST_STATIC_ASSERT(ALIGNMENT_FEMALE_VARIATION::count == ALIGNMENT::count); + static_assert(ALIGNMENT_FEMALE_VARIATION::count == ALIGNMENT::count, "ALIGNMENT_FEMALE_VARIATION and ALIGNMENT do not have the same number of values"); assert(align.valid()); std::string str = std::string(); if (gender == unit_race::FEMALE) { diff --git a/src/utils/reference_counter.hpp b/src/utils/reference_counter.hpp index 70f21c11d05f..995e638384f4 100644 --- a/src/utils/reference_counter.hpp +++ b/src/utils/reference_counter.hpp @@ -21,7 +21,6 @@ #include -#include namespace n_ref_counter { @@ -32,7 +31,7 @@ namespace n_ref_counter { So any negative count disables reference counting. **/ template class t_ref_counter { - BOOST_STATIC_ASSERT( std::numeric_limits::is_signed); + static_assert(std::numeric_limits::is_signed, "Reference counter must be a signed integer"); T_integral count_;