Canonicalize CIDR: Difference between revisions

m
C++ - tighten up parsing code
(→‎{{header|Raku}}: Alternate entry)
m (C++ - tighten up parsing code)
Line 89:
=={{header|C++}}==
<lang cpp>#include <cstdint>
#include <iomanip>
#include <iostream>
#include <sstream>
Line 114 ⟶ 115:
int a, b, c, d, m;
char ch;
if (!(in >> a >> std::noskipws >> ch) || a < 0 || a > UINT8_MAX || ch != '.'
|| !(in >> b >> ch) || b < 0 || b > UINT8_MAX || ch != '.'
|| !(in >> c >> ch) || c < 0 || c > UINT8_MAX || ch != '.'
1,777

edits