At present `algorithm' and `random' can not be included after `tchar.h' [1]
because it contains
#define _UI unsigned int
and the former contain templates like
template <class _UI, _UI _Xp> struct __log2
that fail to compile with
algorithm:2807: error C2332: 'class': missing tag name
algorithm:2807: error C2628: '<unnamed-tag>' followed by 'unsigned' is illegal (did you forget a ';'?)
algorithm:2807: error C2628: '<unnamed-tag>' followed by 'int' is illegal (did you forget a ';'?)
algorithm:2807: error C2993: '': illegal type for non-type template parameter '<unnamed-tag>'
This affects compilation of open source libraries, in particular this
BDB file [2] fails to compile because it includes tchar.h [3] before C++
STL. What is the best way to resolve this? May libc++ rename or
undefine `_UI'?
[1] This one is from the old vc6 crt library, but Visual Studio 2017
installs crt with the same macros:
miniblink49/tchar.h at f3ffb1ee9d9e18cc5537af94a663d5c77146cc63 · weolar/miniblink49 · GitHub
[2] libdb/cxx_seq.cpp at master · berkeleydb/libdb · GitHub
[3] libdb/win_db.h at master · berkeleydb/libdb · GitHub