Use BOOST_STATIC_ASSERT

fix #380
This commit is contained in:
Vinnie Falco
2017-05-23 12:33:31 -07:00
parent 02033c7412
commit 24fd5ec8af
19 changed files with 142 additions and 203 deletions

View File

@@ -4,6 +4,7 @@ Version 44
* Tidy up read_size_helper and dynamic buffers * Tidy up read_size_helper and dynamic buffers
* Require Boost 1.58.0 or later * Require Boost 1.58.0 or later
* Tidy up and make get_lowest_layer public * Tidy up and make get_lowest_layer public
* Use BOOST_STATIC_ASSERT
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@@ -8,6 +8,8 @@
#ifndef BEAST_CONFIG_HPP #ifndef BEAST_CONFIG_HPP
#define BEAST_CONFIG_HPP #define BEAST_CONFIG_HPP
#include <boost/static_assert.hpp>
/* /*
_MSC_VER and _MSC_FULL_VER by version: _MSC_VER and _MSC_FULL_VER by version:

View File

@@ -41,8 +41,8 @@ namespace beast {
template<class CompletionToken, class Signature> template<class CompletionToken, class Signature>
class async_result class async_result
{ {
static_assert(! std::is_reference< BOOST_STATIC_ASSERT(
CompletionToken>::value, ""); ! std::is_reference<CompletionToken>::value);
boost::asio::async_result<typename boost::asio::async_result<typename
boost::asio::handler_type<CompletionToken, boost::asio::handler_type<CompletionToken,

View File

@@ -5,8 +5,8 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
#ifndef BEAST_DETAIL_INTEGER_SEQUENCE_H_INCLUDED #ifndef BEAST_DETAIL_INTEGER_SEQUENCE_HPP
#define BEAST_DETAIL_INTEGER_SEQUENCE_H_INCLUDED #define BEAST_DETAIL_INTEGER_SEQUENCE_HPP
#include <cstddef> #include <cstddef>
#include <type_traits> #include <type_traits>
@@ -19,8 +19,7 @@ template<class T, T... Ints>
struct integer_sequence struct integer_sequence
{ {
using value_type = T; using value_type = T;
static_assert (std::is_integral<T>::value, BOOST_STATIC_ASSERT(std::is_integral<T>::value);
"std::integer_sequence can only be instantiated with an integral type" );
static std::size_t constexpr static_size = sizeof...(Ints); static std::size_t constexpr static_size = sizeof...(Ints);
@@ -65,11 +64,8 @@ struct make_integer_sequence_unchecked<
template<class T, T N> template<class T, T N>
struct make_integer_sequence_checked struct make_integer_sequence_checked
{ {
static_assert (std::is_integral<T>::value, BOOST_STATIC_ASSERT(std::is_integral<T>::value);
"T must be an integral type"); BOOST_STATIC_ASSERT(N >= 0);
static_assert (N >= 0,
"N must be non-negative");
using type = typename make_integer_sequence_unchecked< using type = typename make_integer_sequence_unchecked<
T, N, integer_sequence<T>>::type; T, N, integer_sequence<T>>::type;
@@ -117,11 +113,8 @@ struct integer_sequence_helper;
template<class T, T N, std::size_t... Ints> template<class T, T N, std::size_t... Ints>
struct integer_sequence_helper<T, N, index_tuple<Ints...>> struct integer_sequence_helper<T, N, index_tuple<Ints...>>
{ {
static_assert (std::is_integral<T>::value, BOOST_STATIC_ASSERT(std::is_integral<T>::value);
"T must be an integral type"); BOOST_STATIC_ASSERT(N >= 0);
static_assert (N >= 0,
"N must be non-negative");
using type = integer_sequence<T, static_cast<T> (Ints)...>; using type = integer_sequence<T, static_cast<T> (Ints)...>;
}; };

View File

@@ -84,8 +84,7 @@ handler_ptr(Handler&& handler, Args&&... args)
: p_(new P{std::move(handler), : p_(new P{std::move(handler),
std::forward<Args>(args)...}) std::forward<Args>(args)...})
{ {
static_assert(! std::is_array<T>::value, BOOST_STATIC_ASSERT(! std::is_array<T>::value);
"T must not be an array type");
} }
template<class T, class Handler> template<class T, class Handler>
@@ -94,8 +93,7 @@ handler_ptr<T, Handler>::
handler_ptr(Handler const& handler, Args&&... args) handler_ptr(Handler const& handler, Args&&... args)
: p_(new P{handler, std::forward<Args>(args)...}) : p_(new P{handler, std::forward<Args>(args)...})
{ {
static_assert(! std::is_array<T>::value, BOOST_STATIC_ASSERT(! std::is_array<T>::value);
"T must not be an array type");
} }
template<class T, class Handler> template<class T, class Handler>

View File

@@ -593,9 +593,7 @@ template<class Integer>
static_string<detail::max_digits(sizeof(Integer))> static_string<detail::max_digits(sizeof(Integer))>
to_static_string(Integer x) to_static_string(Integer x)
{ {
static_assert( BOOST_STATIC_ASSERT(std::is_integral<Integer>::value);
std::is_integral<Integer>::value,
"Integral requirements not met");
return detail::to_static_string( return detail::to_static_string(
x, std::integral_constant<bool, x, std::integral_constant<bool,
std::is_signed<Integer>::value>{}); std::is_signed<Integer>::value>{});

View File

@@ -820,54 +820,41 @@ private:
}; };
// //
// Non-member functions // Disallowed operations
// //
// These operations are explicitly deleted since
// there is no reasonable implementation possible.
template<std::size_t N, std::size_t M, class CharT, class Traits> template<std::size_t N, std::size_t M, class CharT, class Traits>
void void
operator+( operator+(
static_string<N, CharT, Traits>const& lhs, static_string<N, CharT, Traits>const& lhs,
static_string<M, CharT, Traits>const& rhs) static_string<M, CharT, Traits>const& rhs) = delete;
{
static_assert(sizeof(CharT) == -1,
"operator+ is not available");
}
template<std::size_t N, class CharT, class Traits> template<std::size_t N, class CharT, class Traits>
void void
operator+(CharT const* lhs, operator+(CharT const* lhs,
static_string<N, CharT, Traits>const& rhs ) static_string<N, CharT, Traits>const& rhs) = delete;
{
static_assert(sizeof(CharT) == -1,
"operator+ is not available");
}
template<std::size_t N, class CharT, class Traits> template<std::size_t N, class CharT, class Traits>
void void
operator+(CharT lhs, operator+(CharT lhs,
static_string<N, CharT, Traits> const& rhs) static_string<N, CharT, Traits> const& rhs) = delete;
{
static_assert(sizeof(CharT) == -1,
"operator+ is not available");
}
template<std::size_t N, class CharT, class Traits> template<std::size_t N, class CharT, class Traits>
void void
operator+(static_string<N, CharT, Traits> const& lhs, operator+(static_string<N, CharT, Traits> const& lhs,
CharT const* rhs ) CharT const* rhs) = delete;
{
static_assert(sizeof(CharT) == -1,
"operator+ is not available");
}
template<std::size_t N, class CharT, class Traits> template<std::size_t N, class CharT, class Traits>
void void
operator+(static_string<N, CharT, Traits> const& lhs, operator+(static_string<N, CharT, Traits> const& lhs,
CharT rhs ) CharT rhs) = delete;
{
static_assert(sizeof(CharT) == -1, //
"operator+ is not available"); // Non-member functions
} //
template<std::size_t N, std::size_t M, template<std::size_t N, std::size_t M,
class CharT, class Traits> class CharT, class Traits>

View File

@@ -458,7 +458,7 @@ public:
body() const body() const
{ {
// This function not available when isDirect==true // This function not available when isDirect==true
static_assert(! isDirect, ""); BOOST_STATIC_ASSERT(! isDirect);
return body_; return body_;
} }
@@ -476,7 +476,7 @@ public:
chunk_extension() const chunk_extension() const
{ {
// This function not available when isDirect==true // This function not available when isDirect==true
static_assert(! isDirect, ""); BOOST_STATIC_ASSERT(! isDirect);
return ext_; return ext_;
} }

View File

@@ -45,7 +45,7 @@ is_alpha(char c)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 224 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 224
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 240 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 240
}; };
static_assert(sizeof(tab) == 256, ""); BOOST_STATIC_ASSERT(sizeof(tab) == 256);
return tab[static_cast<unsigned char>(c)]; return tab[static_cast<unsigned char>(c)];
} }
@@ -72,7 +72,7 @@ is_text(char c)
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 224 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 224
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 240 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 240
}; };
static_assert(sizeof(tab) == 256, ""); BOOST_STATIC_ASSERT(sizeof(tab) == 256);
return tab[static_cast<unsigned char>(c)]; return tab[static_cast<unsigned char>(c)];
} }
@@ -104,7 +104,7 @@ is_tchar(char c)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 224 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 224
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 240 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 240
}; };
static_assert(sizeof(tab) == 256, ""); BOOST_STATIC_ASSERT(sizeof(tab) == 256);
return tab[static_cast<unsigned char>(c)]; return tab[static_cast<unsigned char>(c)];
} }
@@ -133,7 +133,7 @@ is_qdchar(char c)
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 224 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 224
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 240 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 240
}; };
static_assert(sizeof(tab) == 256, ""); BOOST_STATIC_ASSERT(sizeof(tab) == 256);
return tab[static_cast<unsigned char>(c)]; return tab[static_cast<unsigned char>(c)];
} }
@@ -163,7 +163,7 @@ is_qpchar(char c)
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 224 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 224
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 240 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 240
}; };
static_assert(sizeof(tab) == 256, ""); BOOST_STATIC_ASSERT(sizeof(tab) == 256);
return tab[static_cast<unsigned char>(c)]; return tab[static_cast<unsigned char>(c)];
} }
@@ -199,7 +199,7 @@ to_field_char(char c)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}; };
static_assert(sizeof(tab) == 256, ""); BOOST_STATIC_ASSERT(sizeof(tab) == 256);
return tab[static_cast<unsigned char>(c)]; return tab[static_cast<unsigned char>(c)];
} }
@@ -229,7 +229,7 @@ to_value_char(char c)
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, // 224 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, // 224
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 // 240 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 // 240
}; };
static_assert(sizeof(tab) == 256, ""); BOOST_STATIC_ASSERT(sizeof(tab) == 256);
return static_cast<char>(tab[static_cast<unsigned char>(c)]); return static_cast<char>(tab[static_cast<unsigned char>(c)]);
} }
@@ -256,7 +256,7 @@ unhex(char c)
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 224 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 224
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // 240 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // 240
}; };
static_assert(sizeof(tab) == 256, ""); BOOST_STATIC_ASSERT(sizeof(tab) == 256);
return tab[static_cast<unsigned char>(c)]; return tab[static_cast<unsigned char>(c)];
} }

View File

@@ -120,7 +120,7 @@ basic_parser<isRequest, isDirect, Derived>::
copy_body(DynamicBuffer& buffer) copy_body(DynamicBuffer& buffer)
{ {
// This function not available when isDirect==false // This function not available when isDirect==false
static_assert(isDirect, ""); BOOST_STATIC_ASSERT(isDirect);
using boost::asio::buffer_copy; using boost::asio::buffer_copy;
using boost::asio::buffer_size; using boost::asio::buffer_size;
@@ -173,7 +173,7 @@ prepare_body(boost::optional<
MutableBufferSequence>& buffers, std::size_t limit) MutableBufferSequence>& buffers, std::size_t limit)
{ {
// This function not available when isDirect==false // This function not available when isDirect==false
static_assert(isDirect, ""); BOOST_STATIC_ASSERT(isDirect);
BOOST_ASSERT(limit > 0); BOOST_ASSERT(limit > 0);
BOOST_ASSERT( BOOST_ASSERT(
@@ -202,7 +202,7 @@ basic_parser<isRequest, isDirect, Derived>::
commit_body(std::size_t n) commit_body(std::size_t n)
{ {
// This function not available when isDirect==false // This function not available when isDirect==false
static_assert(isDirect, ""); BOOST_STATIC_ASSERT(isDirect);
BOOST_ASSERT(f_ & flagOnBody); BOOST_ASSERT(f_ & flagOnBody);
impl().on_commit(n); impl().on_commit(n);

View File

@@ -226,7 +226,7 @@ private:
on_data(string_view const& s, on_data(string_view const& s,
error_code& ec) error_code& ec)
{ {
static_assert(! Body::reader::is_direct, ""); BOOST_STATIC_ASSERT(! Body::reader::is_direct);
r_->write(s, ec); r_->write(s, ec);
} }

View File

@@ -133,7 +133,7 @@ protected:
static std::uint16_t constexpr maxMatch = 258; static std::uint16_t constexpr maxMatch = 258;
// Can't change minMatch without also changing code, see original zlib // Can't change minMatch without also changing code, see original zlib
static_assert(minMatch==3, ""); BOOST_STATIC_ASSERT(minMatch == 3);
// end of block literal code // end of block literal code
static std::uint16_t constexpr END_BLOCK = 256; static std::uint16_t constexpr END_BLOCK = 256;

View File

@@ -216,50 +216,38 @@ public:
}; };
// Check is_all_const_buffer_sequence // Check is_all_const_buffer_sequence
static_assert( BOOST_STATIC_ASSERT(
detail::is_all_const_buffer_sequence< detail::is_all_const_buffer_sequence<const_buffers_1>::value);
const_buffers_1 BOOST_STATIC_ASSERT(
>::value, ""); detail::is_all_const_buffer_sequence<const_buffers_1, const_buffers_1>::value);
static_assert( BOOST_STATIC_ASSERT(
detail::is_all_const_buffer_sequence< detail::is_all_const_buffer_sequence<mutable_buffers_1>::value);
const_buffers_1, const_buffers_1 BOOST_STATIC_ASSERT(
>::value, ""); detail::is_all_const_buffer_sequence<mutable_buffers_1, mutable_buffers_1>::value);
static_assert( BOOST_STATIC_ASSERT(
detail::is_all_const_buffer_sequence< detail::is_all_const_buffer_sequence<const_buffers_1, mutable_buffers_1>::value);
mutable_buffers_1 BOOST_STATIC_ASSERT(
>::value, ""); ! detail::is_all_const_buffer_sequence<const_buffers_1, mutable_buffers_1, int>::value);
static_assert(
detail::is_all_const_buffer_sequence<
mutable_buffers_1, mutable_buffers_1
>::value, "");
static_assert(
detail::is_all_const_buffer_sequence<
const_buffers_1, mutable_buffers_1
>::value, "");
static_assert(
! detail::is_all_const_buffer_sequence<
const_buffers_1, mutable_buffers_1, int
>::value, "");
// Ensure that concatenating mutable buffer // Ensure that concatenating mutable buffer
// sequences results in a mutable buffer sequence // sequences results in a mutable buffer sequence
static_assert(std::is_same< BOOST_STATIC_ASSERT(std::is_same<
mutable_buffer, mutable_buffer,
decltype(buffer_cat( decltype(buffer_cat(
std::declval<mutable_buffer>(), std::declval<mutable_buffer>(),
std::declval<user_defined>(), std::declval<user_defined>(),
std::declval<mutable_buffer>() std::declval<mutable_buffer>()
))::value_type>::value, ""); ))::value_type>::value);
// Ensure that concatenating mixed buffer // Ensure that concatenating mixed buffer
// sequences results in a const buffer sequence. // sequences results in a const buffer sequence.
static_assert(std::is_same< BOOST_STATIC_ASSERT(std::is_same<
const_buffer, const_buffer,
decltype(buffer_cat( decltype(buffer_cat(
std::declval<mutable_buffer>(), std::declval<mutable_buffer>(),
std::declval<user_defined>(), std::declval<user_defined>(),
std::declval<const_buffer>() std::declval<const_buffer>()
))::value_type>::value, ""); ))::value_type>::value);
testBufferCat(); testBufferCat();
testIterators(); testIterators();

View File

@@ -16,24 +16,24 @@
namespace beast { namespace beast {
static_assert( BOOST_STATIC_ASSERT(
std::is_same<boost::asio::const_buffer, decltype( std::is_same<boost::asio::const_buffer, decltype(
buffer_prefix(0, buffer_prefix(0,
std::declval<boost::asio::const_buffer>()))>::value, ""); std::declval<boost::asio::const_buffer>()))>::value);
static_assert( BOOST_STATIC_ASSERT(
is_const_buffer_sequence<decltype( is_const_buffer_sequence<decltype(
buffer_prefix(0, buffer_prefix(0,
std::declval<boost::asio::const_buffers_1>()))>::value, ""); std::declval<boost::asio::const_buffers_1>()))>::value);
static_assert( BOOST_STATIC_ASSERT(
std::is_same<boost::asio::mutable_buffer, decltype( std::is_same<boost::asio::mutable_buffer, decltype(
buffer_prefix(0, buffer_prefix(0,
std::declval<boost::asio::mutable_buffer>()))>::value, ""); std::declval<boost::asio::mutable_buffer>()))>::value);
static_assert( BOOST_STATIC_ASSERT(
is_mutable_buffer_sequence<decltype( is_mutable_buffer_sequence<decltype(
buffer_prefix(0, buffer_prefix(0,
std::declval<boost::asio::mutable_buffers_1>()))>::value, ""); std::declval<boost::asio::mutable_buffers_1>()))>::value);
class buffer_prefix_test : public beast::unit_test::suite class buffer_prefix_test : public beast::unit_test::suite
{ {

View File

@@ -108,7 +108,7 @@ void
check_read_size_helper() check_read_size_helper()
{ {
static_assert(has_read_size_helper::trait<DynamicBuffer>::value, static_assert(has_read_size_helper::trait<DynamicBuffer>::value,
"Missing read_size_helper for dynamic buffer"); "Missing read_size_helper for dynamic buffer");
} }
} // test } // test

View File

@@ -21,7 +21,7 @@
namespace beast { namespace beast {
static_assert(is_dynamic_buffer<multi_buffer>::value, ""); BOOST_STATIC_ASSERT(is_dynamic_buffer<multi_buffer>::value);
class multi_buffer_test : public beast::unit_test::suite class multi_buffer_test : public beast::unit_test::suite
{ {

View File

@@ -37,26 +37,13 @@ struct is_invocable_udt3
#ifndef __INTELLISENSE__ #ifndef __INTELLISENSE__
// VFALCO Fails to compile with Intellisense // VFALCO Fails to compile with Intellisense
static_assert(is_invocable< BOOST_STATIC_ASSERT(is_invocable<is_invocable_udt1, void(int)>::value);
is_invocable_udt1, void(int)>::value, ""); BOOST_STATIC_ASSERT(is_invocable<is_invocable_udt2, int(int)>::value);
BOOST_STATIC_ASSERT(is_invocable<is_invocable_udt3, int(int)>::value);
static_assert(! is_invocable< BOOST_STATIC_ASSERT(! is_invocable<is_invocable_udt1, void(void)>::value);
is_invocable_udt1, void(void)>::value, ""); BOOST_STATIC_ASSERT(! is_invocable<is_invocable_udt2, int(void)>::value);
BOOST_STATIC_ASSERT(! is_invocable<is_invocable_udt2, void(void)>::value);
static_assert(is_invocable< BOOST_STATIC_ASSERT(! is_invocable<is_invocable_udt3 const, int(int)>::value);
is_invocable_udt2, int(int)>::value, "");
static_assert(! is_invocable<
is_invocable_udt2, int(void)>::value, "");
static_assert(! is_invocable<
is_invocable_udt2, void(void)>::value, "");
static_assert(is_invocable<
is_invocable_udt3, int(int)>::value, "");
static_assert(! is_invocable<
is_invocable_udt3 const, int(int)>::value, "");
#endif #endif
// //
@@ -86,29 +73,14 @@ struct F4
get_lowest_layer<next_layer_type>::type; get_lowest_layer<next_layer_type>::type;
}; };
static_assert(std::is_same< BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F1>::type, F1>::value);
get_lowest_layer<F1>::type, F1>::value, ""); BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F2>::type, F2>::value);
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F3<F1>>::type, F1>::value);
static_assert(std::is_same< BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F3<F2>>::type, F2>::value);
get_lowest_layer<F2>::type, F2>::value, ""); BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F4<F1>>::type, F1>::value);
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F4<F2>>::type, F2>::value);
static_assert(std::is_same< BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F4<F3<F1>>>::type, F1>::value);
get_lowest_layer<F3<F1>>::type, F1>::value, ""); BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F4<F3<F2>>>::type, F2>::value);
static_assert(std::is_same<
get_lowest_layer<F3<F2>>::type, F2>::value, "");
static_assert(std::is_same<
get_lowest_layer<F4<F1>>::type, F1>::value, "");
static_assert(std::is_same<
get_lowest_layer<F4<F2>>::type, F2>::value, "");
static_assert(std::is_same<
get_lowest_layer<F4<F3<F1>>>::type, F1>::value, "");
static_assert(std::is_same<
get_lowest_layer<F4<F3<F2>>>::type, F2>::value, "");
} // (anonymous) } // (anonymous)
@@ -122,11 +94,11 @@ namespace {
struct T {}; struct T {};
static_assert(is_const_buffer_sequence<detail::ConstBufferSequence>::value, ""); BOOST_STATIC_ASSERT(is_const_buffer_sequence<detail::ConstBufferSequence>::value);
static_assert(! is_const_buffer_sequence<T>::value, ""); BOOST_STATIC_ASSERT(! is_const_buffer_sequence<T>::value);
static_assert(is_mutable_buffer_sequence<detail::MutableBufferSequence>::value, ""); BOOST_STATIC_ASSERT(is_mutable_buffer_sequence<detail::MutableBufferSequence>::value);
static_assert(! is_mutable_buffer_sequence<T>::value, ""); BOOST_STATIC_ASSERT(! is_mutable_buffer_sequence<T>::value);
} // (anonymous) } // (anonymous)
@@ -143,8 +115,8 @@ struct H
} // anonymous } // anonymous
static_assert(is_completion_handler<H, void(int)>::value, ""); BOOST_STATIC_ASSERT(is_completion_handler<H, void(int)>::value);
static_assert(! is_completion_handler<H, void(void)>::value, ""); BOOST_STATIC_ASSERT(! is_completion_handler<H, void(void)>::value);
// //
// stream concepts // stream concepts
@@ -154,19 +126,19 @@ static_assert(! is_completion_handler<H, void(void)>::value, "");
using stream_type = boost::asio::ip::tcp::socket; using stream_type = boost::asio::ip::tcp::socket;
static_assert(has_get_io_service<stream_type>::value, ""); BOOST_STATIC_ASSERT(has_get_io_service<stream_type>::value);
static_assert(is_async_read_stream<stream_type>::value, ""); BOOST_STATIC_ASSERT(is_async_read_stream<stream_type>::value);
static_assert(is_async_write_stream<stream_type>::value, ""); BOOST_STATIC_ASSERT(is_async_write_stream<stream_type>::value);
static_assert(is_async_stream<stream_type>::value, ""); BOOST_STATIC_ASSERT(is_async_stream<stream_type>::value);
static_assert(is_sync_read_stream<stream_type>::value, ""); BOOST_STATIC_ASSERT(is_sync_read_stream<stream_type>::value);
static_assert(is_sync_write_stream<stream_type>::value, ""); BOOST_STATIC_ASSERT(is_sync_write_stream<stream_type>::value);
static_assert(is_sync_stream<stream_type>::value, ""); BOOST_STATIC_ASSERT(is_sync_stream<stream_type>::value);
static_assert(! has_get_io_service<int>::value, ""); BOOST_STATIC_ASSERT(! has_get_io_service<int>::value);
static_assert(! is_async_read_stream<int>::value, ""); BOOST_STATIC_ASSERT(! is_async_read_stream<int>::value);
static_assert(! is_async_write_stream<int>::value, ""); BOOST_STATIC_ASSERT(! is_async_write_stream<int>::value);
static_assert(! is_sync_read_stream<int>::value, ""); BOOST_STATIC_ASSERT(! is_sync_read_stream<int>::value);
static_assert(! is_sync_write_stream<int>::value, ""); BOOST_STATIC_ASSERT(! is_sync_write_stream<int>::value);
//} // (anonymous) //} // (anonymous)

View File

@@ -73,39 +73,39 @@ public:
void void
testMessage() testMessage()
{ {
static_assert(std::is_constructible< BOOST_STATIC_ASSERT(std::is_constructible<
message<true, default_body, fields>>::value, ""); message<true, default_body, fields>>::value);
static_assert(std::is_constructible< BOOST_STATIC_ASSERT(std::is_constructible<
message<true, one_arg_body, fields>, Arg1>::value, ""); message<true, one_arg_body, fields>, Arg1>::value);
static_assert(std::is_constructible< BOOST_STATIC_ASSERT(std::is_constructible<
message<true, one_arg_body, fields>, Arg1 const>::value, ""); message<true, one_arg_body, fields>, Arg1 const>::value);
static_assert(std::is_constructible< BOOST_STATIC_ASSERT(std::is_constructible<
message<true, one_arg_body, fields>, Arg1 const&>::value, ""); message<true, one_arg_body, fields>, Arg1 const&>::value);
static_assert(std::is_constructible< BOOST_STATIC_ASSERT(std::is_constructible<
message<true, one_arg_body, fields>, Arg1&&>::value, ""); message<true, one_arg_body, fields>, Arg1&&>::value);
static_assert(! std::is_constructible< BOOST_STATIC_ASSERT(! std::is_constructible<
message<true, one_arg_body, fields>>::value, ""); message<true, one_arg_body, fields>>::value);
static_assert(std::is_constructible< BOOST_STATIC_ASSERT(std::is_constructible<
message<true, one_arg_body, fields>, message<true, one_arg_body, fields>,
Arg1, fields::allocator_type>::value, ""); Arg1, fields::allocator_type>::value);
static_assert(std::is_constructible< BOOST_STATIC_ASSERT(std::is_constructible<
message<true, one_arg_body, fields>, std::piecewise_construct_t, message<true, one_arg_body, fields>, std::piecewise_construct_t,
std::tuple<Arg1>>::value, ""); std::tuple<Arg1>>::value);
static_assert(std::is_constructible< BOOST_STATIC_ASSERT(std::is_constructible<
message<true, two_arg_body, fields>, std::piecewise_construct_t, message<true, two_arg_body, fields>, std::piecewise_construct_t,
std::tuple<Arg1, Arg2>>::value, ""); std::tuple<Arg1, Arg2>>::value);
static_assert(std::is_constructible< BOOST_STATIC_ASSERT(std::is_constructible<
message<true, two_arg_body, fields>, std::piecewise_construct_t, message<true, two_arg_body, fields>, std::piecewise_construct_t,
std::tuple<Arg1, Arg2>, std::tuple<fields::allocator_type>>::value, ""); std::tuple<Arg1, Arg2>, std::tuple<fields::allocator_type>>::value);
{ {
Arg1 arg1; Arg1 arg1;
@@ -171,16 +171,16 @@ public:
{ {
{ {
using req_type = request_header; using req_type = request_header;
static_assert(std::is_copy_constructible<req_type>::value, ""); BOOST_STATIC_ASSERT(std::is_copy_constructible<req_type>::value);
static_assert(std::is_move_constructible<req_type>::value, ""); BOOST_STATIC_ASSERT(std::is_move_constructible<req_type>::value);
static_assert(std::is_copy_assignable<req_type>::value, ""); BOOST_STATIC_ASSERT(std::is_copy_assignable<req_type>::value);
static_assert(std::is_move_assignable<req_type>::value, ""); BOOST_STATIC_ASSERT(std::is_move_assignable<req_type>::value);
using res_type = response_header; using res_type = response_header;
static_assert(std::is_copy_constructible<res_type>::value, ""); BOOST_STATIC_ASSERT(std::is_copy_constructible<res_type>::value);
static_assert(std::is_move_constructible<res_type>::value, ""); BOOST_STATIC_ASSERT(std::is_move_constructible<res_type>::value);
static_assert(std::is_copy_assignable<res_type>::value, ""); BOOST_STATIC_ASSERT(std::is_copy_assignable<res_type>::value);
static_assert(std::is_move_assignable<res_type>::value, ""); BOOST_STATIC_ASSERT(std::is_move_assignable<res_type>::value);
} }
{ {

View File

@@ -1837,23 +1837,23 @@ public:
void run() override void run() override
{ {
static_assert(std::is_constructible< BOOST_STATIC_ASSERT(std::is_constructible<
stream<socket_type>, boost::asio::io_service&>::value, ""); stream<socket_type>, boost::asio::io_service&>::value);
static_assert(std::is_move_constructible< BOOST_STATIC_ASSERT(std::is_move_constructible<
stream<socket_type>>::value, ""); stream<socket_type>>::value);
static_assert(std::is_move_assignable< BOOST_STATIC_ASSERT(std::is_move_assignable<
stream<socket_type>>::value, ""); stream<socket_type>>::value);
static_assert(std::is_constructible< BOOST_STATIC_ASSERT(std::is_constructible<
stream<socket_type&>, socket_type&>::value, ""); stream<socket_type&>, socket_type&>::value);
static_assert(std::is_move_constructible< BOOST_STATIC_ASSERT(std::is_move_constructible<
stream<socket_type&>>::value, ""); stream<socket_type&>>::value);
static_assert(! std::is_move_assignable< BOOST_STATIC_ASSERT(! std::is_move_assignable<
stream<socket_type&>>::value, ""); stream<socket_type&>>::value);
log << "sizeof(websocket::stream) == " << log << "sizeof(websocket::stream) == " <<
sizeof(websocket::stream<boost::asio::ip::tcp::socket&>) << std::endl; sizeof(websocket::stream<boost::asio::ip::tcp::socket&>) << std::endl;