http://www.cppblog.com/finehai/archive/2009/07/20/90586.html