summaryrefslogtreecommitdiff
path: root/src/wx/editable_list.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-04-28 22:12:54 +0200
committerCarl Hetherington <cth@carlh.net>2022-04-29 23:37:48 +0200
commit54141c7a9504e289d41af997067ca6b78a1d4b0a (patch)
tree4f792d29c6d090837be267362334151b23f00399 /src/wx/editable_list.h
parentaff13422649363d7fed58287958ca66b363825ba (diff)
Fix (I think) some strange situations where ::get() on dialogs
used by EditableList would return something that wasn't a optional<> but would then get implicitly cast to one. Now we have a static_assert to check that the type is what we expect.
Diffstat (limited to 'src/wx/editable_list.h')
-rw-r--r--src/wx/editable_list.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/wx/editable_list.h b/src/wx/editable_list.h
index 56c3a9463..e82c4f91c 100644
--- a/src/wx/editable_list.h
+++ b/src/wx/editable_list.h
@@ -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;
}