Function dependence on iteration variable of another function Consider two versions of implementing the same functionality. 

Version 1 -
Functions calculateA(),calculateB() and calculateC() dependent on iteration variable of calculateAll().

class Box
{
    void calculateAll()
    {
        for(unsigned i = 0; i &lt; _values.size(); i++)
        {
            calculateA(i);
            calculateB(i);
            calculateC(i);
        }

    }

    A calculateA(unsigned i) const
    {
        //Calcualate A based on _values 
    }

    B calculateB(unsigned i) const
    {
        //Calcualate B based on _values 
    }

    C calculateC(unsigned i) const
    {
        //Calcualate A based on _values 
    }

    std::vector&lt;unsigned&gt;           _values;
};


Version 2 - Functions calculateA(),calculateB() and calculateC() are not dependent on calculateAll() 

class Box
{
    void calculateAll()
    {
        calculateA();
        calculateB();
        calculateC();
    }

    A calculateA() const
    {
        for(const auto&amp; value: _values)
        {
            //Calcualate A based on _values 
        }
    }

    B calculateB() const
    {
        for(const auto&amp; value: _values)
        {
            //Calcualate B based on _values 
        }
    }

    C calculateC() const
    {
        for(const auto&amp; value: _values)
        {
            //Calcualate C based on _values 
        }
    }


    std::vector&lt;unsigned&gt;           _values;
};


Which version is more cleaner? Which version is better performance wise? Is there a better implementation that these?
This largely depends on your use case. If there are situations that call for only calculating based off of certain values or subsets of values, then the second version should be preferred, but if you are always going be calculating all values, then the first should be preferred.