Generic conversion operator templates and move semantics: any universal solution?
This is a follow-up of Explicit ref-qualified conversion operator templates in action . I have experimented with many different options and I am giving some results here in an attempt to see if there is any solution eventually. Say a class (e.g. any ) needs to provide conversion to any possible type in a convenient, safe (no surprises) way that preserves move semantics. I can think of four different ways. struct A { // explicit conversion operators (nice, safe?) template<typename T> explicit operator T&& () &&; template<typename T> explicit operator T& () &; template<typename T> explicit