mirror of
https://github.com/boostorg/histogram.git
synced 2026-01-29 19:42:12 +00:00
use std::type_traits everywhere
This commit is contained in:
@@ -145,7 +145,7 @@ template <typename T> python::str axis_get_label(const T& t) {
|
||||
|
||||
#ifdef HAVE_NUMPY
|
||||
template <typename Axis> python::object axis_array_interface(const Axis& axis) {
|
||||
using T = typename decay<decltype(axis[0].lower())>::type;
|
||||
using T = typename std::decay<decltype(axis[0].lower())>::type;
|
||||
python::dict d;
|
||||
auto shape = python::make_tuple(axis.size()+1);
|
||||
d["shape"] = shape;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define _BOOST_HISTOGRAM_PYTHON_UTILITY_HPP_
|
||||
|
||||
#include <boost/python/str.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <type_traits>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace boost {
|
||||
@@ -16,14 +16,12 @@ namespace python {
|
||||
template <typename T>
|
||||
str dtype_typestr() {
|
||||
str s;
|
||||
if (is_unsigned<T>::value)
|
||||
s = "|u";
|
||||
else if (is_signed<T>::value)
|
||||
s = "|i";
|
||||
else if (is_floating_point<T>::value)
|
||||
if (std::is_floating_point<T>::value)
|
||||
s = "|f";
|
||||
else if (std::is_integral<T>::value)
|
||||
s = std::is_unsigned<T>::value ? "|u" : "|i";
|
||||
else
|
||||
throw std::invalid_argument("T must be an arithmetic type");
|
||||
throw std::invalid_argument("T must be a builtin arithmetic type");
|
||||
s += str(sizeof(T));
|
||||
return s;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user