mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-17 06:00:51 +00:00
Strictly defined integer.
This commit is contained in:
parent
043adbc724
commit
74b027e586
@ -261,16 +261,16 @@ them mapping to respective C++ counterparts.
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
This is a strict type, it will only allow input arguments of the specified
|
This is a strict type, it will only allows to specify NumPy type as input
|
||||||
NumPy type and nothing else (e.g., ``py::numpy_scalar<int64_t>`` will not
|
arguments, and does not allow other types of input parameters (e.g.,
|
||||||
accept built-in ``int`` or any other type for that matter).
|
``py::numpy_scalar<int64_t>`` will not accept Python's builtin ``int`` ).
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Native C types are mapped to NumPy types in a platform specific way: for
|
Native C types are mapped to NumPy types in a platform specific way: for
|
||||||
instance, ``char`` may be mapped to either ``np.int8`` or ``np.uint8``
|
instance, ``char`` may be mapped to either ``np.int8`` or ``np.uint8``
|
||||||
depending on the platform. If you want to ensure specific NumPy types,
|
and ``long`` may use 4 or 8 bytes depending on the platform. Unless you
|
||||||
it is recommended to use fixed-width aliases from ``<cstdint>``.
|
clearly understand the difference and your needs, please use ``<cstdint>``.
|
||||||
|
|
||||||
Vectorizing functions
|
Vectorizing functions
|
||||||
=====================
|
=====================
|
||||||
|
@ -322,16 +322,16 @@ DECL_NPY_SCALAR(signed char, NPY_BYTE);
|
|||||||
DECL_NPY_SCALAR(unsigned char, NPY_UBYTE);
|
DECL_NPY_SCALAR(unsigned char, NPY_UBYTE);
|
||||||
|
|
||||||
// signed integer types
|
// signed integer types
|
||||||
DECL_NPY_SCALAR(short, NPY_SHORT);
|
DECL_NPY_SCALAR(std::int16_t, NPY_SHORT);
|
||||||
DECL_NPY_SCALAR(int, NPY_INT);
|
DECL_NPY_SCALAR(std::int32_t, NPY_INT);
|
||||||
|
DECL_NPY_SCALAR(std::int64_t, NPY_LONG);
|
||||||
DECL_NPY_SCALAR(long, NPY_LONG);
|
DECL_NPY_SCALAR(long, NPY_LONG);
|
||||||
DECL_NPY_SCALAR(long long, NPY_LONGLONG);
|
|
||||||
|
|
||||||
// unsigned integer types
|
// unsigned integer types
|
||||||
DECL_NPY_SCALAR(unsigned short, NPY_USHORT);
|
DECL_NPY_SCALAR(std::uint16_t, NPY_USHORT);
|
||||||
DECL_NPY_SCALAR(unsigned int, NPY_UINT);
|
DECL_NPY_SCALAR(std::uint32_t, NPY_UINT);
|
||||||
|
DECL_NPY_SCALAR(std::uint64_t, NPY_ULONG);
|
||||||
DECL_NPY_SCALAR(unsigned long, NPY_ULONG);
|
DECL_NPY_SCALAR(unsigned long, NPY_ULONG);
|
||||||
DECL_NPY_SCALAR(unsigned long long, NPY_ULONGLONG);
|
|
||||||
|
|
||||||
// floating point types
|
// floating point types
|
||||||
DECL_NPY_SCALAR(float, NPY_FLOAT);
|
DECL_NPY_SCALAR(float, NPY_FLOAT);
|
||||||
|
Loading…
Reference in New Issue
Block a user