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
56 template<
typename _CompletionToken,
typename _Signature,
typename>
60 template<
typename _CompletionToken,
typename _Signature>
61 using __deduced_t =
typename 62 async_result<decay_t<_CompletionToken>, _Signature,
void>::return_type;
65 template<
typename _Tp>
66 using __is_value_constructible =
typename __and_<
67 is_copy_constructible<_Tp>, is_move_constructible<_Tp>,
68 is_constructible<_Tp, _Tp&>, is_constructible<_Tp, const _Tp&&>
71 struct __throw_on_error
74 __throw_on_error(
const char* __msg) : _M_msg(__msg) { }
76 ~__throw_on_error() noexcept(false)
79 _GLIBCXX_THROW_OR_ABORT(system_error(_M_ec, _M_msg));
82 __throw_on_error(
const __throw_on_error&) =
delete;
83 __throw_on_error& operator=(
const __throw_on_error&) =
delete;
85 operator error_code&() noexcept {
return _M_ec; }
92 template<
typename _Tp>
95 __sockopt_base() =
default;
97 explicit __sockopt_base(
int __val) : _M_value(__val) { }
99 int value() const noexcept {
return _M_value; }
101 template<
typename _Protocol>
103 data(
const _Protocol&) noexcept
106 template<
typename _Protocol>
108 data(
const _Protocol&)
const noexcept
111 template<
typename _Protocol>
113 size(
const _Protocol&)
const noexcept
114 {
return sizeof(_M_value); }
116 template<
typename _Protocol>
118 resize(
const _Protocol&,
size_t __s)
120 if (__s !=
sizeof(_M_value))
121 __throw_length_error(
"invalid value for socket option resize");
130 struct __sockopt_base<bool> : __sockopt_base<int>
132 __sockopt_base() =
default;
134 explicit __sockopt_base(
bool __val) : __sockopt_base<int>(__val) { }
136 bool value() const noexcept {
return __sockopt_base<int>::_M_value; }
137 explicit operator bool() const noexcept {
return value(); }
138 bool operator!() const noexcept {
return !value(); }
141 template<
typename _Derived,
typename _Tp =
int>
142 struct __sockopt_crtp : __sockopt_base<_Tp>
144 using __sockopt_base<_Tp>::__sockopt_base;
147 operator=(_Tp __value)
149 __sockopt_base<_Tp>::_M_value = __value;
150 return static_cast<_Derived&
>(*this);
153 template<
typename _Protocol>
155 level(
const _Protocol&)
const noexcept
156 {
return _Derived::_S_level; }
158 template<
typename _Protocol>
160 name(
const _Protocol&)
const noexcept
161 {
return _Derived::_S_name; }
169 _GLIBCXX_END_NAMESPACE_VERSION
174 #endif // _GLIBCXX_EXPERIMENTAL_NET_H ISO C++ entities toplevel namespace is std.
_GLIBCXX17_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...