// // detail/is_buffer_sequence.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2016 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 ASIO_DETAIL_IS_BUFFER_SEQUENCE_HPP #define ASIO_DETAIL_IS_BUFFER_SEQUENCE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" #include "asio/detail/type_traits.hpp" #include "asio/detail/push_options.hpp" 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 (&begin_memfn_helper(...))[2]; template char begin_memfn_helper( buffer_sequence_memfns_check< void (buffer_sequence_memfns_base::*)(), &buffer_sequence_memfns_derived::begin>*); template char (&end_memfn_helper(...))[2]; template char end_memfn_helper( buffer_sequence_memfns_check< void (buffer_sequence_memfns_base::*)(), &buffer_sequence_memfns_derived::end>*); 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::data>*); 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_element_type_helper(...))[2]; #if defined(ASIO_HAS_DECL_TYPE) template char buffer_element_type_helper(T* t, typename enable_if::value>::type*); #else // defined(ASIO_HAS_DECL_TYPE) template char buffer_element_type_helper( typename T::const_iterator*, typename enable_if::value>::type*); #endif // defined(ASIO_HAS_DECL_TYPE) 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(end_memfn_helper(0)) != 1 && sizeof(buffer_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_sequence_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_sequence : conditional::value, is_dynamic_buffer_sequence_class, false_type>::type { }; } // namespace detail } // namespace asio #include "asio/detail/pop_options.hpp" #endif // ASIO_DETAIL_IS_BUFFER_SEQUENCE_HPP