@@ -243,7 +243,7 @@ void output_pgsql_t::stop(osmium::thread::Pool *pool)
243243{
244244 // attempt to stop tables in parallel
245245 for (auto &t : m_tables) {
246- pool->submit (std::bind (&table_t ::stop, t));
246+ pool->submit (std::bind (&table_t ::stop, t. get () ));
247247 }
248248
249249 if (m_options.expire_tiles_zoom_min > 0 ) {
@@ -492,10 +492,9 @@ int output_pgsql_t::relation_modify(osmium::Relation const &rel)
492492
493493int output_pgsql_t::start ()
494494{
495- for (std::vector<std::shared_ptr<table_t > >::iterator table = m_tables.begin (); table != m_tables.end (); ++table)
496- {
495+ for (auto &t : m_tables) {
497496 // setup the table in postgres
498- table-> get () ->start ();
497+ t ->start ();
499498 }
500499
501500 return 0 ;
@@ -529,7 +528,6 @@ output_pgsql_t::output_pgsql_t(std::shared_ptr<middle_query_t> const &mid,
529528 }
530529
531530 // for each table
532- m_tables.reserve (t_MAX);
533531 for (int i = 0 ; i < t_MAX; i++) {
534532
535533 // figure out the columns this table needs
@@ -566,12 +564,12 @@ output_pgsql_t::output_pgsql_t(std::shared_ptr<middle_query_t> const &mid,
566564 // tremble in awe of this massive constructor! seriously we are trying to avoid passing an
567565 // options object because we want to make use of the table_t in output_mutli_t which could
568566 // have a different tablespace/hstores/etc per table
569- m_tables. push_back (std::shared_ptr< table_t > (new table_t (
567+ m_tables[i]. reset (new table_t (
570568 m_options.database_options .conninfo (), name, type, columns,
571569 m_options.hstore_columns , m_options.projection ->target_srs (),
572570 m_options.append , m_options.slim , m_options.droptemp ,
573571 m_options.hstore_mode , m_options.enable_hstore_index ,
574- m_options.tblsmain_data , m_options.tblsmain_index ))) ;
572+ m_options.tblsmain_data , m_options.tblsmain_index ));
575573 }
576574}
577575
@@ -590,9 +588,9 @@ output_pgsql_t::output_pgsql_t(output_pgsql_t const *other,
590588 buffer(1024 , osmium::memory::Buffer::auto_grow::yes),
591589 rels_buffer(1024 , osmium::memory::Buffer::auto_grow::yes)
592590{
593- for (auto const &t : other-> m_tables ) {
591+ for (size_t i = 0 ; i < t_MAX; ++i ) {
594592 // copy constructor will just connect to the already there table
595- m_tables. push_back (std::shared_ptr< table_t >( new table_t (*t .get ())));
593+ m_tables[i]. reset ( new table_t (*(other-> m_tables [i] .get ())));
596594 }
597595}
598596
0 commit comments