#include <boost/foreach.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <iterator>

namespace math { 
    class IntegerVector
    {
    public:
        IntegerVector(int, int, int) {};

    };

    class IntegerVectorRange
    {
    private:
    public:
        IntegerVectorRange(IntegerVector const& ) {};

        struct const_iterator : public boost::iterator_facade<const_iterator, 
                                                        IntegerVector const,
                                                        std::forward_iterator_tag>
        {
            bool equal(const_iterator const& ) const {return true;}
            void increment() {}
            IntegerVector const& dereference() const {return *static_cast<IntegerVector*>(0);}
        };

        const_iterator begin() const {return const_iterator();}
        const_iterator end() const {return const_iterator();}
    };
}

template <class T1>
T1 fun()
{
    T1 result(0.0);

    BOOST_FOREACH(const math::IntegerVector &v, math::IntegerVectorRange(math::IntegerVector(2 , 2 ,2)))
    {
        // Do stuff.
    }

    return result;
}

int main()
{
    fun<int>();
}