// // Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef BEAST_DETAIL_BUFFER_CONCEPTS_HPP #define BEAST_DETAIL_BUFFER_CONCEPTS_HPP #include #include #include namespace beast { namespace detail { // Types that meet the requirements, // for use with std::declval only. template struct BufferSequence { using value_type = BufferType; using const_iterator = BufferType const*; ~BufferSequence(); BufferSequence(BufferSequence const&) = default; const_iterator begin() const noexcept; const_iterator end() const noexcept; }; using ConstBufferSequence = BufferSequence; using MutableBufferSequence = BufferSequence; template class is_BufferSequence { template > static R check1(int); template static std::false_type check1(...); using type1 = decltype(check1(0)); template::iterator_category>> #else // workaround: // boost::asio::detail::consuming_buffers::const_iterator // is not bidirectional std::forward_iterator_tag, typename std::iterator_traits< typename U::const_iterator>::iterator_category>> #endif static R check2(int); template static std::false_type check2(...); using type2 = decltype(check2(0)); template().begin()), typename U::const_iterator>::type> static R check3(int); template static std::false_type check3(...); using type3 = decltype(check3(0)); template().end()), typename U::const_iterator>::type> static R check4(int); template static std::false_type check4(...); using type4 = decltype(check4(0)); public: using type = std::integral_constant::value && std::is_destructible::value && type1::value && type2::value && type3::value && type4::value>; }; template class is_DynamicBuffer { template().prepare(1)), boost::asio::mutable_buffer>::type::value>> static R check1(int); template static std::false_type check1(...); using type1 = decltype(check1(0)); template().data()), boost::asio::const_buffer>::type::value>> static R check2(int); template static std::false_type check2(...); using type2 = decltype(check2(0)); template().commit(1), std::true_type{})> static R check3(int); template static std::false_type check3(...); using type3 = decltype(check3(0)); template().consume(1), std::true_type{})> static R check4(int); template static std::false_type check4(...); using type4 = decltype(check4(0)); template().size()), std::size_t>> static R check5(int); template static std::false_type check5(...); using type5 = decltype(check5(0)); public: using type = std::integral_constant; }; } // detail } // beast #endif