#include #include template auto substr(const std::string& input) -> std::string { return input.substr(from, to-from); } struct X { std::string input; X(const std::string& input) : input{input} { } template auto substr() -> std::string { return input.substr(from, to-from); } }; main: () -> int = { test_string: std::string = "The rain in Spain flows mainly down the drain"; std::cout << substr<4,8>(test_string) << "\n"; x: X = test_string; std::cout << x.substr<4,8>() << "\n"; }