fork download
#include <iostream>
#include <vector>
using namespace std;

typedef vector<int> Vect;

Vect operator<<(Vect v, const int i){v.push_back(i); return v;};

//Vect& operator<<(Vect& v, const int i){v.push_back(i); return v;};  //<-What I would expect

const Vect const_vect = Vect() << 1 << 2;

int main() {
	for(auto e = const_vect.begin(); e!=const_vect.end() ; ++e){ cout << *e << " ";}
	return 0;
}
Success #stdin #stdout 0s 3060KB
stdin
Standard input is empty
stdout
1 2