Skip to content

Commit

Permalink
BOOST_STATIC_ASSERT -> static_assert
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Apr 6, 2016
1 parent 1afa45a commit 1e5e071
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/display.cpp
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions src/gui/auxiliary/field.hpp
Expand Up @@ -31,8 +31,6 @@
#include "gui/widgets/window.hpp"
#include "wml_exception.hpp"

#include <boost/static_assert.hpp>

namespace gui2
{

Expand Down Expand Up @@ -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<tcontrol, W>::value));
static_assert((!boost::is_same<tcontrol, W>::value), "Second template argument cannot be tcontrol");
}

/**
Expand All @@ -313,7 +311,7 @@ class tfield : public tfield_
, 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");
}

/**
Expand All @@ -340,7 +338,7 @@ class tfield : public tfield_
, 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_. */
Expand Down
4 changes: 1 addition & 3 deletions src/gui/auxiliary/formula.hpp
Expand Up @@ -24,8 +24,6 @@
#include "util.hpp"
#include "tstring.hpp"

#include <boost/static_assert.hpp>

#include <cassert>

namespace gui2
Expand Down Expand Up @@ -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();
}

Expand Down
4 changes: 1 addition & 3 deletions src/gui/core/timer.cpp
Expand Up @@ -17,8 +17,6 @@
#include "events.hpp"
#include "gui/core/log.hpp"

#include <boost/static_assert.hpp>

#include <SDL_timer.h>

#include <map>
Expand Down Expand Up @@ -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";

Expand Down
1 change: 0 additions & 1 deletion src/serialization/unicode.hpp
Expand Up @@ -21,7 +21,6 @@
#include "ucs4_convert_impl.hpp"
#include "unicode_cast.hpp"

#include <boost/static_assert.hpp>
#include <string>
#include <vector>

Expand Down
3 changes: 1 addition & 2 deletions src/units/types.cpp
Expand Up @@ -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");
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions src/utils/reference_counter.hpp
Expand Up @@ -21,7 +21,6 @@


#include <limits>
#include <boost/static_assert.hpp>

namespace n_ref_counter {

Expand All @@ -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_;

Expand Down

0 comments on commit 1e5e071

Please sign in to comment.