In my opinion, the problem is small enough to be solved by brute force.
In a header file called machine.hpp or similar, I would test that the C ++ Standard version is at least what I need ( __cplusplus macro). Then I would add various macro checks to reject any library that I know has been corrupted.
In other words, instead of the whitelist approach, I would choose the blacklist approach.
For instance:
#pragma once #ifndef MACHINE_HPP_HEADER_GUARDS #define MACHINE_HPP_HEADER_GUARDS #if __cplusplus < 201103L // Library is incompatible if it does not implement at least the C++11 // standard. #error "I need a library that supports at least C++11." #else // Load an arbitrary header to ensure that the pre-processor macro is // defined. Otherwise you will need to load this header AFTER you // #include the header you care about. #include <iosfwd> #endif #if __GLIBCXX__ == 20150422 #error "This version of GLIBCXX (20150422) has flaws in it" #endif // ...repeat for other versions of GLIBCXX that you know to be flawed #endif // MACHINE_HPP_HEADER_GUARDS
source share