// Iterator returning by value. template struct Iterator { void operator++(); T operator*(); bool operator!=(const Iterator& other); }; // The template argument is an iterator type, and a view is an object you can // run a for loop on. template struct View { T begin(); T end(); }; // With this class, the implicit conversion is a call to the (implicit) // constructor of the class. template class ImplicitWrapper { public: // Implicit! ImplicitWrapper(const T& t); }; template class OperatorWrapper { public: OperatorWrapper() = delete; }; struct SimpleClass { int foo; operator OperatorWrapper(); }; typedef View> SimpleView; void ImplicitSimpleClassIterator() { for (const ImplicitWrapper& foo : SimpleView()) {} for (const ImplicitWrapper foo : SimpleView()) {} for (ImplicitWrapper foo : SimpleView()) {} }