Skip to content

Instantly share code, notes, and snippets.

@mkmkme
Created December 20, 2021 08:46
Show Gist options
  • Save mkmkme/3cb37861c63566b075d207e70489f51b to your computer and use it in GitHub Desktop.
Save mkmkme/3cb37861c63566b075d207e70489f51b to your computer and use it in GitHub Desktop.
Modern C++
❯ g++ omg.cpp && ./a.out
S1: Mod
S2: ern C++
#include <iostream>
#include <string>
int main()
{
const std::string str = "Modern C++";
std::string s1{"Modern C++", 3};
std::string s2{str, 3};
std::cout << "S1: " << s1 << std::endl;
std::cout << "S2: " << s2 << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment