summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2016-02-05 23:27:15 +0100
committerMurray Cumming <murrayc@murrayc.com>2016-02-05 23:39:36 +0100
commit757fab512e4f390fa6e8645202efd87eebb42b66 (patch)
tree95466ffdca211db0042df49b535ff7f48a4d4baa
parent843547cfe72de8958b7cdd5cc1a3390fc5102657 (diff)
downloadglibmm-757fab512e4f390fa6e8645202efd87eebb42b66.tar.gz
C++11: Use initializer list instead of push_back() for initial single item.
-rw-r--r--gio/src/appinfo.ccg12
-rw-r--r--tests/glibmm_variant/main.cc7
2 files changed, 6 insertions, 13 deletions
diff --git a/gio/src/appinfo.ccg b/gio/src/appinfo.ccg
index b0aa292d..c9c251ea 100644
--- a/gio/src/appinfo.ccg
+++ b/gio/src/appinfo.ccg
@@ -51,8 +51,7 @@ Glib::RefPtr<AppInfo> AppInfo::create_duplicate() const
bool AppInfo::launch(const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<AppLaunchContext>& launch_context)
{
- std::vector< Glib::RefPtr<Gio::File> > vec;
- vec.push_back(file);
+ std::vector< Glib::RefPtr<Gio::File> > vec = {file};
GError* gerror = nullptr;
const bool retvalue = g_app_info_launch(gobj(),
@@ -66,8 +65,7 @@ bool AppInfo::launch(const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<App
bool AppInfo::launch(const Glib::RefPtr<Gio::File>& file)
{
- std::vector< Glib::RefPtr<Gio::File> > vec;
- vec.push_back(file);
+ std::vector< Glib::RefPtr<Gio::File> > vec = {file};
GError* gerror = nullptr;
const bool retvalue = g_app_info_launch(gobj(),
@@ -81,8 +79,7 @@ bool AppInfo::launch(const Glib::RefPtr<Gio::File>& file)
bool AppInfo::launch_uri(const std::string& uri, const Glib::RefPtr<AppLaunchContext>& launch_context)
{
- std::vector<std::string> vec;
- vec.push_back(uri);
+ std::vector<std::string> vec = {uri};
GError* gerror = nullptr;
const bool retvalue = g_app_info_launch_uris(gobj(),
@@ -96,8 +93,7 @@ bool AppInfo::launch_uri(const std::string& uri, const Glib::RefPtr<AppLaunchCon
bool AppInfo::launch_uri(const std::string& uri)
{
- std::vector<std::string> vec;
- vec.push_back(uri);
+ std::vector<std::string> vec = {uri};
GError* gerror = nullptr;
const bool retvalue = g_app_info_launch_uris(gobj(),
diff --git a/tests/glibmm_variant/main.cc b/tests/glibmm_variant/main.cc
index 47943de3..bf17d143 100644
--- a/tests/glibmm_variant/main.cc
+++ b/tests/glibmm_variant/main.cc
@@ -51,8 +51,7 @@ int main(int, char**)
//vector<std::string>:
- std::vector<std::string> vec_strings;
- vec_strings.push_back("a");
+ std::vector<std::string> vec_strings = {"a"};
auto variant_vec_strings =
Glib::Variant<std::vector<std::string> >::create(vec_strings);
@@ -146,9 +145,7 @@ int main(int, char**)
typedef std::vector< std::map< Glib::ustring, Glib::Variant<int> > >
ComplexVecType;
- ComplexVecType complex_vector;
- complex_vector.push_back(complex_dict1);
- complex_vector.push_back(complex_dict2);
+ ComplexVecType complex_vector = {complex_dict1, complex_dict2};
auto complex_variant =
Glib::Variant<ComplexVecType>::create(complex_vector);