My gcc version is 4.8.3 20140624. I can use is_pod
, is_trivial
, is_standard_layout
, but fail when trying is_trivially_copyable
, is_constructible
and is_default_constructible
, maybe more. The error message is 'xxx' is not a member of 'std'
.
What's the problem here? Are they even supported by the current GCC? Thanks!
As others mention, GCC versions < 5 do not support std::is_trivially_copyable
from the C++11 standard.
Here is a hack to somewhat work around this limitation:
// workaround missing "is_trivially_copyable" in g++ < 5.0
#if __GNUG__ && __GNUC__ < 5
#define IS_TRIVIALLY_COPYABLE(T) __has_trivial_copy(T)
#else
#define IS_TRIVIALLY_COPYABLE(T) std::is_trivially_copyable<T>::value
#endif
For common cases, this hack might be enough to get your code working. Beware, however, subtle differences between GCC's __has_trivial_copy
and std::is_trivially_copyable
. Suggestions for improvement welcome.