mirror of
https://github.com/osm2pgsql-dev/osm2pgsql.git
synced 2025-08-19 16:28:16 +00:00
Put fmt library into contrib and use it
Changes all uses of boost::format to use the "xxx"_format syntax of the fmt library. Starting from C++14 this will parse the format strings at compile time making sure the format string and the arguments fit together. This also changes the CMake config so that you can set the C++ version to compile with by using something like -DCMAKE_CXX_STANDARD=14 . C++11 is still the default. On travis bionic builds are now using C++14.
This commit is contained in:
@ -13,8 +13,8 @@ static std::shared_ptr<db_target_descr_t> setup_table(std::string const &cols)
|
||||
{
|
||||
auto conn = db.connect();
|
||||
conn.exec("DROP TABLE IF EXISTS test_copy_mgr");
|
||||
conn.exec(boost::format("CREATE TABLE test_copy_mgr (id int8%1%%2%)") %
|
||||
(cols.empty() ? "" : ",") % cols);
|
||||
conn.exec("CREATE TABLE test_copy_mgr (id int8{}{})"_format(
|
||||
cols.empty() ? "" : ",", cols));
|
||||
|
||||
auto table = std::make_shared<db_target_descr_t>();
|
||||
table->name = "test_copy_mgr";
|
||||
@ -182,9 +182,9 @@ TEST_CASE("db_copy_mgr_t")
|
||||
|
||||
auto c = db.connect();
|
||||
|
||||
auto sql = boost::format("SELECT h->'%1%' from test_copy_mgr");
|
||||
for (auto const &v : values) {
|
||||
auto res = c.require_scalar<std::string>((sql % v.first).str());
|
||||
auto const res = c.require_scalar<std::string>(
|
||||
"SELECT h->'{}' FROM test_copy_mgr"_format(v.first));
|
||||
CHECK(res == v.second);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user