A job sequencing solution
The Job class has public members, so it's simpler to make it an aggregate:

struct Job {
    int index;
    int time_slot;
    int profit;
};


Then, use std::tie to simplify the comparison operators: (operands to these operators should be marked as const, which you didn't)

bool operator&lt;(const Job&amp; lhs, const Job&amp; rhs)
{
    return std::tie(lhs.time_slot, lhs.profit) &lt; std::tie(rhs.time_slot, rhs.profit);
}

// implement other operators in terms of &lt;


You == is not consistent with other comparison operators, which is confusing and likely to cause problems.

Also note that if (condition) { return true; } return false; should be changed to return condition; for clarity.

This is convoluted:


Job j1(1, 1, 3);
Job j2(2, 3, 5);
Job j3(3, 4, 20);
Job j4(4, 3, 18);
Job j5(5, 2, 1);
Job j6(6, 1, 6);
Job j7(7, 2, 30);
std::vector&lt;Job&gt; vect = { j1,j2,j3,j4,j5,j6,j7 };



It should be simplified to

std::vector&lt;Job&gt; vect {
    {1, 1, 3}, {2, 3, 5}, // ...
};


This:


auto order = [&amp;]() {
    auto it = vect.begin();
    while (it + 1 != vect.end()) {
        if (*it == *(it + 1)) {
            it = vect.erase(it);
            continue;
        }
        it++;
    }
};
order();



should be

vect.erase(std::unique(vect.begin(), vect.end()), vect.end());


(provided that I understand the code correctly).

And this:


std::for_each(vect.begin(), vect.end(), [](Job i) {std::cout &lt;&lt; i &lt;&lt; " "; });



is a complicated way of writing

for (const auto&amp; job : vect) {
    std::cout &lt;&lt; job &lt;&lt; ' ';
}


or

std::copy(vect.begin(), vect.end(),
          std::ostream_iterator&lt;Job&gt;{std::cout, ' '});