#include <algorithm>
#include <vector>
#include <iostream>


template <typename T>
auto firstInactive(const std::vector<T>& v)
-> typename std::vector<T>::const_iterator // for c++11
{
    return std::find_if(v.begin(), v.end(), [](const T& e) { return !e.active; });
}

struct ChildTest_1{
    bool active = false;
};

struct ChildTest_2{
    bool active = true;
};


int main()
{
    std::vector<ChildTest_1> allTest1(10);
    std::vector<ChildTest_2> allTest2(10);
    
    allTest1[0].active = true;
    allTest2[4].active = false;
    
    auto it1 = firstInactive(allTest1);
    auto it2 = firstInactive(allTest2);
    
    if (it1 != allTest1.end()) {
        std::cout << "First inactive in alltest1 is "
                  << std::distance(allTest1.cbegin(), it1) << std::endl;
    }
    if (it2 != allTest2.end()) {
        std::cout << "First inactive in alltest2 is "
                  << std::distance(allTest2.cbegin(), it2) << std::endl;
    }
}