I'm making a container class and I want to specify that its maximum size, if multiplied by itself, should not be more than the maximum value of unsigned long long (specifically, std::numeric_limits<unsigned long long>::max()).
Assuming that ULLONG_MAX is 264-1, how safe is this calculation and how can I improve it if necessary?
typedef unsigned long long size_type;
size_type max_size = size_type(std::sqrt(ULLONG_MAX)) - 1;