30 #ifndef _GLIBCXX_EXPERIMENTAL_NET_H
31 #define _GLIBCXX_EXPERIMENTAL_NET_H 1
33 #pragma GCC system_header
35 #if __cplusplus >= 201402L
39 #include <experimental/netfwd>
41 namespace std _GLIBCXX_VISIBILITY(default)
43 _GLIBCXX_BEGIN_NAMESPACE_VERSION
44 namespace experimental
55 template<
typename _CompletionToken,
typename _Signature,
typename>
61 template<
typename _CompletionToken,
typename _Signature>
62 using __deduced_t =
typename
63 async_result<decay_t<_CompletionToken>, _Signature,
void>::return_type;
66 template<
typename _Tp>
67 using __is_value_constructible =
typename __and_<
68 is_copy_constructible<_Tp>, is_move_constructible<_Tp>,
69 is_constructible<_Tp, _Tp&>, is_constructible<_Tp, const _Tp&&>
72 struct __throw_on_error
75 __throw_on_error(
const char* __msg) : _M_msg(__msg) { }
77 ~__throw_on_error() noexcept(false)
80 _GLIBCXX_THROW_OR_ABORT(system_error(_M_ec, _M_msg));
83 __throw_on_error(
const __throw_on_error&) =
delete;
84 __throw_on_error& operator=(
const __throw_on_error&) =
delete;
86 operator error_code&() noexcept {
return _M_ec; }
95 template<
typename _Tp>
98 __sockopt_base() =
default;
100 explicit __sockopt_base(
int __val) : _M_value(__val) { }
102 int value() const noexcept {
return _M_value; }
104 template<
typename _Protocol>
106 data(
const _Protocol&) noexcept
109 template<
typename _Protocol>
111 data(
const _Protocol&)
const noexcept
114 template<
typename _Protocol>
116 size(
const _Protocol&)
const noexcept
117 {
return sizeof(_M_value); }
119 template<
typename _Protocol>
121 resize(
const _Protocol&,
size_t __s)
123 if (__s !=
sizeof(_M_value))
124 __throw_length_error(
"invalid value for socket option resize");
133 struct __sockopt_base<bool> : __sockopt_base<int>
135 __sockopt_base() =
default;
137 explicit __sockopt_base(
bool __val) : __sockopt_base<int>(__val) { }
139 bool value() const noexcept {
return __sockopt_base<int>::_M_value; }
140 explicit operator bool() const noexcept {
return value(); }
141 bool operator!() const noexcept {
return !value(); }
144 template<
typename _Derived,
typename _Tp =
int>
145 struct __sockopt_crtp : __sockopt_base<_Tp>
147 using __sockopt_base<_Tp>::__sockopt_base;
150 operator=(_Tp __value)
152 __sockopt_base<_Tp>::_M_value = __value;
153 return static_cast<_Derived&
>(*this);
156 template<
typename _Protocol>
158 level(
const _Protocol&)
const noexcept
159 {
return _Derived::_S_level; }
161 template<
typename _Protocol>
163 name(
const _Protocol&)
const noexcept
164 {
return _Derived::_S_name; }
172 _GLIBCXX_END_NAMESPACE_VERSION
constexpr _Tp * addressof(_Tp &__r) noexcept
Returns the actual address of the object or function referenced by r, even in the presence of an over...
ISO C++ entities toplevel namespace is std.