diff options
author | Murray Cumming <murrayc@murrayc.com> | 2016-02-05 23:28:12 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2016-02-05 23:39:39 +0100 |
commit | 1c212efc8e0983a69b29a5cbef7565b13e4ebfa3 (patch) | |
tree | 0fa97d18f9a0255c8c6aa07aee4b3173c8d9ab3a /glib | |
parent | 757fab512e4f390fa6e8645202efd87eebb42b66 (diff) | |
download | glibmm-1c212efc8e0983a69b29a5cbef7565b13e4ebfa3.tar.gz |
C++11: Use emplace_back() instead of push_back().
Diffstat (limited to 'glib')
-rw-r--r-- | glib/glibmm/class.cc | 2 | ||||
-rw-r--r-- | glib/glibmm/containerhandle_shared.h | 2 | ||||
-rw-r--r-- | glib/glibmm/dispatcher.cc | 2 | ||||
-rw-r--r-- | glib/glibmm/interface.cc | 4 | ||||
-rw-r--r-- | glib/glibmm/property.cc | 6 | ||||
-rw-r--r-- | glib/glibmm/threadpool.cc | 2 | ||||
-rw-r--r-- | glib/glibmm/wrap.cc | 2 | ||||
-rw-r--r-- | glib/src/miscutils.ccg | 4 | ||||
-rw-r--r-- | glib/src/optiongroup.ccg | 6 | ||||
-rw-r--r-- | glib/src/variant.ccg | 6 | ||||
-rw-r--r-- | glib/src/variant.hg | 2 |
11 files changed, 19 insertions, 19 deletions
diff --git a/glib/glibmm/class.cc b/glib/glibmm/class.cc index bf57f84e..bbaf37fa 100644 --- a/glib/glibmm/class.cc +++ b/glib/glibmm/class.cc @@ -218,7 +218,7 @@ void Class::custom_class_init_function(void* g_class, void* class_data) GValue* g_value = g_new0(GValue, 1); g_value_init(g_value, iface_props[p]->value_type); g_param_value_set_default(iface_props[p], g_value); - props->push_back(g_value); + props->emplace_back(g_value); g_object_class_override_property(gobject_class, props->size(), prop_name); } diff --git a/glib/glibmm/containerhandle_shared.h b/glib/glibmm/containerhandle_shared.h index d88182da..4d5a552c 100644 --- a/glib/glibmm/containerhandle_shared.h +++ b/glib/glibmm/containerhandle_shared.h @@ -378,7 +378,7 @@ template <class Cont, class In> void fill_container(Cont& container, In pbegin, In pend) { for(; pbegin != pend; ++pbegin) - container.push_back(*pbegin); + container.emplace_back(*pbegin); } #endif /* GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS */ diff --git a/glib/glibmm/dispatcher.cc b/glib/glibmm/dispatcher.cc index 1bbab0ec..f0ea19de 100644 --- a/glib/glibmm/dispatcher.cc +++ b/glib/glibmm/dispatcher.cc @@ -330,7 +330,7 @@ void DispatchNotifier::send_notification(Dispatcher* dispatcher) const std::lock_guard<std::mutex> lock (mutex_); const bool was_empty = notify_queue_.empty(); - notify_queue_.push_back(DispatchNotifyData(dispatcher, this)); + notify_queue_.emplace_back(DispatchNotifyData(dispatcher, this)); if(was_empty) { diff --git a/glib/glibmm/interface.cc b/glib/glibmm/interface.cc index be04a50d..f592d1b0 100644 --- a/glib/glibmm/interface.cc +++ b/glib/glibmm/interface.cc @@ -81,7 +81,7 @@ Interface::Interface(const Interface_Class& interface_class) GValue* g_value = g_new0(GValue, 1); g_value_init(g_value, iface_props[p]->value_type); g_param_value_set_default(iface_props[p], g_value); - props->push_back(g_value); + props->emplace_back(g_value); const gchar* prop_name = g_param_spec_get_name(iface_props[p]); GParamSpec* new_spec = g_param_spec_override(prop_name, iface_props[p]); @@ -99,7 +99,7 @@ Interface::Interface(const Interface_Class& interface_class) // The GObject is not instantiated yet. Add to the custom_interface_classes // and add the interface in the Glib::Object constructor. std::lock_guard<std::mutex> lock(extra_object_base_data_mutex); - extra_object_base_data[this].custom_interface_classes.push_back(&interface_class); + extra_object_base_data[this].custom_interface_classes.emplace_back(&interface_class); } } } diff --git a/glib/glibmm/property.cc b/glib/glibmm/property.cc index 0971e14d..302d48a0 100644 --- a/glib/glibmm/property.cc +++ b/glib/glibmm/property.cc @@ -186,7 +186,7 @@ void custom_set_property_callback(GObject* object, unsigned int property_id, GValue* g_value = g_new0(GValue, 1); g_value_init(g_value, G_VALUE_TYPE((*iface_props)[p])); g_value_copy((*iface_props)[p], g_value); - obj_iface_props->push_back(g_value); + obj_iface_props->emplace_back(g_value); } } @@ -245,7 +245,7 @@ bool PropertyBase::lookup_property(const Glib::ustring& name) g_assert(G_PARAM_SPEC_VALUE_TYPE(param_spec_) == G_VALUE_TYPE(value_.gobj())); g_param_spec_ref(param_spec_); - get_obj_custom_props(object_->gobj())->push_back(this); + get_obj_custom_props(object_->gobj())->emplace_back(this); } return (param_spec_ != nullptr); @@ -271,7 +271,7 @@ void PropertyBase::install_property(GParamSpec* param_spec) auto obj_custom_props = get_obj_custom_props(object_->gobj()); const unsigned int pos_in_obj_custom_props = obj_custom_props->size(); - obj_custom_props->push_back(this); + obj_custom_props->emplace_back(this); // We need to offset by 1 as zero is an invalid property id. const unsigned int property_id = pos_in_obj_custom_props + iface_props_size + 1; diff --git a/glib/glibmm/threadpool.cc b/glib/glibmm/threadpool.cc index f0218154..163fb19d 100644 --- a/glib/glibmm/threadpool.cc +++ b/glib/glibmm/threadpool.cc @@ -58,7 +58,7 @@ sigc::slot<void>* ThreadPool::SlotList::push(const sigc::slot<void>& slot) { Threads::Mutex::Lock lock (mutex_); - list_.push_back(slot); + list_.emplace_back(slot); return &list_.back(); } diff --git a/glib/glibmm/wrap.cc b/glib/glibmm/wrap.cc index eebe888c..18725a99 100644 --- a/glib/glibmm/wrap.cc +++ b/glib/glibmm/wrap.cc @@ -86,7 +86,7 @@ void wrap_register(GType type, WrapNewFunction func) return; const guint idx = wrap_func_table->size(); - wrap_func_table->push_back(func); + wrap_func_table->emplace_back(func); // Store the table index in the type's static data. g_type_set_qdata(type, Glib::quark_, GUINT_TO_POINTER(idx)); diff --git a/glib/src/miscutils.ccg b/glib/src/miscutils.ccg index 76b539d4..c0600a6c 100644 --- a/glib/src/miscutils.ccg +++ b/glib/src/miscutils.ccg @@ -135,7 +135,7 @@ std::vector<std::string> get_system_data_dirs() for(const gchar* const * iter = cresult; *iter != nullptr; ++iter) { - result.push_back( + result.emplace_back( convert_const_gchar_ptr_to_stdstring(*iter)); } @@ -152,7 +152,7 @@ std::vector<std::string> get_system_config_dirs() for(const gchar* const * iter = cresult; *iter != nullptr; ++iter) { - result.push_back( + result.emplace_back( convert_const_gchar_ptr_to_stdstring(*iter)); } diff --git a/glib/src/optiongroup.ccg b/glib/src/optiongroup.ccg index 0dbba0db..56236e4d 100644 --- a/glib/src/optiongroup.ccg +++ b/glib/src/optiongroup.ccg @@ -766,7 +766,7 @@ void OptionGroup::CppOptionEntry::convert_c_to_cpp() //for(Glib::StringArrayHandle::iterator iter = array_handle.begin(); iter != array_handle.end(); ++iter) //{ - // typed_cpp_arg->push_back(*iter); + // typed_cpp_arg->emplace_back(*iter); //} //So we do this: @@ -774,7 +774,7 @@ void OptionGroup::CppOptionEntry::convert_c_to_cpp() char** char_array_next = *typed_arg; while(*char_array_next) { - typed_cpp_arg->push_back(*char_array_next); + typed_cpp_arg->emplace_back(*char_array_next); ++char_array_next; } } @@ -793,7 +793,7 @@ void OptionGroup::CppOptionEntry::convert_c_to_cpp() char** char_array_next = *typed_arg; while(*char_array_next) { - typed_cpp_arg->push_back(*char_array_next); + typed_cpp_arg->emplace_back(*char_array_next); ++char_array_next; } } diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg index a99c17c6..aba6902b 100644 --- a/glib/src/variant.ccg +++ b/glib/src/variant.ccg @@ -175,7 +175,7 @@ VariantContainerBase VariantContainerBase::create_tuple(const VariantBase& child) { std::vector<VariantBase> vec; - vec.push_back(child); + vec.emplace_back(child); return create_tuple(vec); } @@ -492,7 +492,7 @@ type_vec_ustring Variant<type_vec_ustring>::get() const GVariant* gvariant = g_variant_get_child_value(const_cast<GVariant*>(gobj()), i); - result.push_back(Glib::Variant<Glib::ustring>(gvariant).get()); + result.emplace_back(Glib::Variant<Glib::ustring>(gvariant).get()); } return result; @@ -597,7 +597,7 @@ type_vec_string Variant<type_vec_string>::get() const GVariant* gvariant = g_variant_get_child_value(const_cast<GVariant*>(gobj()), i); - result.push_back(Glib::Variant<std::string>(gvariant).get()); + result.emplace_back(Glib::Variant<std::string>(gvariant).get()); } return result; diff --git a/glib/src/variant.hg b/glib/src/variant.hg index 5f9a440e..c73fc8ed 100644 --- a/glib/src/variant.hg +++ b/glib/src/variant.hg @@ -1137,7 +1137,7 @@ std::vector<T> Variant< std::vector<T> >::get() const g_variant_get_child_value(const_cast<GVariant*>(gobj()), i); variant.init(gvariant); - result.push_back(variant.get()); + result.emplace_back(variant.get()); } return result; |