Checking for availability of C++0x algorithm additions

前端 未结 2 750
后悔当初
后悔当初 2021-01-06 21:12

I\'m trying to figure out which of the additions to the algorithm headers are supported by a given implementation (gcc and MSVC would be enough).

The simple way woul

2条回答
  •  灰色年华
    2021-01-06 21:36

    As far as I could figure out the only proper solution is to have a build script that tries to compile and run a file that uses the feature and has a runtime assertion. Depending on the outcome have a #define CONFIG_NO_FEATURENAME or similiar in a config file and guard your uses and workaround with a #ifndef.

    This way it is possible to check if

    1. the feature is available
    2. the feature functions properly (depending on the correctness of the assertion)

提交回复
热议问题