Skip to content

Instantly share code, notes, and snippets.

@carlos-urena
Last active November 1, 2019 10:29
Show Gist options
  • Save carlos-urena/341df22838a56453e98196408ba7648b to your computer and use it in GitHub Desktop.
Save carlos-urena/341df22838a56453e98196408ba7648b to your computer and use it in GitHub Desktop.
Anonymous 'stringstream' sample (compiles, but only for some compilers)
// try this in compiler explorer with
// -std=c++11 -Wall -Wextra
// works for some compilers but not for others (add list here)
// (Oct, 2019)
#include <iostream>
#include <sstream>
#include <string>
int main()
{
using namespace std;
cout << ((stringstream() << "hola").str()) << endl ;
}
.PHONY: x
x: a.out
./a.out
a.out: a.cpp
g++ -std=c++11 -Wall -Wextra a.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment