Namespace alias in c++
问题 I use c++11 while I need some classes from c++17 library. When using boost from which classes were added I wish to do the following: #if __cplusplus < CPP17 using std::any = boost::any; #endif Such alias is not allowed. Also extending the std namespace causes undefined behaviour. I wish my code to look the same regardles of the c++ version. Is there a clear way? 回答1: The clear way is to add a customized name for it. #if __cplusplus < CPP17 using my_any = boost::any; #else using my_any = std: