Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

How would I throw a compiler error if the new function is used?

$
0
0
I want to prohibit the use of new, delete in one of my projects. There are still instances where I need the placement new operator to construct things like containers which need a constructor call. So I cannot just use the old #define new Error trick. I looked at static_assert but that will throw an error irrespective of whether the function is used or not. In addition, I can't use the #pragma deprecated because it only generates a warning and we have warnings in our project which are out of my control. So is there any other way to throw a compiler error when a function is used? I am talking about the global new and delete operators. Thank you

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>