IPAddress is missing a constructor as:
IPAddress(IPAddress::Family family, unsigned prefixlen);
which creates a netmask IPAddress, and:
const IPAddress& operator~();
which takes an IPAddress (typically a netmask), and inverts all of the bits.
This would permit, for instance:
IPAddress dst; unsigned prefix; ... // check for bits in complement of mask if (dst & ~Net::IPAddress(dst.family(), prefix) != Net::IPAddress::wildcard(dst.family())) throw std::invalid_argument("Prefix disagrees with destination length");
if one wanted to validate a subnet address and matching prefix length, for instance, by making sure that only bits that fell inside the prefix were set.