'How to sort container with std::optional type?
Looking for a way to sort an optional container Like the following...
#include <optional>
#include <vector>
using optional = std::optional<int>;
std::vector<optional> cont;
int main()
{
auto min_iter = std::min_element(cont.begin(), cont.end());
std::sort(cont.begin(), cont.end());
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|