summaryrefslogtreecommitdiffstats
path: root/kvoctrain
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2024-04-14 20:58:48 +0200
committerSlávek Banko <slavek.banko@axis.cz>2024-04-15 03:00:46 +0200
commit46fd80ef2d9be3be7ab361fa85fde98f900a39cf (patch)
treeb241ab811764ac819f31422e400a01074c7504c5 /kvoctrain
parent2b50eee093583106e736f40d2e4780c661138645 (diff)
downloadtdeedu-r14.1.2.tar.gz
tdeedu-r14.1.2.zip
Fix compatibility with C++17.r14.1.2
Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit 0bcb76d981bf8ebd8806d6ae73cdcb77b5f4a124)
Diffstat (limited to 'kvoctrain')
-rw-r--r--kvoctrain/kvoctrain/kvt-core/kvoctraindoc.cpp14
-rw-r--r--kvoctrain/kvoctrain/query-dialogs/MCQueryDlg.cpp8
2 files changed, 13 insertions, 9 deletions
diff --git a/kvoctrain/kvoctrain/kvt-core/kvoctraindoc.cpp b/kvoctrain/kvoctrain/kvt-core/kvoctraindoc.cpp
index 906c3753..4d364bbc 100644
--- a/kvoctrain/kvoctrain/kvt-core/kvoctraindoc.cpp
+++ b/kvoctrain/kvoctrain/kvt-core/kvoctraindoc.cpp
@@ -472,7 +472,7 @@ void kvoctrainDoc::setSizeHint (int idx, const int width)
}
-class eraseTrans : public unary_function<kvoctrainExpr, void>
+class eraseTrans : public function<void(kvoctrainExpr)>
{
public:
@@ -516,7 +516,7 @@ void kvoctrainDoc::setOriginalIdent (const TQString &id)
}
-class sortByOrg : public binary_function<kvoctrainExpr, kvoctrainExpr, bool>
+class sortByOrg : public function<bool(kvoctrainExpr, kvoctrainExpr)>
{
public:
@@ -540,7 +540,7 @@ public:
class sortByLessonAndOrg_alpha
- : public binary_function<kvoctrainExpr, kvoctrainExpr, bool>
+ : public function<bool(kvoctrainExpr, kvoctrainExpr)>
{
public:
@@ -573,7 +573,7 @@ public:
class sortByLessonAndOrg_index
- : public binary_function<kvoctrainExpr, kvoctrainExpr, bool>
+ : public function<bool(kvoctrainExpr, kvoctrainExpr)>
{
public:
@@ -603,7 +603,7 @@ public:
};
-class sortByTrans : public binary_function<kvoctrainExpr, kvoctrainExpr, bool>
+class sortByTrans : public function<bool(kvoctrainExpr, kvoctrainExpr)>
{
public:
@@ -675,7 +675,7 @@ bool kvoctrainDoc::sortByLesson_index ()
}
-class resetAll : public unary_function<kvoctrainExpr, void>
+class resetAll : public function<void(kvoctrainExpr)>
{
public:
@@ -703,7 +703,7 @@ public:
};
-class resetOne : public unary_function<kvoctrainExpr, void>
+class resetOne : public function<void(kvoctrainExpr)>
{
public:
diff --git a/kvoctrain/kvoctrain/query-dialogs/MCQueryDlg.cpp b/kvoctrain/kvoctrain/query-dialogs/MCQueryDlg.cpp
index 19b977c1..4b287b83 100644
--- a/kvoctrain/kvoctrain/query-dialogs/MCQueryDlg.cpp
+++ b/kvoctrain/kvoctrain/query-dialogs/MCQueryDlg.cpp
@@ -40,6 +40,7 @@
#include <tqpushbutton.h>
#include <algorithm>
+#include <random>
using namespace std;
MCQueryDlg::MCQueryDlg(
@@ -137,13 +138,16 @@ void MCQueryDlg::setQuery(TQString org,
mw->timebar->setEnabled(false);
vector<TQString> strings;
+ random_device randomDev;
+ mt19937 randomGenerator(randomDev());
+
button_ref.clear();
button_ref.push_back(RB_Label(mw->rb_trans1, mw->trans1));
button_ref.push_back(RB_Label(mw->rb_trans2, mw->trans2));
button_ref.push_back(RB_Label(mw->rb_trans3, mw->trans3));
button_ref.push_back(RB_Label(mw->rb_trans4, mw->trans4));
button_ref.push_back(RB_Label(mw->rb_trans5, mw->trans5));
- random_shuffle(button_ref.begin(), button_ref.end() );
+ shuffle(button_ref.begin(), button_ref.end(), randomGenerator);
resetButton(button_ref[0].rb, button_ref[0].label);
resetButton(button_ref[1].rb, button_ref[1].label);
resetButton(button_ref[2].rb, button_ref[2].label);
@@ -155,7 +159,7 @@ void MCQueryDlg::setQuery(TQString org,
MultipleChoice mc = exp->getMultipleChoice(q_tcol);
for (unsigned i = 0; i < TQMIN(MAX_MULTIPLE_CHOICE, mc.size()); ++i)
strings.push_back(mc.mc(i));
- std::random_shuffle(strings.begin(), strings.end());
+ shuffle(strings.begin(), strings.end(), randomGenerator);
// always include false friend
TQString ff;