| 3 | import roman; |
| 4 | |
| 5 | int main() |
| 6 | { |
| 7 | // std::string_view is reachable, so its constructor can be invoked |
| 8 | // (this constructor, unlike the std::string_view name itself, is visible) |
| 9 | std::cout << "MMXX in Arabic numerals is " << from_roman("MMXX") << std::endl; |
| 10 | |
| 11 | // The names of the c_str() and size() members are visible as well |
| 12 | // (because the definition of std::string is reachable), |
| 13 | // and can thus be invoked. |
| 14 | std::cout << "1234 in Roman numerals is " << to_roman(1234).c_str() << std::endl; |
| 15 | std::cout << "This consists of " << to_roman(1234).size() << " numerals" << std::endl; |
| 16 | |
| 17 | // std::string_view s{ "MMXX" }; /* Error: the name std::string_view is not visible */ |
| 18 | // std::string roman{ to_roman(567) }; /* Error: the name std::string is not visible */ |
| 19 | |
| 20 | auto roman{ to_roman(567) }; |
| 21 | std::cout << "567 in Roman numerals is " << roman.c_str() << std::endl; |
| 22 | |
| 23 | // std::cout << "std::stoi() is not visible: " << std::stoi("1234") << std::endl; |
| 24 | |
| 25 | // The << operator (which is implemented as a non-member function) is not visible either |
| 26 | // std::cout << "1234 in Roman numerals is " << to_roman(1234) << std::endl; |
| 27 | } |
nothing calls this directly
no test coverage detected