考虑到以下情况
#include <array>
struct litmus final : std::array<unsigned char, 16>
{
};
static_assert(std::is_pod<std::array<unsigned char, 16> >::value, "not pod");
// this fails on MSVC:
static_assert(std::is_pod<litmus>::value, "not pod");以下编译器一致认为litmus是pod:
然而,MSVC12 (VS2013 RTM)坚持认为第二个断言失败。
编辑以获取信息:
is_trivially_copyable<litmus>在MSVC上返回真值。这可能是有用的,在许多情况下,实际的POD-度并不是严格要求。
发布于 2014-01-07 09:54:49
litmus的特性:
命名空间std {模板<>结构is_pod : std::true_type {};}
请注意,严格按照标准,这会给出未定义的行为(感谢@R.MartinhoFernandes指出这一点)。然而,作为一个特定于编译器的解决方案,我希望它能起作用。使用时不作任何保证。https://stackoverflow.com/questions/20968200
复制相似问题