I want to implement my own std::make_unique
function with the function being part of std namespace. I know this helper function is added to C++14 but I do not have it in C++11. So, I want to check it with some C++11 template magic (couldn't find any options with macros) to check if a function exists inside the std
namespace and if it doesn't define it on my own. Is that possible? I don't even know where to start.
Your best bet is to use the standard __cplusplus
macro which, for C++11, is 201103L
. For C++14 onwards it will be a different value to this.
You cannot add a new function to the ::std
namespace. You are only allowed to add specializations of existing templates, and even then only for your own types.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With