summaryrefslogtreecommitdiffstats
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 02:59:14 +0200
commit0bcb76d981bf8ebd8806d6ae73cdcb77b5f4a124 (patch)
treeb9e9a52e0d1b2476eea815b83af0f121b604f27f
parent7720a8f7b3eba8cd055a0b66f43a92d30a3d586a (diff)
downloadtdeedu-0bcb76d981bf8ebd8806d6ae73cdcb77b5f4a124.tar.gz
tdeedu-0bcb76d981bf8ebd8806d6ae73cdcb77b5f4a124.zip
Fix compatibility with C++17.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--kanagram/src/keduvocdocument.cpp14
-rw-r--r--kig/kig/kig_part.cpp4
-rw-r--r--kig/misc/object_constructor.cpp14
-rw-r--r--kig/misc/special_constructors.cpp6
-rw-r--r--kig/modes/construct_mode.cpp4
-rw-r--r--kig/modes/linkslabel.cpp4
-rw-r--r--kig/modes/macro.cpp8
-rw-r--r--kig/modes/normal.cpp4
-rw-r--r--kig/objects/object_calcer.cpp14
-rw-r--r--kig/objects/object_factory.cpp2
-rw-r--r--kvoctrain/kvoctrain/kvt-core/kvoctraindoc.cpp14
-rw-r--r--kvoctrain/kvoctrain/query-dialogs/MCQueryDlg.cpp8
12 files changed, 50 insertions, 46 deletions
diff --git a/kanagram/src/keduvocdocument.cpp b/kanagram/src/keduvocdocument.cpp
index 47053372..a89072d8 100644
--- a/kanagram/src/keduvocdocument.cpp
+++ b/kanagram/src/keduvocdocument.cpp
@@ -463,7 +463,7 @@ void KEduVocDocument::setSizeHint (int idx, const int width)
}
-class eraseTrans : public unary_function<KEduVocExpression, void>
+class eraseTrans : public function<void(KEduVocExpression)>
{
public:
@@ -507,7 +507,7 @@ void KEduVocDocument::setOriginalIdent (const TQString &id)
}
-class sortByOrg : public binary_function<KEduVocExpression, KEduVocExpression, bool>
+class sortByOrg : public function<bool(KEduVocExpression, KEduVocExpression)>
{
public:
@@ -531,7 +531,7 @@ public:
class sortByLessonAndOrg_alpha
- : public binary_function<KEduVocExpression, KEduVocExpression, bool>
+ : public function<bool(KEduVocExpression, KEduVocExpression)>
{
public:
@@ -564,7 +564,7 @@ public:
class sortByLessonAndOrg_index
- : public binary_function<KEduVocExpression, KEduVocExpression, bool>
+ : public function<bool(KEduVocExpression, KEduVocExpression)>
{
public:
@@ -594,7 +594,7 @@ public:
};
-class sortByTrans : public binary_function<KEduVocExpression, KEduVocExpression, bool>
+class sortByTrans : public function<bool(KEduVocExpression, KEduVocExpression)>
{
public:
@@ -727,7 +727,7 @@ LeitnerSystem* KEduVocDocument::getLeitnerSystem()
}
-class resetAll : public unary_function<KEduVocExpression, void>
+class resetAll : public function<void(KEduVocExpression)>
{
public:
@@ -755,7 +755,7 @@ public:
};
-class resetOne : public unary_function<KEduVocExpression, void>
+class resetOne : public function<void(KEduVocExpression)>
{
public:
diff --git a/kig/kig/kig_part.cpp b/kig/kig/kig_part.cpp
index fa7a9f6b..4ccbb62b 100644
--- a/kig/kig/kig_part.cpp
+++ b/kig/kig/kig_part.cpp
@@ -563,8 +563,8 @@ void KigPart::delObjects( const std::vector<ObjectHolder*>& os )
void KigPart::enableConstructActions( bool enabled )
{
for_each( aActions.begin(), aActions.end(),
- bind2nd( mem_fun( &TDEAction::setEnabled ),
- enabled ) );
+ std::bind( mem_fn( &TDEAction::setEnabled ),
+ std::placeholders::_1, enabled ) );
}
void KigPart::unplugActionLists()
diff --git a/kig/misc/object_constructor.cpp b/kig/misc/object_constructor.cpp
index 625554a8..6db3d802 100644
--- a/kig/misc/object_constructor.cpp
+++ b/kig/misc/object_constructor.cpp
@@ -130,7 +130,7 @@ void SimpleObjectTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPai
Args args;
using namespace std;
transform( parents.begin(), parents.end(),
- back_inserter( args ), mem_fun( &ObjectCalcer::imp ) );
+ back_inserter( args ), mem_fn( &ObjectCalcer::imp ) );
ObjectImp* data = mtype->calc( args, doc );
drawer.draw( *data, p, true );
delete data;
@@ -184,7 +184,7 @@ void MultiObjectTypeConstructor::drawprelim( const ObjectDrawer& drawer, KigPain
Args args;
using namespace std;
transform( parents.begin(), parents.end(),
- back_inserter( args ), mem_fun( &ObjectCalcer::imp ) );
+ back_inserter( args ), mem_fn( &ObjectCalcer::imp ) );
for ( vector<int>::const_iterator i = mparams.begin(); i != mparams.end(); ++i )
{
@@ -302,7 +302,7 @@ TQString StandardConstructorBase::useText( const ObjectCalcer& o, const std::vec
{
using namespace std;
Args args;
- transform( sel.begin(), sel.end(), back_inserter( args ), mem_fun( &ObjectCalcer::imp ) );
+ transform( sel.begin(), sel.end(), back_inserter( args ), mem_fn( &ObjectCalcer::imp ) );
std::string ret = margsparser.usetext( o.imp(), args );
if ( ret.empty() ) return TQString();
@@ -315,7 +315,7 @@ TQString StandardConstructorBase::selectStatement(
{
using namespace std;
Args args;
- transform( sel.begin(), sel.end(), back_inserter( args ), mem_fun( &ObjectCalcer::imp ) );
+ transform( sel.begin(), sel.end(), back_inserter( args ), mem_fn( &ObjectCalcer::imp ) );
std::string ret = margsparser.selectStatement( args );
if ( ret.empty() ) return TQString();
@@ -419,7 +419,7 @@ TQString MacroConstructor::selectStatement(
using namespace std;
Args args;
transform( sel.begin(), sel.end(), back_inserter( args ),
- mem_fun( &ObjectCalcer::imp ) );
+ mem_fn( &ObjectCalcer::imp ) );
std::string ret = mparser.selectStatement( args );
if ( ret.empty() ) return TQString();
else return i18n( ret.c_str() );
@@ -432,7 +432,7 @@ TQString MacroConstructor::useText( const ObjectCalcer& o, const std::vector<Obj
using namespace std;
Args args;
transform( sel.begin(), sel.end(), back_inserter( args ),
- mem_fun( &ObjectCalcer::imp ) );
+ mem_fn( &ObjectCalcer::imp ) );
std::string ret = mparser.usetext( o.imp(), args );
if ( ret.empty() ) return TQString();
else return i18n( ret.c_str() );
@@ -447,7 +447,7 @@ void MacroConstructor::handlePrelim( KigPainter& p, const std::vector<ObjectCalc
using namespace std;
Args args;
transform( sel.begin(), sel.end(), back_inserter( args ),
- mem_fun( &ObjectCalcer::imp ) );
+ mem_fn( &ObjectCalcer::imp ) );
args = mparser.parse( args );
std::vector<ObjectImp*> ret = mhier.calc( args, doc );
for ( uint i = 0; i < ret.size(); ++i )
diff --git a/kig/misc/special_constructors.cpp b/kig/misc/special_constructors.cpp
index 1cc27ecb..c8137966 100644
--- a/kig/misc/special_constructors.cpp
+++ b/kig/misc/special_constructors.cpp
@@ -116,7 +116,7 @@ void ConicRadicalConstructor::drawprelim(
{
Args args;
std::transform( parents.begin(), parents.end(),
- std::back_inserter( args ), std::mem_fun( &ObjectCalcer::imp ) );
+ std::back_inserter( args ), std::mem_fn( &ObjectCalcer::imp ) );
for ( int i = -1; i < 2; i += 2 )
{
IntImp root( i );
@@ -803,7 +803,7 @@ void PolygonBCVConstructor::drawprelim( const ObjectDrawer& drawer, KigPainter&
Args args;
std::transform( parents.begin(), parents.end(),
- std::back_inserter( args ), std::mem_fun( &ObjectCalcer::imp ) );
+ std::back_inserter( args ), std::mem_fn( &ObjectCalcer::imp ) );
ObjectImp* data = mtype->calc( args, doc );
drawer.draw( *data, p, true );
@@ -1196,7 +1196,7 @@ void MeasureTransportConstructor::drawprelim( const ObjectDrawer& drawer,
Args args;
using namespace std;
transform( parents.begin(), parents.end(),
- back_inserter( args ), mem_fun( &ObjectCalcer::imp ) );
+ back_inserter( args ), mem_fn( &ObjectCalcer::imp ) );
ObjectImp* data = mtype->calc( args, doc );
drawer.draw( *data, p, true );
delete data;
diff --git a/kig/modes/construct_mode.cpp b/kig/modes/construct_mode.cpp
index cc07c78a..378fc999 100644
--- a/kig/modes/construct_mode.cpp
+++ b/kig/modes/construct_mode.cpp
@@ -423,7 +423,7 @@ void TestConstructMode::handlePrelim( const std::vector<ObjectCalcer*>& os, cons
{
Args args;
std::transform( os.begin(), os.end(), std::back_inserter( args ),
- std::mem_fun( &ObjectCalcer::imp ) );
+ std::mem_fn( &ObjectCalcer::imp ) );
// usetext
TQString usetext = i18n( mtype->argsParser().usetext( args.back(), args ).c_str() );
@@ -554,7 +554,7 @@ TQString TestConstructMode::selectStatement( const std::vector<ObjectCalcer*>& s
{
using namespace std;
Args args;
- transform( sel.begin(), sel.end(), back_inserter( args ), mem_fun( &ObjectCalcer::imp ) );
+ transform( sel.begin(), sel.end(), back_inserter( args ), mem_fn( &ObjectCalcer::imp ) );
std::string ret = mtype->argsParser().selectStatement( args );
if ( ret.empty() ) return TQString();
diff --git a/kig/modes/linkslabel.cpp b/kig/modes/linkslabel.cpp
index a9d0fa59..19cb744d 100644
--- a/kig/modes/linkslabel.cpp
+++ b/kig/modes/linkslabel.cpp
@@ -129,6 +129,6 @@ void LinksLabel::applyEdit( LinksLabelEditBuf& buf )
p->layout->activate();
- std::for_each( p->urllabels.begin(), p->urllabels.end(), mem_fun( &TQWidget::show ) );
- std::for_each( p->labels.begin(), p->labels.end(), mem_fun( &TQWidget::show ) );
+ std::for_each( p->urllabels.begin(), p->urllabels.end(), mem_fn( &TQWidget::show ) );
+ std::for_each( p->labels.begin(), p->labels.end(), mem_fn( &TQWidget::show ) );
}
diff --git a/kig/modes/macro.cpp b/kig/modes/macro.cpp
index 35315b26..be69d80b 100644
--- a/kig/modes/macro.cpp
+++ b/kig/modes/macro.cpp
@@ -94,11 +94,11 @@ void DefineMacroMode::namePageEntered()
std::vector<ObjectCalcer*> given;
std::transform( mgiven.begin(), mgiven.end(),
std::back_inserter( given ),
- std::mem_fun( memfun ) );
+ std::mem_fn( memfun ) );
std::vector<ObjectCalcer*> final;
std::transform( mfinal.begin(), mfinal.end(),
std::back_inserter( final ),
- std::mem_fun( memfun ) );
+ std::mem_fn( memfun ) );
ObjectHierarchy hier( given, final );
if ( hier.resultDoesNotDependOnGiven() )
{
@@ -132,11 +132,11 @@ void DefineMacroMode::finishPressed()
std::vector<ObjectCalcer*> given;
std::transform( mgiven.begin(), mgiven.end(),
std::back_inserter( given ),
- std::mem_fun( memfun ) );
+ std::mem_fn( memfun ) );
std::vector<ObjectCalcer*> final;
std::transform( mfinal.begin(), mfinal.end(),
std::back_inserter( final ),
- std::mem_fun( memfun ) );
+ std::mem_fn( memfun ) );
ObjectHierarchy hier( given, final );
MacroConstructor* ctor =
new MacroConstructor( hier,
diff --git a/kig/modes/normal.cpp b/kig/modes/normal.cpp
index 2ca6f8b0..b91db417 100644
--- a/kig/modes/normal.cpp
+++ b/kig/modes/normal.cpp
@@ -71,8 +71,8 @@ void NormalMode::selectObjects( const std::vector<ObjectHolder*>& os )
{
// hehe, don't you love this c++ stuff ;)
std::for_each( os.begin(), os.end(),
- std::bind1st(
- std::mem_fun( &NormalMode::selectObject ), this ) );
+ std::bind(
+ std::mem_fn( &NormalMode::selectObject ), this, std::placeholders::_1 ) );
}
void NormalMode::unselectObject( ObjectHolder* o )
diff --git a/kig/objects/object_calcer.cpp b/kig/objects/object_calcer.cpp
index 40545ed1..b15766bc 100644
--- a/kig/objects/object_calcer.cpp
+++ b/kig/objects/object_calcer.cpp
@@ -31,7 +31,7 @@ void ObjectTypeCalcer::calc( const KigDocument& doc )
Args a;
a.reserve( mparents.size() );
std::transform( mparents.begin(), mparents.end(),
- std::back_inserter( a ), std::mem_fun( &ObjectCalcer::imp ) );
+ std::back_inserter( a ), std::mem_fn( &ObjectCalcer::imp ) );
ObjectImp* n = mtype->calc( a, doc );
delete mimp;
mimp = n;
@@ -42,7 +42,7 @@ ObjectTypeCalcer::ObjectTypeCalcer( const ObjectType* type,
: mparents( ( sort )?type->sortArgs( parents ):parents ), mtype( type ), mimp( 0 )
{
std::for_each( mparents.begin(), mparents.end(),
- std::bind2nd( std::mem_fun( &ObjectCalcer::addChild ), this ) );
+ std::bind( std::mem_fn( &ObjectCalcer::addChild ), std::placeholders::_1, this ) );
}
ObjectCalcer::~ObjectCalcer()
@@ -122,7 +122,7 @@ void ObjectCalcer::delChild( ObjectCalcer* c )
ObjectTypeCalcer::~ObjectTypeCalcer()
{
std::for_each( mparents.begin(), mparents.end(),
- std::bind2nd( std::mem_fun( &ObjectCalcer::delChild ), this ) );
+ std::bind( std::mem_fn( &ObjectCalcer::delChild ), std::placeholders::_1, this ) );
delete mimp;
}
@@ -201,7 +201,7 @@ const ObjectImpType* ObjectTypeCalcer::impRequirement(
std::transform(
os.begin(), os.end(),
std::back_inserter( args ),
- std::mem_fun( &ObjectCalcer::imp ) );
+ std::mem_fn( &ObjectCalcer::imp ) );
assert( std::find( args.begin(), args.end(), o->imp() ) != args.end() );
return mtype->impRequirement( o->imp(), args );
}
@@ -219,9 +219,9 @@ void ObjectConstCalcer::setImp( ObjectImp* newimp )
void ObjectTypeCalcer::setParents( const std::vector<ObjectCalcer*> np )
{
std::for_each( np.begin(), np.end(),
- std::bind2nd( std::mem_fun( &ObjectCalcer::addChild ), this ) );
+ std::bind( std::mem_fn( &ObjectCalcer::addChild ), std::placeholders::_1, this ) );
std::for_each( mparents.begin(), mparents.end(),
- std::bind2nd( std::mem_fun( &ObjectCalcer::delChild ), this ) );
+ std::bind( std::mem_fn( &ObjectCalcer::delChild ), std::placeholders::_1, this ) );
mparents = np;
}
@@ -314,7 +314,7 @@ bool ObjectTypeCalcer::isDefinedOnOrThrough( const ObjectCalcer* o ) const
std::transform(
mparents.begin(), mparents.end(),
std::back_inserter( args ),
- std::mem_fun( &ObjectCalcer::imp ) );
+ std::mem_fn( &ObjectCalcer::imp ) );
if ( std::find( args.begin(), args.end(), o->imp() ) == args.end() )
return false;
diff --git a/kig/objects/object_factory.cpp b/kig/objects/object_factory.cpp
index bf333094..7235e834 100644
--- a/kig/objects/object_factory.cpp
+++ b/kig/objects/object_factory.cpp
@@ -296,7 +296,7 @@ void ObjectFactory::redefinePoint(
std::vector<ObjectCalcer*> os;
ObjectCalcer* (ObjectHolder::*calcmeth)() = &ObjectHolder::calcer;
std::transform( hos.begin(), hos.end(), std::back_inserter( os ),
- std::mem_fun( calcmeth ) );
+ std::mem_fn( calcmeth ) );
ObjectCalcer* v = 0;
// we don't want one of our children as a parent...
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;