I have a function that returns a lowercase string:
constexpr auto string_to_lower_case(const std::string& string) {
return string
| std::views::transform(std::tolower)
| std::views::transform([](const auto& ascii) { return static_cast<char>(ascii); });
}
and I expect that function return the same resultat when i will pass "SOME"
or const std::string some("SOME")
, but it's not. When I try to print out a result of string_to_lower_case("SOME")
, I retrieve an empty console (the output of string_to_lower_case(some)
is correct)
const std::string some("SOME");
for (const auto& ch : string_to_lower_case(some))
std::cout << ch;