+
+/**
+Registers the class to be used for program startup. The main application class
+should be derived from this.
+*/
+template<typename T>
+class RegisteredApplication: public Application
+{
+private:
+ class Starter: public Application::Starter
+ {
+ public:
+ Application *create_app(int argc, char **argv) { return new T(argc, argv); }
+ };
+
+ static Starter starter_;
+
+protected:
+ RegisteredApplication(const std::string &n = std::string()):
+ Application(n)
+ { (void)starter_; } // Force the starter into existence