The origins of the shape memory effect