Search code examples
c++memorymemory-managementaddressof

c++ get address of variable without operator&


I have got a class that has overloaded unary operator&. The objects of that type were created using new, so address of variable was accessible but now I need to use static object. Is it possible to get its address?


Solution

  • Since C++11, you may use the function std::addressof