    template<typename E, E v>
    struct EnumValue
    {
        static const E value = v;
    };
    
    template<typename h, typename t>
    struct StaticList
    {
        typedef h head;
        typedef t tail;
    };
    
    template<typename list, typename first>
    struct CyclicHead
    {
        typedef typename list::head item;
    };
    
    template<typename first>
    struct CyclicHead<void,first>
    {
        typedef first item;
    };
    
    template<typename E, typename list, typename first = typename list::head>
    struct Advance
    {
        typedef typename list::head lh;
        typedef typename list::tail lt;
        typedef typename CyclicHead<lt, first>::item next;
    
        static void advance(E& value)
        {
            if(value == lh::value)
                value = next::value;
            else
                Advance<E, typename list::tail, first>::advance(value);
        }
    };
    
    template<typename E, typename f>
    struct Advance<E,void,f>
    {
        static void advance(E& value)
        {
        }
    };
    
    /// Test enum
    enum class Fruit
    {
        apple,
        banana,
        orange,
        pineapple,
        lemon
    };

    /// Scalable way, C++03-ish
    typedef StaticList<EnumValue<Fruit,Fruit::apple>,
            StaticList<EnumValue<Fruit,Fruit::banana>,
            StaticList<EnumValue<Fruit,Fruit::orange>,
            StaticList<EnumValue<Fruit,Fruit::pineapple>,
            StaticList<EnumValue<Fruit,Fruit::lemon>,
            void
    > > > > > Fruit_values;

    Fruit& operator++(Fruit& f)
    {
        Advance<Fruit, Fruit_values>::advance(f);
        return f;
    }

    
    
    #include <iostream>
    std::ostream& operator<<(std::ostream& os, Fruit f)
    {
        switch(f)
        {
            case Fruit::apple: os << "Fruit::apple"; return os;
            case Fruit::banana: os << "Fruit::banana"; return os;
            case Fruit::orange: os << "Fruit::orange"; return os;
            case Fruit::pineapple: os << "Fruit::pineapple"; return os;
            case Fruit::lemon: os << "Fruit::lemon"; return os;
        }
    }
    
    int main()
    {
        Fruit f = Fruit::banana;
        std::cout << "f = " << f << ";\n";
        std::cout << "++f = " << ++f << ";\n";
    }