#pragma once
#include <string><--- Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <iterator><--- Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <algorithm><--- Include file: not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include "internal/dev_env.hpp"
namespace uni {
template<std::input_iterator I, std::sentinel_for<I> S, class Res = std::string>
Res to_lower(I first, S last) noexcept(NO_EXCEPT) {
Res res;
res.reserve(std::ranges::distance(first, last));
std::ranges::transform(first, last, std::back_inserter(res), ::tolower);
return res;
}
template<std::input_iterator I, std::sentinel_for<I> S, class Res = std::string>
Res to_uppwer(I first, S last) noexcept(NO_EXCEPT) {
Res res;
res.reserve(std::ranges::distance(first, last));
std::ranges::transform(first, last, std::back_inserter(res), ::toupper);
return res;
}
template<class Res = std::string>
Res to_lower(const std::string str) noexcept(NO_EXCEPT) {<--- Function parameter 'str' should be passed by const reference.
return to_lower<std::string::const_iterator, std::string::const_iterator, Res>(std::begin(str), std::end(str));
}
template<class Res = std::string>
Res to_uppwer(const std::string str) noexcept(NO_EXCEPT) {<--- Function parameter 'str' should be passed by const reference.
return to_uppwer<std::string::const_iterator, std::string::const_iterator, Res>(std::begin(str), std::end(str));
}
} // namespace uni