[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master aff4ac4: Replace BOOST_STATIC_ASSERT with sta
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master aff4ac4: Replace BOOST_STATIC_ASSERT with static_assert |
Date: |
Wed, 11 Jan 2017 10:36:37 +0000 (UTC) |
branch: master
commit aff4ac4f59b16f4a6cc3359b89464f56dac821df
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Replace BOOST_STATIC_ASSERT with static_assert
A string-literal message is required by C++11, but C++17 wisely makes
it optional. For the nonce, it is uniformly coded as "".
---
actuarial_table.cpp | 9 ++++-----
alert.cpp | 5 +----
any_member.hpp | 18 ++++++++----------
authenticity.hpp | 3 +--
callback.hpp | 6 ++----
contains_test.cpp | 14 ++++++--------
database_view_editor.cpp | 4 ++--
database_view_editor.hpp | 3 ++-
group_quote_pdf_gen_wx.cpp | 3 +--
ieee754.hpp | 10 ++++------
math_functors.hpp | 28 +++++++++++++---------------
math_functors_test.cpp | 10 +++++-----
mc_enum.hpp | 3 +--
mc_enum.tpp | 2 +-
mc_enum_metadata.hpp | 4 +---
multidimgrid_safe.hpp | 3 +--
mvc_controller.tpp | 8 ++------
numeric_io_cast.hpp | 12 +++++-------
numeric_io_test.cpp | 2 +-
numeric_io_traits.hpp | 3 +--
rate_table.cpp | 2 +-
round_to.hpp | 4 +---
safely_dereference_as.hpp | 5 +----
stratified_charges.cpp | 4 +---
stream_cast.hpp | 7 +++----
tn_range.hpp | 5 +----
tn_range.tpp | 10 +++++-----
tn_range_test_aux.hpp | 2 +-
tn_range_type_trammels.hpp | 5 +----
uncopyable_lmi.hpp | 5 +----
value_cast.hpp | 2 +-
view_ex.tpp | 5 +----
wx_utility.hpp | 9 +++------
xml_serializable.tpp | 10 ++--------
xml_serialize.hpp | 4 +---
35 files changed, 86 insertions(+), 143 deletions(-)
diff --git a/actuarial_table.cpp b/actuarial_table.cpp
index bce3193..8557b9e 100644
--- a/actuarial_table.cpp
+++ b/actuarial_table.cpp
@@ -33,7 +33,6 @@
#include <boost/filesystem/convenience.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>
-#include <boost/static_assert.hpp>
#include <algorithm> // std::max(), std::min()
#include <cctype> // std::toupper()
@@ -221,9 +220,9 @@ void actuarial_table::find_table()
// TODO ?? Assert endianness too? SOA tables are not portable;
// probably they can easily be read only on x86 hardware.
- BOOST_STATIC_ASSERT(8 == CHAR_BIT);
- BOOST_STATIC_ASSERT(4 == sizeof(int));
- BOOST_STATIC_ASSERT(2 == sizeof(short int));
+ static_assert(8 == CHAR_BIT, "");
+ static_assert(4 == sizeof(int), "");
+ static_assert(2 == sizeof(short int), "");
// 27.4.3.2/2 requires that this be interpreted as invalid.
// Reinitialize it here for robustness, even though the ctor
@@ -233,7 +232,7 @@ void actuarial_table::find_table()
int const index_record_length(58);
char index_record[index_record_length] = {0};
- BOOST_STATIC_ASSERT(sizeof(std::int32_t) <= sizeof(int));
+ static_assert(sizeof(std::int32_t) <= sizeof(int), "");
while(index_ifs)
{
int index_table_number = deserialize_cast<std::int32_t>(index_record);
diff --git a/alert.cpp b/alert.cpp
index 1fa70b2..2a48c8f 100644
--- a/alert.cpp
+++ b/alert.cpp
@@ -23,8 +23,6 @@
#include "alert.hpp"
-#include <boost/static_assert.hpp>
-
#if !defined LMI_MSW
# include <cstdio>
#else // defined LMI_MSW
@@ -195,8 +193,7 @@ class fatal_error_buf
template<typename T>
inline std::ostream& alert_stream()
{
- // Double parentheses: don't parse comma as a macro parameter separator.
- BOOST_STATIC_ASSERT((std::is_base_of<alert_buf,T>::value));
+ static_assert(std::is_base_of<alert_buf,T>::value, "");
static T buffer_;
static std::ostream stream_(&buffer_);
stream_.clear();
diff --git a/any_member.hpp b/any_member.hpp
index 87638cc..d5fbef2 100644
--- a/any_member.hpp
+++ b/any_member.hpp
@@ -68,8 +68,6 @@
#include "uncopyable_lmi.hpp"
#include "value_cast.hpp"
-#include <boost/static_assert.hpp>
-
#include <algorithm> // std::lower_bound(), std::swap()
#include <map>
#include <sstream>
@@ -617,22 +615,22 @@ void MemberSymbolTable<ClassType>::ascribe
,ValueType SameOrBaseClassType::* p2m
)
{
- // Assert that the static_cast doesn't engender undefined behavior.
- // Double parentheses: don't parse comma as a macro parameter separator.
- BOOST_STATIC_ASSERT
- ((
+ static_assert
+ (
std::is_base_of
<MemberSymbolTable<ClassType>
,ClassType
>::value
- ));
- BOOST_STATIC_ASSERT
- ((
+ ,""
+ );
+ static_assert
+ (
std::is_base_of
<SameOrBaseClassType
,ClassType
>::value
- ));
+ ,""
+ );
ClassType* class_object = static_cast<ClassType*>(this);
map_.insert(member_pair_type(s, any_member<ClassType>(class_object, p2m)));
diff --git a/authenticity.hpp b/authenticity.hpp
index 8d3464d..ece0dec 100644
--- a/authenticity.hpp
+++ b/authenticity.hpp
@@ -30,14 +30,13 @@
#include "uncopyable_lmi.hpp"
#include <boost/filesystem/path.hpp>
-#include <boost/static_assert.hpp>
#include <climits> // CHAR_BIT
#include <string>
#include <vector>
// The gnu libc md5 implementation seems to assume this:
-BOOST_STATIC_ASSERT(8 == CHAR_BIT || 16 == CHAR_BIT);
+static_assert(8 == CHAR_BIT || 16 == CHAR_BIT, "");
// so md5 output is 128 bits == 16 8-bit bytes or 8 16-bit bytes:
enum {md5len = 128 / CHAR_BIT};
diff --git a/callback.hpp b/callback.hpp
index eb51a5f..885e8ca 100644
--- a/callback.hpp
+++ b/callback.hpp
@@ -28,8 +28,6 @@
#include "so_attributes.hpp"
#include "uncopyable_lmi.hpp"
-#include <boost/static_assert.hpp>
-
#include <stdexcept>
#include <type_traits>
@@ -102,9 +100,9 @@ class LMI_SO callback
: private lmi::uncopyable <callback<FunctionPointer> >
,virtual private obstruct_slicing<callback<FunctionPointer> >
{
- BOOST_STATIC_ASSERT(std::is_pointer<FunctionPointer>::value);
+ static_assert(std::is_pointer<FunctionPointer>::value, "");
typedef typename std::remove_pointer<FunctionPointer>::type f_type;
- BOOST_STATIC_ASSERT(std::is_function<f_type>::value);
+ static_assert(std::is_function<f_type>::value, "");
public:
FunctionPointer operator()() const;
diff --git a/contains_test.cpp b/contains_test.cpp
index 18b237b..766d13a 100644
--- a/contains_test.cpp
+++ b/contains_test.cpp
@@ -26,8 +26,6 @@
#include "miscellany.hpp" // lmi_array_size()
#include "test_tools.hpp"
-#include <boost/static_assert.hpp>
-
#include <deque>
#include <list>
#include <map>
@@ -42,14 +40,14 @@ struct LacksFind { };
void test_has_member_find()
{
#if !defined LMI_NO_SFINAE
- BOOST_STATIC_ASSERT( has_member_find<HasFind >::value);
- BOOST_STATIC_ASSERT(!has_member_find<LacksFind>::value);
+ static_assert( has_member_find<HasFind >::value, "");
+ static_assert(!has_member_find<LacksFind>::value, "");
- BOOST_STATIC_ASSERT( has_member_find<std::string>::value);
+ static_assert( has_member_find<std::string>::value, "");
- BOOST_STATIC_ASSERT(( has_member_find<std::map <int,int> >::value));
- BOOST_STATIC_ASSERT ( has_member_find<std::set <int > >::value) ;
- BOOST_STATIC_ASSERT (!has_member_find<std::vector<int > >::value) ;
+ static_assert( has_member_find<std::map <int,int> >::value, "");
+ static_assert( has_member_find<std::set <int > >::value, "");
+ static_assert(!has_member_find<std::vector<int > >::value, "");
#endif // !defined LMI_NO_SFINAE
}
diff --git a/database_view_editor.cpp b/database_view_editor.cpp
index 890e618..e5224ec 100644
--- a/database_view_editor.cpp
+++ b/database_view_editor.cpp
@@ -284,7 +284,7 @@ void DatabaseTableAdapter::ConvertValue
// If the following assert fails, then it probably means that
// the number of axes has been changed and the change should
// be reflected in the code above.
- BOOST_STATIC_ASSERT( eda_max == 7 );
+ static_assert(eda_max == 7, "");
}
unsigned int DatabaseTableAdapter::DoGetDimension() const
@@ -338,6 +338,6 @@ MultiDimTableAny::AxesAny
DatabaseTableAdapter::DoGetAxesAny()
// If the following assert fails, then it probably means that
// the number of axes has been changed and the change should
// be reflected in the code above.
- BOOST_STATIC_ASSERT( eda_max == 7 );
+ static_assert(eda_max == 7, "");
return axes;
}
diff --git a/database_view_editor.hpp b/database_view_editor.hpp
index 3043968..763b211 100644
--- a/database_view_editor.hpp
+++ b/database_view_editor.hpp
@@ -64,10 +64,11 @@ class DatabaseTableAdapter
,eda_duration
,eda_max
};
- BOOST_STATIC_ASSERT
+ static_assert
(
static_cast<int>(DatabaseTableAdapter::eda_max)
== static_cast<int>(e_number_of_axes)
+ ,""
);
public:
DatabaseTableAdapter(database_entity* db_value = nullptr);
diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index 649c3b5..810cf38 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -43,7 +43,6 @@
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/scoped_ptr.hpp>
-#include <boost/static_assert.hpp>
#include <wx/datetime.h>
#include <wx/html/htmlcell.h>
@@ -466,7 +465,7 @@ column_definition const column_definitions[] =
,{"Total\n%s\nPremium" , "$9,999,999,999.00"} //
e_col_total_premium
};
-BOOST_STATIC_ASSERT(sizeof column_definitions / sizeof(column_definitions[0])
== e_col_max);
+static_assert(sizeof column_definitions / sizeof(column_definitions[0]) ==
e_col_max, "");
class group_quote_pdf_generator_wx
:public group_quote_pdf_generator
diff --git a/ieee754.hpp b/ieee754.hpp
index 34bf260..5fcb897 100644
--- a/ieee754.hpp
+++ b/ieee754.hpp
@@ -24,8 +24,6 @@
#include "config.hpp"
-#include <boost/static_assert.hpp>
-
#include <limits>
#include <type_traits>
@@ -44,7 +42,7 @@
template<typename T>
T implausible_value(T const& t = -9.99999e35)
{
- BOOST_STATIC_ASSERT(::std::is_floating_point<T>::value);
+ static_assert(::std::is_floating_point<T>::value, "");
if(std::numeric_limits<T>::has_quiet_NaN)
{
@@ -72,8 +70,8 @@ T implausible_value(T const& t = -9.99999e35)
template<typename T>
inline T infinity()
{
- BOOST_STATIC_ASSERT(::std::is_floating_point<T>::value);
- BOOST_STATIC_ASSERT(std::numeric_limits<T>::has_infinity);
+ static_assert(::std::is_floating_point<T>::value, "");
+ static_assert(std::numeric_limits<T>::has_infinity, "");
static T const volatile z = std::numeric_limits<T>::infinity();
return z;
}
@@ -104,7 +102,7 @@ inline T infinity()
template<typename T>
inline bool is_infinite(T t)
{
- BOOST_STATIC_ASSERT(::std::is_floating_point<T>::value);
+ static_assert(::std::is_floating_point<T>::value, "");
static T const volatile pos_inf = std::numeric_limits<T>::infinity();
static T const volatile neg_inf = -std::numeric_limits<T>::infinity();
static bool const has_inf = std::numeric_limits<T>::has_infinity;
diff --git a/math_functors.hpp b/math_functors.hpp
index 62337a8..95b1b65 100644
--- a/math_functors.hpp
+++ b/math_functors.hpp
@@ -27,8 +27,6 @@
#include "assert_lmi.hpp"
#include "et_vector.hpp"
-#include <boost/static_assert.hpp>
-
#include <algorithm> // std::max(), std::min()
#include <cmath> // C99 expm1(), log1p()
#include <functional>
@@ -103,7 +101,7 @@ template<typename T>
struct mean
:public std::binary_function<T, T, T>
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
+ static_assert(std::is_floating_point<T>::value, "");
T operator()(T const& x, T const& y) const
{return 0.5 * x + 0.5 * y;}
};
@@ -133,8 +131,8 @@ struct mean
template<typename T, int n>
struct i_upper_n_over_n_from_i
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
- BOOST_STATIC_ASSERT(0 < n);
+ static_assert(std::is_floating_point<T>::value, "");
+ static_assert(0 < n, "");
T operator()(T const& i) const
{
if(i < -1.0)
@@ -159,7 +157,7 @@ template<typename T>
struct i_upper_12_over_12_from_i
:public std::unary_function<T, T>
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
+ static_assert(std::is_floating_point<T>::value, "");
T operator()(T const& i) const
{
return i_upper_n_over_n_from_i<double,12>()(i);
@@ -170,8 +168,8 @@ template<typename T, int n>
struct i_from_i_upper_n_over_n
:public std::unary_function<T, T>
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
- BOOST_STATIC_ASSERT(0 < n);
+ static_assert(std::is_floating_point<T>::value, "");
+ static_assert(0 < n, "");
T operator()(T const& i) const
{
// naively: (1+i)^n - 1
@@ -185,7 +183,7 @@ template<typename T>
struct i_from_i_upper_12_over_12
:public std::unary_function<T, T>
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
+ static_assert(std::is_floating_point<T>::value, "");
T operator()(T const& i) const
{
return i_from_i_upper_n_over_n<double,12>()(i);
@@ -196,8 +194,8 @@ template<typename T, int n>
struct d_upper_n_from_i
:public std::unary_function<T, T>
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
- BOOST_STATIC_ASSERT(0 < n);
+ static_assert(std::is_floating_point<T>::value, "");
+ static_assert(0 < n, "");
T operator()(T const& i) const
{
if(i < -1.0)
@@ -222,7 +220,7 @@ template<typename T>
struct d_upper_12_from_i
:public std::unary_function<T, T>
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
+ static_assert(std::is_floating_point<T>::value, "");
T operator()(T const& i) const
{
return d_upper_n_from_i<double,12>()(i);
@@ -238,8 +236,8 @@ struct d_upper_12_from_i
template<typename T, int n>
struct net_i_from_gross
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
- BOOST_STATIC_ASSERT(0 < n);
+ static_assert(std::is_floating_point<T>::value, "");
+ static_assert(0 < n, "");
T operator()(T const& i, T const& spread, T const& fee) const
{
static long double const reciprocal_n = 1.0L / n;
@@ -289,7 +287,7 @@ template<typename T>
struct coi_rate_from_q
:public std::binary_function<T,T,T>
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
+ static_assert(std::is_floating_point<T>::value, "");
T operator()(T const& q, T const& max_coi) const
{
if(!(0.0 <= max_coi && max_coi <= 1.0))
diff --git a/math_functors_test.cpp b/math_functors_test.cpp
index 18b5384..6b088d9 100644
--- a/math_functors_test.cpp
+++ b/math_functors_test.cpp
@@ -60,7 +60,7 @@ template<typename T>
struct i_upper_12_over_12_from_i_naive
:public std::unary_function<T, T>
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
+ static_assert(std::is_floating_point<T>::value, "");
T operator()(T const& i) const
{
long double z = -1.0L + std::pow((1.0L + i), 1.0L / 12.0L);
@@ -72,7 +72,7 @@ template<typename T>
struct i_from_i_upper_12_over_12_naive
:public std::unary_function<T, T>
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
+ static_assert(std::is_floating_point<T>::value, "");
T operator()(T const& i) const
{
long double z = -1.0L + std::pow((1.0L + i), 12.0L);
@@ -84,7 +84,7 @@ template<typename T>
struct d_upper_12_from_i_naive
:public std::unary_function<T, T>
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
+ static_assert(std::is_floating_point<T>::value, "");
T operator()(T const& i) const
{
long double z = 12.0L * (1.0L - std::pow(1.0L + i, -1.0L / 12.0L));
@@ -95,7 +95,7 @@ struct d_upper_12_from_i_naive
template<typename T, int n>
struct net_i_from_gross_naive
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
+ static_assert(std::is_floating_point<T>::value, "");
T operator()(T const& i, T const& spread, T const& fee) const
{
static long double const reciprocal_n = 1.0L / n;
@@ -115,7 +115,7 @@ template<typename T>
struct coi_rate_from_q_naive
:public std::binary_function<T,T,T>
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
+ static_assert(std::is_floating_point<T>::value, "");
T operator()(T const& q, T const& max_coi) const
{
if(0.0 == q)
diff --git a/mc_enum.hpp b/mc_enum.hpp
index a916f50..94924ac 100644
--- a/mc_enum.hpp
+++ b/mc_enum.hpp
@@ -27,7 +27,6 @@
#include "datum_base.hpp"
#include <boost/operators.hpp>
-#include <boost/static_assert.hpp>
#include <cstddef> // std::size_t
#include <deque>
@@ -99,7 +98,7 @@ class mc_enum
,private boost::equality_comparable<mc_enum<T>, T >
,private boost::equality_comparable<mc_enum<T>, std::string>
{
- BOOST_STATIC_ASSERT(std::is_enum<T>::value);
+ static_assert(std::is_enum<T>::value, "");
friend class mc_enum_test;
template<typename U> friend std::vector<std::string> const& all_strings();
diff --git a/mc_enum.tpp b/mc_enum.tpp
index ed78bfe..85c9abd 100644
--- a/mc_enum.tpp
+++ b/mc_enum.tpp
@@ -39,7 +39,7 @@ mc_enum<T>::mc_enum()
,value_(e()[0])
{
typedef mc_enum_key<T> metadata;
- BOOST_STATIC_ASSERT(0 < metadata::n_);
+ static_assert(0 < metadata::n_, "");
}
template<typename T>
diff --git a/mc_enum_metadata.hpp b/mc_enum_metadata.hpp
index d91a481..991e2ce 100644
--- a/mc_enum_metadata.hpp
+++ b/mc_enum_metadata.hpp
@@ -36,8 +36,6 @@
#include "config.hpp"
-#include <boost/static_assert.hpp>
-
#include <cstddef> // std::size_t
/// Associate an mc_enum type with its metadata through its enum type.
@@ -111,7 +109,7 @@ struct mc_enum_key
template<typename T, std::size_t N, T const (&E)[N], char const*const (&C)[N]>
struct mc_enum_data
{
- BOOST_STATIC_ASSERT(0 < N);
+ static_assert(0 < N, "");
static std::size_t const n_ = N;
static T const* e() {return E;}
diff --git a/multidimgrid_safe.hpp b/multidimgrid_safe.hpp
index 0717d0f..dd809f3 100644
--- a/multidimgrid_safe.hpp
+++ b/multidimgrid_safe.hpp
@@ -32,7 +32,6 @@
#include "multidimgrid_any.hpp"
#include <boost/any.hpp>
-#include <boost/static_assert.hpp>
#include <type_traits>
@@ -260,7 +259,7 @@ template<typename AdjustControl, typename BaseAxisType =
MultiDimAxisAny>
class MultiDimAdjustableAxis
:public BaseAxisType
{
- BOOST_STATIC_ASSERT((std::is_base_of<MultiDimAxisAny,
BaseAxisType>::value));
+ static_assert(std::is_base_of<MultiDimAxisAny,BaseAxisType>::value, "");
protected:
typedef AdjustControl AxisAdjustControl;
diff --git a/mvc_controller.tpp b/mvc_controller.tpp
index ef4a810..e418a37 100644
--- a/mvc_controller.tpp
+++ b/mvc_controller.tpp
@@ -26,8 +26,6 @@
#include "mvc_model.hpp"
#include "rtti_lmi.hpp"
-#include <boost/static_assert.hpp>
-
#include <wx/window.h>
#include <wx/xrc/xmlres.h>
@@ -71,10 +69,8 @@ T const& MvcController::ModelReference(std::string const&
name) const
template<typename T>
T& MvcController::WindowFromXrcName(char const* name) const
{
- BOOST_STATIC_ASSERT(!std::is_pointer<T>::value);
-
- // Double parentheses: don't parse comma as a macro parameter separator.
- BOOST_STATIC_ASSERT((std::is_base_of<wxWindow,T>::value));
+ static_assert(!std::is_pointer<T>::value, "");
+ static_assert(std::is_base_of<wxWindow,T>::value, "");
wxWindow* w = FindWindow(wxXmlResource::GetXRCID(name));
if(!w)
diff --git a/numeric_io_cast.hpp b/numeric_io_cast.hpp
index cbb493e..4e94594 100644
--- a/numeric_io_cast.hpp
+++ b/numeric_io_cast.hpp
@@ -27,8 +27,6 @@
#include "numeric_io_traits.hpp"
#include "rtti_lmi.hpp"
-#include <boost/static_assert.hpp>
-
#include <cstring> // std::strcmp()
#include <sstream>
#include <stdexcept>
@@ -110,7 +108,7 @@ To numeric_io_cast(From from, To = To())
// A compile-time failure iff this template is ever instantiated is
// desired, but the straightforward
-// BOOST_STATIC_ASSERT(0);
+// static_assert(0, "");
// can fail even if it's never instantiated; instead, it is asserted
// that both template parameters are void, which 14.1/7 forbids.
//
@@ -121,8 +119,8 @@ To numeric_io_cast(From from, To = To())
template<typename To, typename From>
struct numeric_converter
{
- BOOST_STATIC_ASSERT(std::is_void<To >::value);
- BOOST_STATIC_ASSERT(std::is_void<From>::value);
+ static_assert(std::is_void<To >::value, "");
+ static_assert(std::is_void<From>::value, "");
To operator()(From const& from) const
{
@@ -146,7 +144,7 @@ struct numeric_converter
template<typename To>
struct numeric_converter<To, std::string>
{
- BOOST_STATIC_ASSERT(std::is_arithmetic<To>::value);
+ static_assert(std::is_arithmetic<To>::value, "");
typedef std::string From;
To operator()(From const& from) const
@@ -215,7 +213,7 @@ struct numeric_converter<To, char const*>
template<typename From>
struct numeric_converter<std::string, From>
{
- BOOST_STATIC_ASSERT(std::is_arithmetic<From>::value);
+ static_assert(std::is_arithmetic<From>::value, "");
typedef std::string To;
To operator()(From const& from) const
diff --git a/numeric_io_test.cpp b/numeric_io_test.cpp
index 9135382..e17dab1 100644
--- a/numeric_io_test.cpp
+++ b/numeric_io_test.cpp
@@ -98,7 +98,7 @@ void mete_infinity()
// that deviates from that standard is probably so rare that it can
// reasonably be ignored, with an appropriate runtime message.
-BOOST_STATIC_ASSERT(std::numeric_limits<double>::is_iec559);
+static_assert(std::numeric_limits<double>::is_iec559, "");
int test_main(int, char*[])
{
diff --git a/numeric_io_traits.hpp b/numeric_io_traits.hpp
index 48c8444..bb2509d 100644
--- a/numeric_io_traits.hpp
+++ b/numeric_io_traits.hpp
@@ -27,7 +27,6 @@
#include "ieee754.hpp" // is_infinite<>()
#include <boost/cast.hpp>
-#include <boost/static_assert.hpp>
#include <algorithm> // std::max()
#include <cmath> // C99 functions fabsl(), log10l(),
strtold()
@@ -65,7 +64,7 @@
template<typename T>
inline int floating_point_decimals(T t)
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
+ static_assert(std::is_floating_point<T>::value, "");
#if defined LMI_MSVCRT
// COMPILER !! This C runtime not only writes infinity as "1.#INF"
// instead of "inf" but also "respects" the precision specifier
diff --git a/rate_table.cpp b/rate_table.cpp
index 9bb9435..c39da08 100644
--- a/rate_table.cpp
+++ b/rate_table.cpp
@@ -82,7 +82,7 @@ using std::uint64_t;
// The SOA binary format uses IEEE 754 for the floating point values
// representation and the code in this file won't work correctly if it is
// different from their in memory representation.
-BOOST_STATIC_ASSERT(std::numeric_limits<double>::is_iec559);
+static_assert(std::numeric_limits<double>::is_iec559, "");
// Helper functions used to swap bytes on big endian platforms.
//
diff --git a/round_to.hpp b/round_to.hpp
index 1591f10..ba5540e 100644
--- a/round_to.hpp
+++ b/round_to.hpp
@@ -27,8 +27,6 @@
#include "mc_enum_type_enums.hpp"
#include "stl_extensions.hpp" // nonstd::power()
-#include <boost/static_assert.hpp>
-
#include <cmath>
#include <functional>
#include <limits>
@@ -284,7 +282,7 @@ template<typename RealType>
class round_to
:public std::unary_function<RealType, RealType>
{
- BOOST_STATIC_ASSERT(std::is_floating_point<RealType>::value);
+ static_assert(std::is_floating_point<RealType>::value, "");
public:
round_to();
diff --git a/safely_dereference_as.hpp b/safely_dereference_as.hpp
index 7c5e5f7..36c3888 100644
--- a/safely_dereference_as.hpp
+++ b/safely_dereference_as.hpp
@@ -26,8 +26,6 @@
#include "rtti_lmi.hpp"
-#include <boost/static_assert.hpp>
-
#include <sstream>
#include <stdexcept>
#include <type_traits>
@@ -70,8 +68,7 @@
template<typename T, typename U>
T& safely_dereference_as(U* u)
{
- // Double parentheses: don't parse comma as a macro parameter separator.
- BOOST_STATIC_ASSERT((std::is_base_of<U,T>::value));
+ static_assert(std::is_base_of<U,T>::value, "");
if(!u)
{
std::ostringstream oss;
diff --git a/stratified_charges.cpp b/stratified_charges.cpp
index ab5634d..b3211ab 100644
--- a/stratified_charges.cpp
+++ b/stratified_charges.cpp
@@ -35,8 +35,6 @@
#include "xml_lmi.hpp"
#include "xml_serialize.hpp"
-#include <boost/static_assert.hpp>
-
#include <algorithm>
template class xml_serializable<stratified_charges>;
@@ -250,7 +248,7 @@ namespace
,"stratified_last"
};
- BOOST_STATIC_ASSERT(sizeof s_stratified_nodes / sizeof(char const*) == 1 +
e_stratified_last);
+ static_assert(sizeof s_stratified_nodes / sizeof(char const*) == 1 +
e_stratified_last, "");
} // Unnamed namespace.
stratified_entity& stratified_charges::raw_entity(e_stratified e)
diff --git a/stream_cast.hpp b/stream_cast.hpp
index c249bdb..744dce1 100644
--- a/stream_cast.hpp
+++ b/stream_cast.hpp
@@ -49,8 +49,6 @@
#include "facets.hpp"
#include "rtti_lmi.hpp"
-#include <boost/static_assert.hpp>
-
#include <istream> // std::ws
#include <sstream>
#include <stdexcept>
@@ -99,11 +97,12 @@
template<typename To, typename From>
To stream_cast(From from, To = To())
{
- BOOST_STATIC_ASSERT
+ static_assert
( !std::is_arithmetic<From>::value
|| !std::is_arithmetic<To >::value
+ ,""
);
- BOOST_STATIC_ASSERT(!std::is_pointer<To>::value);
+ static_assert(!std::is_pointer<To>::value, "");
std::stringstream interpreter;
std::ostringstream err;
diff --git a/tn_range.hpp b/tn_range.hpp
index df8b8d8..3227d22 100644
--- a/tn_range.hpp
+++ b/tn_range.hpp
@@ -28,8 +28,6 @@
#include <boost/operators.hpp>
-#include <boost/static_assert.hpp>
-
#include <string>
#include <type_traits>
#include <typeinfo>
@@ -236,8 +234,7 @@ class tn_range
,private boost::equality_comparable<tn_range<Number,Trammel>, Number>
,private boost::equality_comparable<tn_range<Number,Trammel>, std::string>
{
- // Double parentheses: don't parse comma as a macro parameter separator.
-
BOOST_STATIC_ASSERT((std::is_base_of<trammel_base<Number>,Trammel>::value));
+ static_assert(std::is_base_of<trammel_base<Number>,Trammel>::value, "");
friend class tn_range_test;
diff --git a/tn_range.tpp b/tn_range.tpp
index f64d6f9..2636b68 100644
--- a/tn_range.tpp
+++ b/tn_range.tpp
@@ -108,7 +108,7 @@ namespace
template<typename T>
T signum(T t)
{
- BOOST_STATIC_ASSERT(std::is_arithmetic<T>::value);
+ static_assert(std::is_arithmetic<T>::value, "");
T volatile zero = 0;
if(t < zero)
{
@@ -191,7 +191,7 @@ namespace
template<typename T>
struct is_exact_integer_tester<T,true>
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
+ static_assert(std::is_floating_point<T>::value, "");
bool operator()(T t)
{
static T z0 = std::pow
@@ -220,7 +220,7 @@ namespace
template<typename T>
T adjust_bound(T t, T direction)
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
+ static_assert(std::is_floating_point<T>::value, "");
if(is_exact_integer(t))
{
return t;
@@ -273,7 +273,7 @@ namespace
template<typename T>
struct bound_adjuster<T,-1>
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
+ static_assert(std::is_floating_point<T>::value, "");
T operator()(T t)
{
static T const extremum = -std::numeric_limits<T>::max();
@@ -284,7 +284,7 @@ namespace
template<typename T>
struct bound_adjuster<T,1>
{
- BOOST_STATIC_ASSERT(std::is_floating_point<T>::value);
+ static_assert(std::is_floating_point<T>::value, "");
T operator()(T t)
{
static T const extremum = std::numeric_limits<T>::max();
diff --git a/tn_range_test_aux.hpp b/tn_range_test_aux.hpp
index 07e5698..cf2aecc 100644
--- a/tn_range_test_aux.hpp
+++ b/tn_range_test_aux.hpp
@@ -33,7 +33,7 @@
// known to all translation units that might use it.
// An assertion such as
-// BOOST_STATIC_ASSERT(100 <= std::numeric_limits<T>::max());
+// static_assert(100 <= std::numeric_limits<T>::max(), "");
// cannot work: the macro's argument must be an integral constant
// expression, so it can't involve a function call and can't perform
// any non-integer operation.
diff --git a/tn_range_type_trammels.hpp b/tn_range_type_trammels.hpp
index a9da28f..d329a61 100644
--- a/tn_range_type_trammels.hpp
+++ b/tn_range_type_trammels.hpp
@@ -28,8 +28,6 @@
#include "calendar_date.hpp"
-#include <boost/static_assert.hpp>
-
#include <limits>
#include <type_traits>
@@ -111,8 +109,7 @@ template<typename T>
class date_trammel
:public trammel_base<T>
{
- // Double parentheses: don't parse comma as a macro parameter separator.
- BOOST_STATIC_ASSERT((std::is_same<calendar_date,T>::value));
+ static_assert(std::is_same<calendar_date,T>::value, "");
T nominal_minimum() const override {return gregorian_epoch();}
T default_value() const override {return today ();}
diff --git a/uncopyable_lmi.hpp b/uncopyable_lmi.hpp
index d53cb78..1c13679 100644
--- a/uncopyable_lmi.hpp
+++ b/uncopyable_lmi.hpp
@@ -22,8 +22,6 @@
#include "config.hpp"
-#include <boost/static_assert.hpp>
-
#include <type_traits>
/// Forbid compiler to generate copy and assignment functions.
@@ -99,8 +97,7 @@ class uncopyable
uncopyable() = default;
~uncopyable()
{
- // Double parentheses: don't parse comma as a macro parameter
separator.
- BOOST_STATIC_ASSERT((std::is_base_of<uncopyable<T>,T>::value));
+ static_assert(std::is_base_of<uncopyable<T>,T>::value, "");
}
private:
diff --git a/value_cast.hpp b/value_cast.hpp
index 9bb0a10..210fb57 100644
--- a/value_cast.hpp
+++ b/value_cast.hpp
@@ -265,7 +265,7 @@ struct value_cast_chooser<To,From,e_stream>
template<typename To, typename From>
To value_cast(From const& from)
{
- BOOST_STATIC_ASSERT(!std::is_pointer<To>::value);
+ static_assert(!std::is_pointer<To>::value, "");
return value_cast_chooser<To,From>()(from);
}
diff --git a/view_ex.tpp b/view_ex.tpp
index 6b0ecaf..2942765 100644
--- a/view_ex.tpp
+++ b/view_ex.tpp
@@ -23,8 +23,6 @@
#include "assert_lmi.hpp"
#include "rtti_lmi.hpp"
-#include <boost/static_assert.hpp>
-
#include <wx/docview.h>
#include <string>
@@ -51,8 +49,7 @@
template<typename ViewType>
std::string ViewName()
{
- // Double parentheses: don't parse comma as a macro parameter separator.
- BOOST_STATIC_ASSERT((std::is_base_of<wxView,ViewType>::value));
+ static_assert(std::is_base_of<wxView,ViewType>::value, "");
return lmi::TypeInfo(typeid(ViewType)).Name();
}
diff --git a/wx_utility.hpp b/wx_utility.hpp
index 2638cca..d3c97ee 100644
--- a/wx_utility.hpp
+++ b/wx_utility.hpp
@@ -26,8 +26,6 @@
#include "so_attributes.hpp"
-#include <boost/static_assert.hpp>
-
#include <wx/event.h>
#include <wx/string.h>
@@ -80,11 +78,10 @@ void Connect
,wxEvtHandler* event_sink = nullptr
)
{
- // Double parentheses: don't parse comma as a macro parameter separator.
- BOOST_STATIC_ASSERT((std::is_same<void,Return>::value));
- BOOST_STATIC_ASSERT((std::is_base_of<wxEvtHandler,Class>::value));
+ static_assert(std::is_same<void,Return>::value, "");
+ static_assert(std::is_base_of<wxEvtHandler,Class>::value, "");
typedef typename std::remove_reference<Argument>::type argument_type;
- BOOST_STATIC_ASSERT((std::is_base_of<wxEvent,argument_type>::value));
+ static_assert(std::is_base_of<wxEvent,argument_type>::value, "");
if(!object)
{
diff --git a/xml_serializable.tpp b/xml_serializable.tpp
index 10baad3..8b4fb45 100644
--- a/xml_serializable.tpp
+++ b/xml_serializable.tpp
@@ -28,7 +28,6 @@
#include "xml_lmi.hpp"
#include <boost/filesystem/convenience.hpp> // basename()
-#include <boost/static_assert.hpp>
#include <boost/utility/enable_if.hpp>
#include <xmlwrapp/nodes_view.h>
@@ -45,13 +44,8 @@ xml_serializable<T>::~xml_serializable()
// Assert that static_cast<T cv&> doesn't engender undefined
// behavior, and that class T provides the expected operator[]()
// and member_names() functions.
- //
- // Double parentheses: don't parse comma as a macro parameter separator.
- BOOST_STATIC_ASSERT
- ((
- std::is_base_of<xml_serializable <T>,T>::value
- && std::is_base_of<MemberSymbolTable<T>,T>::value
- ));
+ static_assert(std::is_base_of<xml_serializable <T>,T>::value, "");
+ static_assert(std::is_base_of<MemberSymbolTable<T>,T>::value, "");
}
template<typename T>
diff --git a/xml_serialize.hpp b/xml_serialize.hpp
index fac654d..1f0944a 100644
--- a/xml_serialize.hpp
+++ b/xml_serialize.hpp
@@ -28,8 +28,6 @@
#include "value_cast.hpp"
#include "xml_lmi.hpp"
-#include <boost/static_assert.hpp>
-
#include <xmlwrapp/nodes_view.h>
#include <string>
@@ -58,7 +56,7 @@ namespace xml_serialize
template<typename T>
struct xml_io
{
- BOOST_STATIC_ASSERT(!std::is_enum<T>::value); // Prefer mc_enum.
+ static_assert(!std::is_enum<T>::value, ""); // Prefer mc_enum.
static void to_xml(xml::element& e, T const& t)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [lmi] master aff4ac4: Replace BOOST_STATIC_ASSERT with static_assert,
Greg Chicares <=