@@ -30,11 +30,14 @@ class node_opl_t
3030 {
3131 std::uniform_real_distribution<double > dist{-90 , 89.99 };
3232
33- fmt::format_to (m_opl, " n{} T{} x{} y{}\n " , id, tags, 2 * dist (rng) ,
34- dist (rng));
33+ fmt::format_to (std::back_inserter ( m_opl) , " n{} T{} x{} y{}\n " , id, tags,
34+ 2 * dist (rng), dist (rng));
3535 }
3636
37- void del (osmid_t id) { fmt::format_to (m_opl, " n{} v2 dD\n " , id); }
37+ void del (osmid_t id)
38+ {
39+ fmt::format_to (std::back_inserter (m_opl), " n{} v2 dD\n " , id);
40+ }
3841
3942 std::string get_and_clear_opl ()
4043 {
@@ -57,13 +60,17 @@ class way_opl_t
5760 osmid_t const first_node = m_current_node_id;
5861 osmid_t const last_node = make_nodes ();
5962
60- fmt::format_to (m_way_opl, " w{} T{} N" , id, tags);
63+ fmt::format_to (std::back_inserter ( m_way_opl) , " w{} T{} N" , id, tags);
6164 for (osmid_t i = first_node; i <= last_node; ++i) {
62- fmt::format_to (m_way_opl, " n{}{}" , i, i == last_node ? ' \n ' : ' ,' );
65+ fmt::format_to (std::back_inserter (m_way_opl), " n{}{}" , i,
66+ i == last_node ? ' \n ' : ' ,' );
6367 }
6468 }
6569
66- void del (osmid_t id) { fmt::format_to (m_way_opl, " w{} v2 dD\n " , id); }
70+ void del (osmid_t id)
71+ {
72+ fmt::format_to (std::back_inserter (m_way_opl), " w{} v2 dD\n " , id);
73+ }
6774
6875 std::string get_and_clear_opl ()
6976 {
@@ -91,8 +98,8 @@ class way_opl_t
9198
9299 std::uniform_real_distribution<double > diff_dist{-0.01 , 0.01 };
93100 for (unsigned i = 0 ; i < num_nodes; ++i) {
94- fmt::format_to (m_node_opl, " n{} x{} y{}\n " , m_current_node_id++, x ,
95- y);
101+ fmt::format_to (std::back_inserter ( m_node_opl) , " n{} x{} y{}\n " ,
102+ m_current_node_id++, x, y);
96103 double diffx = 0.0 ;
97104 double diffy = 0.0 ;
98105 do {
@@ -120,17 +127,20 @@ class relation_opl_t
120127 osmid_t const last_node = make_nodes ();
121128
122129 // create a very simple multipolygon with one closed way
123- fmt::format_to (m_way_opl, " w{} N" , id, tags);
130+ fmt::format_to (std::back_inserter ( m_way_opl) , " w{} N" , id, tags);
124131 for (osmid_t i = first_node; i <= last_node; ++i) {
125- fmt::format_to (m_way_opl, " n{}," , i);
132+ fmt::format_to (std::back_inserter ( m_way_opl) , " n{}," , i);
126133 }
127- fmt::format_to (m_way_opl, " n{}\n " , first_node);
134+ fmt::format_to (std::back_inserter ( m_way_opl) , " n{}\n " , first_node);
128135
129- fmt::format_to (m_rel_opl, " r{} Ttype=multipolygon,{} Mw{}@ \n " , id, tags ,
130- id);
136+ fmt::format_to (std::back_inserter ( m_rel_opl) ,
137+ " r{} Ttype=multipolygon,{} Mw{}@ \n " , id, tags, id);
131138 }
132139
133- void del (osmid_t id) { fmt::format_to (m_rel_opl, " r{} v2 dD\n " , id); }
140+ void del (osmid_t id)
141+ {
142+ fmt::format_to (std::back_inserter (m_rel_opl), " r{} v2 dD\n " , id);
143+ }
134144
135145 std::string get_and_clear_opl ()
136146 {
@@ -157,14 +167,18 @@ class relation_opl_t
157167
158168 std::uniform_real_distribution<double > diff_dist{0.0000001 , 0.01 };
159169
160- fmt::format_to (m_node_opl, " n{} x{} y{}\n " , m_current_node_id++,
161- x - diff_dist (rng), y - diff_dist (rng));
162- fmt::format_to (m_node_opl, " n{} x{} y{}\n " , m_current_node_id++,
163- x - diff_dist (rng), y + diff_dist (rng));
164- fmt::format_to (m_node_opl, " n{} x{} y{}\n " , m_current_node_id++,
165- x + diff_dist (rng), y + diff_dist (rng));
166- fmt::format_to (m_node_opl, " n{} x{} y{}\n " , m_current_node_id++,
167- x + diff_dist (rng), y - diff_dist (rng));
170+ fmt::format_to (std::back_inserter (m_node_opl), " n{} x{} y{}\n " ,
171+ m_current_node_id++, x - diff_dist (rng),
172+ y - diff_dist (rng));
173+ fmt::format_to (std::back_inserter (m_node_opl), " n{} x{} y{}\n " ,
174+ m_current_node_id++, x - diff_dist (rng),
175+ y + diff_dist (rng));
176+ fmt::format_to (std::back_inserter (m_node_opl), " n{} x{} y{}\n " ,
177+ m_current_node_id++, x + diff_dist (rng),
178+ y + diff_dist (rng));
179+ fmt::format_to (std::back_inserter (m_node_opl), " n{} x{} y{}\n " ,
180+ m_current_node_id++, x + diff_dist (rng),
181+ y - diff_dist (rng));
168182
169183 return m_current_node_id - 1 ;
170184 }
0 commit comments