I'm trying to implement the missing bits of the standard C++ library that I need for template programming. My journey has begun at implementing std::tuple, but it requires a lot of stuff from type_traits. Some of that stuff is just template magic, but some other stuff requires compiler intrinsics. I'm currently stuck at is_union:
template<typename _Tp>
struct is_union
: public integral_constant<bool, __is_union(_Tp)>
{ };
As you can see, it's implemented as a wrapper around __is_union, a compiler intrinsic: a compiler-specific way to directly ask the compiler what we need to know. And, of course, this fails to compile for Uno because the compiler doesn't understand the __is_union symbol.
Question: is it supposed to work? Can I make it work? Do I need to enable compiler intrinsics by a special compiler key, or by including some header, or... ?
The compiler is based on GCC 4.9.2, which is surprisingly fresh:
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin> ./avr-g++ --version
avr-g++.exe (GCC) 4.9.2
P. S. The type traits intrinsics are documented here: https://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html