forked from boostorg/beast
1 parent
1b616fa1da
commit
cd9f41b1a0
19 files changed
+142
-203
No files matched your search
@@ -8,6 +8,8 @@
|
||||
#ifndef BEAST_CONFIG_HPP
|
||||
#define BEAST_CONFIG_HPP
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
/*
|
||||
_MSC_VER and _MSC_FULL_VER by version:
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@ namespace beast {
|
||||
template<class CompletionToken, class Signature>
|
||||
class async_result
|
||||
{
|
||||
static_assert(! std::is_reference<
|
||||
CompletionToken>::value, "");
|
||||
BOOST_STATIC_ASSERT(
|
||||
! std::is_reference<CompletionToken>::value);
|
||||
|
||||
boost::asio::async_result<typename
|
||||
boost::asio::handler_type<CompletionToken,
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_INTEGER_SEQUENCE_H_INCLUDED
|
||||
#define BEAST_DETAIL_INTEGER_SEQUENCE_H_INCLUDED
|
||||
#ifndef BEAST_DETAIL_INTEGER_SEQUENCE_HPP
|
||||
#define BEAST_DETAIL_INTEGER_SEQUENCE_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
@@ -19,8 +19,7 @@ template<class T, T... Ints>
|
||||
struct integer_sequence
|
||||
{
|
||||
using value_type = T;
|
||||
static_assert (std::is_integral<T>::value,
|
||||
"std::integer_sequence can only be instantiated with an integral type" );
|
||||
BOOST_STATIC_ASSERT(std::is_integral<T>::value);
|
||||
|
||||
static std::size_t constexpr static_size = sizeof...(Ints);
|
||||
|
||||
@@ -65,11 +64,8 @@ struct make_integer_sequence_unchecked<
|
||||
template<class T, T N>
|
||||
struct make_integer_sequence_checked
|
||||
{
|
||||
static_assert (std::is_integral<T>::value,
|
||||
"T must be an integral type");
|
||||
|
||||
static_assert (N >= 0,
|
||||
"N must be non-negative");
|
||||
BOOST_STATIC_ASSERT(std::is_integral<T>::value);
|
||||
BOOST_STATIC_ASSERT(N >= 0);
|
||||
|
||||
using type = typename make_integer_sequence_unchecked<
|
||||
T, N, integer_sequence<T>>::type;
|
||||
@@ -117,11 +113,8 @@ struct integer_sequence_helper;
|
||||
template<class T, T N, std::size_t... Ints>
|
||||
struct integer_sequence_helper<T, N, index_tuple<Ints...>>
|
||||
{
|
||||
static_assert (std::is_integral<T>::value,
|
||||
"T must be an integral type");
|
||||
|
||||
static_assert (N >= 0,
|
||||
"N must be non-negative");
|
||||
BOOST_STATIC_ASSERT(std::is_integral<T>::value);
|
||||
BOOST_STATIC_ASSERT(N >= 0);
|
||||
|
||||
using type = integer_sequence<T, static_cast<T> (Ints)...>;
|
||||
};
|
||||
|
||||
@@ -84,8 +84,7 @@ handler_ptr(Handler&& handler, Args&&... args)
|
||||
: p_(new P{std::move(handler),
|
||||
std::forward<Args>(args)...})
|
||||
{
|
||||
static_assert(! std::is_array<T>::value,
|
||||
"T must not be an array type");
|
||||
BOOST_STATIC_ASSERT(! std::is_array<T>::value);
|
||||
}
|
||||
|
||||
template<class T, class Handler>
|
||||
@@ -94,8 +93,7 @@ handler_ptr<T, Handler>::
|
||||
handler_ptr(Handler const& handler, Args&&... args)
|
||||
: p_(new P{handler, std::forward<Args>(args)...})
|
||||
{
|
||||
static_assert(! std::is_array<T>::value,
|
||||
"T must not be an array type");
|
||||
BOOST_STATIC_ASSERT(! std::is_array<T>::value);
|
||||
}
|
||||
|
||||
template<class T, class Handler>
|
||||
|
||||
@@ -593,9 +593,7 @@ template<class Integer>
|
||||
static_string<detail::max_digits(sizeof(Integer))>
|
||||
to_static_string(Integer x)
|
||||
{
|
||||
static_assert(
|
||||
std::is_integral<Integer>::value,
|
||||
"Integral requirements not met");
|
||||
BOOST_STATIC_ASSERT(std::is_integral<Integer>::value);
|
||||
return detail::to_static_string(
|
||||
x, std::integral_constant<bool,
|
||||
std::is_signed<Integer>::value>{});
|
||||
|
||||
@@ -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>
|
||||
void
|
||||
operator+(
|
||||
static_string<N, CharT, Traits>const& lhs,
|
||||
static_string<M, CharT, Traits>const& rhs)
|
||||
{
|
||||
static_assert(sizeof(CharT) == -1,
|
||||
"operator+ is not available");
|
||||
}
|
||||
static_string<M, CharT, Traits>const& rhs) = delete;
|
||||
|
||||
template<std::size_t N, class CharT, class Traits>
|
||||
void
|
||||
operator+(CharT const* lhs,
|
||||
static_string<N, CharT, Traits>const& rhs )
|
||||
{
|
||||
static_assert(sizeof(CharT) == -1,
|
||||
"operator+ is not available");
|
||||
}
|
||||
static_string<N, CharT, Traits>const& rhs) = delete;
|
||||
|
||||
template<std::size_t N, class CharT, class Traits>
|
||||
void
|
||||
operator+(CharT lhs,
|
||||
static_string<N, CharT, Traits> const& rhs)
|
||||
{
|
||||
static_assert(sizeof(CharT) == -1,
|
||||
"operator+ is not available");
|
||||
}
|
||||
static_string<N, CharT, Traits> const& rhs) = delete;
|
||||
|
||||
template<std::size_t N, class CharT, class Traits>
|
||||
void
|
||||
operator+(static_string<N, CharT, Traits> const& lhs,
|
||||
CharT const* rhs )
|
||||
{
|
||||
static_assert(sizeof(CharT) == -1,
|
||||
"operator+ is not available");
|
||||
}
|
||||
CharT const* rhs) = delete;
|
||||
|
||||
template<std::size_t N, class CharT, class Traits>
|
||||
void
|
||||
operator+(static_string<N, CharT, Traits> const& lhs,
|
||||
CharT rhs )
|
||||
{
|
||||
static_assert(sizeof(CharT) == -1,
|
||||
"operator+ is not available");
|
||||
}
|
||||
CharT rhs) = delete;
|
||||
|
||||
//
|
||||
// Non-member functions
|
||||
//
|
||||
|
||||
template<std::size_t N, std::size_t M,
|
||||
class CharT, class Traits>
|
||||
|
||||
@@ -458,7 +458,7 @@ public:
|
||||
body() const
|
||||
{
|
||||
// This function not available when isDirect==true
|
||||
static_assert(! isDirect, "");
|
||||
BOOST_STATIC_ASSERT(! isDirect);
|
||||
return body_;
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ public:
|
||||
chunk_extension() const
|
||||
{
|
||||
// This function not available when isDirect==true
|
||||
static_assert(! isDirect, "");
|
||||
BOOST_STATIC_ASSERT(! isDirect);
|
||||
return ext_;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 // 240
|
||||
};
|
||||
static_assert(sizeof(tab) == 256, "");
|
||||
BOOST_STATIC_ASSERT(sizeof(tab) == 256);
|
||||
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 // 240
|
||||
};
|
||||
static_assert(sizeof(tab) == 256, "");
|
||||
BOOST_STATIC_ASSERT(sizeof(tab) == 256);
|
||||
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 // 240
|
||||
};
|
||||
static_assert(sizeof(tab) == 256, "");
|
||||
BOOST_STATIC_ASSERT(sizeof(tab) == 256);
|
||||
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 // 240
|
||||
};
|
||||
static_assert(sizeof(tab) == 256, "");
|
||||
BOOST_STATIC_ASSERT(sizeof(tab) == 256);
|
||||
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 // 240
|
||||
};
|
||||
static_assert(sizeof(tab) == 256, "");
|
||||
BOOST_STATIC_ASSERT(sizeof(tab) == 256);
|
||||
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
|
||||
};
|
||||
static_assert(sizeof(tab) == 256, "");
|
||||
BOOST_STATIC_ASSERT(sizeof(tab) == 256);
|
||||
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
|
||||
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)]);
|
||||
}
|
||||
|
||||
@@ -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 // 240
|
||||
};
|
||||
static_assert(sizeof(tab) == 256, "");
|
||||
BOOST_STATIC_ASSERT(sizeof(tab) == 256);
|
||||
return tab[static_cast<unsigned char>(c)];
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ basic_parser<isRequest, isDirect, Derived>::
|
||||
copy_body(DynamicBuffer& buffer)
|
||||
{
|
||||
// This function not available when isDirect==false
|
||||
static_assert(isDirect, "");
|
||||
BOOST_STATIC_ASSERT(isDirect);
|
||||
|
||||
using boost::asio::buffer_copy;
|
||||
using boost::asio::buffer_size;
|
||||
@@ -173,7 +173,7 @@ prepare_body(boost::optional<
|
||||
MutableBufferSequence>& buffers, std::size_t limit)
|
||||
{
|
||||
// This function not available when isDirect==false
|
||||
static_assert(isDirect, "");
|
||||
BOOST_STATIC_ASSERT(isDirect);
|
||||
|
||||
BOOST_ASSERT(limit > 0);
|
||||
BOOST_ASSERT(
|
||||
@@ -202,7 +202,7 @@ basic_parser<isRequest, isDirect, Derived>::
|
||||
commit_body(std::size_t n)
|
||||
{
|
||||
// This function not available when isDirect==false
|
||||
static_assert(isDirect, "");
|
||||
BOOST_STATIC_ASSERT(isDirect);
|
||||
|
||||
BOOST_ASSERT(f_ & flagOnBody);
|
||||
impl().on_commit(n);
|
||||
|
||||
@@ -226,7 +226,7 @@ private:
|
||||
on_data(string_view const& s,
|
||||
error_code& ec)
|
||||
{
|
||||
static_assert(! Body::reader::is_direct, "");
|
||||
BOOST_STATIC_ASSERT(! Body::reader::is_direct);
|
||||
r_->write(s, ec);
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ protected:
|
||||
static std::uint16_t constexpr maxMatch = 258;
|
||||
|
||||
// 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
|
||||
static std::uint16_t constexpr END_BLOCK = 256;
|
||||
|
||||
Reference in new issue
Block a user