static constexpr flags all_matching = (flags)AI_ALL;
static constexpr flags address_configured = (flags)AI_ADDRCONFIG;
- protected:
- resolver_base() = default;
- ~resolver_base() = default;
- };
+ friend constexpr flags
+ operator&(flags __f1, flags __f2) noexcept
+ { return flags( int(__f1) & int(__f2) ); }
- constexpr resolver_base::flags
- operator&(resolver_base::flags __f1, resolver_base::flags __f2) noexcept
- { return resolver_base::flags( int(__f1) & int(__f2) ); }
+ friend constexpr flags
+ operator|(flags __f1, flags __f2) noexcept
+ { return flags( int(__f1) | int(__f2) ); }
- constexpr resolver_base::flags
- operator|(resolver_base::flags __f1, resolver_base::flags __f2) noexcept
- { return resolver_base::flags( int(__f1) | int(__f2) ); }
+ friend constexpr flags
+ operator^(flags __f1, flags __f2) noexcept
+ { return flags( int(__f1) ^ int(__f2) ); }
- constexpr resolver_base::flags
- operator^(resolver_base::flags __f1, resolver_base::flags __f2) noexcept
- { return resolver_base::flags( int(__f1) ^ int(__f2) ); }
+ friend constexpr flags
+ operator~(flags __f) noexcept
+ { return flags( ~int(__f) ); }
- constexpr resolver_base::flags
- operator~(resolver_base::flags __f) noexcept
- { return resolver_base::flags( ~int(__f) ); }
+ friend constexpr flags&
+ operator&=(flags& __f1, flags __f2) noexcept
+ { return __f1 = (__f1 & __f2); }
- constexpr resolver_base::flags&
- operator&=(resolver_base::flags& __f1, resolver_base::flags __f2) noexcept
- { return __f1 = (__f1 & __f2); }
+ friend constexpr flags&
+ operator|=(flags& __f1, flags __f2) noexcept
+ { return __f1 = (__f1 | __f2); }
- constexpr resolver_base::flags&
- operator|=(resolver_base::flags& __f1, resolver_base::flags __f2) noexcept
- { return __f1 = (__f1 | __f2); }
+ friend constexpr flags&
+ operator^=(flags& __f1, flags __f2) noexcept
+ { return __f1 = (__f1 ^ __f2); }
- constexpr resolver_base::flags&
- operator^=(resolver_base::flags& __f1, resolver_base::flags __f2) noexcept
- { return __f1 = (__f1 ^ __f2); }
+ protected:
+ resolver_base() = default;
+ ~resolver_base() = default;
+ };
// TODO define resolver_base::flags static constants in .so for C++14 mode
= (message_flags)MSG_DONTROUTE;
static const int max_listen_connections = SOMAXCONN;
-#endif
- protected:
- socket_base() = default;
- ~socket_base() = default;
+ // message_flags bitmask operations are defined as hidden friends.
-#ifdef _GLIBCXX_HAVE_SYS_SOCKET_H
+ friend constexpr message_flags
+ operator&(message_flags __f1, message_flags __f2) noexcept
+ { return message_flags( int(__f1) & int(__f2) ); }
+
+ friend constexpr message_flags
+ operator|(message_flags __f1, message_flags __f2) noexcept
+ { return message_flags( int(__f1) | int(__f2) ); }
+
+ friend constexpr message_flags
+ operator^(message_flags __f1, message_flags __f2) noexcept
+ { return message_flags( int(__f1) ^ int(__f2) ); }
+
+ friend constexpr message_flags
+ operator~(message_flags __f) noexcept
+ { return message_flags( ~int(__f) ); }
+
+ friend constexpr message_flags&
+ operator&=(message_flags& __f1, message_flags __f2) noexcept
+ { return __f1 = (__f1 & __f2); }
+
+ friend constexpr message_flags&
+ operator|=(message_flags& __f1, message_flags __f2) noexcept
+ { return __f1 = (__f1 | __f2); }
+
+ friend constexpr message_flags&
+ operator^=(message_flags& __f1, message_flags __f2) noexcept
+ { return __f1 = (__f1 ^ __f2); }
+
+ protected:
struct __msg_hdr : ::msghdr
{
#ifdef IOV_MAX
}
};
#endif
- };
- constexpr socket_base::message_flags
- operator&(socket_base::message_flags __f1, socket_base::message_flags __f2)
- noexcept
- { return socket_base::message_flags( int(__f1) & int(__f2) ); }
-
- constexpr socket_base::message_flags
- operator|(socket_base::message_flags __f1, socket_base::message_flags __f2)
- noexcept
- { return socket_base::message_flags( int(__f1) | int(__f2) ); }
-
- constexpr socket_base::message_flags
- operator^(socket_base::message_flags __f1, socket_base::message_flags __f2)
- noexcept
- { return socket_base::message_flags( int(__f1) ^ int(__f2) ); }
-
- constexpr socket_base::message_flags
- operator~(socket_base::message_flags __f)
- noexcept
- { return socket_base::message_flags( ~int(__f) ); }
-
- constexpr socket_base::message_flags&
- operator&=(socket_base::message_flags& __f1, socket_base::message_flags __f2)
- noexcept
- { return __f1 = (__f1 & __f2); }
-
- constexpr socket_base::message_flags&
- operator|=(socket_base::message_flags& __f1, socket_base::message_flags __f2)
- noexcept
- { return __f1 = (__f1 | __f2); }
-
- constexpr socket_base::message_flags&
- operator^=(socket_base::message_flags& __f1, socket_base::message_flags __f2)
- noexcept
- { return __f1 = (__f1 ^ __f2); }
+ protected:
+ socket_base() = default;
+ ~socket_base() = default;
+ };
// TODO define socket_base static constants in .so for C++14 mode