BOOST_STATIC_ASSERT -> static_assert

This commit is contained in:
Celtic Minstrel 2016-04-05 22:57:47 -04:00
parent 1afa45a53e
commit 1e5e071734
7 changed files with 8 additions and 17 deletions

View file

@ -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

View file

@ -31,8 +31,6 @@
#include "gui/widgets/window.hpp"
#include "wml_exception.hpp"
#include <boost/static_assert.hpp>
namespace gui2
{
@ -289,7 +287,7 @@ public:
, callback_load_value_(callback_load_value)
, callback_save_value_(callback_save_value)
{
BOOST_STATIC_ASSERT((!boost::is_same<tcontrol, W>::value));
static_assert((!boost::is_same<tcontrol, W>::value), "Second template argument cannot be tcontrol");
}
/**
@ -313,7 +311,7 @@ public:
, callback_load_value_(std::function<T()>())
, callback_save_value_(std::function<void(CT)>())
{
BOOST_STATIC_ASSERT((!boost::is_same<tcontrol, W>::value));
static_assert((!boost::is_same<tcontrol, W>::value), "Second template argument cannot be tcontrol");
}
/**
@ -340,7 +338,7 @@ public:
, callback_load_value_(std::function<T()>())
, callback_save_value_(std::function<void(CT)>())
{
BOOST_STATIC_ASSERT((boost::is_same<tcontrol, W>::value));
static_assert((boost::is_same<tcontrol, W>::value), "Second template argument must be tcontrol");
}
/** Inherited from tfield_. */

View file

@ -24,8 +24,6 @@
#include "util.hpp"
#include "tstring.hpp"
#include <boost/static_assert.hpp>
#include <cassert>
namespace gui2
@ -235,7 +233,7 @@ tformula<T>::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();
}

View file

@ -17,8 +17,6 @@
#include "events.hpp"
#include "gui/core/log.hpp"
#include <boost/static_assert.hpp>
#include <SDL_timer.h>
#include <map>
@ -115,7 +113,7 @@ size_t add_timer(const Uint32 interval,
const std::function<void(size_t id)>& 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";

View file

@ -21,7 +21,6 @@
#include "ucs4_convert_impl.hpp"
#include "unicode_cast.hpp"
#include <boost/static_assert.hpp>
#include <string>
#include <vector>

View file

@ -34,7 +34,6 @@
#include "gui/auxiliary/formula.hpp"
#include "gui/dialogs/loadscreen.hpp"
#include <boost/static_assert.hpp>
#include <boost/regex.hpp>
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) {

View file

@ -21,7 +21,6 @@
#include <limits>
#include <boost/static_assert.hpp>
namespace n_ref_counter {
@ -32,7 +31,7 @@ namespace n_ref_counter {
So any negative count disables reference counting.
**/
template <typename T_integral> class t_ref_counter {
BOOST_STATIC_ASSERT( std::numeric_limits<T_integral>::is_signed);
static_assert(std::numeric_limits<T_integral>::is_signed, "Reference counter must be a signed integer");
T_integral count_;