From 46fd80ef2d9be3be7ab361fa85fde98f900a39cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 14 Apr 2024 20:58:48 +0200 Subject: Fix compatibility with C++17. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko (cherry picked from commit 0bcb76d981bf8ebd8806d6ae73cdcb77b5f4a124) --- kanagram/src/keduvocdocument.cpp | 14 +++++++------- kig/kig/kig_part.cpp | 4 ++-- kig/misc/object_constructor.cpp | 14 +++++++------- kig/misc/special_constructors.cpp | 6 +++--- kig/modes/construct_mode.cpp | 4 ++-- kig/modes/linkslabel.cpp | 4 ++-- kig/modes/macro.cpp | 8 ++++---- kig/modes/normal.cpp | 4 ++-- kig/objects/object_calcer.cpp | 14 +++++++------- kig/objects/object_factory.cpp | 2 +- kvoctrain/kvoctrain/kvt-core/kvoctraindoc.cpp | 14 +++++++------- kvoctrain/kvoctrain/query-dialogs/MCQueryDlg.cpp | 8 ++++++-- 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 +class eraseTrans : public function { public: @@ -507,7 +507,7 @@ void KEduVocDocument::setOriginalIdent (const TQString &id) } -class sortByOrg : public binary_function +class sortByOrg : public function { public: @@ -531,7 +531,7 @@ public: class sortByLessonAndOrg_alpha - : public binary_function + : public function { public: @@ -564,7 +564,7 @@ public: class sortByLessonAndOrg_index - : public binary_function + : public function { public: @@ -594,7 +594,7 @@ public: }; -class sortByTrans : public binary_function +class sortByTrans : public function { public: @@ -727,7 +727,7 @@ LeitnerSystem* KEduVocDocument::getLeitnerSystem() } -class resetAll : public unary_function +class resetAll : public function { public: @@ -755,7 +755,7 @@ public: }; -class resetOne : public unary_function +class resetOne : public function { 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& 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::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 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& 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& 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 given; std::transform( mgiven.begin(), mgiven.end(), std::back_inserter( given ), - std::mem_fun( memfun ) ); + std::mem_fn( memfun ) ); std::vector 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 given; std::transform( mgiven.begin(), mgiven.end(), std::back_inserter( given ), - std::mem_fun( memfun ) ); + std::mem_fn( memfun ) ); std::vector 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& 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 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 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 +class eraseTrans : public function { public: @@ -516,7 +516,7 @@ void kvoctrainDoc::setOriginalIdent (const TQString &id) } -class sortByOrg : public binary_function +class sortByOrg : public function { public: @@ -540,7 +540,7 @@ public: class sortByLessonAndOrg_alpha - : public binary_function + : public function { public: @@ -573,7 +573,7 @@ public: class sortByLessonAndOrg_index - : public binary_function + : public function { public: @@ -603,7 +603,7 @@ public: }; -class sortByTrans : public binary_function +class sortByTrans : public function { public: @@ -675,7 +675,7 @@ bool kvoctrainDoc::sortByLesson_index () } -class resetAll : public unary_function +class resetAll : public function { public: @@ -703,7 +703,7 @@ public: }; -class resetOne : public unary_function +class resetOne : public function { 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 #include +#include using namespace std; MCQueryDlg::MCQueryDlg( @@ -137,13 +138,16 @@ void MCQueryDlg::setQuery(TQString org, mw->timebar->setEnabled(false); vector 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; -- cgit v1.2.1