From a3d73d8f287ebe11a92bacc48de685412e03efca Mon Sep 17 00:00:00 2001
From: Felix Schindler <felix.schindler@wwu.de>
Date: Mon, 19 Oct 2015 15:39:10 +0200
Subject: [PATCH] [functions] add convenience `create()`

---
 dune/stuff/functions.hh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/dune/stuff/functions.hh b/dune/stuff/functions.hh
index 3ff12d3b3..0a0fe27fc 100644
--- a/dune/stuff/functions.hh
+++ b/dune/stuff/functions.hh
@@ -234,6 +234,13 @@ public:
                                     << ":\n"
                                     << available_as_str());
   } // ... create(...)
+
+  static std::unique_ptr<InterfaceType> create(const Common::Configuration& cfg)
+  {
+    if (!cfg.has_key("type"))
+      DUNE_THROW(Exceptions::wrong_input_given, "Missing 'type' in given cfg (see below)!\n\n" << cfg);
+    return create(cfg.get<std::string>("type"), cfg);
+  }
 }; // class FunctionsProvider
 
 } // namespace Stuff
-- 
GitLab