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

int main()
{
	std::vector<bool> mask{0,   0,   1,   0,   1,   1,   0};
	std::vector<double> vec{7.1, 1.0, 3.2, 2.0, 1.8, 5.0, 0.0};
	std::vector<double> combined;
	
	std::transform(vec.begin(), vec.end(), mask.begin(), std::back_inserter(combined),
				   [](double v, bool mask) { return mask ? v : std::numeric_limits<double>::max(); });
	
	auto it = std::min_element(combined.begin(), combined.end());
	std::cout << "min(combined)=" << *it << "\n";
	
    auto index = std::distance(combined.begin(), it);
    auto it_vec = vec.begin() + index;
	std::cout << "min(vec)=" << *it_vec << ", index=" << index << "\n";

	return 0;
}