Skip to content

Commit 8fba88e

Browse files
committed
fix: c++17 cases. fix: old compiler support by defining templaye type on backward class.
1 parent 3bebcb6 commit 8fba88e

6 files changed

Lines changed: 8 additions & 8 deletions

File tree

include/fix_std_cxx_17.pri

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
## Reference: https://stackoverflow.com/questions/46610996/cant-use-c17-features-using-g-7-2-in-qtcreator
55

66

7-
lessThan($$QT_MAJOR_VERSION, 5)
7+
lessThan(QT_MAJOR_VERSION, 5)
88
{
99
QMAKE_CXXFLAGS += -std=c++17
1010
}
1111

12-
isEqual($$QT_MINOR_VERSION, 5) | lessThan($$QT_MINOR_VERSION, 12)
12+
isEqual(QT_MINOR_VERSION, 5) : lessThan(QT_MINOR_VERSION, 12)
1313
{
1414
QMAKE_CXXFLAGS += -std=c++17
1515
}

src/cblock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ bool CBlock::SetBestChain(CTxDB& txdb, CBlockIndex* pindexNew)
726726
}
727727

728728
// Connect further blocks
729-
for(CBlockIndex *pindex : backwards(vpindexSecondary))
729+
for(CBlockIndex *pindex : backwards<std::vector<CBlockIndex*>>(vpindexSecondary))
730730
{
731731
CBlock block;
732732
if (!block.ReadFromDisk(pindex))

src/checkpoints.cpp

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ namespace Checkpoints
7373
{
7474
MapCheckpoints& checkpoints = (TestNet() ? mapCheckpointsTestnet : mapCheckpoints);
7575

76-
for(const MapCheckpoints::value_type& i : backwards(checkpoints))
76+
for(const MapCheckpoints::value_type& i : backwards<MapCheckpoints>(checkpoints))
7777
{
7878
const uint256& hash = i.second;
7979
std::map<uint256, CBlockIndex*>::const_iterator t = mapBlockIndex.find(hash);

src/cmasternodepayments.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight)
263263

264264
std::vector<CTxIn> vecLastPayments;
265265

266-
for(CMasternodePaymentWinner& winner : backwards(vWinning))
266+
for(CMasternodePaymentWinner& winner : backwards<std::vector<CMasternodePaymentWinner>>(vWinning))
267267
{
268268
//if we already have the same vin - we have one full payment cycle, break
269269
if(vecLastPayments.size() > (unsigned int)nMinimumAge)
@@ -301,7 +301,7 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight)
301301
{
302302
LogPrintf(" Find by reverse \n");
303303

304-
for(CTxIn& vinLP : backwards(vecLastPayments))
304+
for(CTxIn& vinLP : backwards<std::vector<CTxIn>>(vecLastPayments))
305305
{
306306
CMasternode* pmn = mnodeman.Find(vinLP);
307307
if(pmn != NULL)

src/instantx.cpp

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ int64_t CreateNewLock(CTransaction tx)
295295
{
296296
int64_t nTxAge = 0;
297297

298-
for(CTxIn i : backwards(tx.vin))
298+
for(CTxIn i : backwards<std::vector<CTxIn>>(tx.vin))
299299
{
300300
nTxAge = GetInputAge(i);
301301

src/main.cpp

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1744,7 +1744,7 @@ bool Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
17441744
// Queue memory transactions to resurrect.
17451745
// We only do this for blocks after the last checkpoint (reorganisation before that
17461746
// point should only happen with -reindex/-loadblock, or a misbehaving peer.
1747-
for(const CTransaction& tx : backwards(block.vtx))
1747+
for(const CTransaction& tx : backwards<std::vector<CTransaction>>(block.vtx))
17481748
{
17491749
if (!(tx.IsCoinBase() || tx.IsCoinStake()) && pindex->nHeight > Checkpoints::GetTotalBlocksEstimate())
17501750
{

0 commit comments

Comments
 (0)