Fix (I think) some strange situations where ::get() on dialogs
[dcpomatic.git] / src / wx / editable_list.h
index 56c3a946379cedfa99ef19da832327eda7597291..e82c4f91cdf77b44d9c35eb5bb786f6e3ae00b06 100644 (file)
@@ -210,7 +210,8 @@ private:
                S* dialog = new S (this);
 
                if (dialog->ShowModal() == wxID_OK) {
-                       boost::optional<T> const v = dialog->get ();
+                       auto const v = dialog->get ();
+                       static_assert(std::is_same<typename std::remove_const<decltype(v)>::type, boost::optional<T>>::value, "get() must return boost::optional<T>");
                        if (v) {
                                add_to_control (v.get ());
                                std::vector<T> all = _get ();
@@ -235,7 +236,8 @@ private:
                S* dialog = new S (this);
                dialog->set (all[item]);
                if (dialog->ShowModal() == wxID_OK) {
-                       boost::optional<T> const v = dialog->get ();
+                       auto const v = dialog->get ();
+                       static_assert(std::is_same<typename std::remove_const<decltype(v)>::type, boost::optional<T>>::value, "get() must return boost::optional<T>");
                        if (!v) {
                                return;
                        }