flowchart TB
Old.Count("signed int") & Old.Array("char **") --> New.Class
subgraph Old.Main["main"]
New.Class("std::vector<std::string>") --> New.Main["Main"]
end
Old.Main --> Old.State.Success(["0"]) -..- Old.State("signed int")
Created
November 5, 2022 03:46
-
-
Save dlOuOlb/a5193553067a06d33b044195c07cc75c to your computer and use it in GitHub Desktop.
The C++ main function with read-only string arguments.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if __cplusplus < 201103L | |
# error "This code requires a C++11 compiler." | |
#else | |
# include <string> /* std::string */ | |
# include <vector> /* std::vector */ | |
extern R"(C++)" auto Main( const std::vector<std::string> & ) noexcept( false ) -> void; | |
extern R"(C++)" auto main( const signed int argc, char **const argv ) noexcept( false ) -> signed int { return Main( { argv, argv + argc } ), 0; } | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if __cplusplus < 201103L | |
# error "This code requires a C++11 compiler." | |
#else | |
# include <iostream> /* std::(cout|endl) */ | |
# include <string> /* std::string */ | |
# include <vector> /* std::vector */ | |
extern R"(C++)" auto Main( const std::vector<std::string> &Arguments ) noexcept( false ) -> void | |
{ | |
for( const auto &Argument : Arguments ) | |
static_cast<void>( std::cout << R"(- ")" + Argument + R"(")" << std::endl ); | |
return; | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment