繁体   English   中英

boost :: multiprecision :: cpp_int是POD吗?

[英]Is boost::multiprecision::cpp_int a POD?

我打算使用具有boost::multiprecision::cpp_int请参见Boost Multiprecision )作为数据成员的类,并且我希望使用boost::fast_pool_allocator Boost自定义分配器在堆上管理这些类的实例。

为了安全起见,我需要知道boost::multiprecision::cpp_int是一个POD(或者至少它不对堆进行分配-即,它完全基于堆栈)。

boost::multiprecision::cpp_int是POD吗?

谢谢!

为什么不写一个小程序找出来?

#include <iostream>
#include <type_traits>
#include <boost/multiprecision/cpp_int.hpp>

int main()
{
    std::cout << std::is_pod<boost::multiprecision::cpp_int>::value << std::endl;
}

在我的平台(gcc版本4.8.2)上,输出为0,这意味着该类型不是POD类型。

答案来自@PlasmaHH的评论,回想起来很明显,那就是不, boost::multiprecision::cpp_int不是POD

引用PlasmaHH:

考虑一下,它可能会扩展到什么地方? 您所链接的文档中的“确定求助于动态内存分配之前直接在对象内存储的位数”又可能是什么呢?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM