Fix compatibility with C++17.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/39/head
Slávek Banko 7 months ago
parent 7720a8f7b3
commit 0bcb76d981
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -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:

@ -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()

@ -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 )

@ -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;

@ -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();

@ -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 ) );
}

@ -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,

@ -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 )

@ -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;

@ -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...

@ -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:

@ -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;

Loading…
Cancel
Save