[glom/C++14: 4/4] C++14: Use decltype(auto) for return types of some templated methods.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/C++14: 4/4] C++14: Use decltype(auto) for return types of some templated methods.
- Date: Mon, 4 Jan 2016 12:08:39 +0000 (UTC)
commit f5c09d37a114be2ca7bb725f55d9507fa6584c41
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Jan 4 12:07:12 2016 +0100
C++14: Use decltype(auto) for return types of some templated methods.
glom/glade_utils.h | 6 ++++--
glom/libglom/utils.h | 2 +-
tests/test_document_load_translations.cc | 3 ++-
3 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/glom/glade_utils.h b/glom/glade_utils.h
index 77e2daa..e438bdb 100644
--- a/glom/glade_utils.h
+++ b/glom/glade_utils.h
@@ -47,7 +47,8 @@ inline std::string get_glade_resource_path(const std::string& filename)
* such as a GtkSpinButton's GtkAdjustment.
*/
template<class T_Widget>
-Glib::RefPtr<Gtk::Builder> helper_get_glade_widget_derived_with_warning(const std::string& filename, const
Glib::ustring& id, T_Widget*& widget, bool load_all)
+decltype(auto)
+helper_get_glade_widget_derived_with_warning(const std::string& filename, const Glib::ustring& id,
T_Widget*& widget, bool load_all)
{
Glib::RefPtr<Gtk::Builder> refXml;
@@ -92,7 +93,8 @@ Glib::RefPtr<Gtk::Builder> helper_get_glade_widget_derived_with_warning(const st
* will be deleted immediately.
*/
template<class T_Widget>
-Glib::RefPtr<Gtk::Builder> get_glade_child_widget_derived_with_warning(T_Widget*& widget)
+decltype(auto)
+get_glade_child_widget_derived_with_warning(T_Widget*& widget)
{
// Check the path to the installed .glade file:
// The id is the same as the filename, in a developer/operator sub-directory:
diff --git a/glom/libglom/utils.h b/glom/libglom/utils.h
index d12dcf7..63e916d 100644
--- a/glom/libglom/utils.h
+++ b/glom/libglom/utils.h
@@ -256,7 +256,7 @@ bool script_check_for_pygtk2(const Glib::ustring& script);
bool get_resource_exists(const std::string& resource_path);
template<typename E>
-constexpr typename std::underlying_type<E>::type
+decltype(auto)
to_utype(E enumerator) noexcept
{
return static_cast<typename std::underlying_type<E>::type>(enumerator);
diff --git a/tests/test_document_load_translations.cc b/tests/test_document_load_translations.cc
index 11fa026..3305151 100644
--- a/tests/test_document_load_translations.cc
+++ b/tests/test_document_load_translations.cc
@@ -39,7 +39,8 @@ bool contains(const T_Container& container, const T_Value& name)
}
template<typename T_Container>
-typename T_Container::value_type get_titled(const T_Container& container, const Glib::ustring& title)
+decltype(auto)
+get_titled(const T_Container& container, const Glib::ustring& title)
{
typedef typename T_Container::value_type type_sharedptr;
type_sharedptr result;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]