1// Prevents the compiler from optimizing everything away.2template <class T> void DoNotOptimize(const T &var) {3 asm volatile("" : "+m"(const_cast<T &>(var)));4}5