c++ - 如何声明 boost histograms 的 std::vector ?提升直方图的类型是什么?
问题描述
我目前正在研究一个需要使用提升直方图的 std::vector 的项目。
我遇到的问题是我无法找到正确的提升直方图类型。我在下面的代码中进行了最后一次尝试。
这是该情况的示例代码:
#include <boost/format.hpp>
#include <boost/histogram.hpp>
#include <boost/histogram/serialization.hpp> // includes serialization code
int main() {
using namespace boost::histogram;
// Creation of the histogram.
auto h = make_histogram(axis::regular<double> {3, 0.0, 1.0, "x"},
axis::regular<double> {3, 0.0, 1.0, "y"},
axis::regular<double> {3, 0.0, 1.0, "z"},
axis::regular<double, axis::transform::log> {3, 1.0, 230.0, "Energy_log"});
h(0.1,0.1,0.1,70);
h(0.1,0.1,0.1,100);
h(0.1,0.1,0.1,200);
//std::vector<*Boost_histogram_TYPE*> histograms4D;
std::vector<boost::histogram::histogram<boost::histogram::axis::variant, boost::histogram::unlimited_storage>> histograms4D;
histograms4D.push_back(h);
}
有没有人遇到过这种情况?
我已经谢谢你的帮助,
艾略特
解决方案
一旦您拥有该类型的对象,您就可以命名该类型:
using boost_histogram = decltype(h);
一旦你有了类型,你可以像这样使用它:
std::vector<boost_histogram> histograms4D;
这是一个演示。
推荐阅读
- javascript - AJAX 返回文本中的回车
- laravel - 任何 /oauth/token 请求的 Laravel Passport 自定义验证
- javascript - 如何在用php,apache服务器编写的网站的子路由上激活vue-router的历史模式?
- ios - Xcode:找不到已安装的应用程序。安装声称已成功,但在设备上找不到应用程序
- php - 我在合并 meta_query “OR” 和 “AND” 关系时遇到问题
- reactjs - TypeError 无法读取未定义的属性“价格”
- html - 输入字段不允许我输入输入
- c# - 类中的模拟字段?
- java - 如何向 EditTextPreference 添加消息?
- html - 如何为输入占位符制作弹跳效果?