On a Generalization of the Stone–Weierstrass Theorem