From a9dda6566135c46c0d75d4feb8e539876278eb40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rajmund=20Hru=C5=A1ka?= <rajmund.hruska@gmail.com> Date: Sat, 30 May 2020 20:42:34 +0200 Subject: [PATCH] algo: covers: Use ext::pair instead of std::pair --- .../cover/ApproximateEnhancedCoversCommon.h | 14 +++++++------- .../cover/ApproximateEnhancedCoversComputation.h | 2 +- .../RelaxedApproximateEnhancedCoversComputation.h | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/alib2algo/src/stringology/cover/ApproximateEnhancedCoversCommon.h b/alib2algo/src/stringology/cover/ApproximateEnhancedCoversCommon.h index 31c16cc4f9..67ba764d74 100644 --- a/alib2algo/src/stringology/cover/ApproximateEnhancedCoversCommon.h +++ b/alib2algo/src/stringology/cover/ApproximateEnhancedCoversCommon.h @@ -31,9 +31,9 @@ protected: struct State { unsigned depth = 0; - /// Pair of two integers - depth of the element with level 0 and length of - /// corresponding factor - std::pair < unsigned, unsigned > lfactor; + // Pair of two integers - depth of the element with level 0 and length of + // corresponding factor + ext::pair < unsigned, unsigned > lfactor; ext::vector < Element > elements; }; @@ -66,7 +66,7 @@ protected: * enhanced covers * @param h the maximum number of covered position */ - static void updateEnhCov ( State const * state, ext::set < std::pair < unsigned, unsigned > > & enhCovers, unsigned & h ) { + static void updateEnhCov ( State const * state, ext::set < ext::pair < unsigned, unsigned > > & enhCovers, unsigned & h ) { unsigned hNext = distEnhCov ( state ); if ( hNext > h ) { @@ -92,7 +92,7 @@ protected: auto * firstState = new State ( ); firstState->depth = 1; - firstState->lfactor = { 1, 1 }; + firstState->lfactor = ext::pair < unsigned, unsigned > ( 1, 1 ); for ( size_t i = 0; i < x.getContent ( ).size ( ); ++i ) { if ( symbol == x.getContent ( )[i] ) @@ -125,7 +125,7 @@ protected: if ( element.depth < x.getContent ( ).size ( ) ) { if ( symbol == x.getContent ( )[element.depth] ) { nextState->elements.push_back ( Element ( element.depth + 1, element.level ) ); - nextState->lfactor = { element.depth + 1, nextState->depth }; + nextState->lfactor = ext::pair < unsigned, unsigned > ( element.depth + 1, nextState->depth ); } else if ( element.level < k ) { nextState->elements.push_back ( Element ( element.depth + 1, element.level + 1 ) ); } @@ -145,7 +145,7 @@ protected: * @return the set of (relaxed) approximate enhanced covers */ template < class SymbolType > - static ext::set < string::LinearString < SymbolType > > getFactors ( const string::LinearString < SymbolType > & x, ext::set < std::pair < unsigned int, unsigned int > > & enhCovers ) { + static ext::set < string::LinearString < SymbolType > > getFactors ( const string::LinearString < SymbolType > & x, ext::set < ext::pair < unsigned int, unsigned int > > & enhCovers ) { ext::set < string::LinearString < SymbolType > > result; for ( const auto & p : enhCovers ) diff --git a/alib2algo/src/stringology/cover/ApproximateEnhancedCoversComputation.h b/alib2algo/src/stringology/cover/ApproximateEnhancedCoversComputation.h index f2664b641c..43e9a54bbd 100644 --- a/alib2algo/src/stringology/cover/ApproximateEnhancedCoversComputation.h +++ b/alib2algo/src/stringology/cover/ApproximateEnhancedCoversComputation.h @@ -38,7 +38,7 @@ template < class SymbolType > ext::set < string::LinearString < SymbolType > > ApproximateEnhancedCoversComputation::compute ( const string::LinearString < SymbolType > & x, unsigned k ) { // found approximate enhanced covers are not stored directly but rather as a // set of lfactors - ext::set < std::pair < unsigned, unsigned > > result; + ext::set < ext::pair < unsigned, unsigned > > result; // the maximum number of covered positions unsigned h = 0; diff --git a/alib2algo/src/stringology/cover/RelaxedApproximateEnhancedCoversComputation.h b/alib2algo/src/stringology/cover/RelaxedApproximateEnhancedCoversComputation.h index 98e6f60710..3e617bf8d7 100644 --- a/alib2algo/src/stringology/cover/RelaxedApproximateEnhancedCoversComputation.h +++ b/alib2algo/src/stringology/cover/RelaxedApproximateEnhancedCoversComputation.h @@ -43,14 +43,14 @@ private: * @param h the maximum number of covered position */ template < class SymbolType > - static void processState ( const string::LinearString < SymbolType > & x, unsigned k, State const * previousState, ext::set < std::pair < unsigned, unsigned > > & covers, unsigned & h ); + static void processState ( const string::LinearString < SymbolType > & x, unsigned k, State const * previousState, ext::set < ext::pair < unsigned, unsigned > > & covers, unsigned & h ); }; template < class SymbolType > ext::set < string::LinearString < SymbolType > > RelaxedApproximateEnhancedCoversComputation::compute ( const string::LinearString < SymbolType > & x, unsigned k ) { // found relaxed approximate enhanced covers are not stored directly but // rather as a set of lfactors - ext::set < std::pair < unsigned, unsigned > > result; + ext::set < ext::pair < unsigned, unsigned > > result; unsigned h = 0; if ( x.getContent ( ).size ( ) < 2 ) @@ -72,14 +72,14 @@ ext::set < string::LinearString < SymbolType > > RelaxedApproximateEnhancedCover } template < class SymbolType > -void RelaxedApproximateEnhancedCoversComputation::processState ( const string::LinearString < SymbolType > & x, unsigned k, State const * previousState, ext::set < std::pair < unsigned, unsigned > > & covers, unsigned & h ) { +void RelaxedApproximateEnhancedCoversComputation::processState ( const string::LinearString < SymbolType > & x, unsigned k, State const * previousState, ext::set < ext::pair < unsigned, unsigned > > & covers, unsigned & h ) { for ( const auto & symbol : x.getAlphabet ( ) ) { auto * currState = constrNextState ( x, previousState, k, symbol ); bool isFactor = false; for ( const Element & element : currState->elements ) if ( element.level == 0 ) { - currState->lfactor = { element.depth, currState->depth }; + currState->lfactor = ext::pair < unsigned, unsigned > ( element.depth, currState->depth ); isFactor = true; } -- GitLab