BoostInfo ========= .. cpp:class:: numpy::BoostInfo Configuration and system information class. Example ------- .. code-block:: cpp #include using namespace numpy; // Use BoostInfo BoostInfo obj; // ... operations ... Indexing / Selection -------------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``std::string get_version()`` - std::string - BOOST_CONFIG.H:66 - :ref:`View ` Type Checking ------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``bool is_compiled_with_boost()`` - bool - BOOST_CONFIG.H:54 - :ref:`View ` * - ``bool is_runtime_available()`` - bool - BOOST_CONFIG.H:58 - :ref:`View ` Other Methods ------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``void print_status()`` - void - BOOST_CONFIG.H:77 - :ref:`View ` Code Examples ------------- The following examples are extracted from the test suite. .. _example-boostinfo-get_version-0: .. dropdown:: get_version (np_test_1_all.cpp:25337) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 25327 :emphasize-lines: 11 // Test compile-time detection bool compiled_with_boost = numpy::boost_lib::BoostInfo::is_compiled_with_boost(); // std::cout << "Compiled with Boost: " << (compiled_with_boost ? "Yes" : "No") << std::endl; // Test runtime availability bool runtime_available = numpy::boost_lib::BoostInfo::is_runtime_available(); // std::cout << "Runtime available: " << (runtime_available ? "Yes" : "No") << std::endl; // Test version string std::string version = numpy::boost_lib::BoostInfo::get_version(); // std::cout << "Version: " << version << std::endl; // Verify version contains "Boost" when enabled if (compiled_with_boost) { if (version.find("Boost") == std::string::npos) { throw std::runtime_error("Version string should contain 'Boost' when enabled"); } // std::cout << "[OK] Version string contains 'Boost'" << std::endl; } else { .. _example-boostinfo-is_compiled_with_boost-1: .. dropdown:: is_compiled_with_boost (np_test_1_all.cpp:25329) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 25319 :emphasize-lines: 11 #include #include namespace numpy_tests { // Helper functions for testing void test_boost_info() { std::cout << "========= Testing BoostInfo ======================"; // Test compile-time detection bool compiled_with_boost = numpy::boost_lib::BoostInfo::is_compiled_with_boost(); // std::cout << "Compiled with Boost: " << (compiled_with_boost ? "Yes" : "No") << std::endl; // Test runtime availability bool runtime_available = numpy::boost_lib::BoostInfo::is_runtime_available(); // std::cout << "Runtime available: " << (runtime_available ? "Yes" : "No") << std::endl; // Test version string std::string version = numpy::boost_lib::BoostInfo::get_version(); // std::cout << "Version: " << version << std::endl; .. _example-boostinfo-is_runtime_available-2: .. dropdown:: is_runtime_available (np_test_1_all.cpp:25333) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 25323 :emphasize-lines: 11 // Helper functions for testing void test_boost_info() { std::cout << "========= Testing BoostInfo ======================"; // Test compile-time detection bool compiled_with_boost = numpy::boost_lib::BoostInfo::is_compiled_with_boost(); // std::cout << "Compiled with Boost: " << (compiled_with_boost ? "Yes" : "No") << std::endl; // Test runtime availability bool runtime_available = numpy::boost_lib::BoostInfo::is_runtime_available(); // std::cout << "Runtime available: " << (runtime_available ? "Yes" : "No") << std::endl; // Test version string std::string version = numpy::boost_lib::BoostInfo::get_version(); // std::cout << "Version: " << version << std::endl; // Verify version contains "Boost" when enabled if (compiled_with_boost) { if (version.find("Boost") == std::string::npos) { throw std::runtime_error("Version string should contain 'Boost' when enabled"); .. _example-boostinfo-print_status-3: .. dropdown:: print_status (np_test_1_all.cpp:25356) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 25346 :emphasize-lines: 11 } else { if (version != "Boost not compiled in") { throw std::runtime_error("Version string incorrect when Boost not enabled"); } // std::cout << "[OK] Boost not compiled message correct" << std::endl; } // Test print_status // std::cout << "Boost status:" << std::endl; numpy::boost_lib::BoostInfo::print_status(); // std::cout << "[OK] BoostInfo tests passed" << std::endl; } void test_boost_config() { std::cout << "========= Testing BoostConfig ==================="; using namespace numpy::boost_lib; // Test default backend