NDPointer ========= .. cpp:class:: numpy::NDPointer numpy C++ class. Example ------- .. code-block:: cpp #include using namespace numpy; // Use NDPointer NDPointer obj; // ... operations ... Other Methods ------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``bool matches(const NDArray&array)`` - bool - NP_CTYPES_INTEROP.H:212 - :ref:`View ` Code Examples ------------- The following examples are extracted from the test suite. .. _example-ndpointer-matches-0: .. dropdown:: matches (np_test_1_all.cpp:26699) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 26689 :emphasize-lines: 11 std::cout << std::string("[FAIL] ") + description << std::endl; throw std::runtime_error(description); } // std::cout << " ✓ load_library() (stub)" << std::endl; } // Test ndpointer { auto ptr_desc = numpy::ctypeslib::ndpointer(2, { 10, 10 }); auto arr = NDArray({ 10, 10 }, 0.0); bool matches = ptr_desc.matches(arr); if (!(matches)) { std::string description = std::string("test_ctypes_interop():") + __FILE__ + ":" + std::to_string(__LINE__) + ": !(matches)"; std::cout << std::string("[FAIL] ") + description << std::endl; throw std::runtime_error(description); } // std::cout << " ✓ ndpointer()" << std::endl; } // std::cout << " [PASS] Sub-phase 6D complete (4 functions tested)" << std::endl; }