Force originally global variable to be nearer

Is there C++ feature to force an originally global variable to be near or in the closest distant to the operation require it but cannot redefined within the scope of that operation?
It's a reconsideration on efficiency issue.
We know copy it to somewhere nearer at least make a better,
but I purely need C++ knowledge and its growth, as C++ is famous for its vast powerful features.
Last edited on
What's your actual goal? This looks like an XY problem:
Remove the code that creates it.

Read the compiler errors that now tell you all the code that want it but can't find it.

Now you know who actually needs it and you can work out what common scope they have.
Great insight! Thanks.
Registered users can post here. Sign in or register to post.