This documentation is automatically generated by competitive-verifier/competitive-verifier
#include "tools/less_by_get.hpp"
It compares two values by std::get
.
std::vector<std::tuple<int, int, int>> a;
std::sort(a.begin(), a.end(), tools::less_by_get<2>());
template <std::size_t I>
tools::less_by_get<I> comp();
It creates a comparator.
template <typename T>
bool comp.operator()(T x, T y);
It returns true
if std::get<I>(x) < std::get<I>(y)
.
Otherwise, it returns false
.
#ifndef TOOLS_LESS_BY_GET_HPP
#define TOOLS_LESS_BY_GET_HPP
#include <cstddef>
#include <tuple>
namespace tools {
template <::std::size_t I>
struct less_by_get {
template <class T>
bool operator()(const T& x, const T& y) const {
return ::std::get<I>(x) < ::std::get<I>(y);
}
};
}
#endif
#line 1 "tools/less_by_get.hpp"
#include <cstddef>
#include <tuple>
namespace tools {
template <::std::size_t I>
struct less_by_get {
template <class T>
bool operator()(const T& x, const T& y) const {
return ::std::get<I>(x) < ::std::get<I>(y);
}
};
}