[gtkmm-documentation] C++11: Slightly more use of auto.



commit b03379552b67817b1280d0e841dd458b69e1f215
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Mar 17 16:48:55 2017 +0100

    C++11: Slightly more use of auto.

 examples/book/application/simple/main.cc     |    2 +-
 examples/book/placessidebar/examplewindow.cc |    5 ++---
 examples/others/window/wheelbarrow.cc        |    2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/examples/book/application/simple/main.cc b/examples/book/application/simple/main.cc
index 57acdfc..1eaf3f6 100644
--- a/examples/book/application/simple/main.cc
+++ b/examples/book/application/simple/main.cc
@@ -28,6 +28,6 @@ int main(int argc, char *argv[])
   // and opening extra windows for any files that it is asked to open,
   // for instance as a command-line parameter.
   // run() will return when the last window has been closed by the user.
-  const int status = application->run(argc, argv);
+  const auto status = application->run(argc, argv);
   return status;
 }
diff --git a/examples/book/placessidebar/examplewindow.cc b/examples/book/placessidebar/examplewindow.cc
index 74dde0c..d2653f1 100644
--- a/examples/book/placessidebar/examplewindow.cc
+++ b/examples/book/placessidebar/examplewindow.cc
@@ -47,9 +47,8 @@ ExampleWindow::ExampleWindow()
   m_controls.attach(m_show_enter_location, 0, 1, 1, 1);
 
   std::cout << "Shortcuts:" << std::endl;
-  std::vector<Glib::RefPtr<Gio::File > > shortcuts = m_places_sidebar.list_shortcuts();
-  for(std::vector<Glib::RefPtr<Gio::File > >::const_iterator it = shortcuts.begin();
-    it != shortcuts.end(); ++it)
+  const auto shortcuts = m_places_sidebar.list_shortcuts();
+  for(auto it = shortcuts.begin(); it != shortcuts.end(); ++it)
   {
     std::cout << "basename: " << (*it)->get_basename() << std::endl;
   }
diff --git a/examples/others/window/wheelbarrow.cc b/examples/others/window/wheelbarrow.cc
index d87d1b5..7e52a10 100644
--- a/examples/others/window/wheelbarrow.cc
+++ b/examples/others/window/wheelbarrow.cc
@@ -150,7 +150,7 @@ Wheelbarrow::Wheelbarrow()
   set_icon(Gdk::Pixbuf::create_from_xpm_data(wheelbarrow_xpm));
 
   realize(); // the widget must be realized to create the GDK window
-  const Glib::RefPtr<const Gdk::Window> window = get_window();
+  const auto window = get_window();
 
   //TODO: Use get_style_context() and Gdk::RGBA instead?
   const auto transparent = Gtk::Widget::get_default_style()->get_bg(Gtk::STATE_NORMAL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]