typeof to decltype, typeof is not portable

This commit is contained in:
Substitute 2021-02-12 14:16:05 -05:00
parent c544f574b3
commit 036b50b979
3 changed files with 4 additions and 5 deletions

BIN
Project1 Executable file

Binary file not shown.

View File

@ -10,12 +10,12 @@ constexpr auto all = std::numeric_limits<std::streamsize>::max();
namespace math namespace math
{ {
template<auto lb, typeof(lb) ub> [[maybe_unused]] template<auto lb, decltype(lb) ub> [[maybe_unused]]
constexpr auto is_between(typeof(lb) x) -> bool { return (ub > x) && (x > lb); } constexpr auto is_between(decltype(lb) x) -> bool { return (ub > x) && (x > lb); }
template<auto lb> [[maybe_unused]] template<auto lb> [[maybe_unused]]
constexpr auto is_larger(typeof(lb) x) -> bool { return (x > lb); } constexpr auto is_larger(decltype(lb) x) -> bool { return (x > lb); }
template<auto ub> [[maybe_unused]] template<auto ub> [[maybe_unused]]
constexpr auto is_smaller(typeof(ub) x) -> bool { return (ub > x); } constexpr auto is_smaller(decltype(ub) x) -> bool { return (ub > x); }
template<typename T> [[maybe_unused]] template<typename T> [[maybe_unused]]
auto numerical_suffix(T value) -> std::string auto numerical_suffix(T value) -> std::string
{ {

View File

@ -23,7 +23,6 @@ public:
explicit client() : networked(net::socket(AF_INET, SOCK_STREAM, 0)){} explicit client() : networked(net::socket(AF_INET, SOCK_STREAM, 0)){}
auto connect(const std::string& ip, const port port) -> std::thread auto connect(const std::string& ip, const port port) -> std::thread
{ {
const auto address = net::getaddrinfo(ip, std::to_string(port));
auto remote_address = net::getaddrinfo(ip, std::to_string(port)); auto remote_address = net::getaddrinfo(ip, std::to_string(port));
if (!remote_address || net::connect(socket, remote_address) < 0) if (!remote_address || net::connect(socket, remote_address) < 0)
return std::thread(); return std::thread();