template/vector.hpp
lib/template/vector.hpp
インクルード
#include "template/vector.hpp"
検証
このヘッダを使うライブラリ(1)
-
template/atcoder.hpp
lib/template/atcoder.hpp
検証プログラム(3)
-
test/aoj/joi/rle.test.cpp
test/aoj/joi/rle.test.cpp -
test/yosupo/sample/many_a+b.test.cpp
test/yosupo/sample/many_a+b.test.cpp -
test/yosupo/string/enumerate_palindromes.test.cpp
test/yosupo/string/enumerate_palindromes.test.cpp
実装
#pragma once
#include <algorithm>
#include <vector>
struct increment_impl {
template <class T>
const increment_impl &operator>>(std::vector<T> &v) const {
for (auto &x : v) ++x;
return *this;
}
} Inc;
struct decrement_impl {
template <class T>
const decrement_impl &operator>>(std::vector<T> &v) const {
for (auto &x : v) --x;
return *this;
}
} Dec;
struct sort_impl {
template <class T>
const sort_impl &operator>>(std::vector<T> &v) const {
std::sort(v.begin(), v.end());
return *this;
}
} Sort;
struct unique_impl {
template <class T>
const unique_impl &operator>>(std::vector<T> &v) const {
std::sort(v.begin(), v.end());
v.erase(std::unique(v.begin(), v.end()), v.end());
return *this;
}
} Uniq;
bundled
#line 2 "lib/template/vector.hpp"
#include <algorithm>
#include <vector>
struct increment_impl {
template <class T>
const increment_impl &operator>>(std::vector<T> &v) const {
for (auto &x : v) ++x;
return *this;
}
} Inc;
struct decrement_impl {
template <class T>
const decrement_impl &operator>>(std::vector<T> &v) const {
for (auto &x : v) --x;
return *this;
}
} Dec;
struct sort_impl {
template <class T>
const sort_impl &operator>>(std::vector<T> &v) const {
std::sort(v.begin(), v.end());
return *this;
}
} Sort;
struct unique_impl {
template <class T>
const unique_impl &operator>>(std::vector<T> &v) const {
std::sort(v.begin(), v.end());
v.erase(std::unique(v.begin(), v.end()), v.end());
return *this;
}
} Uniq;