Maximum theorems for convex structures with an application to the theory of optimal intertemporal allocation