restore axis_size command to track size of axis types

This commit is contained in:
Hans Dembinski 2018-11-29 00:10:10 +01:00
parent 9783a329c4
commit 8013048c71
2 changed files with 37 additions and 0 deletions

View File

@ -143,4 +143,7 @@ if (BUILD_BENCHMARKS)
target_include_directories(speed_cpp PRIVATE include ${Boost_INCLUDE_DIR})
target_compile_definitions(speed_cpp PRIVATE -DBOOST_DISABLE_ASSERTS)
target_compile_options(speed_cpp PRIVATE -O3)
add_executable(axis_size test/axis_size.cpp)
target_include_directories(axis_size PRIVATE include ${Boost_INCLUDE_DIR})
target_compile_options(axis_size PRIVATE -O3)
endif()

34
test/axis_size.cpp Normal file
View File

@ -0,0 +1,34 @@
// Copyright 2018 Hans Dembinski
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/histogram.hpp>
#include <iostream>
#define SHOW_SIZE(x) std::cout << #x << " " << sizeof(x) << std::endl
int main() {
using namespace boost::histogram;
using regular = axis::regular<>;
using regular_float = axis::regular<axis::transform::identity<float>>;
using regular_pow = axis::regular<axis::transform::pow<>>;
using regular_no_metadata = axis::regular<axis::transform::identity<>, axis::null_type>;
using circular = axis::circular<>;
using variable = axis::variable<>;
using integer = axis::integer<>;
using category = axis::category<>;
using variant = axis::variant<regular, circular, variable, integer, category>;
SHOW_SIZE(regular);
SHOW_SIZE(regular_float);
SHOW_SIZE(regular_pow);
SHOW_SIZE(regular_no_metadata);
SHOW_SIZE(circular);
SHOW_SIZE(variable);
SHOW_SIZE(integer);
SHOW_SIZE(category);
SHOW_SIZE(variant);
}