From 06bd27f53683c43198cfb791a5a15fac06f0fbd5 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Tue, 15 Nov 2016 06:37:39 +0100 Subject: [PATCH] import size_t into pybind11 namespace (fixes #498) --- include/pybind11/common.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/pybind11/common.h b/include/pybind11/common.h index c422081e..f6e54e7f 100644 --- a/include/pybind11/common.h +++ b/include/pybind11/common.h @@ -93,6 +93,7 @@ # pragma warning(pop) #endif +#include #include #include #include @@ -182,7 +183,8 @@ extern "C" { NAMESPACE_BEGIN(pybind11) -typedef Py_ssize_t ssize_t; +using ssize_t = Py_ssize_t; +using size_t = std::size_t; /// Approach used to cast a previously unknown C++ instance into a Python object enum class return_value_policy : uint8_t { @@ -320,7 +322,7 @@ template > struct in }; struct overload_hash { - inline std::size_t operator()(const std::pair& v) const { + inline size_t operator()(const std::pair& v) const { size_t value = std::hash()(v.first); value ^= std::hash()(v.second) + 0x9e3779b9 + (value<<6) + (value>>2); return value;