Generalized monosplines and optimal approximation