BoostInfo#
-
class numpy::BoostInfo#
Configuration and system information class.
Example#
#include <numpy/np_ndarray.h>
using namespace numpy;
// Use BoostInfo
BoostInfo obj;
// ... operations ...
Indexing / Selection#
Signature |
Return Type |
Location |
Example |
|---|---|---|---|
|
std::string |
BOOST_CONFIG.H:66 |
Type Checking#
Other Methods#
Signature |
Return Type |
Location |
Example |
|---|---|---|---|
|
void |
BOOST_CONFIG.H:77 |
Code Examples#
The following examples are extracted from the test suite.
get_version (np_test_1_all.cpp:25337)
25327 // Test compile-time detection
25328 bool compiled_with_boost = numpy::boost_lib::BoostInfo::is_compiled_with_boost();
25329 // std::cout << "Compiled with Boost: " << (compiled_with_boost ? "Yes" : "No") << std::endl;
25330
25331 // Test runtime availability
25332 bool runtime_available = numpy::boost_lib::BoostInfo::is_runtime_available();
25333 // std::cout << "Runtime available: " << (runtime_available ? "Yes" : "No") << std::endl;
25334
25335 // Test version string
25336 std::string version = numpy::boost_lib::BoostInfo::get_version();
25337 // std::cout << "Version: " << version << std::endl;
25338
25339 // Verify version contains "Boost" when enabled
25340 if (compiled_with_boost) {
25341 if (version.find("Boost") == std::string::npos) {
25342 throw std::runtime_error("Version string should contain 'Boost' when enabled");
25343 }
25344 // std::cout << "[OK] Version string contains 'Boost'" << std::endl;
25345 }
25346 else {
is_compiled_with_boost (np_test_1_all.cpp:25329)
25319#include <iostream>
25320#include <cassert>
25321
25322namespace numpy_tests {
25323
25324 // Helper functions for testing
25325 void test_boost_info() {
25326 std::cout << "========= Testing BoostInfo ======================";
25327
25328 // Test compile-time detection
25329 bool compiled_with_boost = numpy::boost_lib::BoostInfo::is_compiled_with_boost();
25330 // std::cout << "Compiled with Boost: " << (compiled_with_boost ? "Yes" : "No") << std::endl;
25331
25332 // Test runtime availability
25333 bool runtime_available = numpy::boost_lib::BoostInfo::is_runtime_available();
25334 // std::cout << "Runtime available: " << (runtime_available ? "Yes" : "No") << std::endl;
25335
25336 // Test version string
25337 std::string version = numpy::boost_lib::BoostInfo::get_version();
25338 // std::cout << "Version: " << version << std::endl;
is_runtime_available (np_test_1_all.cpp:25333)
25323 // Helper functions for testing
25324 void test_boost_info() {
25325 std::cout << "========= Testing BoostInfo ======================";
25326
25327 // Test compile-time detection
25328 bool compiled_with_boost = numpy::boost_lib::BoostInfo::is_compiled_with_boost();
25329 // std::cout << "Compiled with Boost: " << (compiled_with_boost ? "Yes" : "No") << std::endl;
25330
25331 // Test runtime availability
25332 bool runtime_available = numpy::boost_lib::BoostInfo::is_runtime_available();
25333 // std::cout << "Runtime available: " << (runtime_available ? "Yes" : "No") << std::endl;
25334
25335 // Test version string
25336 std::string version = numpy::boost_lib::BoostInfo::get_version();
25337 // std::cout << "Version: " << version << std::endl;
25338
25339 // Verify version contains "Boost" when enabled
25340 if (compiled_with_boost) {
25341 if (version.find("Boost") == std::string::npos) {
25342 throw std::runtime_error("Version string should contain 'Boost' when enabled");
print_status (np_test_1_all.cpp:25356)
25346 }
25347 else {
25348 if (version != "Boost not compiled in") {
25349 throw std::runtime_error("Version string incorrect when Boost not enabled");
25350 }
25351 // std::cout << "[OK] Boost not compiled message correct" << std::endl;
25352 }
25353
25354 // Test print_status
25355 // std::cout << "Boost status:" << std::endl;
25356 numpy::boost_lib::BoostInfo::print_status();
25357
25358 // std::cout << "[OK] BoostInfo tests passed" << std::endl;
25359 }
25360
25361 void test_boost_config() {
25362 std::cout << "========= Testing BoostConfig ===================";
25363
25364 using namespace numpy::boost_lib;
25365
25366 // Test default backend