1 // 2 // is_read_buffered.hpp 3 // ~~~~~~~~~~~~~~~~~~~~ 4 // 5 // Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 // 7 // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 // 10 11 #ifndef BOOST_ASIO_IS_READ_BUFFERED_HPP 12 #define BOOST_ASIO_IS_READ_BUFFERED_HPP 13 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 # pragma once 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 18 #include <boost/asio/detail/config.hpp> 19 #include <boost/asio/buffered_read_stream_fwd.hpp> 20 #include <boost/asio/buffered_stream_fwd.hpp> 21 22 #include <boost/asio/detail/push_options.hpp> 23 24 namespace boost { 25 namespace asio { 26 27 namespace detail { 28 29 template <typename Stream> 30 char is_read_buffered_helper(buffered_stream<Stream>* s); 31 32 template <typename Stream> 33 char is_read_buffered_helper(buffered_read_stream<Stream>* s); 34 35 struct is_read_buffered_big_type { char data[10]; }; 36 is_read_buffered_big_type is_read_buffered_helper(...); 37 38 } // namespace detail 39 40 /// The is_read_buffered class is a traits class that may be used to determine 41 /// whether a stream type supports buffering of read data. 42 template <typename Stream> 43 class is_read_buffered 44 { 45 public: 46 #if defined(GENERATING_DOCUMENTATION) 47 /// The value member is true only if the Stream type supports buffering of 48 /// read data. 49 static const bool value; 50 #else 51 BOOST_ASIO_STATIC_CONSTANT(bool, 52 value = sizeof(detail::is_read_buffered_helper((Stream*)0)) == 1); 53 #endif 54 }; 55 56 } // namespace asio 57 } // namespace boost 58 59 #include <boost/asio/detail/pop_options.hpp> 60 61 #endif // BOOST_ASIO_IS_READ_BUFFERED_HPP 62