zawatins-library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub zawa-tin/zawatins-library

:heavy_check_mark: sorted (ソート列を返す)
(src/template/sorted.hpp)

概要

引数で与えた列に対してソートした列を返します。引数で与えた列は破壊されません

機能

std::vector<T> zawa::util::sorted<T>(std::vector<T> A)
std::string zawa::util::sorted(std::string s)

using namespace zawa::utilすることを前提としています。

Verified with

Code

#pragma once

#include <vector>
#include <algorithm>
#include <string>

namespace zawa::util {

template <class T>
std::vector<T> sorted(std::vector<T> A) {
	std::sort(A.begin(), A.end());
	return A;
}

std::string sorted(std::string s) {
	std::sort(s.begin(), s.end());
	return s;
}

} // namespace zawa::util
#line 2 "src/template/sorted.hpp"

#include <vector>
#include <algorithm>
#include <string>

namespace zawa::util {

template <class T>
std::vector<T> sorted(std::vector<T> A) {
	std::sort(A.begin(), A.end());
	return A;
}

std::string sorted(std::string s) {
	std::sort(s.begin(), s.end());
	return s;
}

} // namespace zawa::util
Back to top page