The previous check was done in a very intrusive way, it also was not catching
the issue when a parser is not inherited from `unary_parser`/`binary_parser`.
Win32 only defines the types from wtypes.h, like WCHAR, LPWCSTR, etc.
These may or may not be the same thing as wchar_t.
MinGW, cygwin, and wineg++ all support f(no-)short-wchar,
with the caveat that libstdc++ must be compiled with the same option.
Doing so is quite unusual for MinGW or cygwin, but more common for wineg++
as it enables building a winelib app with system glibc/libstdc++.
Win32's WCHAR is then unsigned short, or with C++11 perhaps char16_t.
MSVC does explicitly document that its wchar_t is always UTF16:
https://docs.microsoft.com/en-us/cpp/cpp/char-wchar-t-char16-t-char32-t?view=vs-2019
C99/C++11 compilers should provide __STDC_ISO_10646__ if wchar_t is unicode
GCC, Clang, and ICC all provide __SIZEOF_WCHAR_T__ to distinguish
-fshort-wchar (defaulted by mingw/cygwin) from -fno-short-wchar
https://gcc.gnu.org/onlinedocs/gcc-9.2.0/cpp/Common-Predefined-Macros.html
This takes the approach of assuming that a 2-byte unicode wchar_t
might be UTF-16 (and still works if its's actually UCS-2, it just never
finds any surrogate pairs), and 4-byte unicode must be UCS-4.
Include needed parts at place where they are needed instead of including the
whole Proto library and significant parts of Phoenix in a few places.
Parsing time reported by Clang 9 with default (C++14) std:
was |now |gain|include
----|----|----|----------
4.45|4.22|5.2%|qi
4.52|4.23|7.5%|karma
4.37|3.99|9.7%|lex
3.75|3.47|7.5%|qi_numeric
There were phoenix/limits.hpp inclusion before every Proto inclusion to override
Proto limits with Phoenix limits values. It has no value in C++11+ world, and
poisons code too much as the number of places where Proto headers now included
increased, so I did not replicate it.
Include needed parts at place where they are needed instead of including the
whole Proto library and significant parts of Phoenix in a few places.
Parsing time reported by Clang 9 with default (C++14) std:
was |now |gain|include
----|----|----|----------
4.45|4.22|5.2%|qi
4.52|4.23|7.5%|karma
4.37|3.99|9.7%|lex
3.75|3.47|7.5%|qi_numeric
There were phoenix/limits.hpp inclusion before every Proto inclusion to override
Proto limits with Phoenix limits values. It has no value in C++11+ world, and
poisons code too much as the number of places where Proto headers now included
increased, so I did not replicate it.