In class we calculated the electric field in- and outside a charge distribution: $$ \rho(r)= \begin{cases} \cos(r)+\frac{1}{r}\sin(r) &\text{if }r\leq R \\ 0 &\text{if }r>R \end{cases} $$
We used the divergence theorem to calculate this. But as far as I know, this theorem only applies if $\rho$ is continuously differentiable. Why can we apply this then?
Well, consider the function $f(r) = \cos(r) + \frac{1}{r} \sin(r)$. This function is continuously differentiable on the whole plane (since we didn't cut it off at $r = R$), so you can apply the divergence theorem to $f$. But $f$ agrees with $\rho$ for $r \leq R$, so any integrals you compute over open sets or surfaces which lie in that region will be the same for either function. I'm not sure what calculations you needed to do in the region $r > R$, but certainly if you compute surface integrals of $\rho$ in that region then you know the answer is $0$ without the need for the divergence theorem.