#ifndef UTILS #define UTILS #include #include double Small(double first, double second, double third) { std::cout << "In double small" << std::endl; return std::min(first, std::min(second, third)); } template T Small(T first, T second, T third) { T smallest = first; if (first > second) { smallest = second; } if (smallest > third) { smallest = third; } return smallest; } template std::ostream & operator << (std::ostream & s, const std::vector & v) { bool first = true; s << "{"; for (auto x: v) { if (first) { first = false; } else { s << ", "; } s << x; } s << " }"; return s; } template void SmallTest(std::vector list) { std::sort(begin(list), end(list)); std::cout << "Trying all permutations of " << std::endl; std::cout << list << std::endl; while (std::next_permutation(begin(list), end(list))) { std::cout << "\t" << Small(list[0], list[1], list[2]) << std::endl; } } #endif