useful cpp code chunks