// // detail/is_buffer_sequence.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff 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 BOOST_ASIO_DETAIL_IS_BUFFER_SEQUENCE_HPP #define BOOST_ASIO_DETAIL_IS_BUFFER_SEQUENCE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include #include #include namespace lslboost { namespace asio { class mutable_buffer; class const_buffer; namespace detail { struct buffer_sequence_memfns_base { void begin(); void end(); void size(); void max_size(); void capacity(); void data(); void prepare(); void commit(); void consume(); }; template struct buffer_sequence_memfns_derived : T, buffer_sequence_memfns_base { }; template struct buffer_sequence_memfns_check { }; template char (&buffer_sequence_begin_helper(...))[2]; #if defined(BOOST_ASIO_HAS_DECLTYPE) template char buffer_sequence_begin_helper(T* t, typename enable_if::value>::type*); #else // defined(BOOST_ASIO_HAS_DECLTYPE) template char buffer_sequence_begin_helper(T* t, buffer_sequence_memfns_check< void (buffer_sequence_memfns_base::*)(), &buffer_sequence_memfns_derived::begin>*); #endif // defined(BOOST_ASIO_HAS_DECLTYPE) template char (&buffer_sequence_end_helper(...))[2]; #if defined(BOOST_ASIO_HAS_DECLTYPE) template char buffer_sequence_end_helper(T* t, typename enable_if::value>::type*); #else // defined(BOOST_ASIO_HAS_DECLTYPE) template char buffer_sequence_end_helper(T* t, buffer_sequence_memfns_check< void (buffer_sequence_memfns_base::*)(), &buffer_sequence_memfns_derived::end>*); #endif // defined(BOOST_ASIO_HAS_DECLTYPE) template char (&size_memfn_helper(...))[2]; template char size_memfn_helper( buffer_sequence_memfns_check< void (buffer_sequence_memfns_base::*)(), &buffer_sequence_memfns_derived::size>*); template char (&max_size_memfn_helper(...))[2]; template char max_size_memfn_helper( buffer_sequence_memfns_check< void (buffer_sequence_memfns_base::*)(), &buffer_sequence_memfns_derived::max_size>*); template char (&capacity_memfn_helper(...))[2]; template char capacity_memfn_helper( buffer_sequence_memfns_check< void (buffer_sequence_memfns_base::*)(), &buffer_sequence_memfns_derived::capacity>*); template char (&data_memfn_helper(...))[2]; template char data_memfn_helper( buffer_sequence_memfns_check< void (buffer_sequence_memfns_base::*)(), &buffer_sequence_memfns_derived::data>*); template char (&prepare_memfn_helper(...))[2]; template char prepare_memfn_helper( buffer_sequence_memfns_check< void (buffer_sequence_memfns_base::*)(), &buffer_sequence_memfns_derived::prepare>*); template char (&commit_memfn_helper(...))[2]; template char commit_memfn_helper( buffer_sequence_memfns_check< void (buffer_sequence_memfns_base::*)(), &buffer_sequence_memfns_derived::commit>*); template char (&consume_memfn_helper(...))[2]; template char consume_memfn_helper( buffer_sequence_memfns_check< void (buffer_sequence_memfns_base::*)(), &buffer_sequence_memfns_derived::consume>*); template char (&buffer_sequence_element_type_helper(...))[2]; #if defined(BOOST_ASIO_HAS_DECLTYPE) template char buffer_sequence_element_type_helper(T* t, typename enable_if::value>::type*); #else // defined(BOOST_ASIO_HAS_DECLTYPE) template char buffer_sequence_element_type_helper( typename T::const_iterator*, typename enable_if::value>::type*); #endif // defined(BOOST_ASIO_HAS_DECLTYPE) template char (&const_buffers_type_typedef_helper(...))[2]; template char const_buffers_type_typedef_helper( typename T::const_buffers_type*); template char (&mutable_buffers_type_typedef_helper(...))[2]; template char mutable_buffers_type_typedef_helper( typename T::mutable_buffers_type*); template struct is_buffer_sequence_class : integral_constant(0)) != 1 && sizeof(buffer_sequence_end_helper(0)) != 1 && sizeof(buffer_sequence_element_type_helper(0, 0)) == 1> { }; template struct is_buffer_sequence : conditional::value, is_buffer_sequence_class, false_type>::type { }; template <> struct is_buffer_sequence : true_type { }; template <> struct is_buffer_sequence : true_type { }; template <> struct is_buffer_sequence : true_type { }; template <> struct is_buffer_sequence : false_type { }; template struct is_dynamic_buffer_class : integral_constant(0)) != 1 && sizeof(max_size_memfn_helper(0)) != 1 && sizeof(capacity_memfn_helper(0)) != 1 && sizeof(data_memfn_helper(0)) != 1 && sizeof(consume_memfn_helper(0)) != 1 && sizeof(prepare_memfn_helper(0)) != 1 && sizeof(commit_memfn_helper(0)) != 1 && sizeof(const_buffers_type_typedef_helper(0)) == 1 && sizeof(mutable_buffers_type_typedef_helper(0)) == 1> { }; template struct is_dynamic_buffer : conditional::value, is_dynamic_buffer_class, false_type>::type { }; } // namespace detail } // namespace asio } // namespace lslboost #include #endif // BOOST_ASIO_DETAIL_IS_BUFFER_SEQUENCE_HPP