Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:39

0001 //
0002 // Copyright (c) 2019-2023 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 
0008 #ifndef BOOST_MYSQL_DETAIL_SOCKET_STREAM_HPP
0009 #define BOOST_MYSQL_DETAIL_SOCKET_STREAM_HPP
0010 
0011 #include <boost/asio/basic_socket.hpp>
0012 #include <boost/asio/basic_stream_socket.hpp>
0013 
0014 #include <type_traits>
0015 
0016 namespace boost {
0017 namespace mysql {
0018 namespace detail {
0019 
0020 template <class T>
0021 struct is_socket : std::false_type
0022 {
0023 };
0024 
0025 // typename basic_stream_socket::lowest_layer_type is basic_socket, so we accept basic_socket and
0026 // basic_stream_socket here
0027 template <class Protocol, class Executor>
0028 struct is_socket<asio::basic_socket<Protocol, Executor>> : std::true_type
0029 {
0030 };
0031 
0032 template <class Protocol, class Executor>
0033 struct is_socket<asio::basic_stream_socket<Protocol, Executor>> : std::true_type
0034 {
0035 };
0036 
0037 template <class T, class = void>
0038 struct is_socket_stream : std::false_type
0039 {
0040 };
0041 
0042 template <class T>
0043 struct is_socket_stream<T, typename std::enable_if<is_socket<typename T::lowest_layer_type>::value>::type>
0044     : std::true_type
0045 {
0046 };
0047 
0048 }  // namespace detail
0049 }  // namespace mysql
0050 }  // namespace boost
0051 
0052 #endif