This documentation is automatically generated by competitive-verifier/competitive-verifier
#include "lib/string/converter.hpp"#pragma once
#include <locale>
#include <string>
#include <vector>
struct string_converter {
char type(const char &c) const {
return (std::islower(c) ? 'a' : std::isupper(c) ? 'A' : std::isdigit(c) ? '0' : 0);
}
int convert(const char &c) {
if (!start) start = type(c);
return c - start;
}
int convert(const char &c, const std::string &chars) { return chars.find(c); }
template <class T>
auto convert(const T &v) {
std::vector<decltype(convert(v[0]))> res;
res.reserve(v.size());
for (auto &&e : v) res.emplace_back(convert(e));
return res;
}
template <class T>
auto convert(const T &v, const std::string &chars) {
std::vector<decltype(convert(v[0], chars))> res;
res.reserve(v.size());
for (auto &&e : v) res.emplace_back(convert(e, chars));
return res;
}
int operator()(const char &v, char s = 0) {
start = s;
return convert(v);
}
int operator()(const char &v, const std::string &chars) { return convert(v, chars); }
template <class T>
auto operator()(const T &v, char s = 0) {
start = s;
return convert(v);
}
template <class T>
auto operator()(const T &v, const std::string &chars) {
return convert(v, chars);
}
private:
char start = 0;
} to_int;
#line 2 "lib/string/converter.hpp"
#include <locale>
#include <string>
#include <vector>
struct string_converter {
char type(const char &c) const {
return (std::islower(c) ? 'a' : std::isupper(c) ? 'A' : std::isdigit(c) ? '0' : 0);
}
int convert(const char &c) {
if (!start) start = type(c);
return c - start;
}
int convert(const char &c, const std::string &chars) { return chars.find(c); }
template <class T>
auto convert(const T &v) {
std::vector<decltype(convert(v[0]))> res;
res.reserve(v.size());
for (auto &&e : v) res.emplace_back(convert(e));
return res;
}
template <class T>
auto convert(const T &v, const std::string &chars) {
std::vector<decltype(convert(v[0], chars))> res;
res.reserve(v.size());
for (auto &&e : v) res.emplace_back(convert(e, chars));
return res;
}
int operator()(const char &v, char s = 0) {
start = s;
return convert(v);
}
int operator()(const char &v, const std::string &chars) { return convert(v, chars); }
template <class T>
auto operator()(const T &v, char s = 0) {
start = s;
return convert(v);
}
template <class T>
auto operator()(const T &v, const std::string &chars) {
return convert(v, chars);
}
private:
char start = 0;
} to_int;