Generalized convexity and invexity without vector space structure