Update ACCESS_ONCE macro to support c++