简体   繁体   English

针对特定后端的Boost.Locale测试

[英]Boost.Locale testing for particular backend

有没有一种方法(最好在编译时或在配置时)检查Boost.Locale库是否在支持特定后端(即ICU)的情况下进行编译?

Boost.Locale provides this : Boost.Locale提供了以下内容

std::vector<std::string> boost::locale::localization_backend_manager::get_all_backends() const

This will list all the backends available. 这将列出所有可用的后端。 Eg, 例如,

localization_backend_manager lbm = localization_backend_manager::global();
auto s = lbm.get_all_backends();
for_each(s.begin(), s.end(), [](string& x){ cout << x << endl; });

will print 将打印

icu
winapi
std

If Boost.Locale wasn't built with ICU support, it will list only the two last lines. 如果Boost.Locale不是由ICU支持构建的,它将仅列出最后两行。

You can use this in a configure script and compile a .cpp that accepts a backend as a parameter and checks whether it is supported. 您可以在配置脚本中使用它,并编译一个接受后端作为参数的.cpp并检查是否支持该参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM