Assume that $(X,\tau)$ is a topological space and assume that every continuous mapping $f$ of $X$ into real line $\mathbb{R}$ achieves its maximum. Under which conditions on $\tau$, the space $X$ is compact. It can be easily prove that, $X$ is compact, provided that $\tau$ is a metric topology in $X$.
Is for example this true for the Hausdorff spaces?