diff --git a/bin/autoconfig/CCmdLineParser.h b/bin/autoconfig/CCmdLineParser.h index 80dd0bf3ac..dd6b7cae28 100644 --- a/bin/autoconfig/CCmdLineParser.h +++ b/bin/autoconfig/CCmdLineParser.h @@ -27,7 +27,7 @@ namespace autoconfig class CCmdLineParser { public: - typedef std::vector TStrVec; + using TStrVec = std::vector; public: //! Parse the arguments and return options if appropriate. diff --git a/include/api/CAnomalyJob.h b/include/api/CAnomalyJob.h index 96e99d38b9..a873fbd646 100644 --- a/include/api/CAnomalyJob.h +++ b/include/api/CAnomalyJob.h @@ -112,21 +112,22 @@ class API_EXPORT CAnomalyJob : public CDataProcessor public: - typedef std::function TPersistCompleteFunc; - typedef model::CAnomalyDetector::TAnomalyDetectorPtr TAnomalyDetectorPtr; - typedef std::vector TAnomalyDetectorPtrVec; - typedef std::vector::iterator TAnomalyDetectorPtrVecItr; - typedef std::vector::const_iterator TAnomalyDetectorPtrVecCItr; - typedef std::vector TKeyVec; - typedef boost::unordered_map TKeyAnomalyDetectorPtrUMap; - typedef std::pair TKeyCRefAnomalyDetectorPtrPr; - typedef std::vector TKeyCRefAnomalyDetectorPtrPrVec; - typedef model::CAnomalyDetector::TModelPlotDataVec TModelPlotDataVec; - typedef TModelPlotDataVec::const_iterator TModelPlotDataVecCItr; - typedef model::CBucketQueue TModelPlotDataVecQueue; + using TPersistCompleteFunc = std::function; + using TAnomalyDetectorPtr = model::CAnomalyDetector::TAnomalyDetectorPtr; + using TAnomalyDetectorPtrVec = std::vector; + using TAnomalyDetectorPtrVecItr = std::vector::iterator; + using TAnomalyDetectorPtrVecCItr = std::vector::const_iterator; + using TKeyVec = std::vector; + using TKeyAnomalyDetectorPtrUMap = + boost::unordered_map; + using TKeyCRefAnomalyDetectorPtrPr = std::pair; + using TKeyCRefAnomalyDetectorPtrPrVec = std::vector; + using TModelPlotDataVec = model::CAnomalyDetector::TModelPlotDataVec; + using TModelPlotDataVecCItr = TModelPlotDataVec::const_iterator; + using TModelPlotDataVecQueue = model::CBucketQueue; struct API_EXPORT SRestoredStateDetail { @@ -155,7 +156,7 @@ class API_EXPORT CAnomalyJob : public CDataProcessor TKeyCRefAnomalyDetectorPtrPrVec s_Detectors; }; - typedef boost::shared_ptr TBackgroundPersistArgsPtr; + using TBackgroundPersistArgsPtr = boost::shared_ptr; public: CAnomalyJob(const std::string &jobId, diff --git a/include/api/CBenchMarker.h b/include/api/CBenchMarker.h index a51fd4ef03..df3e84740a 100644 --- a/include/api/CBenchMarker.h +++ b/include/api/CBenchMarker.h @@ -40,20 +40,20 @@ class API_EXPORT CBenchMarker { public: //! A count and and example string - typedef std::pair TSizeStrPr; + using TSizeStrPr = std::pair; //! Used for mapping Ml type to count and example - typedef std::map TIntSizeStrPrMap; - typedef TIntSizeStrPrMap::iterator TIntSizeStrPrMapItr; - typedef TIntSizeStrPrMap::const_iterator TIntSizeStrPrMapCItr; + using TIntSizeStrPrMap = std::map; + using TIntSizeStrPrMapItr = TIntSizeStrPrMap::iterator; + using TIntSizeStrPrMapCItr = TIntSizeStrPrMap::const_iterator; //! A regex and its corresponding type count map - typedef std::pair TRegexIntSizeStrPrMapPr; + using TRegexIntSizeStrPrMapPr = std::pair; //! Vector of regexes with corresponding type count maps - typedef std::vector TRegexIntSizeStrPrMapPrVec; - typedef TRegexIntSizeStrPrMapPrVec::iterator TRegexIntSizeStrPrMapPrVecItr; - typedef TRegexIntSizeStrPrMapPrVec::const_iterator TRegexIntSizeStrPrMapPrVecCItr; + using TRegexIntSizeStrPrMapPrVec = std::vector; + using TRegexIntSizeStrPrMapPrVecItr = TRegexIntSizeStrPrMapPrVec::iterator; + using TRegexIntSizeStrPrMapPrVecCItr = TRegexIntSizeStrPrMapPrVec::const_iterator; public: CBenchMarker(void); diff --git a/include/api/CCategoryExamplesCollector.h b/include/api/CCategoryExamplesCollector.h index 36ad5290fd..a34179dd27 100644 --- a/include/api/CCategoryExamplesCollector.h +++ b/include/api/CCategoryExamplesCollector.h @@ -33,8 +33,8 @@ namespace api class API_EXPORT CCategoryExamplesCollector { public: - typedef std::set TStrSet; - typedef TStrSet::const_iterator TStrSetCItr; + using TStrSet = std::set; + using TStrSetCItr = TStrSet::const_iterator; //! Truncate examples to be no longer than this static const size_t MAX_EXAMPLE_LENGTH; diff --git a/include/api/CCsvOutputWriter.h b/include/api/CCsvOutputWriter.h index 4d20c38397..a2c1f1e0d8 100644 --- a/include/api/CCsvOutputWriter.h +++ b/include/api/CCsvOutputWriter.h @@ -136,9 +136,9 @@ class API_EXPORT CCsvOutputWriter : public COutputHandler //! an appropriate level, avoiding regular memory allocations. std::string m_WorkRecord; - typedef std::pair TStrStrPr; - typedef std::set TStrStrPrSet; - typedef TStrStrPrSet::const_iterator TStrStrPrSetCItr; + using TStrStrPr = std::pair; + using TStrStrPrSet = std::set; + using TStrStrPrSetCItr = TStrStrPrSet::const_iterator; //! Messages to be printed before the next lot of output TStrStrPrSet m_Messages; diff --git a/include/api/CDataProcessor.h b/include/api/CDataProcessor.h index 9690172217..78c1d13f60 100644 --- a/include/api/CDataProcessor.h +++ b/include/api/CDataProcessor.h @@ -49,13 +49,13 @@ class API_EXPORT CDataProcessor : private core::CNonCopyable static const std::string CONTROL_FIELD_NAME; public: - typedef std::vector TStrVec; - typedef TStrVec::iterator TStrVecItr; - typedef TStrVec::const_iterator TStrVecCItr; + using TStrVec = std::vector; + using TStrVecItr = TStrVec::iterator; + using TStrVecCItr = TStrVec::const_iterator; - typedef boost::unordered_map TStrStrUMap; - typedef TStrStrUMap::iterator TStrStrUMapItr; - typedef TStrStrUMap::const_iterator TStrStrUMapCItr; + using TStrStrUMap = boost::unordered_map; + using TStrStrUMapItr = TStrStrUMap::iterator; + using TStrStrUMapCItr = TStrStrUMap::const_iterator; public: CDataProcessor(void); diff --git a/include/api/CDataTyper.h b/include/api/CDataTyper.h index a5e41c5db4..4fb5cf7a18 100644 --- a/include/api/CDataTyper.h +++ b/include/api/CDataTyper.h @@ -44,14 +44,14 @@ class API_EXPORT CDataTyper { public: //! Used for storing distinct token IDs - typedef boost::unordered_map TStrStrUMap; - typedef TStrStrUMap::const_iterator TStrStrUMapCItr; + using TStrStrUMap = boost::unordered_map; + using TStrStrUMapCItr = TStrStrUMap::const_iterator; //! Shared pointer to an instance of this class - typedef boost::shared_ptr TDataTyperP; + using TDataTyperP = boost::shared_ptr; //! Shared pointer to an instance of this class - typedef std::function TPersistFunc; + using TPersistFunc = std::function; public: CDataTyper(const std::string &fieldName); diff --git a/include/api/CDetectionRulesJsonParser.h b/include/api/CDetectionRulesJsonParser.h index 17798f52dd..4b8cd2cf46 100644 --- a/include/api/CDetectionRulesJsonParser.h +++ b/include/api/CDetectionRulesJsonParser.h @@ -29,8 +29,8 @@ namespace api class API_EXPORT CDetectionRulesJsonParser { public: - typedef std::vector TDetectionRuleVec; - typedef boost::unordered_map TStrPatternSetUMap; + using TDetectionRuleVec = std::vector; + using TStrPatternSetUMap = boost::unordered_map; public: //! Default constructor diff --git a/include/api/CFieldConfig.h b/include/api/CFieldConfig.h index f209966f47..8e939b77f7 100644 --- a/include/api/CFieldConfig.h +++ b/include/api/CFieldConfig.h @@ -342,7 +342,7 @@ class API_EXPORT CFieldConfig //! Uniqueness is enforced by config key and also by the combination of //! function, field name, by field name, over field name and //! partition field name. - typedef boost::multi_index::multi_index_container< + using TFieldOptionsMIndex = boost::multi_index::multi_index_container< CFieldOptions, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< @@ -361,28 +361,28 @@ class API_EXPORT CFieldConfig > > > - > TFieldOptionsMIndex; + >; - typedef TFieldOptionsMIndex::iterator TFieldOptionsMIndexItr; - typedef TFieldOptionsMIndex::const_iterator TFieldOptionsMIndexCItr; + using TFieldOptionsMIndexItr = TFieldOptionsMIndex::iterator; + using TFieldOptionsMIndexCItr = TFieldOptionsMIndex::const_iterator; //! Used to maintain a list of all unique config keys - typedef std::set TIntSet; + using TIntSet = std::set; //! Used to return the superset of enabled field names - typedef std::set TStrSet; + using TStrSet = std::set; //! Used to obtain command line clause tokens - typedef std::vector TStrVec; - typedef TStrVec::iterator TStrVecItr; + using TStrVec = std::vector; + using TStrVecItr = TStrVec::iterator; - typedef std::vector TDetectionRuleVec; - typedef boost::unordered_map TIntDetectionRuleVecUMap; + using TDetectionRuleVec = std::vector; + using TIntDetectionRuleVecUMap = boost::unordered_map; - typedef boost::unordered_map TStrPatternSetUMap; + using TStrPatternSetUMap = boost::unordered_map; - typedef std::pair TStrDetectionRulePr; - typedef std::vector TStrDetectionRulePrVec; + using TStrDetectionRulePr = std::pair; + using TStrDetectionRulePrVec = std::vector; public: //! Construct empty. This call should generally be followed by a call to diff --git a/include/api/CFieldDataTyper.h b/include/api/CFieldDataTyper.h index 314e97c834..b0e87ba9af 100644 --- a/include/api/CFieldDataTyper.h +++ b/include/api/CFieldDataTyper.h @@ -68,17 +68,17 @@ class API_EXPORT CFieldDataTyper : public CDataProcessor public: // A type of token list data typer that DOESN'T exclude fields from its // analysis - typedef CTokenListDataTyper - TTokenListDataTyperKeepsFields; + using TTokenListDataTyperKeepsFields = + CTokenListDataTyper; public: //! Construct without persistence capability @@ -151,7 +151,7 @@ class API_EXPORT CFieldDataTyper : public CDataProcessor void acknowledgeFlush(const std::string &flushId); private: - typedef CCategoryExamplesCollector::TStrSet TStrSet; + using TStrSet = CCategoryExamplesCollector::TStrSet; private: //! The job ID diff --git a/include/api/CHierarchicalResultsWriter.h b/include/api/CHierarchicalResultsWriter.h index bf13e19280..48477ba36f 100644 --- a/include/api/CHierarchicalResultsWriter.h +++ b/include/api/CHierarchicalResultsWriter.h @@ -139,9 +139,9 @@ class API_EXPORT CHierarchicalResultsWriter : public model::CHierarchicalResults }; public: - typedef SResults TResults; - typedef std::function TResultWriterFunc; - typedef std::function TPivotWriterFunc; + using TResults = SResults; + using TResultWriterFunc = std::function; + using TPivotWriterFunc = std::function; public: CHierarchicalResultsWriter(const model::CLimits &limits, diff --git a/include/api/CInputParser.h b/include/api/CInputParser.h index 97aae77d95..f15049be70 100644 --- a/include/api/CInputParser.h +++ b/include/api/CInputParser.h @@ -38,27 +38,27 @@ namespace api class API_EXPORT CInputParser : private core::CNonCopyable { public: - typedef std::vector TStrVec; - typedef TStrVec::iterator TStrVecItr; - typedef TStrVec::const_iterator TStrVecCItr; + using TStrVec = std::vector; + using TStrVecItr = TStrVec::iterator; + using TStrVecCItr = TStrVec::const_iterator; - typedef boost::unordered_map TStrStrUMap; - typedef TStrStrUMap::iterator TStrStrUMapItr; - typedef TStrStrUMap::const_iterator TStrStrUMapCItr; + using TStrStrUMap = boost::unordered_map; + using TStrStrUMapItr = TStrStrUMap::iterator; + using TStrStrUMapCItr = TStrStrUMap::const_iterator; //! For fast access to the field values without repeatedly computing the //! hash, we maintain references to the values in the hash map - typedef boost::reference_wrapper TStrRef; - typedef std::vector TStrRefVec; - typedef TStrRefVec::iterator TStrRefVecItr; - typedef TStrRefVec::const_iterator TStrRefVecCItr; + using TStrRef = boost::reference_wrapper; + using TStrRefVec = std::vector; + using TStrRefVecItr = TStrRefVec::iterator; + using TStrRefVecCItr = TStrRefVec::const_iterator; //! Callback function prototype that gets called for each record //! read from the input stream. Return false to exit reader loop. //! Arguments are: //! 1) Header row fields //! 2) Data row fields - typedef std::function TReaderFunc; + using TReaderFunc = std::function; public: CInputParser(void); diff --git a/include/api/CJsonOutputWriter.h b/include/api/CJsonOutputWriter.h index a97e46ad3a..063e521e18 100644 --- a/include/api/CJsonOutputWriter.h +++ b/include/api/CJsonOutputWriter.h @@ -102,29 +102,29 @@ namespace api class API_EXPORT CJsonOutputWriter : public COutputHandler { public: - typedef boost::shared_ptr TDocumentPtr; - typedef boost::weak_ptr TDocumentWeakPtr; - typedef std::vector TDocumentWeakPtrVec; - typedef TDocumentWeakPtrVec::iterator TDocumentWeakPtrVecItr; - typedef TDocumentWeakPtrVec::const_iterator TDocumentWeakPtrVecCItr; - - typedef std::pair TDocumentWeakPtrIntPr; - typedef std::vector TDocumentWeakPtrIntPrVec; - typedef TDocumentWeakPtrIntPrVec::iterator TDocumentWeakPtrIntPrVecItr; - typedef std::map TStrDocumentPtrVecMap; - - typedef std::vector TStrVec; - typedef core::CSmallVector TStr1Vec; - typedef std::vector TTimeVec; - typedef std::vector TDoubleVec; - typedef std::pair TDoubleDoublePr; - typedef std::vector TDoubleDoublePrVec; - typedef std::pair TDoubleDoubleDoublePrPr; - typedef std::vector TDoubleDoubleDoublePrPrVec; - typedef std::pair TStringDoublePr; - typedef std::vector TStringDoublePrVec; - - typedef boost::shared_ptr TValuePtr; + using TDocumentPtr = boost::shared_ptr; + using TDocumentWeakPtr = boost::weak_ptr; + using TDocumentWeakPtrVec = std::vector; + using TDocumentWeakPtrVecItr = TDocumentWeakPtrVec::iterator; + using TDocumentWeakPtrVecCItr = TDocumentWeakPtrVec::const_iterator; + + using TDocumentWeakPtrIntPr = std::pair; + using TDocumentWeakPtrIntPrVec = std::vector; + using TDocumentWeakPtrIntPrVecItr = TDocumentWeakPtrIntPrVec::iterator; + using TStrDocumentPtrVecMap = std::map; + + using TStrVec = std::vector; + using TStr1Vec = core::CSmallVector; + using TTimeVec = std::vector; + using TDoubleVec = std::vector; + using TDoubleDoublePr = std::pair; + using TDoubleDoublePrVec = std::vector; + using TDoubleDoubleDoublePrPr = std::pair; + using TDoubleDoubleDoublePrPrVec = std::vector; + using TStringDoublePr = std::pair; + using TStringDoublePrVec = std::vector; + + using TValuePtr = boost::shared_ptr; //! Structure to buffer up information about each bucket that we have //! unwritten results for @@ -175,13 +175,13 @@ class API_EXPORT CJsonOutputWriter : public COutputHandler TStr1Vec s_ScheduledEventDescriptions; }; - typedef std::map TTimeBucketDataMap; - typedef TTimeBucketDataMap::iterator TTimeBucketDataMapItr; - typedef TTimeBucketDataMap::const_iterator TTimeBucketDataMapCItr; + using TTimeBucketDataMap = std::map; + using TTimeBucketDataMapItr = TTimeBucketDataMap::iterator; + using TTimeBucketDataMapCItr = TTimeBucketDataMap::const_iterator; private: - typedef CCategoryExamplesCollector::TStrSet TStrSet; - typedef TStrSet::const_iterator TStrSetCItr; + using TStrSet = CCategoryExamplesCollector::TStrSet; + using TStrSetCItr = TStrSet::const_iterator; public: //! Constructor that causes output to be written to the specified wrapped stream diff --git a/include/api/CLengthEncodedInputParser.h b/include/api/CLengthEncodedInputParser.h index 293ebb3b8b..c61f99662a 100644 --- a/include/api/CLengthEncodedInputParser.h +++ b/include/api/CLengthEncodedInputParser.h @@ -129,7 +129,7 @@ class API_EXPORT CLengthEncodedInputParser : public CInputParser //! Reference to the stream we're going to read from std::istream &m_StrmIn; - typedef boost::scoped_array TScopedCharArray; + using TScopedCharArray = boost::scoped_array; //! The working buffer is also held as a member to avoid constantly //! reallocating it. It is a raw character array rather than a string diff --git a/include/api/CLineifiedInputParser.h b/include/api/CLineifiedInputParser.h index 46cfc72a8c..23126e1a72 100644 --- a/include/api/CLineifiedInputParser.h +++ b/include/api/CLineifiedInputParser.h @@ -48,7 +48,7 @@ class API_EXPORT CLineifiedInputParser : public CInputParser //! Line end character static const char LINE_END; - typedef std::pair TCharPSizePr; + using TCharPSizePr = std::pair; protected: //! Return a pointer to the start of the next line and its length, @@ -71,7 +71,7 @@ class API_EXPORT CLineifiedInputParser : public CInputParser //! Reference to the stream we're going to read from std::istream &m_StrmIn; - typedef boost::scoped_array TScopedCharArray; + using TScopedCharArray = boost::scoped_array; //! The working buffer is a raw character array rather than a string to //! facilitate the use of std::istream::read() to obtain input rather diff --git a/include/api/CLineifiedJsonOutputWriter.h b/include/api/CLineifiedJsonOutputWriter.h index fff5b236f6..f0cfc802e3 100644 --- a/include/api/CLineifiedJsonOutputWriter.h +++ b/include/api/CLineifiedJsonOutputWriter.h @@ -40,7 +40,7 @@ namespace api class API_EXPORT CLineifiedJsonOutputWriter : public COutputHandler { public: - typedef std::set TStrSet; + using TStrSet = std::set; public: //! Constructor that causes output to be written to the internal string @@ -102,7 +102,7 @@ class API_EXPORT CLineifiedJsonOutputWriter : public COutputHandler //! JSON writer ostream wrapper rapidjson::OStreamWrapper m_WriteStream; - typedef core::CRapidJsonLineWriter TGenericLineWriter; + using TGenericLineWriter = core::CRapidJsonLineWriter; //! JSON writer TGenericLineWriter m_Writer; diff --git a/include/api/COutputChainer.h b/include/api/COutputChainer.h index f94311318b..5656434146 100644 --- a/include/api/COutputChainer.h +++ b/include/api/COutputChainer.h @@ -108,9 +108,9 @@ class API_EXPORT COutputChainer : public COutputHandler //! processor TStrStrUMap m_WorkRecordFields; - typedef boost::reference_wrapper TStrRef; - typedef std::vector TStrRefVec; - typedef TStrRefVec::const_iterator TStrRefVecCItr; + using TStrRef = boost::reference_wrapper; + using TStrRefVec = std::vector; + using TStrRefVecCItr = TStrRefVec::const_iterator; //! References to the strings within m_WorkRecordFields in the same //! order as the field names in m_FieldNames. This avoids the need to diff --git a/include/api/COutputHandler.h b/include/api/COutputHandler.h index 49ba467af7..6810de1e69 100644 --- a/include/api/COutputHandler.h +++ b/include/api/COutputHandler.h @@ -51,13 +51,13 @@ class CBackgroundPersister; class API_EXPORT COutputHandler : private core::CNonCopyable { public: - typedef std::vector TStrVec; - typedef TStrVec::iterator TStrVecItr; - typedef TStrVec::const_iterator TStrVecCItr; + using TStrVec = std::vector; + using TStrVecItr = TStrVec::iterator; + using TStrVecCItr = TStrVec::const_iterator; - typedef boost::unordered_map TStrStrUMap; - typedef TStrStrUMap::iterator TStrStrUMapItr; - typedef TStrStrUMap::const_iterator TStrStrUMapCItr; + using TStrStrUMap = boost::unordered_map; + using TStrStrUMapItr = TStrStrUMap::iterator; + using TStrStrUMapCItr = TStrStrUMap::const_iterator; public: COutputHandler(void); @@ -130,9 +130,9 @@ class API_EXPORT COutputHandler : private core::CNonCopyable //! Used when there are no field overrides static const TStrStrUMap EMPTY_FIELD_OVERRIDES; - typedef std::vector TPreComputedHashVec; - typedef TPreComputedHashVec::iterator TPreComputedHashVecItr; - typedef TPreComputedHashVec::const_iterator TPreComputedHashVecCItr; + using TPreComputedHashVec = std::vector; + using TPreComputedHashVecItr = TPreComputedHashVec::iterator; + using TPreComputedHashVecCItr = TPreComputedHashVec::const_iterator; }; diff --git a/include/api/CResultNormalizer.h b/include/api/CResultNormalizer.h index 9abe78eafe..044ce7ecb2 100644 --- a/include/api/CResultNormalizer.h +++ b/include/api/CResultNormalizer.h @@ -70,13 +70,13 @@ class API_EXPORT CResultNormalizer static const std::string ZERO; public: - typedef std::vector TStrVec; - typedef TStrVec::iterator TStrVecItr; - typedef TStrVec::const_iterator TStrVecCItr; + using TStrVec = std::vector; + using TStrVecItr = TStrVec::iterator; + using TStrVecCItr = TStrVec::const_iterator; - typedef boost::unordered_map TStrStrUMap; - typedef TStrStrUMap::iterator TStrStrUMapItr; - typedef TStrStrUMap::const_iterator TStrStrUMapCItr; + using TStrStrUMap = boost::unordered_map; + using TStrStrUMapItr = TStrStrUMap::iterator; + using TStrStrUMapCItr = TStrStrUMap::const_iterator; public: CResultNormalizer(const model::CAnomalyDetectorModelConfig &modelConfig, diff --git a/include/api/CTokenListType.h b/include/api/CTokenListType.h index 1fba15667a..594c5dbdad 100644 --- a/include/api/CTokenListType.h +++ b/include/api/CTokenListType.h @@ -44,17 +44,17 @@ class API_EXPORT CTokenListType //! Used to associate tokens with weightings: //! first -> token ID //! second -> weighting - typedef std::pair TSizeSizePr; + using TSizeSizePr = std::pair; //! Used for storing token ID sequences - typedef std::vector TSizeSizePrVec; - typedef TSizeSizePrVec::iterator TSizeSizePrVecItr; - typedef TSizeSizePrVec::const_iterator TSizeSizePrVecCItr; + using TSizeSizePrVec = std::vector; + using TSizeSizePrVecItr = TSizeSizePrVec::iterator; + using TSizeSizePrVecCItr = TSizeSizePrVec::const_iterator; //! Used for storing distinct token IDs mapped to weightings - typedef std::map TSizeSizeMap; - typedef TSizeSizeMap::iterator TSizeSizeMapItr; - typedef TSizeSizeMap::const_iterator TSizeSizeMapCItr; + using TSizeSizeMap = std::map; + using TSizeSizeMapItr = TSizeSizeMap::iterator; + using TSizeSizeMapCItr = TSizeSizeMap::const_iterator; public: //! Create a new type diff --git a/include/config/CAutoconfigurer.h b/include/config/CAutoconfigurer.h index 2ac3304edb..26462c86a2 100644 --- a/include/config/CAutoconfigurer.h +++ b/include/config/CAutoconfigurer.h @@ -64,7 +64,7 @@ class CONFIG_EXPORT CAutoconfigurer : public api::CDataProcessor virtual api::COutputHandler &outputHandler(void); private: - typedef boost::shared_ptr TImplPtr; + using TImplPtr = boost::shared_ptr; private: //! The pointer to the actual implementation. diff --git a/include/config/CAutoconfigurerDetectorPenalties.h b/include/config/CAutoconfigurerDetectorPenalties.h index d09b7464ee..f9dd20440c 100644 --- a/include/config/CAutoconfigurerDetectorPenalties.h +++ b/include/config/CAutoconfigurerDetectorPenalties.h @@ -36,7 +36,7 @@ class CPenalty; class CONFIG_EXPORT CAutoconfigurerDetectorPenalties { public: - typedef boost::shared_ptr TPenaltyPtr; + using TPenaltyPtr = boost::shared_ptr; public: CAutoconfigurerDetectorPenalties(const CAutoconfigurerParams ¶ms, @@ -46,9 +46,9 @@ class CONFIG_EXPORT CAutoconfigurerDetectorPenalties TPenaltyPtr penaltyFor(const CDetectorSpecification &spec); private: - typedef boost::reference_wrapper TAutoconfigurerParamsCRef; - typedef boost::reference_wrapper TAutoconfigurerFieldRolePenaltiesCRef; - typedef std::vector TPenaltyPtrVec; + using TAutoconfigurerParamsCRef = boost::reference_wrapper; + using TAutoconfigurerFieldRolePenaltiesCRef = boost::reference_wrapper; + using TPenaltyPtrVec = std::vector; private: //! Get the penalty for the detector \p spec based on its field roles. diff --git a/include/config/CAutoconfigurerFieldRolePenalties.h b/include/config/CAutoconfigurerFieldRolePenalties.h index bf9f8e7797..2888b62dff 100644 --- a/include/config/CAutoconfigurerFieldRolePenalties.h +++ b/include/config/CAutoconfigurerFieldRolePenalties.h @@ -54,7 +54,7 @@ class CONFIG_EXPORT CAutoconfigurerFieldRolePenalties : core::CNonCopyable const CPenalty &partitionPenalty(void) const; private: - typedef boost::shared_ptr TPenaltyCPtr; + using TPenaltyCPtr = boost::shared_ptr; private: //! The penalties. diff --git a/include/config/CAutoconfigurerParams.h b/include/config/CAutoconfigurerParams.h index 2c8ce004e7..b22faed8cf 100644 --- a/include/config/CAutoconfigurerParams.h +++ b/include/config/CAutoconfigurerParams.h @@ -49,14 +49,14 @@ namespace config class CONFIG_EXPORT CAutoconfigurerParams { public: - typedef std::vector TTimeVec; - typedef std::vector TSizeVec; - typedef std::vector TStrVec; - typedef boost::optional TOptionalStrVec; - typedef std::pair TStrUserDataTypePr; - typedef std::vector TStrUserDataTypePrVec; - typedef boost::optional TOptionalUserDataType; - typedef std::vector TFunctionCategoryVec; + using TTimeVec = std::vector; + using TSizeVec = std::vector; + using TStrVec = std::vector; + using TOptionalStrVec = boost::optional; + using TStrUserDataTypePr = std::pair; + using TStrUserDataTypePrVec = std::vector; + using TOptionalUserDataType = boost::optional; + using TFunctionCategoryVec = std::vector; public: CAutoconfigurerParams(const std::string &timeFieldName, @@ -269,8 +269,8 @@ class CONFIG_EXPORT CAutoconfigurerParams std::string print(void) const; private: - typedef std::vector TDoubleVec; - typedef std::vector TSizeVecVec; + using TDoubleVec = std::vector; + using TSizeVecVec = std::vector; private: //! Refresh the penalty indices. diff --git a/include/config/CDataCountStatistics.h b/include/config/CDataCountStatistics.h index 1489e79e6f..96a7ec12ee 100644 --- a/include/config/CDataCountStatistics.h +++ b/include/config/CDataCountStatistics.h @@ -40,13 +40,13 @@ class CDetectorSpecification; class CONFIG_EXPORT CBucketCountStatistics { public: - typedef std::pair TSizeSizePr; - typedef core::CTriple TSizeSizeSizeTr; - typedef boost::unordered_map TSizeSizePrUInt64UMap; - typedef boost::unordered_map TSizeSizeSizeTrUInt64UMap; - typedef std::vector TDetectorRecordVec; - typedef core::CMaskIterator TDetectorRecordCItr; - typedef maths::CBasicStatistics::SSampleMeanVarSkew::TAccumulator TMoments; + using TSizeSizePr = std::pair; + using TSizeSizeSizeTr = core::CTriple; + using TSizeSizePrUInt64UMap = boost::unordered_map; + using TSizeSizeSizeTrUInt64UMap = boost::unordered_map; + using TDetectorRecordVec = std::vector; + using TDetectorRecordCItr = core::CMaskIterator; + using TMoments = maths::CBasicStatistics::SSampleMeanVarSkew::TAccumulator; //! \brief The moments of a categorical function argument field. struct CONFIG_EXPORT SArgumentMoments @@ -57,11 +57,11 @@ class CONFIG_EXPORT CBucketCountStatistics TMoments s_InfoContent; }; - typedef boost::unordered_map TSizeSizePrMomentsUMap; - typedef boost::unordered_map TSizeSizePrArgumentMomentsUMap; - typedef std::pair TStrCPtrSizeSizePrArgumentMomentsUMapPr; - typedef std::vector TStrCPtrSizeSizePrArgumentMomentsUMapPrVec; - typedef boost::unordered_map TSizeSizePrQuantileUMap; + using TSizeSizePrMomentsUMap = boost::unordered_map; + using TSizeSizePrArgumentMomentsUMap = boost::unordered_map; + using TStrCPtrSizeSizePrArgumentMomentsUMapPr = std::pair; + using TStrCPtrSizeSizePrArgumentMomentsUMapPrVec = std::vector; + using TSizeSizePrQuantileUMap = boost::unordered_map; public: //! Add the record for \p partition. @@ -86,7 +86,7 @@ class CONFIG_EXPORT CBucketCountStatistics const TSizeSizePrArgumentMomentsUMap &argumentMomentsPerPartition(const std::string &name) const; private: - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMean; + using TMean = maths::CBasicStatistics::SSampleMean::TAccumulator; //! \brief Bucket data stored about argument field. struct CONFIG_EXPORT SBucketArgumentData @@ -100,9 +100,9 @@ class CONFIG_EXPORT CBucketCountStatistics TMean s_MeanStringLength; }; - typedef boost::unordered_map TSizeSizeSizeTrArgumentDataUMap; - typedef std::pair TStrCPtrSizeSizeSizeTrBjkstArgumentDataUMapPr; - typedef std::vector TStrCPtrSizeSizeSizeTrArgumentDataUMapPrVec; + using TSizeSizeSizeTrArgumentDataUMap = boost::unordered_map; + using TStrCPtrSizeSizeSizeTrBjkstArgumentDataUMapPr = std::pair; + using TStrCPtrSizeSizeSizeTrArgumentDataUMapPrVec = std::vector; private: //! The distinct partitions seen this bucket. @@ -142,10 +142,10 @@ class CONFIG_EXPORT CBucketCountStatistics class CONFIG_EXPORT CDataCountStatistics { public: - typedef std::vector TUInt64Vec; - typedef std::vector TDetectorRecordVec; - typedef core::CMaskIterator TDetectorRecordCItr; - typedef std::vector TBucketStatisticsVec; + using TUInt64Vec = std::vector; + using TDetectorRecordVec = std::vector; + using TDetectorRecordCItr = core::CMaskIterator; + using TBucketStatisticsVec = std::vector; public: CDataCountStatistics(const CAutoconfigurerParams ¶ms); @@ -188,8 +188,8 @@ class CONFIG_EXPORT CDataCountStatistics } protected: - typedef std::vector TTimeVec; - typedef boost::unordered_set TSizeUSet; + using TTimeVec = std::vector; + using TSizeUSet = boost::unordered_set; protected: //! Get the parameters. @@ -199,15 +199,15 @@ class CONFIG_EXPORT CDataCountStatistics bool samplePartition(std::size_t partition) const; private: - typedef std::vector TBoolVec; - typedef std::vector TBoolVecVec; - typedef std::vector TSizeVec; - typedef std::pair TSizeSizePr; - typedef boost::unordered_set TSizeSizePrUSet; - typedef boost::optional TOptionalTime; - typedef boost::reference_wrapper TAutoconfigurerParamsCRef; - typedef maths::CBasicStatistics::COrderStatisticsStack TMinTimeAccumulator; - typedef maths::CBasicStatistics::COrderStatisticsStack > TMaxTimeAccumulator; + using TBoolVec = std::vector; + using TBoolVecVec = std::vector; + using TSizeVec = std::vector; + using TSizeSizePr = std::pair; + using TSizeSizePrUSet = boost::unordered_set; + using TOptionalTime = boost::optional; + using TAutoconfigurerParamsCRef = boost::reference_wrapper; + using TMinTimeAccumulator = maths::CBasicStatistics::COrderStatisticsStack; + using TMaxTimeAccumulator = maths::CBasicStatistics::COrderStatisticsStack >; private: //! Fill in the last bucket end times if they are empty. @@ -274,10 +274,10 @@ class CONFIG_EXPORT CPartitionDataCountStatistics : public CDataCountStatistics class CONFIG_EXPORT CByAndPartitionDataCountStatistics : public CDataCountStatistics { public: - typedef std::pair TSizeSizePr; - typedef boost::unordered_set TSizeSizePrUSet; - typedef boost::unordered_map TSizeSizePrUInt64UMap; - typedef TSizeSizePrUInt64UMap::const_iterator TSizeSizePrUInt64UMapCItr; + using TSizeSizePr = std::pair; + using TSizeSizePrUSet = boost::unordered_set; + using TSizeSizePrUInt64UMap = boost::unordered_map; + using TSizeSizePrUInt64UMapCItr = TSizeSizePrUInt64UMap::const_iterator; public: CByAndPartitionDataCountStatistics(const CAutoconfigurerParams ¶ms); @@ -290,10 +290,10 @@ class CONFIG_EXPORT CByAndPartitionDataCountStatistics : public CDataCountStatis class CONFIG_EXPORT CByOverAndPartitionDataCountStatistics : public CDataCountStatistics { public: - typedef boost::unordered_map TSizeUInt64UMap; - typedef std::pair TSizeSizePr; - typedef boost::unordered_map TSizeSizePrCBjkstUMap; - typedef TSizeSizePrCBjkstUMap::const_iterator TSizeSizePrCBjkstUMapCItr; + using TSizeUInt64UMap = boost::unordered_map; + using TSizeSizePr = std::pair; + using TSizeSizePrCBjkstUMap = boost::unordered_map; + using TSizeSizePrCBjkstUMapCItr = TSizeSizePrCBjkstUMap::const_iterator; public: CByOverAndPartitionDataCountStatistics(const CAutoconfigurerParams ¶ms); @@ -322,8 +322,8 @@ class CONFIG_EXPORT CByOverAndPartitionDataCountStatistics : public CDataCountSt class CONFIG_EXPORT CDataCountStatisticsDirectAddressTable { public: - typedef std::vector TDetectorRecordVec; - typedef std::vector TDetectorSpecificationVec; + using TDetectorRecordVec = std::vector; + using TDetectorSpecificationVec = std::vector; public: CDataCountStatisticsDirectAddressTable(const CAutoconfigurerParams ¶ms); @@ -341,12 +341,12 @@ class CONFIG_EXPORT CDataCountStatisticsDirectAddressTable const CDataCountStatistics &statistics(const CDetectorSpecification &spec) const; private: - typedef std::vector TSizeVec; - typedef std::vector TPtrDiffVec; - typedef std::vector TPtrDiffVecVec; - typedef boost::reference_wrapper TAutoconfigurerParamsCRef; - typedef std::shared_ptr TDataCountStatisticsPtr; - typedef std::vector TDataCountStatisticsPtrVec; + using TSizeVec = std::vector; + using TPtrDiffVec = std::vector; + using TPtrDiffVecVec = std::vector; + using TAutoconfigurerParamsCRef = boost::reference_wrapper; + using TDataCountStatisticsPtr = std::shared_ptr; + using TDataCountStatisticsPtrVec = std::vector; private: //! Get the statistics for \p spec. diff --git a/include/config/CDataSemantics.h b/include/config/CDataSemantics.h index ace1020d9c..805a135dc4 100644 --- a/include/config/CDataSemantics.h +++ b/include/config/CDataSemantics.h @@ -45,7 +45,7 @@ namespace config class CONFIG_EXPORT CDataSemantics { public: - typedef boost::optional TOptionalUserDataType; + using TOptionalUserDataType = boost::optional; public: //! The proportion of values which must be numeric for the @@ -83,10 +83,10 @@ class CONFIG_EXPORT CDataSemantics return value.hash(); } }; - typedef std::vector TStrVec; - typedef boost::unordered_map TOrdinalSizeUMap; - typedef maths::CBasicStatistics::COrderStatisticsStack TMinAccumulator; - typedef maths::CBasicStatistics::COrderStatisticsStack > TMaxAccumulator; + using TStrVec = std::vector; + using TOrdinalSizeUMap = boost::unordered_map; + using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsStack; + using TMaxAccumulator = maths::CBasicStatistics::COrderStatisticsStack >; private: //! The maximum number of values we'll hold in the empirical diff --git a/include/config/CDataSummaryStatistics.h b/include/config/CDataSummaryStatistics.h index 73260134ac..d9f7d735bf 100644 --- a/include/config/CDataSummaryStatistics.h +++ b/include/config/CDataSummaryStatistics.h @@ -55,8 +55,8 @@ class CONFIG_EXPORT CDataSummaryStatistics double meanRate(void) const; protected: - typedef maths::CBasicStatistics::COrderStatisticsStack TMinTimeAccumulator; - typedef maths::CBasicStatistics::COrderStatisticsStack > TMaxTimeAccumulator; + using TMinTimeAccumulator = maths::CBasicStatistics::COrderStatisticsStack; + using TMaxTimeAccumulator = maths::CBasicStatistics::COrderStatisticsStack >; private: //! The earliest example time. @@ -81,8 +81,8 @@ class CONFIG_EXPORT CDataSummaryStatistics class CONFIG_EXPORT CCategoricalDataSummaryStatistics : public CDataSummaryStatistics { public: - typedef std::pair TStrSizePr; - typedef std::vector TStrSizePrVec; + using TStrSizePr = std::pair; + using TStrSizePrVec = std::vector; //! The smallest cardinality at which we'll approximate the statistics. static const std::size_t TO_APPROXIMATE = 5000000; @@ -119,17 +119,17 @@ class CONFIG_EXPORT CCategoricalDataSummaryStatistics : public CDataSummaryStati static const std::size_t NUMBER_N_GRAMS = 5; private: - typedef std::pair TUInt32UInt64Pr; - typedef std::vector TUInt32UInt64PrVec; - typedef boost::unordered_map TSizeUInt64UMap; - typedef boost::unordered_map TStrUInt64UMap; - typedef TStrUInt64UMap::iterator TStrUInt64UMapItr; - typedef TStrUInt64UMap::const_iterator TStrUInt64UMapCItr; - typedef std::vector TStrUInt64UMapCItrVec; - typedef maths::CBasicStatistics::COrderStatisticsStack TMinSizeAccumulator; - typedef maths::CBasicStatistics::COrderStatisticsStack > TMaxSizeAccumulator; - typedef std::vector TBjkstUniqueValuesVec; - typedef std::vector TEntropySketchVec; + using TUInt32UInt64Pr = std::pair; + using TUInt32UInt64PrVec = std::vector; + using TSizeUInt64UMap = boost::unordered_map; + using TStrUInt64UMap = boost::unordered_map; + using TStrUInt64UMapItr = TStrUInt64UMap::iterator; + using TStrUInt64UMapCItr = TStrUInt64UMap::const_iterator; + using TStrUInt64UMapCItrVec = std::vector; + using TMinSizeAccumulator = maths::CBasicStatistics::COrderStatisticsStack; + using TMaxSizeAccumulator = maths::CBasicStatistics::COrderStatisticsStack >; + using TBjkstUniqueValuesVec = std::vector; + using TEntropySketchVec = std::vector; private: //! Extract the \p n grams and update the relevant statistics. @@ -213,8 +213,8 @@ class CONFIG_EXPORT CCategoricalDataSummaryStatistics : public CDataSummaryStati class CONFIG_EXPORT CNumericDataSummaryStatistics : public CDataSummaryStatistics { public: - typedef std::pair TDoubleDoublePr; - typedef std::vector TDoubleDoublePrVec; + using TDoubleDoublePr = std::pair; + using TDoubleDoublePrVec = std::vector; public: CNumericDataSummaryStatistics(bool integer); diff --git a/include/config/CDetectorEnumerator.h b/include/config/CDetectorEnumerator.h index 5063a023aa..12aec9a25a 100644 --- a/include/config/CDetectorEnumerator.h +++ b/include/config/CDetectorEnumerator.h @@ -36,7 +36,7 @@ class CDetectorSpecification; class CONFIG_EXPORT CDetectorEnumerator { public: - typedef std::vector TDetectorSpecificationVec; + using TDetectorSpecificationVec = std::vector; public: CDetectorEnumerator(const CAutoconfigurerParams ¶ms); @@ -72,10 +72,10 @@ class CONFIG_EXPORT CDetectorEnumerator void generate(TDetectorSpecificationVec &result); private: - typedef std::vector TStrVec; - typedef boost::optional TOptionalStr; - typedef std::vector TFunctionCategoryVec; - typedef boost::reference_wrapper TAutoconfigurerParamsCRef; + using TStrVec = std::vector; + using TOptionalStr = boost::optional; + using TFunctionCategoryVec = std::vector; + using TAutoconfigurerParamsCRef = boost::reference_wrapper; private: //! Add the detectors with no partitioning fields. diff --git a/include/config/CDetectorRecord.h b/include/config/CDetectorRecord.h index 46e7fab25d..cbb6228005 100644 --- a/include/config/CDetectorRecord.h +++ b/include/config/CDetectorRecord.h @@ -35,9 +35,9 @@ class CDetectorSpecification; class CONFIG_EXPORT CDetectorRecord { public: - typedef boost::array TSizeAry; - typedef boost::array TStrCPtrAry; - typedef boost::unordered_map TStrStrUMap; + using TSizeAry = boost::array; + using TStrCPtrAry = boost::array; + using TStrStrUMap = boost::unordered_map; public: CDetectorRecord(core_t::TTime time, @@ -120,9 +120,9 @@ class CONFIG_EXPORT CDetectorRecord class CONFIG_EXPORT CDetectorRecordDirectAddressTable { public: - typedef boost::unordered_map TStrStrUMap; - typedef std::vector TDetectorSpecificationVec; - typedef std::vector TDetectorRecordVec; + using TStrStrUMap = boost::unordered_map; + using TDetectorSpecificationVec = std::vector; + using TDetectorRecordVec = std::vector; public: //! Build the table from \p specs. @@ -139,12 +139,12 @@ class CONFIG_EXPORT CDetectorRecordDirectAddressTable void clear(void); private: - typedef std::vector TSizeVec; - typedef std::pair TStrSizePr; - typedef std::vector TStrSizePrVec; - typedef boost::array TSizeAry; - typedef std::vector TSizeAryVec; - typedef std::vector TStrCPtrVec; + using TSizeVec = std::vector; + using TStrSizePr = std::pair; + using TStrSizePrVec = std::vector; + using TSizeAry = boost::array; + using TSizeAryVec = std::vector; + using TStrCPtrVec = std::vector; private: //! A map from field to its value entry in the field value table. diff --git a/include/config/CDetectorSpecification.h b/include/config/CDetectorSpecification.h index d4d3ec1bbb..6a9d9c384d 100644 --- a/include/config/CDetectorSpecification.h +++ b/include/config/CDetectorSpecification.h @@ -47,14 +47,14 @@ class CONFIG_EXPORT CDetectorSpecification : boost::equality_comparable< CDetect boost::less_than_comparable< CDetectorSpecification > > { public: - typedef std::vector TDoubleVec; - typedef std::vector TDoubleVecVec; - typedef std::vector TSizeVec; - typedef std::vector TTimeVec; - typedef std::vector TStrVec; - typedef boost::optional TOptionalStr; - typedef std::vector TFieldStatisticsVec; - typedef boost::shared_ptr TPenaltyPtr; + using TDoubleVec = std::vector; + using TDoubleVecVec = std::vector; + using TSizeVec = std::vector; + using TTimeVec = std::vector; + using TStrVec = std::vector; + using TOptionalStr = boost::optional; + using TFieldStatisticsVec = std::vector; + using TPenaltyPtr = boost::shared_ptr; //! Ternary boolean type which supports unknown. enum EFuzzyBool @@ -85,7 +85,7 @@ class CONFIG_EXPORT CDetectorSpecification : boost::equality_comparable< CDetect TStrVec s_Descriptions; }; - typedef std::vector TParamScoresVec; + using TParamScoresVec = std::vector; public: CDetectorSpecification(const CAutoconfigurerParams ¶ms, @@ -212,10 +212,10 @@ class CONFIG_EXPORT CDetectorSpecification : boost::equality_comparable< CDetect std::string description(void) const; private: - typedef std::vector TStrVecVec; - typedef boost::optional TOptionalTime; - typedef boost::array TSizeVecCPtrAry; - typedef boost::reference_wrapper TAutoconfigurerParamsCRef; + using TStrVecVec = std::vector; + using TOptionalTime = boost::optional; + using TSizeVecCPtrAry = boost::array; + using TAutoconfigurerParamsCRef = boost::reference_wrapper; private: //! Get the parameters. diff --git a/include/config/CFieldStatistics.h b/include/config/CFieldStatistics.h index f0126d3ef9..184a22e4e5 100644 --- a/include/config/CFieldStatistics.h +++ b/include/config/CFieldStatistics.h @@ -33,7 +33,7 @@ class CPenalty; class CONFIG_EXPORT CFieldStatistics { public: - typedef boost::reference_wrapper TAutoconfigurerParamsCRef; + using TAutoconfigurerParamsCRef = boost::reference_wrapper; public: CFieldStatistics(const std::string &fieldName, const CAutoconfigurerParams ¶ms); @@ -67,11 +67,12 @@ class CONFIG_EXPORT CFieldStatistics double score(const CPenalty &penalty) const; private: - typedef std::pair TTimeStrPr; - typedef std::vector TTimeStrPrVec; - typedef boost::variant TDataSummaryStatistics; + using TTimeStrPr = std::pair; + using TTimeStrPrVec = std::vector; + using TDataSummaryStatistics = + boost::variant; private: //! The auto-configuration parameters. diff --git a/include/config/CLongTailPenalty.h b/include/config/CLongTailPenalty.h index dd6ea44409..d3aa3c32c0 100644 --- a/include/config/CLongTailPenalty.h +++ b/include/config/CLongTailPenalty.h @@ -43,7 +43,7 @@ class CONFIG_EXPORT CLongTailPenalty : public CPenalty virtual std::string name(void) const; private: - typedef boost::unordered_map TSizeUInt64UMap; + using TSizeUInt64UMap = boost::unordered_map; private: //! Compute a penalty for rare detectors. diff --git a/include/config/CNotEnoughDataPenalty.h b/include/config/CNotEnoughDataPenalty.h index c31a367e4d..6680e86e62 100644 --- a/include/config/CNotEnoughDataPenalty.h +++ b/include/config/CNotEnoughDataPenalty.h @@ -42,8 +42,8 @@ class CONFIG_EXPORT CNotEnoughDataPenalty : public CPenalty virtual std::string name(void) const; private: - typedef std::vector TUInt64Vec; - typedef std::vector TBucketCountStatisticsVec; + using TUInt64Vec = std::vector; + using TBucketCountStatisticsVec = std::vector; private: //! Compute a penalty for rare detectors. diff --git a/include/config/CPenalty.h b/include/config/CPenalty.h index 25953a2496..ff54393863 100644 --- a/include/config/CPenalty.h +++ b/include/config/CPenalty.h @@ -64,13 +64,13 @@ class CNumericDataSummaryStatistics; class CONFIG_EXPORT CPenalty { public: - typedef std::vector TDoubleVec; - typedef std::vector TSizeVec; - typedef std::vector TTimeVec; - typedef std::vector TStrVec; - typedef boost::shared_ptr TPenaltyPtr; - typedef boost::shared_ptr TPenaltyCPtr; - typedef std::vector TPenaltyCPtrVec; + using TDoubleVec = std::vector; + using TSizeVec = std::vector; + using TTimeVec = std::vector; + using TStrVec = std::vector; + using TPenaltyPtr = boost::shared_ptr; + using TPenaltyCPtr = boost::shared_ptr; + using TPenaltyCPtrVec = std::vector; //! \brief Represents the result of multiplying penalties. class CClosure @@ -132,7 +132,7 @@ class CONFIG_EXPORT CPenalty static bool scoreIsZeroFor(double penalty); protected: - typedef boost::reference_wrapper TAutoconfigurerParamsCRef; + using TAutoconfigurerParamsCRef = boost::reference_wrapper; protected: //! Get the parameters. diff --git a/include/config/CPolledDataPenalty.h b/include/config/CPolledDataPenalty.h index eeb76b7163..37a17aa754 100644 --- a/include/config/CPolledDataPenalty.h +++ b/include/config/CPolledDataPenalty.h @@ -41,7 +41,7 @@ class CONFIG_EXPORT CPolledDataPenalty : public CPenalty virtual std::string name(void) const; private: - typedef boost::optional TOptionalTime; + using TOptionalTime = boost::optional; private: //! Compute a penalty for rare detectors. diff --git a/include/config/CReportWriter.h b/include/config/CReportWriter.h index e86a66b898..aa59a39658 100644 --- a/include/config/CReportWriter.h +++ b/include/config/CReportWriter.h @@ -38,10 +38,10 @@ class CNumericDataSummaryStatistics; class CONFIG_EXPORT CReportWriter : public api::COutputHandler { public: - typedef std::vector TStrVec; - typedef std::vector TStrVecVec; - typedef std::vector TStrVecVecVec; - typedef std::vector TStrVecVecVecVec; + using TStrVec = std::vector; + using TStrVecVec = std::vector; + using TStrVecVecVec = std::vector; + using TStrVecVecVecVec = std::vector; //! \name Summary Statistics. //@{ diff --git a/include/config/CTooMuchDataPenalty.h b/include/config/CTooMuchDataPenalty.h index 50d6235cf3..3a629fb8f1 100644 --- a/include/config/CTooMuchDataPenalty.h +++ b/include/config/CTooMuchDataPenalty.h @@ -44,8 +44,8 @@ class CONFIG_EXPORT CTooMuchDataPenalty : public CPenalty virtual std::string name(void) const; private: - typedef std::vector TUInt64Vec; - typedef std::vector TBucketCountStatisticsVec; + using TUInt64Vec = std::vector; + using TBucketCountStatisticsVec = std::vector; private: //! Compute a penalty for rare detectors. diff --git a/include/core/CBase64Filter.h b/include/core/CBase64Filter.h index bc8eb9a948..7e4d991c73 100644 --- a/include/core/CBase64Filter.h +++ b/include/core/CBase64Filter.h @@ -77,11 +77,11 @@ namespace core class CORE_EXPORT CBase64Encoder { public: - typedef boost::circular_buffer TUInt8Buf; - typedef TUInt8Buf::iterator TUInt8BufItr; - typedef TUInt8Buf::const_iterator TUInt8BufCItr; + using TUInt8Buf = boost::circular_buffer; + using TUInt8BufItr = TUInt8Buf::iterator; + using TUInt8BufCItr = TUInt8Buf::const_iterator; - typedef char char_type; + using char_type = char; //! Tell boost::iostreams what this filter is capable of struct category : @@ -134,8 +134,8 @@ class CORE_EXPORT CBase64Encoder template void Encode(SINK &snk, bool isFinal) { - typedef boost::archive::iterators::transform_width TUInt8BufCItrTransformItr; - typedef boost::archive::iterators::base64_from_binary TBase64Text; + using TUInt8BufCItrTransformItr = boost::archive::iterators::transform_width; + using TBase64Text = boost::archive::iterators::base64_from_binary; TUInt8BufItr endItr = m_Buffer.end(); // Base64 turns 3 bytes into 4 characters - unless this is the final part @@ -222,11 +222,11 @@ class CORE_EXPORT CBase64Encoder class CORE_EXPORT CBase64Decoder { public: - typedef boost::circular_buffer TUInt8Buf; - typedef TUInt8Buf::iterator TUInt8BufItr; - typedef TUInt8Buf::const_iterator TUInt8BufCItr; - typedef TUInt8Buf::const_reverse_iterator TUInt8BufCRItr; - typedef char char_type; + using TUInt8Buf = boost::circular_buffer; + using TUInt8BufItr = TUInt8Buf::iterator; + using TUInt8BufCItr = TUInt8Buf::const_iterator; + using TUInt8BufCRItr = TUInt8Buf::const_reverse_iterator; + using char_type = char; //! Tell boost::iostreams what this filter is capable of struct category : @@ -335,8 +335,8 @@ class CORE_EXPORT CBase64Decoder void Decode(bool isFinal) { // Base64 turns 4 characters into 3 bytes - typedef boost::archive::iterators::binary_from_base64 TUInt8BufCItrBinaryBase64Itr; - typedef boost::archive::iterators::transform_width TBase64Binary; + using TUInt8BufCItrBinaryBase64Itr = boost::archive::iterators::binary_from_base64; + using TBase64Binary = boost::archive::iterators::transform_width; std::size_t inBytes = m_BufferIn.size(); if (inBytes == 0) diff --git a/include/core/CBlockingMessageQueue.h b/include/core/CBlockingMessageQueue.h index 54122f74d2..76c431c410 100644 --- a/include/core/CBlockingMessageQueue.h +++ b/include/core/CBlockingMessageQueue.h @@ -281,7 +281,7 @@ class CBlockingMessageQueue //! Using a circular buffer for the queue means that it will not do any //! memory allocations after construction (providing the message type //! does not allocate any heap memory in its constructor). - typedef boost::circular_buffer TMessageCircBuf; + using TMessageCircBuf = boost::circular_buffer; TMessageCircBuf m_Queue; diff --git a/include/core/CCompressUtils.h b/include/core/CCompressUtils.h index ba98f69282..7cb431ae3d 100644 --- a/include/core/CCompressUtils.h +++ b/include/core/CCompressUtils.h @@ -42,7 +42,7 @@ class CORE_EXPORT CCompressUtils : private CNonCopyable { public: //! The output type - typedef std::vector TByteVec; + using TByteVec = std::vector; public: explicit CCompressUtils(bool lengthOnly, diff --git a/include/core/CCompressedDictionary.h b/include/core/CCompressedDictionary.h index 5eba79d1d2..9ee79025de 100644 --- a/include/core/CCompressedDictionary.h +++ b/include/core/CCompressedDictionary.h @@ -46,8 +46,8 @@ template class CCompressedDictionary { public: - typedef boost::array TUInt64Array; - typedef const std::string* TStrCPtr; + using TUInt64Array = boost::array; + using TStrCPtr = const std::string*; //! \brief A hash representation of a string in the dictionary //! with low probability of collision even for relatively large @@ -161,10 +161,10 @@ class CCompressedDictionary }; //! The type of an ordered set of words. - typedef std::set TWordSet; + using TWordSet = std::set; //! The type of an unordered set of words. - typedef boost::unordered_set TWordUSet; + using TWordUSet = boost::unordered_set; //! A "template typedef" of an ordered map from words to //! objects of type T. @@ -172,7 +172,7 @@ class CCompressedDictionary class CWordMap { public: - typedef std::map Type; + using Type = std::map; }; //! A "template typedef" of an unordered map from words to @@ -181,7 +181,7 @@ class CCompressedDictionary class CWordUMap { public: - typedef boost::unordered_map Type; + using Type = boost::unordered_map; }; public: diff --git a/include/core/CContainerPrinter.h b/include/core/CContainerPrinter.h index edb7621f75..140dfb71a2 100644 --- a/include/core/CContainerPrinter.h +++ b/include/core/CContainerPrinter.h @@ -30,15 +30,15 @@ namespace core namespace printer_detail { -typedef boost::true_type true_; -typedef boost::false_type false_; +using true_ = boost::true_type; +using false_ = boost::false_type; //! Auxiliary type used by has_const_iterator to test for a nested //! typedef. template struct enable_if_has { - typedef R type; + using type = R; }; //! Auxiliary type used by has_print_function to test for a nested @@ -46,7 +46,7 @@ struct enable_if_has template struct enable_if_is { - typedef R type; + using type = R; }; //! \name Check For Nested "const_iterator" @@ -65,13 +65,13 @@ struct enable_if_is template struct has_const_iterator { - typedef false_ value; + using value = false_; }; template struct has_const_iterator::type> { - typedef true_ value; + using value = true_; }; //@} @@ -92,13 +92,13 @@ struct has_const_iterator: template struct has_print_function { - typedef false_ value; + using value = false_; }; template struct has_print_function::type> { - typedef true_ value; + using value = true_; }; //@} @@ -255,9 +255,9 @@ class CORE_EXPORT CContainerPrinter : private CNonInstantiatable static std::string printElement(const T &value) { using namespace printer_detail; - typedef typename boost::unwrap_reference::type U; - typedef CNodePrinter::value, - CContainerPrinter> Printer; + using U = typename boost::unwrap_reference::type; + using Printer = CNodePrinter::value, + CContainerPrinter>; return Printer::print(boost::unwrap_ref(value)); } diff --git a/include/core/CDataAdder.h b/include/core/CDataAdder.h index 665230c737..7889bded99 100644 --- a/include/core/CDataAdder.h +++ b/include/core/CDataAdder.h @@ -40,10 +40,10 @@ namespace core class CORE_EXPORT CDataAdder : private CNonCopyable { public: - typedef boost::shared_ptr TOStreamP; - typedef boost::shared_ptr TDataAdderP; + using TOStreamP = boost::shared_ptr; + using TDataAdderP = boost::shared_ptr; - typedef std::function TPersistFunc; + using TPersistFunc = std::function; public: virtual ~CDataAdder(void); diff --git a/include/core/CDataSearcher.h b/include/core/CDataSearcher.h index d5e95d8d3c..b2077f8e11 100644 --- a/include/core/CDataSearcher.h +++ b/include/core/CDataSearcher.h @@ -37,10 +37,10 @@ namespace core class CORE_EXPORT CDataSearcher : private CNonCopyable { public: - typedef std::vector TStrVec; - typedef TStrVec::const_iterator TStrVecCItr; + using TStrVec = std::vector; + using TStrVecCItr = TStrVec::const_iterator; - typedef boost::shared_ptr TIStreamP; + using TIStreamP = boost::shared_ptr; public: //! Empty string diff --git a/include/core/CDetachedProcessSpawner.h b/include/core/CDetachedProcessSpawner.h index 0547265908..93dafd2591 100644 --- a/include/core/CDetachedProcessSpawner.h +++ b/include/core/CDetachedProcessSpawner.h @@ -69,9 +69,9 @@ class CTrackerThread; class CORE_EXPORT CDetachedProcessSpawner { public: - typedef std::vector TStrVec; + using TStrVec = std::vector; - typedef boost::shared_ptr TTrackerThreadP; + using TTrackerThreadP = boost::shared_ptr; public: //! Permitted paths may be relative or absolute, but each process must diff --git a/include/core/CDualThreadStreamBuf.h b/include/core/CDualThreadStreamBuf.h index 2013e509fe..652ef18b5c 100644 --- a/include/core/CDualThreadStreamBuf.h +++ b/include/core/CDualThreadStreamBuf.h @@ -134,7 +134,7 @@ class CORE_EXPORT CDualThreadStreamBuf : public std::streambuf private: //! Used to manage the two buffers. - typedef boost::scoped_array TScopedCharArray; + using TScopedCharArray = boost::scoped_array; //! Buffer that put functions will write to. TScopedCharArray m_WriteBuffer; diff --git a/include/core/CFlatPrefixTree.h b/include/core/CFlatPrefixTree.h index c70a41682d..cabe15c7b4 100644 --- a/include/core/CFlatPrefixTree.h +++ b/include/core/CFlatPrefixTree.h @@ -50,10 +50,10 @@ namespace core class CORE_EXPORT CFlatPrefixTree { public: - typedef std::vector TStrVec; - typedef TStrVec::const_iterator TStrVecCItr; - typedef std::string::const_iterator TStrCItr; - typedef std::string::const_reverse_iterator TStrCRItr; + using TStrVec = std::vector; + using TStrVecCItr = TStrVec::const_iterator; + using TStrCItr = std::string::const_iterator; + using TStrCRItr = std::string::const_reverse_iterator; private: struct SNode @@ -83,9 +83,9 @@ class CORE_EXPORT CFlatPrefixTree }; private: - typedef std::vector TNodeVec; - typedef TNodeVec::const_iterator TNodeVecCItr; - typedef std::vector TDistinctCharVec; + using TNodeVec = std::vector; + using TNodeVecCItr = TNodeVec::const_iterator; + using TDistinctCharVec = std::vector; public: //! Default constructor. diff --git a/include/core/CHashing.h b/include/core/CHashing.h index ebb7be01b7..d9a43feee1 100644 --- a/include/core/CHashing.h +++ b/include/core/CHashing.h @@ -46,7 +46,7 @@ class CORE_EXPORT CHashing : private CNonInstantiatable class CORE_EXPORT CUniversalHash { public: - typedef std::vector TUInt32Vec; + using TUInt32Vec = std::vector; public: //! A member of the universal (2-independent) hash family on @@ -96,7 +96,7 @@ class CORE_EXPORT CHashing : private CNonInstantiatable uint32_t m_M, m_A, m_B; }; - typedef std::vector TUInt32HashVec; + using TUInt32HashVec = std::vector; //! A lightweight implementation universal (2-independent) on //! 32-bit integers. This doesn't further restrict the range @@ -136,7 +136,7 @@ class CORE_EXPORT CHashing : private CNonInstantiatable uint32_t m_A, m_B; }; - typedef std::vector TUInt32UnrestrictedHashVec; + using TUInt32UnrestrictedHashVec = std::vector; //! A member of the universal (2-independent) hash family on //! vectors of integers (Carter and Wegman): @@ -212,7 +212,7 @@ class CORE_EXPORT CHashing : private CNonInstantiatable uint32_t m_B; }; - typedef std::vector TUInt32VecHashVec; + using TUInt32VecHashVec = std::vector; //! Converts hash function objects to a string. class CORE_EXPORT CToString @@ -421,7 +421,7 @@ class CORE_EXPORT CHashing : private CNonInstantiatable public: //! See CMemory. static bool dynamicSizeAlwaysZero(void) { return true; } - typedef boost::reference_wrapper TStrCRef; + using TStrCRef = boost::reference_wrapper; public: CMurmurHash2String(std::size_t seed = 0x5bd1e995) : m_Seed(seed) {} @@ -454,7 +454,7 @@ class CORE_EXPORT CHashing : private CNonInstantiatable public: //! See CMemory. static bool dynamicSizeAlwaysZero(void) { return true; } - typedef boost::reference_wrapper TStrCRef; + using TStrCRef = boost::reference_wrapper; public: CSafeMurmurHash2String64(uint64_t seed = 0x5bd1e995) : m_Seed(seed) {} diff --git a/include/core/CHexUtils.h b/include/core/CHexUtils.h index e97d38877d..604e0f8fd7 100644 --- a/include/core/CHexUtils.h +++ b/include/core/CHexUtils.h @@ -35,7 +35,7 @@ namespace core class CORE_EXPORT CHexUtils { public: - typedef std::vector TDataVec; + using TDataVec = std::vector; public: //! Construct an object of this class, which can then be output to a diff --git a/include/core/CJsonStatePersistInserter.h b/include/core/CJsonStatePersistInserter.h index a10e480508..7267fb5d2d 100644 --- a/include/core/CJsonStatePersistInserter.h +++ b/include/core/CJsonStatePersistInserter.h @@ -71,7 +71,7 @@ class CORE_EXPORT CJsonStatePersistInserter : public CStatePersistInserter //! JSON writer ostream wrapper rapidjson::OStreamWrapper m_WriteStream; - typedef core::CRapidJsonLineWriter TGenericLineWriter; + using TGenericLineWriter = core::CRapidJsonLineWriter; //! JSON writer TGenericLineWriter m_Writer; diff --git a/include/core/CLogger.h b/include/core/CLogger.h index a55427c31f..e94c5bc60c 100644 --- a/include/core/CLogger.h +++ b/include/core/CLogger.h @@ -137,8 +137,8 @@ class CORE_EXPORT CLogger : private CNonCopyable //! 3) %P with the program's process ID void massageProperties(log4cxx::helpers::Properties &props) const; - typedef std::map TLogCharLogStrMap; - typedef TLogCharLogStrMap::const_iterator TLogCharLogStrMapCItr; + using TLogCharLogStrMap = std::map; + using TLogCharLogStrMapCItr = TLogCharLogStrMap::const_iterator; //! Replace Ml specific mappings in a single string void massageString(const TLogCharLogStrMap &mappings, diff --git a/include/core/CMaskIterator.h b/include/core/CMaskIterator.h index 3b1ece250a..a5cd8171e3 100644 --- a/include/core/CMaskIterator.h +++ b/include/core/CMaskIterator.h @@ -39,12 +39,12 @@ class CMaskIterator : private boost::incrementable< CMaskIterator, boost::subtractable2< CMaskIterator, typename std::iterator_traits::difference_type > > > > { public: - typedef typename std::iterator_traits::difference_type difference_type; - typedef typename std::iterator_traits::value_type value_type; - typedef typename std::iterator_traits::pointer pointer; - typedef typename std::iterator_traits::reference reference; - typedef typename std::iterator_traits::iterator_category iterator_category; - typedef std::vector TDifferenceVec; + using difference_type = typename std::iterator_traits::difference_type; + using value_type = typename std::iterator_traits::value_type; + using pointer = typename std::iterator_traits::pointer; + using reference = typename std::iterator_traits::reference; + using iterator_category = typename std::iterator_traits::iterator_category; + using TDifferenceVec = std::vector; public: CMaskIterator(ITR begin, const TDifferenceVec &mask, difference_type index) : diff --git a/include/core/CMemory.h b/include/core/CMemory.h index 5d3ef10a76..69f0bbec2a 100644 --- a/include/core/CMemory.h +++ b/include/core/CMemory.h @@ -66,13 +66,13 @@ const std::size_t MIN_DEQUE_PAGE_VEC_ENTRIES = 8; template struct enable_if_member_function { - typedef R type; + using type = R; }; template struct enable_if_function { - typedef R type; + using type = R; }; //! \brief Default template declaration for CMemoryDynamicSize::dispatch. diff --git a/include/core/CMemoryUsage.h b/include/core/CMemoryUsage.h index 32dabdbd62..62b979ee7a 100644 --- a/include/core/CMemoryUsage.h +++ b/include/core/CMemoryUsage.h @@ -61,12 +61,12 @@ class CORE_EXPORT CMemoryUsage std::size_t s_Unused; }; - typedef CMemoryUsage* TMemoryUsagePtr; - typedef std::list TMemoryUsagePtrList; - typedef TMemoryUsagePtrList::const_iterator TMemoryUsagePtrListCItr; - typedef TMemoryUsagePtrList::iterator TMemoryUsagePtrListItr; - typedef std::vector TMemoryUsageVec; - typedef TMemoryUsageVec::const_iterator TMemoryUsageVecCitr; + using TMemoryUsagePtr = CMemoryUsage*; + using TMemoryUsagePtrList = std::list; + using TMemoryUsagePtrListCItr = TMemoryUsagePtrList::const_iterator; + using TMemoryUsagePtrListItr = TMemoryUsagePtrList::iterator; + using TMemoryUsageVec = std::vector; + using TMemoryUsageVecCitr = TMemoryUsageVec::const_iterator; public: //! Constructor diff --git a/include/core/CMemoryUsageJsonWriter.h b/include/core/CMemoryUsageJsonWriter.h index 58c6403285..431cccb414 100644 --- a/include/core/CMemoryUsageJsonWriter.h +++ b/include/core/CMemoryUsageJsonWriter.h @@ -64,7 +64,7 @@ class CORE_EXPORT CMemoryUsageJsonWriter //! JSON writer ostream wrapper rapidjson::OStreamWrapper m_WriteStream; - typedef CRapidJsonLineWriter TGenericLineWriter; + using TGenericLineWriter = CRapidJsonLineWriter; //! JSON writer TGenericLineWriter m_Writer; diff --git a/include/core/CMessageBuffer.h b/include/core/CMessageBuffer.h index 136dae0b29..7f436a18ae 100644 --- a/include/core/CMessageBuffer.h +++ b/include/core/CMessageBuffer.h @@ -100,7 +100,7 @@ class CMessageBuffer protected: void run(void) { - typedef std::vector TMessageVec; + using TMessageVec = std::vector; m_MessageBuffer.m_Mutex.lock(); diff --git a/include/core/CMessageQueue.h b/include/core/CMessageQueue.h index 4e799c24c3..a3cfa14788 100644 --- a/include/core/CMessageQueue.h +++ b/include/core/CMessageQueue.h @@ -318,7 +318,7 @@ class CMessageQueue CCondition m_Condition; RECEIVER &m_Receiver; - typedef std::queue TMessageQueue; + using TMessageQueue = std::queue; TMessageQueue m_Queue; @@ -328,7 +328,7 @@ class CMessageQueue //! A stop watch for timing how long it takes to process messages CStopWatch m_StopWatch; - typedef boost::circular_buffer TUIntCircBuf; + using TUIntCircBuf = boost::circular_buffer; //! Stop watch readings TUIntCircBuf m_Readings; diff --git a/include/core/CNamedPipeFactory.h b/include/core/CNamedPipeFactory.h index 9cc09bdedc..83f4e163a9 100644 --- a/include/core/CNamedPipeFactory.h +++ b/include/core/CNamedPipeFactory.h @@ -60,9 +60,9 @@ namespace core class CORE_EXPORT CNamedPipeFactory : private CNonInstantiatable { public: - typedef boost::shared_ptr TIStreamP; - typedef boost::shared_ptr TOStreamP; - typedef boost::shared_ptr TFileP; + using TIStreamP = boost::shared_ptr; + using TOStreamP = boost::shared_ptr; + using TFileP = boost::shared_ptr; public: //! Character that can safely be used to test whether named pipes are @@ -97,9 +97,9 @@ class CORE_EXPORT CNamedPipeFactory : private CNonInstantiatable private: #ifdef Windows - typedef HANDLE TPipeHandle; + using TPipeHandle = HANDLE; #else - typedef int TPipeHandle; + using TPipeHandle = int; #endif private: diff --git a/include/core/COsFileFuncs.h b/include/core/COsFileFuncs.h index be044a82ce..dccbcc6d1f 100644 --- a/include/core/COsFileFuncs.h +++ b/include/core/COsFileFuncs.h @@ -80,30 +80,30 @@ class CORE_EXPORT COsFileFuncs : private CNonInstantiatable public: //! Signed size type (to be used instead of ssize_t) #ifdef Windows - typedef int TSignedSize; + using TSignedSize = int; #else - typedef ssize_t TSignedSize; + using TSignedSize = ssize_t; #endif //! Offset type (to be used instead of off_t) #ifdef Windows - typedef __int64 TOffset; + using TOffset = __int64; #else - typedef off_t TOffset; + using TOffset = off_t; #endif //! Mode type (to be used instead of mode_t) #ifdef Windows - typedef int TMode; + using TMode = int; #else - typedef mode_t TMode; + using TMode = mode_t; #endif //! Inode type (to be used instead of ino_t) #ifdef Windows - typedef uint64_t TIno; + using TIno = uint64_t; #else - typedef ino_t TIno; + using TIno = ino_t; #endif //! Stat buffer struct (to be used instead of struct stat) @@ -126,9 +126,9 @@ class CORE_EXPORT COsFileFuncs : private CNonInstantiatable __time64_t st_ctime; }; - typedef SStat TStat; + using TStat = SStat; #else - typedef struct stat TStat; + using TStat = struct stat; #endif public: diff --git a/include/core/CPatternSet.h b/include/core/CPatternSet.h index 6602a88295..96499a576c 100644 --- a/include/core/CPatternSet.h +++ b/include/core/CPatternSet.h @@ -40,9 +40,9 @@ namespace core class CORE_EXPORT CPatternSet { public: - typedef std::vector TStrVec; - typedef TStrVec::const_iterator TStrVecCItr; - typedef std::string::const_iterator TStrCItr; + using TStrVec = std::vector; + using TStrVecCItr = TStrVec::const_iterator; + using TStrCItr = std::string::const_iterator; public: //! Default constructor. diff --git a/include/core/CPersistUtils.h b/include/core/CPersistUtils.h index f955ea0256..fea68dd6f5 100644 --- a/include/core/CPersistUtils.h +++ b/include/core/CPersistUtils.h @@ -43,14 +43,14 @@ const std::string SIZE_TAG("d"); template struct remove_const { - typedef typename boost::remove_const::type type; + using type = typename boost::remove_const::type; }; template struct remove_const > { - typedef std::pair::type, - typename remove_const::type> type; + using type = std::pair::type, + typename remove_const::type>; }; //! Template specialisation utility classes for selecting various @@ -69,7 +69,7 @@ class MemberFromDelimited {}; template struct enable_if { - typedef R type; + using type = R; }; //! Auxiliary type used by has_persist_function to test for a nested @@ -77,7 +77,7 @@ struct enable_if template struct enable_if_is { - typedef R type; + using type = R; }; @@ -87,12 +87,12 @@ struct enable_if_is template struct persist_container_selector { - typedef BasicPersist value; + using value = BasicPersist; }; template struct persist_container_selector::type> { - typedef ContainerPersist value; + using value = ContainerPersist; }; //@} @@ -101,17 +101,17 @@ struct persist_container_selector struct persist_selector { - typedef typename persist_container_selector::value value; + using value = typename persist_container_selector::value; }; template struct persist_selector::type> { - typedef MemberPersist value; + using value = MemberPersist; }; template struct persist_selector::type> { - typedef MemberToDelimited value; + using value = MemberToDelimited; }; //@} @@ -133,12 +133,12 @@ bool persist(const std::string &tag, const T &target, CStatePersistInserter &ins template struct restore_container_selector { - typedef BasicRestore value; + using value = BasicRestore; }; template struct restore_container_selector::type> { - typedef ContainerRestore value; + using value = ContainerRestore; }; //@} @@ -147,17 +147,17 @@ struct restore_container_selector struct restore_selector { - typedef typename restore_container_selector::value value; + using value = typename restore_container_selector::value; }; template struct restore_selector::type> { - typedef MemberRestore value; + using value = MemberRestore; }; template struct restore_selector::type> { - typedef MemberFromDelimited value; + using value = MemberFromDelimited; }; //@} @@ -185,12 +185,12 @@ class CanReserve {}; template struct reserve_selector { - typedef ENABLE value; + using value = ENABLE; }; template struct reserve_selector::type> { - typedef CanReserve value; + using value = CanReserve; }; //@} @@ -631,7 +631,7 @@ class CORE_EXPORT CPersistUtils const char delimiter = DELIMITER, bool append = false) { - typedef typename persist_utils_detail::remove_const::type T; + using T = typename persist_utils_detail::remove_const::type; if (!append) { @@ -835,9 +835,9 @@ class CPersisterImpl const boost::unordered_set &container, CStatePersistInserter &inserter) { - typedef typename std::vector TVec; - typedef typename boost::unordered_set::const_iterator TCItr; - typedef typename std::vector TCItrVec; + using TVec = typename std::vector; + using TCItr = typename boost::unordered_set::const_iterator; + using TCItrVec = typename std::vector; if (boost::is_arithmetic::value) { @@ -867,8 +867,8 @@ class CPersisterImpl const boost::unordered_map &container, CStatePersistInserter &inserter) { - typedef typename boost::unordered_map::const_iterator TCItr; - typedef typename std::vector TCItrVec; + using TCItr = typename boost::unordered_map::const_iterator; + using TCItrVec = typename std::vector; TCItrVec iterators; iterators.reserve(container.size()); @@ -917,7 +917,7 @@ class CPersisterImpl boost::false_type, boost::false_type) { - typedef typename T::const_iterator TCItr; + using TCItr = typename T::const_iterator; inserter.insertLevel(tag, boost::bind(&newLevel, container.begin(), container.end(), container.size(), _1)); } @@ -933,7 +933,7 @@ class CPersisterImpl boost::false_type, boost::true_type) { - typedef boost::indirect_iterator TCItr; + using TCItr = boost::indirect_iterator; inserter.insertLevel(tag, boost::bind(&newLevel, TCItr(t.begin()), TCItr(t.end()), t.size(), _1)); } @@ -1098,7 +1098,7 @@ class CRestorerImpl template bool operator()(T &container, CStateRestoreTraverser &traverser) { - typedef typename remove_const::type TValueType; + using TValueType = typename remove_const::type; do { if (traverser.name() == SIZE_TAG) @@ -1131,7 +1131,7 @@ class CRestorerImpl template bool operator()(boost::array &container, CStateRestoreTraverser &traverser) { - typedef typename remove_const::type TValueType; + using TValueType = typename remove_const::type; typename boost::array::iterator i = container.begin(); do { diff --git a/include/core/CPolymorphicStackObjectCPtr.h b/include/core/CPolymorphicStackObjectCPtr.h index 54ca3d974d..a3a5a8c8a4 100644 --- a/include/core/CPolymorphicStackObjectCPtr.h +++ b/include/core/CPolymorphicStackObjectCPtr.h @@ -31,11 +31,11 @@ template::type TConstBase; - typedef const typename boost::remove_const::type TConstD1; - typedef const typename boost::remove_const::type TConstD2; - typedef const typename boost::remove_const::type TConstD3; - typedef const typename boost::remove_const::type TConstD4; + using TConstBase = const typename boost::remove_const::type; + using TConstD1 = const typename boost::remove_const::type; + using TConstD2 = const typename boost::remove_const::type; + using TConstD3 = const typename boost::remove_const::type; + using TConstD4 = const typename boost::remove_const::type; public: CPolymorphicStackObjectCPtr(void) : m_Storage(CNullPolymorphicStackObjectCPtr()) {} @@ -109,7 +109,7 @@ class CPolymorphicStackObjectCPtr } private: - typedef boost::variant TStorage; + using TStorage = boost::variant; private: //! The static storage of the actual type. diff --git a/include/core/CProcess.h b/include/core/CProcess.h index 01573bef45..c197d01f43 100644 --- a/include/core/CProcess.h +++ b/include/core/CProcess.h @@ -52,20 +52,20 @@ class CORE_EXPORT CProcess : private CNonCopyable public: //! Prototype of the mlMain() function - typedef int (*TMlMainFunc)(int, char *[]); + using TMlMainFunc = int (*)(int, char *[]); //! Vector of process arguments - typedef std::vector TStrVec; - typedef TStrVec::const_iterator TStrVecCItr; + using TStrVec = std::vector; + using TStrVecCItr = TStrVec::const_iterator; //! The shutdown function - typedef std::function TShutdownFunc; + using TShutdownFunc = std::function; //! Process ID type #ifdef Windows - typedef DWORD TPid; + using TPid = DWORD; #else - typedef pid_t TPid; + using TPid = pid_t; #endif public: diff --git a/include/core/CRapidJsonWriterBase.h b/include/core/CRapidJsonWriterBase.h index 3b2856a512..fb11a57c69 100644 --- a/include/core/CRapidJsonWriterBase.h +++ b/include/core/CRapidJsonWriterBase.h @@ -68,24 +68,24 @@ template { public: - typedef std::vector TTimeVec; - typedef std::vector TStrVec; - typedef std::vector TDoubleVec; - typedef std::pair TDoubleDoublePr; - typedef std::vector TDoubleDoublePrVec; - typedef std::pair TDoubleDoubleDoublePrPr; - typedef std::vector TDoubleDoubleDoublePrPrVec; - typedef boost::unordered_set TStrUSet; - typedef rapidjson::Document TDocument; - typedef rapidjson::Value TValue; - typedef boost::weak_ptr TDocumentWeakPtr; - typedef boost::shared_ptr TValuePtr; - - typedef boost::shared_ptr TPoolAllocatorPtr; - typedef std::stack< TPoolAllocatorPtr > TPoolAllocatorPtrStack; - typedef boost::unordered_map< std::string, TPoolAllocatorPtr> TStrPoolAllocatorPtrMap; - typedef TStrPoolAllocatorPtrMap::iterator TStrPoolAllocatorPtrMapItr; - typedef std::pair TStrPoolAllocatorPtrMapItrBoolPr; + using TTimeVec = std::vector; + using TStrVec = std::vector; + using TDoubleVec = std::vector; + using TDoubleDoublePr = std::pair; + using TDoubleDoublePrVec = std::vector; + using TDoubleDoubleDoublePrPr = std::pair; + using TDoubleDoubleDoublePrPrVec = std::vector; + using TStrUSet = boost::unordered_set; + using TDocument = rapidjson::Document; + using TValue = rapidjson::Value; + using TDocumentWeakPtr = boost::weak_ptr; + using TValuePtr = boost::shared_ptr; + + using TPoolAllocatorPtr = boost::shared_ptr; + using TPoolAllocatorPtrStack = std::stack< TPoolAllocatorPtr >; + using TStrPoolAllocatorPtrMap = boost::unordered_map< std::string, TPoolAllocatorPtr>; + using TStrPoolAllocatorPtrMapItr = TStrPoolAllocatorPtrMap::iterator; + using TStrPoolAllocatorPtrMapItrBoolPr = std::pair; public: diff --git a/include/core/CRapidXmlParser.h b/include/core/CRapidXmlParser.h index 7dc623061b..f19aac7c56 100644 --- a/include/core/CRapidXmlParser.h +++ b/include/core/CRapidXmlParser.h @@ -65,8 +65,8 @@ class CRapidXmlStateRestoreTraverser; class CORE_EXPORT CRapidXmlParser : public CXmlParserIntf { public: - typedef std::map TStrStrMap; - typedef TStrStrMap::const_iterator TStrStrMapCItr; + using TStrStrMap = std::map; + using TStrStrMapCItr = TStrStrMap::const_iterator; public: CRapidXmlParser(void); @@ -135,9 +135,9 @@ class CORE_EXPORT CRapidXmlParser : public CXmlParserIntf std::string &result); private: - typedef rapidxml::xml_document TCharRapidXmlDocument; - typedef rapidxml::xml_node TCharRapidXmlNode; - typedef rapidxml::xml_attribute TCharRapidXmlAttribute; + using TCharRapidXmlDocument = rapidxml::xml_document; + using TCharRapidXmlNode = rapidxml::xml_node; + using TCharRapidXmlAttribute = rapidxml::xml_attribute; //! Called recursively by the public toNodeHierarchy() method bool toNodeHierarchy(const TCharRapidXmlNode &parentNode, @@ -166,7 +166,7 @@ class CORE_EXPORT CRapidXmlParser : public CXmlParserIntf //! than in a string to avoid any problems with reference counting in //! STL strings. (Obviously the template parameter here needs to match //! the rapidxml typedef template arguments in the typedefs above.) - typedef boost::scoped_array TScopedCharArray; + using TScopedCharArray = boost::scoped_array; //! RapidXml parses the XML in-situ, so keep a copy of the input TScopedCharArray m_XmlBuf; diff --git a/include/core/CRapidXmlStatePersistInserter.h b/include/core/CRapidXmlStatePersistInserter.h index 7867c2b280..4e9080e2c3 100644 --- a/include/core/CRapidXmlStatePersistInserter.h +++ b/include/core/CRapidXmlStatePersistInserter.h @@ -35,8 +35,8 @@ namespace core class CORE_EXPORT CRapidXmlStatePersistInserter : public CStatePersistInserter { public: - typedef std::map TStrStrMap; - typedef TStrStrMap::const_iterator TStrStrMapCItr; + using TStrStrMap = std::map; + using TStrStrMapCItr = TStrStrMap::const_iterator; public: //! Root node has no attributes @@ -76,8 +76,8 @@ class CORE_EXPORT CRapidXmlStatePersistInserter : public CStatePersistInserter //! so just store each unique name once for efficiency CStringCache m_NameCache; - typedef rapidxml::xml_document TCharRapidXmlDocument; - typedef rapidxml::xml_node TCharRapidXmlNode; + using TCharRapidXmlDocument = rapidxml::xml_document; + using TCharRapidXmlNode = rapidxml::xml_node; //! The RapidXml data structure TCharRapidXmlDocument m_Doc; diff --git a/include/core/CRegex.h b/include/core/CRegex.h index 7ae39881bd..0acbdcbdc9 100644 --- a/include/core/CRegex.h +++ b/include/core/CRegex.h @@ -31,9 +31,9 @@ namespace core class CORE_EXPORT CRegex { public: - typedef std::vector TStrVec; - typedef TStrVec::iterator TStrVecItr; - typedef TStrVec::const_iterator TStrVecCItr; + using TStrVec = std::vector; + using TStrVecItr = TStrVec::iterator; + using TStrVecCItr = TStrVec::const_iterator; public: CRegex(void); diff --git a/include/core/CRegexFilter.h b/include/core/CRegexFilter.h index 9252fdc235..e0ce7deeaa 100644 --- a/include/core/CRegexFilter.h +++ b/include/core/CRegexFilter.h @@ -32,8 +32,8 @@ namespace core class CORE_EXPORT CRegexFilter { public: - typedef std::vector TRegexVec; - typedef std::vector TStrVec; + using TRegexVec = std::vector; + using TStrVec = std::vector; public: CRegexFilter(void); diff --git a/include/core/CStateCompressor.h b/include/core/CStateCompressor.h index a07d86a769..eb6a072b88 100644 --- a/include/core/CStateCompressor.h +++ b/include/core/CStateCompressor.h @@ -48,15 +48,15 @@ class CORE_EXPORT CStateCompressor : public CDataAdder static const std::string END_OF_STREAM_ATTRIBUTE; public: - typedef boost::iostreams::filtering_stream TFilteredOutput; - typedef boost::shared_ptr TFilteredOutputP; - typedef boost::shared_ptr TCompressOStreamP; + using TFilteredOutput = boost::iostreams::filtering_stream; + using TFilteredOutputP = boost::shared_ptr; + using TCompressOStreamP = boost::shared_ptr; // Implements the boost::iostreams Sink template interface class CChunkFilter { public: - typedef char char_type; + using char_type = char; //! Inform the filtering_stream owning object what this is capable of struct category : diff --git a/include/core/CStateDecompressor.h b/include/core/CStateDecompressor.h index baad0a063a..6e372b329a 100644 --- a/include/core/CStateDecompressor.h +++ b/include/core/CStateDecompressor.h @@ -44,8 +44,8 @@ namespace core class CORE_EXPORT CStateDecompressor : public CDataSearcher { public: - typedef boost::iostreams::filtering_stream TFilteredInput; - typedef boost::shared_ptr TFilteredInputP; + using TFilteredInput = boost::iostreams::filtering_stream; + using TFilteredInputP = boost::shared_ptr; static const std::string EMPTY_DATA; @@ -53,7 +53,7 @@ class CORE_EXPORT CStateDecompressor : public CDataSearcher class CDechunkFilter { public: - typedef char char_type; + using char_type = char; //! Inform the filtering_stream owning object what this is capable of struct category : diff --git a/include/core/CStateMachine.h b/include/core/CStateMachine.h index e5e1ef984b..799ce219db 100644 --- a/include/core/CStateMachine.h +++ b/include/core/CStateMachine.h @@ -67,9 +67,9 @@ class CStateRestoreTraverser; class CORE_EXPORT CStateMachine { public: - typedef std::vector TSizeVec; - typedef std::vector TSizeVecVec; - typedef std::vector TStrVec; + using TSizeVec = std::vector; + using TSizeVecVec = std::vector; + using TStrVec = std::vector; public: //! Set the number of machines we expect the program to use. @@ -198,8 +198,8 @@ class CORE_EXPORT CStateMachine void clear(void); private: - typedef std::vector TMachineVec; - typedef std::list TMachineVecList; + using TMachineVec = std::vector; + using TMachineVecList = std::list; private: //! The vector capacity. diff --git a/include/core/CStatistics.h b/include/core/CStatistics.h index 7dc9805207..028281052d 100644 --- a/include/core/CStatistics.h +++ b/include/core/CStatistics.h @@ -132,7 +132,7 @@ class CORE_EXPORT CStatistics : private CNonCopyable //@} private: - typedef boost::array TStatArray; + using TStatArray = boost::array; private: //! Constructor of a Singleton is private diff --git a/include/core/CStringCache.h b/include/core/CStringCache.h index d9ca7f310d..e5fde5b4a4 100644 --- a/include/core/CStringCache.h +++ b/include/core/CStringCache.h @@ -124,8 +124,8 @@ class CORE_EXPORT CStringCache //! strings bool m_HaveCopyOnWriteStrings; - typedef boost::unordered_set TStrUSet; - typedef TStrUSet::const_iterator TStrUSetCItr; + using TStrUSet = boost::unordered_set; + using TStrUSetCItr = TStrUSet::const_iterator; //! The cache of strings TStrUSet m_Cache; diff --git a/include/core/CStringSimilarityTester.h b/include/core/CStringSimilarityTester.h index 15baddacbe..841339ddab 100644 --- a/include/core/CStringSimilarityTester.h +++ b/include/core/CStringSimilarityTester.h @@ -71,11 +71,11 @@ class CORE_EXPORT CStringSimilarityTester : private CNonCopyable { public: //! Used by the simple Levenshtein distance algorithm - typedef boost::scoped_array TScopedSizeArray; + using TScopedSizeArray = boost::scoped_array; //! Used by the more advanced Berghel-Roach algorithm - typedef boost::scoped_array TScopedIntArray; - typedef boost::scoped_array TScopedIntPArray; + using TScopedIntArray = boost::scoped_array; + using TScopedIntPArray = boost::scoped_array; public: CStringSimilarityTester(void); @@ -261,7 +261,7 @@ class CORE_EXPORT CStringSimilarityTester : private CNonCopyable // one go for efficiency. Then the current and previous column // pointers alternate between pointing and the first and second half // of the memory block. - typedef boost::scoped_array TScopedSizeArray; + using TScopedSizeArray = boost::scoped_array; TScopedSizeArray data(new size_t[(secondLen + 1) * 2]); size_t *currentCol(data.get()); size_t *prevCol(currentCol + (secondLen + 1)); diff --git a/include/core/CStringUtils.h b/include/core/CStringUtils.h index 9581b2a77a..4b05465abd 100644 --- a/include/core/CStringUtils.h +++ b/include/core/CStringUtils.h @@ -38,9 +38,9 @@ class CORE_EXPORT CStringUtils : private CNonInstantiatable static const std::string WHITESPACE_CHARS; public: - typedef std::vector TStrVec; - typedef TStrVec::iterator TStrVecItr; - typedef TStrVec::const_iterator TStrVecCItr; + using TStrVec = std::vector; + using TStrVecItr = TStrVec::iterator; + using TStrVecCItr = TStrVec::const_iterator; public: //! If \p c is the start of a UTF-8 character, return the number of diff --git a/include/core/CThread.h b/include/core/CThread.h index 894ccad069..30c5fb7b7a 100644 --- a/include/core/CThread.h +++ b/include/core/CThread.h @@ -37,11 +37,11 @@ class CORE_EXPORT CThread : private CNonCopyable public: //! Thread ID type #ifdef Windows - typedef DWORD TThreadId; - typedef unsigned int TThreadRet; + using TThreadId = DWORD; + using TThreadRet = unsigned int; #else - typedef pthread_t TThreadId; - typedef void *TThreadRet; + using TThreadId = pthread_t; + using TThreadRet = void*; #endif public: diff --git a/include/core/CThreadFarm.h b/include/core/CThreadFarm.h index 89d46b6af7..79c1fdec6d 100644 --- a/include/core/CThreadFarm.h +++ b/include/core/CThreadFarm.h @@ -238,16 +238,16 @@ class CThreadFarm : private CNonCopyable //! Reference to the object that will handle the results HANDLER &m_Handler; - typedef CThreadFarm TThreadFarm; + using TThreadFarm = CThreadFarm; - typedef CThreadFarmReceiver TReceiver; - typedef boost::shared_ptr TReceiverP; - typedef std::vector TReceiverPVec; - typedef typename TReceiverPVec::iterator TReceiverPVecItr; + using TReceiver = CThreadFarmReceiver; + using TReceiverP = boost::shared_ptr; + using TReceiverPVec = std::vector; + using TReceiverPVecItr = typename TReceiverPVec::iterator; - typedef boost::shared_ptr< CMessageQueue > TMessageQueueP; - typedef std::vector TMessageQueuePVec; - typedef typename TMessageQueuePVec::iterator TMessageQueuePVecItr; + using TMessageQueueP = boost::shared_ptr< CMessageQueue >; + using TMessageQueuePVec = std::vector; + using TMessageQueuePVecItr = typename TMessageQueuePVec::iterator; TReceiverPVec m_Receivers; diff --git a/include/core/CTimeUtils.h b/include/core/CTimeUtils.h index 6130b20f39..4a8807cbad 100644 --- a/include/core/CTimeUtils.h +++ b/include/core/CTimeUtils.h @@ -107,7 +107,7 @@ class CORE_EXPORT CTimeUtils : private CNonInstantiatable //! value of this variable has made its way into every thread). static volatile CDateWordCache *ms_Instance; - typedef boost::unordered_set TStrUSet; + using TStrUSet = boost::unordered_set; //! Our cache of date words TStrUSet m_DateWords; diff --git a/include/core/CWordDictionary.h b/include/core/CWordDictionary.h index 54d17d112f..cfbcfbb489 100644 --- a/include/core/CWordDictionary.h +++ b/include/core/CWordDictionary.h @@ -87,7 +87,7 @@ class CORE_EXPORT CWordDictionary : private CNonCopyable } }; - typedef CWeightAll<2> TWeightAll2; + using TWeightAll2 = CWeightAll<2>; //! Functor for weighting one type of dictionary word by a certain //! amount and all dictionary words by a different amount @@ -107,7 +107,7 @@ class CORE_EXPORT CWordDictionary : private CNonCopyable } }; - typedef CWeightOnePart TWeightVerbs5Other2; + using TWeightVerbs5Other2 = CWeightOnePart; //! Functor for weighting two types of dictionary word by certain //! amounts and all dictionary words by a different amount @@ -189,11 +189,11 @@ class CORE_EXPORT CWordDictionary : private CNonCopyable //! Stores the dictionary words - using a multi-index even though //! there's only one index, because of its flexible key extractors. //! The key is the string, but hashed and compared ignoring case. - typedef boost::unordered_map TStrUMap; - typedef TStrUMap::const_iterator TStrUMapCItr; + using TStrUMap = boost::unordered_map; + using TStrUMapCItr = TStrUMap::const_iterator; //! Our dictionary of words TStrUMap m_DictionaryWords; diff --git a/include/core/CXmlNode.h b/include/core/CXmlNode.h index e96ac09a9b..09df73217d 100644 --- a/include/core/CXmlNode.h +++ b/include/core/CXmlNode.h @@ -41,11 +41,11 @@ class CXmlParser; class CORE_EXPORT CXmlNode { public: - typedef std::map TStrStrMap; - typedef std::pair TStrStrPr; - typedef std::vector TStrStrPrVec; - typedef TStrStrPrVec::iterator TStrStrPrVecItr; - typedef TStrStrPrVec::const_iterator TStrStrPrVecCItr; + using TStrStrMap = std::map; + using TStrStrPr = std::pair; + using TStrStrPrVec = std::vector; + using TStrStrPrVecItr = TStrStrPrVec::iterator; + using TStrStrPrVecCItr = TStrStrPrVec::const_iterator; private: class CFirstElementEquals diff --git a/include/core/CXmlNodeWithChildren.h b/include/core/CXmlNodeWithChildren.h index c43c86fe22..6e6ab2db03 100644 --- a/include/core/CXmlNodeWithChildren.h +++ b/include/core/CXmlNodeWithChildren.h @@ -33,11 +33,11 @@ class CXmlNodeWithChildrenPool; class CORE_EXPORT CXmlNodeWithChildren : public CXmlNode { public: - typedef boost::shared_ptr TXmlNodeWithChildrenP; + using TXmlNodeWithChildrenP = boost::shared_ptr; - typedef std::vector TChildNodePVec; - typedef TChildNodePVec::iterator TChildNodePVecItr; - typedef TChildNodePVec::const_iterator TChildNodePVecCItr; + using TChildNodePVec = std::vector; + using TChildNodePVecItr = TChildNodePVec::iterator; + using TChildNodePVecCItr = TChildNodePVec::const_iterator; public: CXmlNodeWithChildren(void); diff --git a/include/core/CXmlParser.h b/include/core/CXmlParser.h index e9c58e84bf..a20c088731 100644 --- a/include/core/CXmlParser.h +++ b/include/core/CXmlParser.h @@ -66,20 +66,20 @@ class CORE_EXPORT CXmlParser : public CXmlParserIntf static const char *INDENT_SPACE_STR; public: - typedef std::vector TStrVec; - typedef TStrVec::iterator TStrVecItr; - typedef TStrVec::const_iterator TStrVecCItr; + using TStrVec = std::vector; + using TStrVecItr = TStrVec::iterator; + using TStrVecCItr = TStrVec::const_iterator; - typedef std::set TStrSet; - typedef TStrSet::iterator TStrSetItr; - typedef TStrSet::const_iterator TStrSetCItr; + using TStrSet = std::set; + using TStrSetItr = TStrSet::iterator; + using TStrSetCItr = TStrSet::const_iterator; - typedef std::vector TXmlNodeVec; - typedef TXmlNodeVec::iterator TXmlNodeVecItr; - typedef TXmlNodeVec::const_iterator TXmlNodeVecCItr; + using TXmlNodeVec = std::vector; + using TXmlNodeVecItr = TXmlNodeVec::iterator; + using TXmlNodeVecCItr = TXmlNodeVec::const_iterator; - typedef std::map TStrStrMap; - typedef TStrStrMap::const_iterator TStrStrMapCItr; + using TStrStrMap = std::map; + using TStrStrMapCItr = TStrStrMap::const_iterator; public: CXmlParser(void); diff --git a/include/core/CoreTypes.h b/include/core/CoreTypes.h index 2f3fb460c2..d95a55bc17 100644 --- a/include/core/CoreTypes.h +++ b/include/core/CoreTypes.h @@ -17,7 +17,7 @@ namespace core_t //! For now just use seconds as the ml time granularity //! This is a UTC value -typedef time_t TTime; +using TTime = time_t; //! The standard line ending for the platform - DON'T make this std::string as diff --git a/include/maths/CAgglomerativeClusterer.h b/include/maths/CAgglomerativeClusterer.h index f478d7a9ce..e2128bd644 100644 --- a/include/maths/CAgglomerativeClusterer.h +++ b/include/maths/CAgglomerativeClusterer.h @@ -41,12 +41,12 @@ namespace maths class MATHS_EXPORT CAgglomerativeClusterer { public: - typedef std::vector TDoubleVec; - typedef std::vector TDoubleVecVec; - typedef std::vector TSizeVec; - typedef std::vector TSizeVecVec; - typedef std::pair TDoubleSizeVecPr; - typedef std::vector TDoubleSizeVecPrVec; + using TDoubleVec = std::vector; + using TDoubleVecVec = std::vector; + using TSizeVec = std::vector; + using TSizeVecVec = std::vector; + using TDoubleSizeVecPr = std::pair; + using TDoubleSizeVecPrVec = std::vector; //! \brief A representation of a node in the tree of clusters. class MATHS_EXPORT CNode @@ -97,7 +97,7 @@ class MATHS_EXPORT CAgglomerativeClusterer double m_Height; }; - typedef std::vector TNodeVec; + using TNodeVec = std::vector; public: //! Possible clustering objective functions supported. diff --git a/include/maths/CAnnotatedVector.h b/include/maths/CAnnotatedVector.h index 9a10b69fbb..76f7b891b8 100644 --- a/include/maths/CAnnotatedVector.h +++ b/include/maths/CAnnotatedVector.h @@ -26,8 +26,8 @@ template class CAnnotatedVector : public VECTOR { public: - typedef ANNOTATION TAnnotation; - typedef typename SCoordinate::Type TCoordinate; + using TAnnotation = ANNOTATION; + using TCoordinate = typename SCoordinate::Type; //! See core::CMemory. static bool dynamicSizeAlwaysZero(void) diff --git a/include/maths/CAssignment.h b/include/maths/CAssignment.h index 71a5e32d32..99fa0baefd 100644 --- a/include/maths/CAssignment.h +++ b/include/maths/CAssignment.h @@ -26,10 +26,10 @@ namespace maths class MATHS_EXPORT CAssignment { public: - typedef std::vector TDoubleVec; - typedef std::vector TDoubleVecVec; - typedef std::pair TSizeSizePr; - typedef std::vector TSizeSizePrVec; + using TDoubleVec = std::vector; + using TDoubleVecVec = std::vector; + using TSizeSizePr = std::pair; + using TSizeSizePrVec = std::vector; public: //! \brief The Kuhn-Munkres algorithm for solving the diff --git a/include/maths/CBjkstUniqueValues.h b/include/maths/CBjkstUniqueValues.h index a1ec9177cc..c6c8f6d1b3 100644 --- a/include/maths/CBjkstUniqueValues.h +++ b/include/maths/CBjkstUniqueValues.h @@ -74,7 +74,7 @@ namespace maths class MATHS_EXPORT CBjkstUniqueValues { public: - typedef core::CHashing::CUniversalHash::TUInt32UnrestrictedHashVec TUInt32HashVec; + using TUInt32HashVec = core::CHashing::CUniversalHash::TUInt32UnrestrictedHashVec; public: //! Get the count of trailing zeros in value. @@ -118,11 +118,11 @@ class MATHS_EXPORT CBjkstUniqueValues std::size_t memoryUsage(void) const; private: - typedef std::vector TUInt8Vec; - typedef std::vector TUInt8VecVec; - typedef std::vector TUInt32Vec; - typedef TUInt32Vec::iterator TUInt32VecItr; - typedef TUInt32Vec::const_iterator TUInt32VecCItr; + using TUInt8Vec = std::vector; + using TUInt8VecVec = std::vector; + using TUInt32Vec = std::vector; + using TUInt32VecItr = TUInt32Vec::iterator; + using TUInt32VecCItr = TUInt32Vec::const_iterator; //! Wraps up the sketch data. struct MATHS_EXPORT SSketch @@ -159,7 +159,7 @@ class MATHS_EXPORT CBjkstUniqueValues TUInt8VecVec s_B; }; - typedef boost::variant TUInt32VecOrSketch; + using TUInt32VecOrSketch = boost::variant; private: //! Maybe switch to sketching the distinct value set. diff --git a/include/maths/CBootstrapClusterer.h b/include/maths/CBootstrapClusterer.h index fe55406f90..5e82691180 100644 --- a/include/maths/CBootstrapClusterer.h +++ b/include/maths/CBootstrapClusterer.h @@ -69,24 +69,24 @@ template class CBootstrapClusterer { public: - typedef std::pair TSizeSizePr; - typedef std::vector TSizeVec; - typedef TSizeVec::iterator TSizeVecItr; - typedef std::vector TSizeVecVec; - typedef std::vector TSizeVecVecVec; - typedef std::vector TPointVec; - typedef std::vector TPointVecVec; - typedef boost::adjacency_list > TGraph; - typedef typename boost::graph_traits::vertex_descriptor TVertex; - typedef typename boost::graph_traits::edge_descriptor TEdge; - typedef typename boost::graph_traits::vertex_iterator TVertexItr; - typedef typename boost::graph_traits::edge_iterator TEdgeItr; - typedef typename boost::graph_traits::out_edge_iterator TOutEdgeItr; - typedef typename boost::graph_traits::adjacency_iterator TAdjacencyItr; + using TSizeSizePr = std::pair; + using TSizeVec = std::vector; + using TSizeVecItr = TSizeVec::iterator; + using TSizeVecVec = std::vector; + using TSizeVecVecVec = std::vector; + using TPointVec = std::vector; + using TPointVecVec = std::vector; + using TGraph = boost::adjacency_list >; + using TVertex = typename boost::graph_traits::vertex_descriptor; + using TEdge = typename boost::graph_traits::edge_descriptor; + using TVertexItr = typename boost::graph_traits::vertex_iterator; + using TEdgeItr = typename boost::graph_traits::edge_iterator; + using TOutEdgeItr = typename boost::graph_traits::out_edge_iterator; + using TAdjacencyItr = typename boost::graph_traits::adjacency_iterator; public: CBootstrapClusterer(double overlapThreshold, double chainingFactor) : @@ -121,11 +121,11 @@ class CBootstrapClusterer } protected: - typedef std::vector TDoubleVec; - typedef std::vector TBoolVec; - typedef std::vector TSizeSizePrVec; - typedef std::pair TDoubleSizePr; - typedef std::vector TDoubleSizePrVec; + using TDoubleVec = std::vector; + using TBoolVec = std::vector; + using TSizeSizePrVec = std::vector; + using TDoubleSizePr = std::pair; + using TDoubleSizePrVec = std::vector; //! \brief Checks if a cluster is empty. struct SIsEmpty @@ -320,8 +320,8 @@ class CBootstrapClusterer TSizeVecVecVec &bootstrapClusters, TGraph &graph) const { - typedef boost::unordered_set TSizeSizePrUSet; - typedef TSizeSizePrUSet::const_iterator TSizeSizePrUSetCItr; + using TSizeSizePrUSet = boost::unordered_set; + using TSizeSizePrUSetCItr = TSizeSizePrUSet::const_iterator; TSizeSizePrUSet edges; @@ -456,9 +456,9 @@ class CBootstrapClusterer const TGraph &graph, TPointVecVec &result) const { - typedef boost::unordered_map TSizeSizeUMap; - typedef TSizeSizeUMap::const_iterator TSizeSizeUMapCItr; - typedef std::vector TSizeSizeUMapVec; + using TSizeSizeUMap = boost::unordered_map; + using TSizeSizeUMapCItr = TSizeSizeUMap::const_iterator; + using TSizeSizeUMapVec = std::vector; // Find the maximum connected components. TSizeVec components(boost::num_vertices(graph)); @@ -976,7 +976,7 @@ class CBootstrapClusterer const TBoolVec &parities, TSizeVec &components) const { - typedef boost::filtered_graph TParityGraph; + using TParityGraph = boost::filtered_graph; CParityFilter parityFilter(graph, parities, true); TParityGraph parityGraph(graph, parityFilter, parityFilter); components.resize(boost::num_vertices(graph)); @@ -1037,10 +1037,10 @@ template class CBootstrapClustererFacadeExtractClusters { public: - typedef std::vector TSizeVec; - typedef std::vector TSizeVecVec; - typedef std::vector TPointVec; - typedef typename TPointVec::const_iterator TPointVecCItr; + using TSizeVec = std::vector; + using TSizeVecVec = std::vector; + using TPointVec = std::vector; + using TPointVecCItr = typename TPointVec::const_iterator; public: //! Compute the cluster of each point in \p points. @@ -1113,9 +1113,9 @@ template class CBootstrapClustererFacade > : private CBootstrapClustererFacadeExtractClusters { public: - typedef std::vector TSizeVec; - typedef std::vector TSizeVecVec; - typedef std::vector TPointVec; + using TSizeVec = std::vector; + using TSizeVecVec = std::vector; + using TPointVec = std::vector; public: CBootstrapClustererFacade(const CXMeans &xmeans, @@ -1131,8 +1131,8 @@ class CBootstrapClustererFacade > : private CBootstrapClust //! \note Assumes \p points are sorted. void cluster(const TPointVec &points, TSizeVecVec &result) { - typedef boost::reference_wrapper TPointVecCRef; - typedef std::vector TPointVecCRefVec; + using TPointVecCRef = boost::reference_wrapper; + using TPointVecCRefVec = std::vector; // Initialize TPointVec tmp(points); @@ -1172,9 +1172,9 @@ template class CBootstrapClustererFacade > : private CBootstrapClustererFacadeExtractClusters { public: - typedef std::vector TSizeVec; - typedef std::vector TSizeVecVec; - typedef std::vector TPointVec; + using TSizeVec = std::vector; + using TSizeVecVec = std::vector; + using TPointVec = std::vector; public: CBootstrapClustererFacade(const CKMeansFast &kmeans, @@ -1188,7 +1188,7 @@ class CBootstrapClustererFacade > : private CBootstrapCluster //! \note Assumes \p points are sorted. void cluster(const TPointVec &points, TSizeVecVec &result) { - typedef std::vector TPointVecVec; + using TPointVecVec = std::vector; // Initialize TPointVec tmp(points); diff --git a/include/maths/CBoundingBox.h b/include/maths/CBoundingBox.h index 1c8c9bab02..b70448e133 100644 --- a/include/maths/CBoundingBox.h +++ b/include/maths/CBoundingBox.h @@ -34,7 +34,7 @@ class CBoundingBox { return core::memory_detail::SDynamicSizeAlwaysZero::value(); } - typedef typename SFloatingPoint::Type TPointPrecise; + using TPointPrecise = typename SFloatingPoint::Type; public: CBoundingBox(void) : m_Empty(true), m_A(), m_B() {} diff --git a/include/maths/CCalendarFeature.h b/include/maths/CCalendarFeature.h index 0e327ea306..2e579c89c9 100644 --- a/include/maths/CCalendarFeature.h +++ b/include/maths/CCalendarFeature.h @@ -40,7 +40,7 @@ class MATHS_EXPORT CCalendarFeature : boost::less_than_comparable< CCalendarFeat static const uint16_t BEGIN_FEATURES = 1; static const uint16_t END_FEATURES = 5; - typedef boost::array TCalendarFeature4Ary; + using TCalendarFeature4Ary = boost::array; public: CCalendarFeature(void); diff --git a/include/maths/CChecksum.h b/include/maths/CChecksum.h index b7c2ce5560..592724f901 100644 --- a/include/maths/CChecksum.h +++ b/include/maths/CChecksum.h @@ -44,7 +44,7 @@ class MemberHash {}; template struct enable_if_type { - typedef R type; + using type = R; }; //! Auxiliary type used by has_checksum_function to test for a nested @@ -52,7 +52,7 @@ struct enable_if_type template struct enable_if_is_type { - typedef R type; + using type = R; }; //! \name Class used to select appropriate checksum implementation @@ -69,12 +69,12 @@ struct enable_if_is_type template struct container_selector { - typedef BasicChecksum value; + using value = BasicChecksum; }; template struct container_selector::type> { - typedef ContainerChecksum value; + using value = ContainerChecksum; }; //@} @@ -94,22 +94,22 @@ struct container_selector template struct selector { - typedef typename container_selector::value value; + using value = typename container_selector::value; }; template struct selector::type> { - typedef MemberChecksumWithSeed value; + using value = MemberChecksumWithSeed; }; template struct selector::type> { - typedef MemberChecksumWithoutSeed value; + using value = MemberChecksumWithoutSeed; }; template struct selector::type> { - typedef MemberHash value; + using value = MemberHash; }; //@} @@ -280,7 +280,7 @@ class CChecksumImpl template static uint64_t dispatch(uint64_t seed, const T &target) { - typedef typename T::const_iterator CItr; + using CItr = typename T::const_iterator; uint64_t result = seed; for (CItr itr = target.begin(); itr != target.end(); ++itr) { @@ -293,8 +293,8 @@ class CChecksumImpl template static uint64_t dispatch(uint64_t seed, const boost::unordered_set &target) { - typedef boost::reference_wrapper TCRef; - typedef std::vector TCRefVec; + using TCRef = boost::reference_wrapper; + using TCRefVec = std::vector; TCRefVec ordered; ordered.reserve(target.size()); @@ -314,10 +314,10 @@ class CChecksumImpl template static uint64_t dispatch(uint64_t seed, const boost::unordered_map &target) { - typedef boost::reference_wrapper TUCRef; - typedef boost::reference_wrapper TVCRef; - typedef std::pair TUCRefVCRefPr; - typedef std::vector TUCRefVCRefPrVec; + using TUCRef = boost::reference_wrapper; + using TVCRef = boost::reference_wrapper; + using TUCRefVCRefPr = std::pair; + using TUCRefVCRefPrVec = std::vector; TUCRefVCRefPrVec ordered; ordered.reserve(target.size()); diff --git a/include/maths/CClusterer.h b/include/maths/CClusterer.h index e7cbecfb17..d426655d4a 100644 --- a/include/maths/CClusterer.h +++ b/include/maths/CClusterer.h @@ -51,10 +51,10 @@ class MATHS_EXPORT CClustererTypes }; // Callback function signature for when clusters are split. - typedef std::function TSplitFunc; + using TSplitFunc = std::function; // Callback function signature for when clusters are merged. - typedef std::function TMergeFunc; + using TMergeFunc = std::function; //! Generates unique cluster indices. class MATHS_EXPORT CIndexGenerator @@ -88,8 +88,8 @@ class MATHS_EXPORT CClustererTypes std::string print(void) const; private: - typedef std::vector TSizeVec; - typedef boost::shared_ptr TSizeVecPtr; + using TSizeVec = std::vector; + using TSizeVecPtr = boost::shared_ptr; private: //! A heap of the next available unique indices. @@ -137,14 +137,14 @@ template class CClusterer : public CClustererTypes { public: - typedef boost::shared_ptr TClustererPtr; - typedef std::vector TPointVec; - typedef typename SPromoted::Type TPointPrecise; - typedef std::vector TPointPreciseVec; - typedef std::pair TPointPreciseDoublePr; - typedef std::vector TPointPreciseDoublePrVec; - typedef std::pair TSizeDoublePr; - typedef core::CSmallVector TSizeDoublePr2Vec; + using TClustererPtr = boost::shared_ptr; + using TPointVec = std::vector; + using TPointPrecise = typename SPromoted::Type; + using TPointPreciseVec = std::vector; + using TPointPreciseDoublePr = std::pair; + using TPointPreciseDoublePrVec = std::vector; + using TSizeDoublePr = std::pair; + using TSizeDoublePr2Vec = core::CSmallVector; public: //! Create a new clusterer. @@ -308,7 +308,7 @@ class CClusterer : public CClustererTypes TMergeFunc m_MergeFunc; }; -typedef CClusterer CClusterer1d; +using CClusterer1d = CClusterer; } } diff --git a/include/maths/CClustererStateSerialiser.h b/include/maths/CClustererStateSerialiser.h index fcecdbca54..02486bee8c 100644 --- a/include/maths/CClustererStateSerialiser.h +++ b/include/maths/CClustererStateSerialiser.h @@ -45,7 +45,7 @@ struct SDistributionRestoreParams; class MATHS_EXPORT CClustererStateSerialiser { public: - typedef boost::shared_ptr TClusterer1dPtr; + using TClusterer1dPtr = boost::shared_ptr; public: //! Construct the appropriate CClusterer sub-class from its state diff --git a/include/maths/CCompositeFunctions.h b/include/maths/CCompositeFunctions.h index 1eb1440759..66df220c02 100644 --- a/include/maths/CCompositeFunctions.h +++ b/include/maths/CCompositeFunctions.h @@ -34,39 +34,39 @@ struct function_result_type template struct function_result_type { - typedef typename boost::remove_reference::type type; + using type = typename boost::remove_reference::type; }; //! Vanilla function type 2: "result type" is the second argument type. template struct function_result_type { - typedef typename boost::remove_reference::type type; + using type = typename boost::remove_reference::type; }; -typedef boost::true_type true_; -typedef boost::false_type false_; +using true_ = boost::true_type; +using false_ = boost::false_type; //! \brief Auxiliary type used by has_result_type to test for //! a nested typedef. template struct enable_if_type { - typedef R type; + using type = R; }; //! Checks for a nested typedef called result_type. template struct has_result_type { - typedef false_ value; + using value = false_; }; //! Has a nested typedef called result_type. template struct has_result_type::type> { - typedef true_ value; + using value = true_; }; //! Extracts the result type of a function (object) for composition. @@ -82,14 +82,14 @@ struct result_type_impl template struct result_type_impl { - typedef typename F::result_type type; + using type = typename F::result_type; }; //! Deduce result type from function (object). template struct result_type_impl { - typedef typename function_result_type::type type; + using type = typename function_result_type::type; }; //! \brief Tries to deduce the result type of a function (object) @@ -135,8 +135,8 @@ class MATHS_EXPORT CCompositeFunctions class CMinusConstant { public: - typedef typename boost::remove_reference::type F; - typedef T result_type; + using F = typename boost::remove_reference::type; + using result_type = T; public: CMinusConstant(const F &f, double offset) : @@ -173,8 +173,8 @@ class MATHS_EXPORT CCompositeFunctions class CMinus { public: - typedef typename boost::remove_reference::type F; - typedef T result_type; + using F = typename boost::remove_reference::type; + using result_type = T; public: explicit CMinus(const F &f = F()) : m_F(f) {} @@ -206,8 +206,8 @@ class MATHS_EXPORT CCompositeFunctions class CExp { public: - typedef typename boost::remove_reference::type F; - typedef T result_type; + using F = typename boost::remove_reference::type; + using result_type = T; public: explicit CExp(const F &f = F()) : m_F(f) {} @@ -246,9 +246,9 @@ class MATHS_EXPORT CCompositeFunctions class CProduct { public: - typedef typename boost::remove_reference::type F; - typedef typename boost::remove_reference::type G; - typedef U result_type; + using F = typename boost::remove_reference::type; + using G = typename boost::remove_reference::type; + using result_type = U; public: explicit CProduct(const F &f = F(), diff --git a/include/maths/CCooccurrences.h b/include/maths/CCooccurrences.h index b06fe97b79..56344d9e1e 100644 --- a/include/maths/CCooccurrences.h +++ b/include/maths/CCooccurrences.h @@ -34,10 +34,10 @@ namespace maths class MATHS_EXPORT CCooccurrences { public: - typedef std::vector TDoubleVec; - typedef std::vector TSizeVec; - typedef std::pair TSizeSizePr; - typedef std::vector TSizeSizePrVec; + using TDoubleVec = std::vector; + using TSizeVec = std::vector; + using TSizeSizePr = std::pair; + using TSizeSizePrVec = std::vector; public: CCooccurrences(std::size_t maximumLength, std::size_t indicatorWidth); @@ -86,8 +86,8 @@ class MATHS_EXPORT CCooccurrences std::size_t memoryUsage(void) const; private: - typedef boost::unordered_set TSizeUSet; - typedef std::vector TPackedBitVectorVec; + using TSizeUSet = boost::unordered_set; + using TPackedBitVectorVec = std::vector; private: //! The maximum permitted event sequence length. diff --git a/include/maths/CCountMinSketch.h b/include/maths/CCountMinSketch.h index d4c73aecf1..08ad91b434 100644 --- a/include/maths/CCountMinSketch.h +++ b/include/maths/CCountMinSketch.h @@ -117,9 +117,9 @@ class MATHS_EXPORT CCountMinSketch std::size_t memoryUsage(void) const; private: - typedef core::CHashing::CUniversalHash::TUInt32UnrestrictedHashVec TUInt32HashVec; - typedef std::vector TFloatVec; - typedef std::vector TFloatVecVec; + using TUInt32HashVec = core::CHashing::CUniversalHash::TUInt32UnrestrictedHashVec; + using TFloatVec = std::vector; + using TFloatVecVec = std::vector; //! Wraps up the sketch data. struct MATHS_EXPORT SSketch @@ -142,9 +142,9 @@ class MATHS_EXPORT CCountMinSketch TFloatVecVec s_Counts; }; - typedef std::pair TUInt32FloatPr; - typedef std::vector TUInt32FloatPrVec; - typedef boost::variant TUInt32FloatPrVecOrSketch; + using TUInt32FloatPr = std::pair; + using TUInt32FloatPrVec = std::vector; + using TUInt32FloatPrVecOrSketch = boost::variant; //! Maybe switch to sketching the counts. void sketch(void); diff --git a/include/maths/CEntropySketch.h b/include/maths/CEntropySketch.h index 76e2d97690..4a316f0382 100644 --- a/include/maths/CEntropySketch.h +++ b/include/maths/CEntropySketch.h @@ -41,8 +41,8 @@ class MATHS_EXPORT CEntropySketch double calculate(void) const; private: - typedef std::vector TDoubleVec; - typedef std::vector TUInt64Vec; + using TDoubleVec = std::vector; + using TUInt64Vec = std::vector; private: //! Generate the projection of the category counts. diff --git a/include/maths/CGammaRateConjugate.h b/include/maths/CGammaRateConjugate.h index 835ad8c065..9b550fbd39 100644 --- a/include/maths/CGammaRateConjugate.h +++ b/include/maths/CGammaRateConjugate.h @@ -60,7 +60,7 @@ class MATHS_EXPORT CGammaRateConjugate : public CPrior //! See core::CMemory. static bool dynamicSizeAlwaysZero(void) { return true; } - typedef CEqualWithTolerance TEqualWithTolerance; + using TEqualWithTolerance = CEqualWithTolerance; //! Lift the overloads of addSamples into scope. using CPrior::addSamples; @@ -357,8 +357,8 @@ class MATHS_EXPORT CGammaRateConjugate : public CPrior //@} private: - typedef CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; + using TMeanAccumulator = CBasicStatistics::SSampleMean::TAccumulator; + using TMeanVarAccumulator = CBasicStatistics::SSampleMeanVar::TAccumulator; private: //! Read parameters from \p traverser. diff --git a/include/maths/CGradientDescent.h b/include/maths/CGradientDescent.h index 39fc3df320..29f3ac5eaf 100644 --- a/include/maths/CGradientDescent.h +++ b/include/maths/CGradientDescent.h @@ -28,8 +28,8 @@ namespace maths class MATHS_EXPORT CGradientDescent { public: - typedef std::vector TDoubleVec; - typedef CVector TVector; + using TDoubleVec = std::vector; + using TVector = CVector; //! \brief The interface for the function calculation. class MATHS_EXPORT CFunction diff --git a/include/maths/CGramSchmidt.h b/include/maths/CGramSchmidt.h index aaf0492f31..27248bf4a2 100644 --- a/include/maths/CGramSchmidt.h +++ b/include/maths/CGramSchmidt.h @@ -33,10 +33,10 @@ namespace maths class MATHS_EXPORT CGramSchmidt : private core::CNonInstantiatable { public: - typedef std::vector TDoubleVec; - typedef std::vector TDoubleVecVec; - typedef CVector TVector; - typedef std::vector TVectorVec; + using TDoubleVec = std::vector; + using TDoubleVecVec = std::vector; + using TVector = CVector; + using TVectorVec = std::vector; public: //! Compute an orthonormal basis for the vectors in \p x. diff --git a/include/maths/CInformationCriteria.h b/include/maths/CInformationCriteria.h index d035735729..d0b48b8100 100644 --- a/include/maths/CInformationCriteria.h +++ b/include/maths/CInformationCriteria.h @@ -36,7 +36,7 @@ struct SSampleCovariances template struct SSampleCovariances> { - typedef CBasicStatistics::SSampleCovariances Type; + using Type = CBasicStatistics::SSampleCovariances; }; //! The confidence interval we use when computing the singular values @@ -110,12 +110,12 @@ template class CSphericalGaussianInfoCriterion { public: - typedef std::vector TPointVec; - typedef std::vector TPointVecVec; - typedef typename SStripped::Type TBarePoint; - typedef typename SFloatingPoint::Type TBarePointPrecise; - typedef typename SCoordinate::Type TCoordinate; - typedef typename CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; + using TPointVec = std::vector; + using TPointVecVec = std::vector; + using TBarePoint = typename SStripped::Type; + using TBarePointPrecise = typename SFloatingPoint::Type; + using TCoordinate = typename SCoordinate::Type; + using TMeanVarAccumulator = typename CBasicStatistics::SSampleMeanVar::TAccumulator; public: CSphericalGaussianInfoCriterion(void) : @@ -242,13 +242,13 @@ template class CGaussianInfoCriterion { public: - typedef std::vector TPointVec; - typedef std::vector TPointVecVec; - typedef typename SStripped::Type TBarePoint; - typedef typename SFloatingPoint::Type TBarePointPrecise; - typedef typename SCoordinate::Type TCoordinate; - typedef typename information_criteria_detail::SSampleCovariances::Type TCovariances; - typedef typename SConformableMatrix::Type TMatrix; + using TPointVec = std::vector; + using TPointVecVec = std::vector; + using TBarePoint = typename SStripped::Type; + using TBarePointPrecise = typename SFloatingPoint::Type; + using TCoordinate = typename SCoordinate::Type; + using TCovariances = typename information_criteria_detail::SSampleCovariances::Type; + using TMatrix = typename SConformableMatrix::Type; public: CGaussianInfoCriterion(void) : diff --git a/include/maths/CKMeansFast.h b/include/maths/CKMeansFast.h index 9fe9d557df..40b3f435c7 100644 --- a/include/maths/CKMeansFast.h +++ b/include/maths/CKMeansFast.h @@ -29,7 +29,7 @@ namespace maths { namespace kmeans_fast_detail { -typedef std::vector TSizeVec; +using TSizeVec = std::vector; //! Get the closest filtered centre to \p point. template @@ -87,10 +87,10 @@ template class CKMeansFast { public: - typedef std::vector TSizeVec; - typedef std::pair TPointPointPr; - typedef std::vector TPointVec; - typedef std::vector TPointVecVec; + using TSizeVec = std::vector; + using TPointPointPr = std::pair; + using TPointVec = std::vector; + using TPointVecVec = std::vector; //! A cluster. //! @@ -164,16 +164,16 @@ class CKMeansFast uint64_t m_Checksum; }; - typedef std::vector TClusterVec; + using TClusterVec = std::vector; protected: - typedef typename SStripped::Type TBarePoint; - typedef typename SFloatingPoint::Type TBarePointPrecise; - typedef typename CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef std::vector TMeanAccumulatorVec; - typedef CBoundingBox TBoundingBox; + using TBarePoint = typename SStripped::Type; + using TBarePointPrecise = typename SFloatingPoint::Type; + using TMeanAccumulator = typename CBasicStatistics::SSampleMean::TAccumulator; + using TMeanAccumulatorVec = std::vector; + using TBoundingBox = CBoundingBox; class CKdTreeNodeData; - typedef typename CKdTree::SNode TNode; + using TNode = typename CKdTree::SNode; //! \brief The data the x-means algorithm needs at each k-d //! tree node. @@ -550,7 +550,7 @@ class CKMeansFast //! Single iteration of Lloyd's algorithm to update \p centres. bool updateCentres(void) { - typedef typename SCoordinate::Type TCoordinate; + using TCoordinate = typename SCoordinate::Type; static const TCoordinate PRECISION = TCoordinate(5) * std::numeric_limits::epsilon(); TMeanAccumulatorVec newCentres(m_Centres.size()); @@ -586,9 +586,9 @@ template class CKMeansPlusPlusInitialization : private core::CNonCopyable { public: - typedef std::vector TDoubleVec; - typedef std::vector TSizeVec; - typedef std::vector TPointVec; + using TDoubleVec = std::vector; + using TSizeVec = std::vector; + using TPointVec = std::vector; public: CKMeansPlusPlusInitialization(RNG &rng) : m_Rng(rng) {} diff --git a/include/maths/CKMeansOnline.h b/include/maths/CKMeansOnline.h index 2754220c83..97c7ee4ab9 100644 --- a/include/maths/CKMeansOnline.h +++ b/include/maths/CKMeansOnline.h @@ -55,14 +55,14 @@ template class CKMeansOnline { public: - typedef std::vector TSizeVec; - typedef std::vector TSizeVecVec; - typedef typename SFloatingPoint::Type TDoublePoint; - typedef std::vector TDoublePointVec; - typedef typename CSphericalCluster::Type TSphericalCluster; - typedef std::vector TSphericalClusterVec; - typedef std::vector TSphericalClusterVecVec; - typedef std::vector TKMeansOnlineVec; + using TSizeVec = std::vector; + using TSizeVecVec = std::vector; + using TDoublePoint = typename SFloatingPoint::Type; + using TDoublePointVec = std::vector; + using TSphericalCluster = typename CSphericalCluster::Type; + using TSphericalClusterVec = std::vector; + using TSphericalClusterVecVec = std::vector; + using TKMeansOnlineVec = std::vector; protected: //! \brief Checks if a cluster should be deleted based on its count. @@ -83,15 +83,15 @@ class CKMeansOnline double m_MinimumCategoryCount; }; - typedef typename SFloatingPoint::Type TFloatPoint; - typedef typename SCoordinate::Type TFloatCoordinate; - typedef std::pair TFloatPointDoublePr; - typedef std::vector TFloatPointDoublePrVec; - typedef typename CBasicStatistics::SSampleMean::TAccumulator TFloatMeanAccumulator; - typedef std::pair TFloatMeanAccumulatorDoublePr; - typedef std::vector TFloatMeanAccumulatorDoublePrVec; - typedef typename CBasicStatistics::SSampleMean::TAccumulator TDoubleMeanAccumulator; - typedef typename CBasicStatistics::SSampleMeanVar::TAccumulator TDoubleMeanVarAccumulator; + using TFloatPoint = typename SFloatingPoint::Type; + using TFloatCoordinate = typename SCoordinate::Type; + using TFloatPointDoublePr = std::pair; + using TFloatPointDoublePrVec = std::vector; + using TFloatMeanAccumulator = typename CBasicStatistics::SSampleMean::TAccumulator; + using TFloatMeanAccumulatorDoublePr = std::pair; + using TFloatMeanAccumulatorDoublePrVec = std::vector; + using TDoubleMeanAccumulator = typename CBasicStatistics::SSampleMean::TAccumulator; + using TDoubleMeanVarAccumulator = typename CBasicStatistics::SSampleMeanVar::TAccumulator; protected: //! The minimum permitted size for the clusterer. @@ -419,8 +419,8 @@ class CKMeansOnline return; } - typedef std::vector TDoubleVec; - typedef std::pair TDoubleSizePr; + using TDoubleVec = std::vector; + using TDoubleSizePr = std::pair; static const double ALMOST_ONE = 0.99999; diff --git a/include/maths/CKMeansOnline1d.h b/include/maths/CKMeansOnline1d.h index 1f6ac5ca33..68ca9b0d81 100644 --- a/include/maths/CKMeansOnline1d.h +++ b/include/maths/CKMeansOnline1d.h @@ -32,11 +32,11 @@ namespace maths class MATHS_EXPORT CKMeansOnline1d : public CClusterer1d { public: - typedef TPointPreciseVec TDoubleVec; - typedef TPointPreciseDoublePrVec TDoubleDoublePrVec; - typedef std::vector TNormalVec; - typedef TNormalVec::iterator TNormalVecItr; - typedef TNormalVec::const_iterator TNormalVecCItr; + using TDoubleVec = TPointPreciseVec; + using TDoubleDoublePrVec = TPointPreciseDoublePrVec; + using TNormalVec = std::vector; + using TNormalVecItr = TNormalVec::iterator; + using TNormalVecCItr = TNormalVec::const_iterator; public: //! Construct a new clusterer. diff --git a/include/maths/CKMostCorrelated.h b/include/maths/CKMostCorrelated.h index 3251cab760..a3b8e05eb8 100644 --- a/include/maths/CKMostCorrelated.h +++ b/include/maths/CKMostCorrelated.h @@ -60,15 +60,15 @@ class MATHS_EXPORT CKMostCorrelated static const std::size_t NUMBER_PROJECTIONS = 10u; public: - typedef std::vector TDoubleVec; - typedef std::vector TSizeVec; - typedef std::pair TSizeSizePr; - typedef std::vector TSizeSizePrVec; - typedef CVectorNx1 TVector; - typedef std::vector TVectorVec; - typedef boost::unordered_map TSizeVectorUMap; - typedef std::pair TVectorPackedBitVectorPr; - typedef boost::unordered_map TSizeVectorPackedBitVectorPrUMap; + using TDoubleVec = std::vector; + using TSizeVec = std::vector; + using TSizeSizePr = std::pair; + using TSizeSizePrVec = std::vector; + using TVector = CVectorNx1; + using TVectorVec = std::vector; + using TSizeVectorUMap = boost::unordered_map; + using TVectorPackedBitVectorPr = std::pair; + using TSizeVectorPackedBitVectorPrUMap = boost::unordered_map; public: CKMostCorrelated(std::size_t k, double decayRate, bool initialize = true); @@ -127,11 +127,11 @@ class MATHS_EXPORT CKMostCorrelated static const double REPLACE_FRACTION; protected: - typedef CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; - typedef std::vector TMeanVarAccumulatorVec; - typedef TSizeVectorUMap::const_iterator TSizeVectorUMapCItr; - typedef TSizeVectorPackedBitVectorPrUMap::iterator TSizeVectorPackedBitVectorPrUMapItr; - typedef TSizeVectorPackedBitVectorPrUMap::const_iterator TSizeVectorPackedBitVectorPrUMapCItr; + using TMeanVarAccumulator = CBasicStatistics::SSampleMeanVar::TAccumulator; + using TMeanVarAccumulatorVec = std::vector; + using TSizeVectorUMapCItr = TSizeVectorUMap::const_iterator; + using TSizeVectorPackedBitVectorPrUMapItr = TSizeVectorPackedBitVectorPrUMap::iterator; + using TSizeVectorPackedBitVectorPrUMapCItr = TSizeVectorPackedBitVectorPrUMap::const_iterator; //! \brief A pair of variables and their correlation. //! @@ -205,7 +205,7 @@ class MATHS_EXPORT CKMostCorrelated std::size_t m_X; }; - typedef std::vector TCorrelationVec; + using TCorrelationVec = std::vector; protected: //! Get the most correlated variables based on the current diff --git a/include/maths/CKdTree.h b/include/maths/CKdTree.h index cb8fb241e7..905686d5cc 100644 --- a/include/maths/CKdTree.h +++ b/include/maths/CKdTree.h @@ -69,12 +69,12 @@ template TPointVec; - typedef typename TPointVec::iterator TPointVecItr; - typedef typename SCoordinate::Type TCoordinate; - typedef typename SPromoted::Type TCoordinatePrecise; - typedef std::pair TCoordinatePrecisePointPr; - typedef CBasicStatistics::COrderStatisticsHeap TNearestAccumulator; + using TPointVec = std::vector; + using TPointVecItr = typename TPointVec::iterator; + using TCoordinate = typename SCoordinate::Type; + using TCoordinatePrecise = typename SPromoted::Type; + using TCoordinatePrecisePointPr = std::pair; + using TNearestAccumulator = CBasicStatistics::COrderStatisticsHeap; //! Less on a specific coordinate of point position vector. class CCoordinateLess @@ -274,7 +274,7 @@ class CKdTree } private: - typedef std::vector TNodeVec; + using TNodeVec = std::vector; private: //! Recursively build the k-d tree. diff --git a/include/maths/CLassoLogisticRegression.h b/include/maths/CLassoLogisticRegression.h index 670c6058fa..7302438896 100644 --- a/include/maths/CLassoLogisticRegression.h +++ b/include/maths/CLassoLogisticRegression.h @@ -23,10 +23,10 @@ namespace maths namespace lasso_logistic_regression_detail { -typedef std::vector TDoubleVec; -typedef std::pair TSizeSizePr; -typedef std::pair TSizeSizePrDoublePr; -typedef std::vector TSizeSizePrDoublePrVec; +using TDoubleVec = std::vector; +using TSizeSizePr = std::pair; +using TSizeSizePrDoublePr = std::pair; +using TSizeSizePrDoublePrVec = std::vector; //! Very simple dynamically sized dense matrix. //! @@ -36,8 +36,8 @@ typedef std::vector TSizeSizePrDoublePrVec; class MATHS_EXPORT CDenseMatrix { public: - typedef TDoubleVec::const_iterator iterator; - typedef std::vector TDoubleVecVec; + using iterator = TDoubleVec::const_iterator; + using TDoubleVecVec = std::vector; public: CDenseMatrix(void); @@ -89,7 +89,7 @@ class MATHS_EXPORT CDenseMatrix class MATHS_EXPORT CSparseMatrix { public: - typedef TSizeSizePrDoublePrVec::const_iterator iterator; + using iterator = TSizeSizePrDoublePrVec::const_iterator; public: CSparseMatrix(void); @@ -288,9 +288,9 @@ enum EHyperparametersStyle class MATHS_EXPORT CLogisticRegressionModel { public: - typedef std::vector TDoubleVec; - typedef std::pair TSizeDoublePr; - typedef std::vector TSizeDoublePrVec; + using TDoubleVec = std::vector; + using TSizeDoublePr = std::pair; + using TSizeDoublePrVec = std::vector; public: CLogisticRegressionModel(void); @@ -346,8 +346,8 @@ template class MATHS_EXPORT CLassoLogisticRegression { public: - typedef std::vector TDoubleVec; - typedef lasso_logistic_regression_detail::EHyperparametersStyle EHyperparametersStyle; + using TDoubleVec = std::vector; + using EHyperparametersStyle = lasso_logistic_regression_detail::EHyperparametersStyle; protected: CLassoLogisticRegression(void); @@ -396,8 +396,8 @@ class MATHS_EXPORT CLassoLogisticRegression TDoubleVec m_Beta; }; -typedef std::vector > TDenseStorage; -typedef std::vector > > TSparseStorage; +using TDenseStorage = std::vector >; +using TSparseStorage = std::vector > >; //! \brief Lasso logistic regression using dense encoding of the //! feature vectors. @@ -411,8 +411,8 @@ typedef std::vector > > TSparseStorag class MATHS_EXPORT CLassoLogisticRegressionDense : public CLassoLogisticRegression { public: - typedef std::pair TSizeDoublePr; - typedef std::vector TSizeDoublePrVec; + using TSizeDoublePr = std::pair; + using TSizeDoublePrVec = std::vector; public: //! Add a labeled feature vector \p x. The label is either @@ -447,9 +447,9 @@ class MATHS_EXPORT CLassoLogisticRegressionDense : public CLassoLogisticRegressi class MATHS_EXPORT CLassoLogisticRegressionSparse : CLassoLogisticRegression { public: - typedef std::pair TSizeDoublePr; - typedef std::vector TSizeDoublePrVec; - typedef lasso_logistic_regression_detail::EHyperparametersStyle EHyperparametersStyle; + using TSizeDoublePr = std::pair; + using TSizeDoublePrVec = std::vector; + using EHyperparametersStyle = lasso_logistic_regression_detail::EHyperparametersStyle; public: //! Add a labeled feature vector \p x. The label is either diff --git a/include/maths/CLogNormalMeanPrecConjugate.h b/include/maths/CLogNormalMeanPrecConjugate.h index 84fee515f4..16c4281dd3 100644 --- a/include/maths/CLogNormalMeanPrecConjugate.h +++ b/include/maths/CLogNormalMeanPrecConjugate.h @@ -54,7 +54,7 @@ class MATHS_EXPORT CLogNormalMeanPrecConjugate : public CPrior //! See core::CMemory. static bool dynamicSizeAlwaysZero(void) { return true; } - typedef CEqualWithTolerance TEqualWithTolerance; + using TEqualWithTolerance = CEqualWithTolerance; //! Lift the overloads of addSamples into scope. using CPrior::addSamples; diff --git a/include/maths/CLogTDistribution.h b/include/maths/CLogTDistribution.h index c9c28a9ea8..5bd127f3a2 100644 --- a/include/maths/CLogTDistribution.h +++ b/include/maths/CLogTDistribution.h @@ -35,8 +35,8 @@ namespace maths class MATHS_EXPORT CLogTDistribution { public: - typedef std::pair TDoubleDoublePr; - typedef boost::optional TOptionalDouble; + using TDoubleDoublePr = std::pair; + using TOptionalDouble = boost::optional; public: CLogTDistribution(double degreesFreedom, diff --git a/include/maths/CMixtureDistribution.h b/include/maths/CMixtureDistribution.h index 718853d5ca..ac4ae1eb17 100644 --- a/include/maths/CMixtureDistribution.h +++ b/include/maths/CMixtureDistribution.h @@ -35,7 +35,7 @@ namespace maths namespace mixture_detail { -typedef std::pair TDoubleDoublePr; +using TDoubleDoublePr = std::pair; //! \brief Implements the "polymorphic" mixture mode. class MATHS_EXPORT CMixtureModeImpl @@ -58,9 +58,9 @@ class MATHS_EXPORT CMixtureModeImpl } private: - typedef boost::variant, - boost::math::gamma_distribution<>, - boost::math::lognormal_distribution<> > TDistribution; + using TDistribution = boost::variant, + boost::math::gamma_distribution<>, + boost::math::lognormal_distribution<> >; private: //! The actual distribution. @@ -154,8 +154,8 @@ template class CMixtureDistribution { public: - typedef std::vector TDoubleVec; - typedef std::vector TModeVec; + using TDoubleVec = std::vector; + using TModeVec = std::vector; public: CMixtureDistribution(void) {} @@ -242,7 +242,7 @@ template class CPdfAdpater { public: - typedef double result_type; + using result_type = double; public: CPdfAdpater(const CMixtureDistribution &distribution) : @@ -265,7 +265,7 @@ class CPdfAdpater template mixture_detail::TDoubleDoublePr support(const CMixtureDistribution &distribution) { - typedef typename CMixtureDistribution::TModeVec TModeVec; + using TModeVec = typename CMixtureDistribution::TModeVec; const TModeVec &modes = distribution.modes(); @@ -302,8 +302,8 @@ mixture_detail::TDoubleDoublePr support(const CMixtureDistribution &distribut template double mode(const CMixtureDistribution &distribution) { - typedef typename CMixtureDistribution::TDoubleVec TDoubleVec; - typedef typename CMixtureDistribution::TModeVec TModeVec; + using TDoubleVec = typename CMixtureDistribution::TDoubleVec; + using TModeVec = typename CMixtureDistribution::TModeVec; static const std::size_t MAX_ITERATIONS = 20u; @@ -356,8 +356,8 @@ double mode(const CMixtureDistribution &distribution) template double pdf(const CMixtureDistribution &distribution, double x) { - typedef typename CMixtureDistribution::TDoubleVec TDoubleVec; - typedef typename CMixtureDistribution::TModeVec TModeVec; + using TDoubleVec = typename CMixtureDistribution::TDoubleVec; + using TModeVec = typename CMixtureDistribution::TModeVec; if (CMathsFuncs::isNan(x)) { @@ -409,8 +409,8 @@ double pdf(const CMixtureDistribution &distribution, double x) template double cdf(const CMixtureDistribution &distribution, double x) { - typedef typename CMixtureDistribution::TDoubleVec TDoubleVec; - typedef typename CMixtureDistribution::TModeVec TModeVec; + using TDoubleVec = typename CMixtureDistribution::TDoubleVec; + using TModeVec = typename CMixtureDistribution::TModeVec; if (CMathsFuncs::isNan(x)) { @@ -467,8 +467,8 @@ double cdf(const CMixtureDistribution &distribution, double x) template double cdfComplement(const CMixtureDistribution &distribution, double x) { - typedef typename CMixtureDistribution::TDoubleVec TDoubleVec; - typedef typename CMixtureDistribution::TModeVec TModeVec; + using TDoubleVec = typename CMixtureDistribution::TDoubleVec; + using TModeVec = typename CMixtureDistribution::TModeVec; if (CMathsFuncs::isNan(x)) { @@ -528,7 +528,7 @@ template class CCdfAdapter { public: - typedef double result_type; + using result_type = double; public: CCdfAdapter(const CMixtureDistribution &distribution) : @@ -553,7 +553,7 @@ class CCdfAdapter template double quantile(const CMixtureDistribution &distribution, const double q) { - typedef typename CMixtureDistribution::TModeVec TModeVec; + using TModeVec = typename CMixtureDistribution::TModeVec; mixture_detail::TDoubleDoublePr s = support(distribution); diff --git a/include/maths/CModelWeight.h b/include/maths/CModelWeight.h index 3c4b2c29e3..fd10ebcebf 100644 --- a/include/maths/CModelWeight.h +++ b/include/maths/CModelWeight.h @@ -82,8 +82,8 @@ template class CScopeCanonicalizeWeights : private core::CNonCopyable { public: - typedef std::pair TWeightPriorPr; - typedef std::vector TWeightPriorPrVec; + using TWeightPriorPr = std::pair; + using TWeightPriorPrVec = std::vector; public: CScopeCanonicalizeWeights(TWeightPriorPrVec &models) : m_Models(models) {} @@ -95,7 +95,7 @@ class CScopeCanonicalizeWeights : private core::CNonCopyable { logMaxWeight.add(model.first.logWeight()); } - for (auto &&model : m_Models) + for (auto &model : m_Models) { model.first.logWeight(model.first.logWeight() - logMaxWeight[0]); } diff --git a/include/maths/CMultimodalPrior.h b/include/maths/CMultimodalPrior.h index 13abe25ccc..b4d23dfe17 100644 --- a/include/maths/CMultimodalPrior.h +++ b/include/maths/CMultimodalPrior.h @@ -54,13 +54,13 @@ namespace maths class MATHS_EXPORT CMultimodalPrior : public CPrior { public: - typedef boost::shared_ptr TClustererPtr; - typedef boost::shared_ptr TPriorPtr; - typedef std::vector TPriorPtrVec; - typedef TPriorPtrVec::iterator TPriorPtrVecItr; - typedef TPriorPtrVec::const_iterator TPriorPtrVecCItr; - typedef CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; - typedef std::vector TMeanVarAccumulatorVec; + using TClustererPtr = boost::shared_ptr; + using TPriorPtr = boost::shared_ptr; + using TPriorPtrVec = std::vector; + using TPriorPtrVecItr = TPriorPtrVec::iterator; + using TPriorPtrVecCItr = TPriorPtrVec::const_iterator; + using TMeanVarAccumulator = CBasicStatistics::SSampleMeanVar::TAccumulator; + using TMeanVarAccumulatorVec = std::vector; // Lift all overloads into scope. //{ @@ -326,8 +326,8 @@ class MATHS_EXPORT CMultimodalPrior : public CPrior bool checkInvariants(const std::string &tag = std::string()) const; private: - typedef std::vector TDouble1VecVec; - typedef std::vector TDouble4Vec1VecVec; + using TDouble1VecVec = std::vector; + using TDouble4Vec1VecVec = std::vector; //! The callback invoked when a mode is split. class MATHS_EXPORT CModeSplitCallback @@ -355,8 +355,8 @@ class MATHS_EXPORT CMultimodalPrior : public CPrior CMultimodalPrior *m_Prior; }; - typedef SMultimodalPriorMode > TMode; - typedef std::vector TModeVec; + using TMode = SMultimodalPriorMode >; + using TModeVec = std::vector; private: //! Read parameters from \p traverser. diff --git a/include/maths/CMultimodalPriorUtils.h b/include/maths/CMultimodalPriorUtils.h index c90331ee4c..92b38081c8 100644 --- a/include/maths/CMultimodalPriorUtils.h +++ b/include/maths/CMultimodalPriorUtils.h @@ -41,13 +41,13 @@ namespace maths class MATHS_EXPORT CMultimodalPriorUtils : private core::CNonInstantiatable { public: - typedef std::pair TDoubleDoublePr; - typedef std::vector TDoubleVec; - typedef core::CSmallVector TDouble1Vec; - typedef core::CSmallVector TDouble4Vec; - typedef core::CSmallVector TDouble4Vec1Vec; - typedef CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef CConstantWeights TWeights; + using TDoubleDoublePr = std::pair; + using TDoubleVec = std::vector; + using TDouble1Vec = core::CSmallVector; + using TDouble4Vec = core::CSmallVector; + using TDouble4Vec1Vec = core::CSmallVector; + using TMeanAccumulator = CBasicStatistics::SSampleMean::TAccumulator; + using TWeights = CConstantWeights; //! Get the mode of the marginal likelihood function. template @@ -120,7 +120,7 @@ class MATHS_EXPORT CMultimodalPriorUtils : private core::CNonInstantiatable return modes[0].s_Prior->marginalLikelihoodMode(weightStyles, weights); } - typedef CBasicStatistics::COrderStatisticsStack > TMaxAccumulator; + using TMaxAccumulator = CBasicStatistics::COrderStatisticsStack >; // We'll approximate this as the maximum likelihood mode (mode). double result = 0.0; @@ -374,8 +374,8 @@ class MATHS_EXPORT CMultimodalPriorUtils : private core::CNonInstantiatable // The approximation is increasingly accurate as the prior distribution // on each mode narrows. - typedef std::pair TSizeDoublePr; - typedef core::CSmallVector TSizeDoublePr5Vec; + using TSizeDoublePr = std::pair; + using TSizeDoublePr5Vec = core::CSmallVector; result = 0.0; @@ -884,7 +884,7 @@ class MATHS_EXPORT CMultimodalPriorUtils : private core::CNonInstantiatable class CLogCdf { public: - typedef double result_type; + using result_type = double; enum EStyle { @@ -958,7 +958,7 @@ class MATHS_EXPORT CMultimodalPriorUtils : private core::CNonInstantiatable return minusLogCdf(modes[0].s_Prior, weightStyles, samples, weights, lowerBound, upperBound); } - typedef CBasicStatistics::COrderStatisticsStack TMinAccumulator; + using TMinAccumulator = CBasicStatistics::COrderStatisticsStack; // The c.d.f. of the marginal likelihood is the weighted sum // of the c.d.fs of each mode since: diff --git a/include/maths/CMultinomialConjugate.h b/include/maths/CMultinomialConjugate.h index 059b0814fd..a9427398fa 100644 --- a/include/maths/CMultinomialConjugate.h +++ b/include/maths/CMultinomialConjugate.h @@ -47,7 +47,7 @@ struct SDistributionRestoreParams; class MATHS_EXPORT CMultinomialConjugate : public CPrior { public: - typedef CEqualWithTolerance TEqualWithTolerance; + using TEqualWithTolerance = CEqualWithTolerance; //! Lift the overloads of addSamples into scope. using CPrior::addSamples; diff --git a/include/maths/CMultivariateConstantPrior.h b/include/maths/CMultivariateConstantPrior.h index 0efa8b4268..d5c8988cf9 100644 --- a/include/maths/CMultivariateConstantPrior.h +++ b/include/maths/CMultivariateConstantPrior.h @@ -36,7 +36,7 @@ namespace maths class MATHS_EXPORT CMultivariateConstantPrior : public CMultivariatePrior { public: - typedef boost::optional TOptionalDouble10Vec; + using TOptionalDouble10Vec = boost::optional; // Lift all overloads of into scope. //{ diff --git a/include/maths/CMultivariateMultimodalPrior.h b/include/maths/CMultivariateMultimodalPrior.h index 069f838382..e2e156b3fa 100644 --- a/include/maths/CMultivariateMultimodalPrior.h +++ b/include/maths/CMultivariateMultimodalPrior.h @@ -50,13 +50,13 @@ namespace maths namespace multivariate_multimodal_prior_detail { -typedef std::pair TSizeDoublePr; -typedef core::CSmallVector TSizeDoublePr3Vec; -typedef boost::shared_ptr TPriorPtr; -typedef CMultivariatePrior::TDouble10Vec1Vec TDouble10Vec1Vec; -typedef CMultivariatePrior::TDouble10Vec4Vec1Vec TDouble10Vec4Vec1Vec; -typedef SMultimodalPriorMode > TMode; -typedef std::vector TModeVec; +using TSizeDoublePr = std::pair; +using TSizeDoublePr3Vec = core::CSmallVector; +using TPriorPtr = boost::shared_ptr; +using TDouble10Vec1Vec = CMultivariatePrior::TDouble10Vec1Vec; +using TDouble10Vec4Vec1Vec = CMultivariatePrior::TDouble10Vec4Vec1Vec; +using TMode = SMultimodalPriorMode >; +using TModeVec = std::vector; //! Implementation of a sample joint log marginal likelihood calculation. MATHS_EXPORT @@ -131,18 +131,18 @@ template class CMultivariateMultimodalPrior : public CMultivariatePrior { public: - typedef core::CSmallVector TDouble5Vec; - typedef CVectorNx1 TPoint; - typedef CVectorNx1 TFloatPoint; - typedef std::vector TPointVec; - typedef core::CSmallVector TPoint4Vec; - typedef typename CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef CSymmetricMatrixNxN TMatrix; - typedef std::vector TMatrixVec; - typedef CClusterer TClusterer; - typedef boost::shared_ptr TClustererPtr; - typedef std::vector TPriorPtrVec; - typedef CConstantWeights TWeights; + using TDouble5Vec = core::CSmallVector; + using TPoint = CVectorNx1; + using TFloatPoint = CVectorNx1; + using TPointVec = std::vector; + using TPoint4Vec = core::CSmallVector; + using TMeanAccumulator = typename CBasicStatistics::SSampleMean::TAccumulator; + using TMatrix = CSymmetricMatrixNxN; + using TMatrixVec = std::vector; + using TClusterer = CClusterer; + using TClustererPtr = boost::shared_ptr; + using TPriorPtrVec = std::vector; + using TWeights = CConstantWeights; // Lift all overloads of into scope. //{ @@ -337,7 +337,7 @@ class CMultivariateMultimodalPrior : public CMultivariatePrior // See CMultimodalPrior::addSamples for discussion. - typedef core::CSmallVector TSizeDoublePr2Vec; + using TSizeDoublePr2Vec = core::CSmallVector; // Declared outside the loop to minimize the number of times it // is initialized. @@ -415,7 +415,7 @@ class CMultivariateMultimodalPrior : public CMultivariatePrior { TDouble10Vec &ww = weight[0][winsorisation]; double f = (k->weight() + cluster.second) / Z; - for (auto &&w : ww) + for (auto &w : ww) { w = std::max(1.0 - (1.0 - w) / f, w * f); } @@ -507,7 +507,7 @@ class CMultivariateMultimodalPrior : public CMultivariatePrior } double Z = 0.0; - for (auto &&weight : weights) + for (auto &weight : weights) { weight = ::exp(weight - maxWeight[0]); Z += weight; @@ -567,7 +567,7 @@ class CMultivariateMultimodalPrior : public CMultivariatePrior } double Z = 0.0; - for (auto &&weight : weights) + for (auto &weight : weights) { weight = ::exp(weight - maxWeight[0]); Z += weight; @@ -668,7 +668,7 @@ class CMultivariateMultimodalPrior : public CMultivariatePrior return m_Modes[0].s_Prior->marginalLikelihoodMode(weightStyles, weight); } - typedef CBasicStatistics::COrderStatisticsStack > TMaxAccumulator; + using TMaxAccumulator = CBasicStatistics::COrderStatisticsStack >; // We'll approximate this as the mode with the maximum likelihood. TPoint result(0.0); @@ -1017,8 +1017,8 @@ class CMultivariateMultimodalPrior : public CMultivariatePrior } protected: - typedef multivariate_multimodal_prior_detail::TMode TMode; - typedef multivariate_multimodal_prior_detail::TModeVec TModeVec; + using TMode = multivariate_multimodal_prior_detail::TMode; + using TModeVec = multivariate_multimodal_prior_detail::TModeVec; protected: //! Get the modes. @@ -1241,7 +1241,7 @@ class CMultivariateMultimodalPrior : public CMultivariatePrior // = Sum_i{ w(i) * (Integral{ x' * x * f(x | i) } - m' * m) } // = Sum_i{ w(i) * ((mi' * mi + Ci) - m' * m) } - typedef typename CBasicStatistics::SSampleMean::TAccumulator TMatrixMeanAccumulator; + using TMatrixMeanAccumulator = typename CBasicStatistics::SSampleMean::TAccumulator; TMatrix mean2 = TPoint(this->marginalLikelihoodMean()).outer(); diff --git a/include/maths/CMultivariateMultimodalPriorFactory.h b/include/maths/CMultivariateMultimodalPriorFactory.h index 06dafb2bdf..8a878c2b0d 100644 --- a/include/maths/CMultivariateMultimodalPriorFactory.h +++ b/include/maths/CMultivariateMultimodalPriorFactory.h @@ -30,7 +30,7 @@ struct SDistributionRestoreParams; class MATHS_EXPORT CMultivariateMultimodalPriorFactory { public: - typedef boost::shared_ptr TPriorPtr; + using TPriorPtr = boost::shared_ptr; public: //! Create a new non-informative multivariate normal prior. diff --git a/include/maths/CMultivariateNormalConjugate.h b/include/maths/CMultivariateNormalConjugate.h index 58a1bd4b74..843c6ae05b 100644 --- a/include/maths/CMultivariateNormalConjugate.h +++ b/include/maths/CMultivariateNormalConjugate.h @@ -81,13 +81,13 @@ class CMultivariateNormalConjugate : public CMultivariatePrior //! See core::CMemory. static bool dynamicSizeAlwaysZero(void) { return true; } - typedef std::vector TDoubleVec; - typedef CVectorNx1 TPoint; - typedef std::vector TPointVec; - typedef core::CSmallVector TPoint4Vec; - typedef CSymmetricMatrixNxN TMatrix; - typedef std::vector TMatrixVec; - typedef typename CBasicStatistics::SSampleCovariances TCovariance; + using TDoubleVec = std::vector; + using TPoint = CVectorNx1; + using TPointVec = std::vector; + using TPoint4Vec = core::CSmallVector; + using TMatrix = CSymmetricMatrixNxN; + using TMatrixVec = std::vector; + using TCovariance = typename CBasicStatistics::SSampleCovariances; // Lift all overloads of into scope. //{ @@ -96,8 +96,8 @@ class CMultivariateNormalConjugate : public CMultivariatePrior //} private: - typedef typename SDenseVector::Type TDenseVector; - typedef typename SDenseMatrix::Type TDenseMatrix; + using TDenseVector = typename SDenseVector::Type; + using TDenseMatrix = typename SDenseMatrix::Type; public: //! \name Life-cycle @@ -504,8 +504,8 @@ class CMultivariateNormalConjugate : public CMultivariatePrior return {TPriorPtr(CMultivariateNormalConjugate<2>::nonInformativePrior(dataType, decayRate).clone()), 0.0}; } - typedef CVectorNx1 TPoint2; - typedef CSymmetricMatrixNxN TMatrix2; + using TPoint2 = CVectorNx1; + using TMatrix2 = CSymmetricMatrixNxN; TPoint2 p; p(0) = m_GaussianPrecision(i1[0]); diff --git a/include/maths/CMultivariateNormalConjugateFactory.h b/include/maths/CMultivariateNormalConjugateFactory.h index 976644df66..72c152b1b1 100644 --- a/include/maths/CMultivariateNormalConjugateFactory.h +++ b/include/maths/CMultivariateNormalConjugateFactory.h @@ -30,7 +30,7 @@ struct SDistributionRestoreParams; class MATHS_EXPORT CMultivariateNormalConjugateFactory { public: - typedef boost::shared_ptr TPriorPtr; + using TPriorPtr = boost::shared_ptr; public: //! Create a new non-informative multivariate normal prior. diff --git a/include/maths/CMultivariateOneOfNPrior.h b/include/maths/CMultivariateOneOfNPrior.h index 5913c06777..40b719cfc7 100644 --- a/include/maths/CMultivariateOneOfNPrior.h +++ b/include/maths/CMultivariateOneOfNPrior.h @@ -58,15 +58,15 @@ struct SDistributionRestoreParams; class MATHS_EXPORT CMultivariateOneOfNPrior : public CMultivariatePrior { public: - typedef core::CSmallVector TDouble3Vec; - typedef std::vector TPriorPtrVec; - typedef std::pair TDoublePriorPtrPr; - typedef std::vector TDoublePriorPtrPrVec; - typedef std::pair TWeightPriorPtrPr; - typedef std::vector TWeightPriorPtrPrVec; - typedef core::CSmallVector TPriorCPtr3Vec; - typedef CBasicStatistics::SMin::TAccumulator TMinAccumulator; - typedef CBasicStatistics::SMax::TAccumulator TMaxAccumulator; + using TDouble3Vec = core::CSmallVector; + using TPriorPtrVec = std::vector; + using TDoublePriorPtrPr = std::pair; + using TDoublePriorPtrPrVec = std::vector; + using TWeightPriorPtrPr = std::pair; + using TWeightPriorPtrPrVec = std::vector; + using TPriorCPtr3Vec = core::CSmallVector; + using TMinAccumulator = CBasicStatistics::SMin::TAccumulator; + using TMaxAccumulator = CBasicStatistics::SMax::TAccumulator; // Lift all overloads of into scope. //{ diff --git a/include/maths/CMultivariateOneOfNPriorFactory.h b/include/maths/CMultivariateOneOfNPriorFactory.h index 0d1d3884e1..e0e1f0b2f8 100644 --- a/include/maths/CMultivariateOneOfNPriorFactory.h +++ b/include/maths/CMultivariateOneOfNPriorFactory.h @@ -30,8 +30,8 @@ struct SDistributionRestoreParams; class MATHS_EXPORT CMultivariateOneOfNPriorFactory { public: - typedef boost::shared_ptr TPriorPtr; - typedef std::vector TPriorPtrVec; + using TPriorPtr = boost::shared_ptr; + using TPriorPtrVec = std::vector; public: //! Create a new non-informative multivariate normal prior. diff --git a/include/maths/CNaturalBreaksClassifier.h b/include/maths/CNaturalBreaksClassifier.h index b4cb9ccb82..f2749994d1 100644 --- a/include/maths/CNaturalBreaksClassifier.h +++ b/include/maths/CNaturalBreaksClassifier.h @@ -100,15 +100,15 @@ struct SDistributionRestoreParams; class MATHS_EXPORT CNaturalBreaksClassifier { public: - typedef std::vector TSizeVec; - typedef std::vector TDoubleVec; - typedef std::pair TDoubleDoublePr; - typedef std::vector TDoubleDoublePrVec; - typedef CBasicStatistics::SSampleMeanVar::TAccumulator TDoubleTuple; - typedef std::vector TDoubleTupleVec; - typedef CBasicStatistics::SSampleMeanVar::TAccumulator TTuple; - typedef std::vector TTupleVec; - typedef std::vector TClassifierVec; + using TSizeVec = std::vector; + using TDoubleVec = std::vector; + using TDoubleDoublePr = std::pair; + using TDoubleDoublePrVec = std::vector; + using TDoubleTuple = CBasicStatistics::SSampleMeanVar::TAccumulator; + using TDoubleTupleVec = std::vector; + using TTuple = CBasicStatistics::SSampleMeanVar::TAccumulator; + using TTupleVec = std::vector; + using TClassifierVec = std::vector; public: //! The type of optimization object which it is possible @@ -282,7 +282,7 @@ class MATHS_EXPORT CNaturalBreaksClassifier TSizeVec &result); private: - typedef std::pair TSizeSizePr; + using TSizeSizePr = std::pair; private: //! Implementation called by naturalBreaks with explicit diff --git a/include/maths/CNormalMeanPrecConjugate.h b/include/maths/CNormalMeanPrecConjugate.h index dc75383220..9e22f635dd 100644 --- a/include/maths/CNormalMeanPrecConjugate.h +++ b/include/maths/CNormalMeanPrecConjugate.h @@ -53,8 +53,8 @@ class MATHS_EXPORT CNormalMeanPrecConjugate : public CPrior //! See core::CMemory. static bool dynamicSizeAlwaysZero(void) { return true; } - typedef CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; - typedef CEqualWithTolerance TEqualWithTolerance; + using TMeanVarAccumulator = CBasicStatistics::SSampleMeanVar::TAccumulator; + using TEqualWithTolerance = CEqualWithTolerance; //! Lift the overloads of addSamples into scope. using CPrior::addSamples; diff --git a/include/maths/COneOfNPrior.h b/include/maths/COneOfNPrior.h index 90e08ca868..d36eb6d5bc 100644 --- a/include/maths/COneOfNPrior.h +++ b/include/maths/COneOfNPrior.h @@ -50,11 +50,11 @@ struct SDistributionRestoreParams; class MATHS_EXPORT COneOfNPrior : public CPrior { public: - typedef boost::shared_ptr TPriorPtr; - typedef std::vector TPriorPtrVec; - typedef std::vector TPriorCPtrVec; - typedef std::pair TDoublePriorPtrPr; - typedef std::vector TDoublePriorPtrPrVec; + using TPriorPtr = boost::shared_ptr; + using TPriorPtrVec = std::vector; + using TPriorCPtrVec = std::vector; + using TDoublePriorPtrPr = std::pair; + using TDoublePriorPtrPrVec = std::vector; //! Lift all overloads of the dataType into scope. using CPrior::dataType; @@ -350,11 +350,11 @@ class MATHS_EXPORT COneOfNPrior : public CPrior //@} private: - typedef std::pair TDoubleSizePr; - typedef core::CSmallVector TDoubleSizePr5Vec; - typedef std::pair TWeightPriorPtrPr; - typedef std::vector TWeightPriorPtrPrVec; - typedef CBasicStatistics::SMax::TAccumulator TMaxAccumulator; + using TDoubleSizePr = std::pair; + using TDoubleSizePr5Vec = core::CSmallVector; + using TWeightPriorPtrPr = std::pair; + using TWeightPriorPtrPrVec = std::vector; + using TMaxAccumulator = CBasicStatistics::SMax::TAccumulator; private: //! Read parameters from \p traverser. diff --git a/include/maths/COrderings.h b/include/maths/COrderings.h index 3f6af12e79..5884573f26 100644 --- a/include/maths/COrderings.h +++ b/include/maths/COrderings.h @@ -48,7 +48,7 @@ class COrderings : private core::CNonInstantiatable //! operator <. struct SOptionalLess { - typedef bool result_type; + using result_type = bool; //! \note U and V must be convertible to T or optional //! for some type T and T must support operator <. @@ -87,7 +87,7 @@ class COrderings : private core::CNonInstantiatable //! operator >. struct SOptionalGreater { - typedef bool result_type; + using result_type = bool; //! \note U and V must be convertible to T or optional //! for some type T and T must support operator >. @@ -126,7 +126,7 @@ class COrderings : private core::CNonInstantiatable //! operator <. struct SPtrLess { - typedef bool result_type; + using result_type = bool; template inline bool operator()(const T *lhs, const T *rhs) const @@ -150,7 +150,7 @@ class COrderings : private core::CNonInstantiatable //! the type operator >. struct SPtrGreater { - typedef bool result_type; + using result_type = bool; template inline bool operator()(const T *lhs, const T *rhs) const @@ -173,7 +173,7 @@ class COrderings : private core::CNonInstantiatable //! comparable with operator <. struct SReferenceLess { - typedef bool result_type; + using result_type = bool; template inline bool operator()(const U &lhs, const V &rhs) const @@ -192,7 +192,7 @@ class COrderings : private core::CNonInstantiatable //! comparable with operator >. struct SReferenceGreater { - typedef bool result_type; + using result_type = bool; template inline bool operator()(const U &lhs, const V &rhs) const @@ -302,7 +302,7 @@ class COrderings : private core::CNonInstantiatable //! \brief Wrapper around various less than comparisons. struct SLess { - typedef bool result_type; + using result_type = bool; template bool operator()(const boost::optional &lhs, @@ -354,7 +354,7 @@ class COrderings : private core::CNonInstantiatable //! \brief Wrapper around various less than comparisons. struct SGreater { - typedef bool result_type; + using result_type = bool; template bool operator()(const boost::optional &lhs, @@ -711,7 +711,7 @@ class COrderings : private core::CNonInstantiatable { \ return true; \ } \ - typedef std::vector TSizeVec; \ + using TSizeVec = std::vector; \ TSizeVec ordering; \ ordering.reserve(keys.size()); \ for (std::size_t i = 0u; i < keys.size(); ++i) \ diff --git a/include/maths/CPRNG.h b/include/maths/CPRNG.h index b43daf041a..a63b163481 100644 --- a/include/maths/CPRNG.h +++ b/include/maths/CPRNG.h @@ -58,7 +58,7 @@ class MATHS_EXPORT CPRNG : private core::CNonInstantiatable class MATHS_EXPORT CSplitMix64 { public: - typedef uint64_t result_type; + using result_type = uint64_t; public: CSplitMix64(void); @@ -117,7 +117,7 @@ class MATHS_EXPORT CPRNG : private core::CNonInstantiatable class MATHS_EXPORT CXorOShiro128Plus { public: - typedef uint64_t result_type; + using result_type = uint64_t; public: CXorOShiro128Plus(void); @@ -213,7 +213,7 @@ class MATHS_EXPORT CPRNG : private core::CNonInstantiatable class MATHS_EXPORT CXorShift1024Mult { public: - typedef uint64_t result_type; + using result_type = uint64_t; public: CXorShift1024Mult(void); diff --git a/include/maths/CPackedBitVector.h b/include/maths/CPackedBitVector.h index 2954578b79..7d403b231b 100644 --- a/include/maths/CPackedBitVector.h +++ b/include/maths/CPackedBitVector.h @@ -50,7 +50,7 @@ class MATHS_EXPORT CPackedBitVector : private boost::equality_comparable< CPacke boost::partially_ordered< CPackedBitVector > > { public: - typedef std::vector TBoolVec; + using TBoolVec = std::vector; //! Operations which can be performed in the inner product. enum EOperation @@ -125,7 +125,7 @@ class MATHS_EXPORT CPackedBitVector : private boost::equality_comparable< CPacke std::size_t memoryUsage(void) const; private: - typedef std::vector TUInt8Vec; + using TUInt8Vec = std::vector; private: //! The maximum permitted run length. Longer runs are encoded diff --git a/include/maths/CPoissonMeanConjugate.h b/include/maths/CPoissonMeanConjugate.h index 817be5a71b..dc3c3499b4 100644 --- a/include/maths/CPoissonMeanConjugate.h +++ b/include/maths/CPoissonMeanConjugate.h @@ -51,7 +51,7 @@ struct SDistributionRestoreParams; class MATHS_EXPORT CPoissonMeanConjugate : public CPrior { public: - typedef CEqualWithTolerance TEqualWithTolerance; + using TEqualWithTolerance = CEqualWithTolerance; //! Lift the overloads of addSamples into scope. using CPrior::addSamples; diff --git a/include/maths/CQDigest.h b/include/maths/CQDigest.h index b97c9358c6..423f91b1ec 100644 --- a/include/maths/CQDigest.h +++ b/include/maths/CQDigest.h @@ -82,8 +82,8 @@ namespace maths class MATHS_EXPORT CQDigest : private core::CNonCopyable { public: - typedef std::pair TUInt32UInt64Pr; - typedef std::vector TUInt32UInt64PrVec; + using TUInt32UInt64Pr = std::pair; + using TUInt32UInt64PrVec = std::vector; public: //! \name XML Tag Names @@ -209,17 +209,17 @@ class MATHS_EXPORT CQDigest : private core::CNonCopyable //@} private: - typedef std::vector TSizeVec; - typedef TSizeVec::const_iterator TSizeVecCItr; - typedef std::greater TSizeGreater; + using TSizeVec = std::vector; + using TSizeVecCItr = TSizeVec::const_iterator; + using TSizeGreater = std::greater; class CNode; class CNodeAllocator; - typedef std::vector TNodePtrVec; - typedef TNodePtrVec::iterator TNodePtrVecItr; - typedef TNodePtrVec::const_iterator TNodePtrVecCItr; - typedef TNodePtrVec::const_reverse_iterator TNodePtrVecCRItr; + using TNodePtrVec = std::vector; + using TNodePtrVecItr = TNodePtrVec::iterator; + using TNodePtrVecCItr = TNodePtrVec::const_iterator; + using TNodePtrVecCRItr = TNodePtrVec::const_reverse_iterator; //! Orders node pointers by level order. struct MATHS_EXPORT SLevelLess @@ -396,12 +396,12 @@ class MATHS_EXPORT CQDigest : private core::CNonCopyable void release(CNode &node); private: - typedef std::vector TNodePtrVecVec; - typedef std::vector TNodeVec; - typedef std::vector::const_iterator TNodeVecCItr; - typedef std::list TNodeVecList; - typedef TNodeVecList::iterator TNodeVecListItr; - typedef TNodeVecList::const_iterator TNodeVecListCItr; + using TNodePtrVecVec = std::vector; + using TNodeVec = std::vector; + using TNodeVecCItr = std::vector::const_iterator; + using TNodeVecList = std::list; + using TNodeVecListItr = TNodeVecList::iterator; + using TNodeVecListCItr = TNodeVecList::const_iterator; private: //! Find the block to which \p node belongs. diff --git a/include/maths/CQuantileSketch.h b/include/maths/CQuantileSketch.h index 7ee8c4cab6..395397307b 100644 --- a/include/maths/CQuantileSketch.h +++ b/include/maths/CQuantileSketch.h @@ -49,8 +49,8 @@ namespace maths class MATHS_EXPORT CQuantileSketch : private boost::addable< CQuantileSketch > { public: - typedef std::pair TFloatFloatPr; - typedef std::vector TFloatFloatPrVec; + using TFloatFloatPr = std::pair; + using TFloatFloatPrVec = std::vector; //! The types of interpolation used for computing the quantile. enum EInterpolation diff --git a/include/maths/CSetTools.h b/include/maths/CSetTools.h index 8891bfd0f3..70c451b52b 100644 --- a/include/maths/CSetTools.h +++ b/include/maths/CSetTools.h @@ -36,7 +36,7 @@ class MATHS_EXPORT CSetTools class CIndexInSet { public: - typedef std::set TSizeSet; + using TSizeSet = std::set; public: CIndexInSet(std::size_t index) : m_IndexSet(index) {} @@ -55,7 +55,7 @@ class MATHS_EXPORT CSetTools } private: - typedef boost::variant TSizeOrSizeSet; + using TSizeOrSizeSet = boost::variant; private: TSizeOrSizeSet m_IndexSet; diff --git a/include/maths/CSolvers.h b/include/maths/CSolvers.h index 9e378667f8..f41770a1e8 100644 --- a/include/maths/CSolvers.h +++ b/include/maths/CSolvers.h @@ -41,7 +41,7 @@ namespace maths class MATHS_EXPORT CSolvers { private: - typedef std::pair TDoubleDoublePr; + using TDoubleDoublePr = std::pair; //! \name Helpers //@{ @@ -921,8 +921,8 @@ class MATHS_EXPORT CSolvers double &x, double &fx) { - typedef std::pair TDoubleSizePr; - typedef CBasicStatistics::COrderStatisticsStack TMinAccumulator; + using TDoubleSizePr = std::pair; + using TMinAccumulator = CBasicStatistics::COrderStatisticsStack; std::size_t n = p.size(); diff --git a/include/maths/CSphericalCluster.h b/include/maths/CSphericalCluster.h index 89295ae55a..57ecd2b4b2 100644 --- a/include/maths/CSphericalCluster.h +++ b/include/maths/CSphericalCluster.h @@ -48,7 +48,7 @@ template class CSphericalCluster { public: - typedef CAnnotatedVector Type; + using Type = CAnnotatedVector; class CHash { @@ -101,7 +101,7 @@ struct SCentralMomentsCustomAdd, SCountAndVari typename SCoordinate::Type n, CBasicStatistics::SSampleCentralMoments &moments) { - typedef typename SCoordinate::Type TCoordinate; + using TCoordinate = typename SCoordinate::Type; moments.add(x, TCoordinate(x.annotation().s_Count) * n, 0); } @@ -110,7 +110,7 @@ struct SCentralMomentsCustomAdd, SCountAndVari typename SCoordinate::Type n, CBasicStatistics::SSampleCentralMoments &moments) { - typedef typename SCoordinate::Type TCoordinate; + using TCoordinate = typename SCoordinate::Type; moments += CBasicStatistics::accumulator(TCoordinate(x.annotation().s_Count) * n, T(x), T(x.annotation().s_Variance)); diff --git a/include/maths/CSpline.h b/include/maths/CSpline.h index b50dac0f2c..ea1eca7bd3 100644 --- a/include/maths/CSpline.h +++ b/include/maths/CSpline.h @@ -31,8 +31,8 @@ namespace maths namespace spline_detail { -typedef std::vector TDoubleVec; -typedef std::vector TFloatVec; +using TDoubleVec = std::vector; +using TFloatVec = std::vector; //! Solves \f$Ax = y\f$ where \f$A\f$ is a tridiagonal matrix //! consisting of vectors \f$a\f$, \f$b\f$ and \f$c\f$. @@ -75,8 +75,8 @@ bool MATHS_EXPORT solvePeturbedTridiagonal(const TDoubleVec &a, class MATHS_EXPORT CSplineTypes { public: - typedef std::vector TDoubleVec; - typedef CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TDoubleVec = std::vector; + using TMeanAccumulator = CBasicStatistics::SSampleMean::TAccumulator; //! Types of spline interpolation that this will perform. //! @@ -141,12 +141,12 @@ template, class CSpline : public CSplineTypes { public: - typedef typename boost::unwrap_reference::type TKnots; - typedef typename boost::unwrap_reference::type TValues; - typedef typename boost::unwrap_reference::type TCurvatures; - typedef typename boost::remove_const::type TNonConstKnots; - typedef typename boost::remove_const::type TNonConstValues; - typedef typename boost::remove_const::type TNonConstCurvatures; + using TKnots = typename boost::unwrap_reference::type; + using TValues = typename boost::unwrap_reference::type; + using TCurvatures = typename boost::unwrap_reference::type; + using TNonConstKnots = typename boost::remove_const::type; + using TNonConstValues = typename boost::remove_const::type; + using TNonConstCurvatures = typename boost::remove_const::type; public: CSpline(EType type) : m_Type(type) {} diff --git a/include/maths/CStatisticalTests.h b/include/maths/CStatisticalTests.h index 0cf4396fc4..ce7950eb84 100644 --- a/include/maths/CStatisticalTests.h +++ b/include/maths/CStatisticalTests.h @@ -31,8 +31,8 @@ namespace maths class MATHS_EXPORT CStatisticalTests { public: - typedef std::vector TUInt16Vec; - typedef std::vector TDoubleVec; + using TUInt16Vec = std::vector; + using TDoubleVec = std::vector; public: //! Get the significance of a left tail F-test for \p x when @@ -126,7 +126,7 @@ class MATHS_EXPORT CStatisticalTests static const double SCALE; private: - typedef CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = CBasicStatistics::SSampleMean::TAccumulator; private: //! The "count - 1" in the test statistic. diff --git a/include/maths/CTimeSeriesModel.h b/include/maths/CTimeSeriesModel.h index facf2574ba..36b5660925 100644 --- a/include/maths/CTimeSeriesModel.h +++ b/include/maths/CTimeSeriesModel.h @@ -289,7 +289,7 @@ class MATHS_EXPORT CTimeSeriesCorrelateModelAllocator class MATHS_EXPORT CTimeSeriesCorrelations { public: - using TTime1Vec = core::CSmallVector ; + using TTime1Vec = core::CSmallVector; using TDouble1Vec = core::CSmallVector; using TDouble2Vec = core::CSmallVector; using TDouble4Vec = core::CSmallVector; diff --git a/include/maths/CXMeans.h b/include/maths/CXMeans.h index bbdbe29a5b..f3c9415749 100644 --- a/include/maths/CXMeans.h +++ b/include/maths/CXMeans.h @@ -51,12 +51,12 @@ template TDoubleVec; - typedef std::vector TPointVec; - typedef std::vector TPointVecVec; - typedef boost::unordered_set TUInt64USet; - typedef TUInt64USet::iterator TUInt64USetItr; - typedef typename CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TDoubleVec = std::vector; + using TPointVec = std::vector; + using TPointVecVec = std::vector; + using TUInt64USet = boost::unordered_set; + using TUInt64USetItr = TUInt64USet::iterator; + using TMeanAccumulator = typename CBasicStatistics::SSampleMean::TAccumulator; //! A cluster. //! @@ -144,7 +144,7 @@ class CXMeans uint64_t m_Checksum; }; - typedef std::vector TClusterVec; + using TClusterVec = std::vector; public: CXMeans(std::size_t kmax) : @@ -220,8 +220,8 @@ class CXMeans //! iterations of Lloyd's algorithm to use. void improveParams(std::size_t kmeansIterations) { - typedef const CCluster *TClusterCPtr; - typedef std::vector TClusterCPtrVec; + using TClusterCPtr = const CCluster*; + using TClusterCPtrVec = std::vector; std::size_t n = m_Clusters.size(); diff --git a/include/maths/CXMeansOnline.h b/include/maths/CXMeansOnline.h index 4f6ff473d8..4c533e1f37 100644 --- a/include/maths/CXMeansOnline.h +++ b/include/maths/CXMeansOnline.h @@ -76,28 +76,28 @@ template class CXMeansOnline : public CClusterer > { public: - typedef CVectorNx1 TPoint; - typedef std::vector TPointVec; - typedef typename CClusterer::TPointPrecise TPointPrecise; - typedef typename CClusterer::TPointPreciseVec TPointPreciseVec; - typedef typename CClusterer::TPointPreciseDoublePrVec TPointPreciseDoublePrVec; - typedef typename CClusterer::TSizeDoublePr TSizeDoublePr; - typedef typename CClusterer::TSizeDoublePr2Vec TSizeDoublePr2Vec; - typedef std::vector TDoubleVec; - typedef std::vector TDoubleVecVec; - typedef std::vector TSizeVec; - typedef std::vector TSizeVecVec; - typedef typename SPromoted::Type TPrecise; - typedef CSymmetricMatrixNxN TMatrixPrecise; - typedef CBasicStatistics::SSampleCovariances TCovariances; - typedef typename CSphericalCluster::Type TSphericalCluster; - typedef std::vector TSphericalClusterVec; - typedef std::vector TSphericalClusterVecVec; - typedef CKMeansOnline TKMeansOnline; - typedef std::vector TKMeansOnlineVec; + using TPoint = CVectorNx1; + using TPointVec = std::vector; + using TPointPrecise = typename CClusterer::TPointPrecise; + using TPointPreciseVec = typename CClusterer::TPointPreciseVec; + using TPointPreciseDoublePrVec = typename CClusterer::TPointPreciseDoublePrVec; + using TSizeDoublePr = typename CClusterer::TSizeDoublePr; + using TSizeDoublePr2Vec = typename CClusterer::TSizeDoublePr2Vec; + using TDoubleVec = std::vector; + using TDoubleVecVec = std::vector; + using TSizeVec = std::vector; + using TSizeVecVec = std::vector; + using TPrecise = typename SPromoted::Type; + using TMatrixPrecise = CSymmetricMatrixNxN; + using TCovariances = CBasicStatistics::SSampleCovariances; + using TSphericalCluster = typename CSphericalCluster::Type; + using TSphericalClusterVec = std::vector; + using TSphericalClusterVecVec = std::vector; + using TKMeansOnline = CKMeansOnline; + using TKMeansOnlineVec = std::vector; class CCluster; - typedef std::pair TClusterClusterPr; - typedef boost::optional TOptionalClusterClusterPr; + using TClusterClusterPr = std::pair; + using TOptionalClusterClusterPr = boost::optional; //! \brief Represents a cluster. class CCluster @@ -627,9 +627,9 @@ class CXMeansOnline : public CClusterer > TKMeansOnline m_Structure; }; - typedef std::vector TClusterVec; - typedef typename TClusterVec::iterator TClusterVecItr; - typedef typename TClusterVec::const_iterator TClusterVecCItr; + using TClusterVec = std::vector; + using TClusterVecItr = typename TClusterVec::iterator; + using TClusterVecCItr = typename TClusterVec::const_iterator; public: //! \name Life-cycle @@ -937,8 +937,8 @@ class CXMeansOnline : public CClusterer > } else { - typedef std::pair TSizeDoublePr; - typedef CBasicStatistics::COrderStatisticsStack > TMaxAccumulator; + using TSizeDoublePr = std::pair; + using TMaxAccumulator = CBasicStatistics::COrderStatisticsStack >; TMaxAccumulator closest; for (std::size_t i = 0u; i < m_Clusters.size(); ++i) @@ -1268,8 +1268,8 @@ class CXMeansOnline : public CClusterer > return false; } - typedef std::pair TDoubleSizePr; - typedef CBasicStatistics::COrderStatisticsStack TMinAccumulator; + using TDoubleSizePr = std::pair; + using TMinAccumulator = CBasicStatistics::COrderStatisticsStack; bool result = false; @@ -1323,7 +1323,7 @@ class CXMeansOnline : public CClusterer > return &m_Clusters[0]; } - typedef CBasicStatistics::COrderStatisticsStack TMinAccumulator; + using TMinAccumulator = CBasicStatistics::COrderStatisticsStack; CCluster *result = 0; TMinAccumulator min; diff --git a/include/maths/CXMeansOnline1d.h b/include/maths/CXMeansOnline1d.h index 426a0e02f4..87269142d4 100644 --- a/include/maths/CXMeansOnline1d.h +++ b/include/maths/CXMeansOnline1d.h @@ -112,11 +112,11 @@ class MATHS_EXPORT CXMeansOnline1d : public CClusterer1d { public: class CCluster; - typedef CClusterer1d::TPointPreciseVec TDoubleVec; - typedef CClusterer1d::TPointPreciseDoublePrVec TDoubleDoublePrVec; - typedef std::pair TClusterClusterPr; - typedef boost::optional TOptionalClusterClusterPr; - typedef std::pair TDoubleDoublePr; + using TDoubleVec = CClusterer1d::TPointPreciseVec; + using TDoubleDoublePrVec = CClusterer1d::TPointPreciseDoublePrVec; + using TClusterClusterPr = std::pair; + using TOptionalClusterClusterPr = boost::optional; + using TDoubleDoublePr = std::pair; using CClusterer1d::add; //! \brief Represents a cluster. @@ -232,9 +232,9 @@ class MATHS_EXPORT CXMeansOnline1d : public CClusterer1d CNaturalBreaksClassifier m_Structure; }; - typedef std::vector TClusterVec; - typedef TClusterVec::iterator TClusterVecItr; - typedef TClusterVec::const_iterator TClusterVecCItr; + using TClusterVec = std::vector; + using TClusterVecItr = TClusterVec::iterator; + using TClusterVecCItr = TClusterVec::const_iterator; public: //! The central confidence interval on which to Winsorise. @@ -391,8 +391,8 @@ class MATHS_EXPORT CXMeansOnline1d : public CClusterer1d CIndexGenerator &indexGenerator(void); private: - typedef CBasicStatistics::COrderStatisticsStack TMinAccumulator; - typedef CBasicStatistics::COrderStatisticsStack > TMaxAccumulator; + using TMinAccumulator = CBasicStatistics::COrderStatisticsStack; + using TMaxAccumulator = CBasicStatistics::COrderStatisticsStack >; private: //! The minimum Kullback-Leibler divergence at which we'll diff --git a/include/maths/MathsTypes.h b/include/maths/MathsTypes.h index 46ddb35066..e4d1317dfe 100644 --- a/include/maths/MathsTypes.h +++ b/include/maths/MathsTypes.h @@ -26,14 +26,14 @@ class CSeasonalComponent; namespace maths_t { -typedef std::pair TDoubleDoublePr; -typedef core::CSmallVector TDouble4Vec; -typedef core::CSmallVector TDouble10Vec; -typedef core::CSmallVector TDouble4Vec1Vec; -typedef core::CSmallVector TDouble10Vec4Vec; -typedef core::CSmallVector TDouble10Vec4Vec1Vec; -typedef std::vector TSeasonalComponentVec; -typedef std::vector TCalendarComponentVec; +using TDoubleDoublePr = std::pair; +using TDouble4Vec = core::CSmallVector; +using TDouble10Vec = core::CSmallVector; +using TDouble4Vec1Vec = core::CSmallVector; +using TDouble10Vec4Vec = core::CSmallVector; +using TDouble10Vec4Vec1Vec = core::CSmallVector; +using TSeasonalComponentVec = std::vector; +using TCalendarComponentVec = std::vector; //! An enumeration of the types of data which can be modeled. //! @@ -81,7 +81,7 @@ enum ESampleWeightStyle //! IMPORTANT: this must be kept this up-to-date with ESampleWeightStyle. const std::size_t NUMBER_WEIGHT_STYLES = 4; -typedef core::CSmallVector TWeightStyleVec; +using TWeightStyleVec = core::CSmallVector; //! Extract the effective sample count from a collection of weights. MATHS_EXPORT diff --git a/include/maths/ProbabilityAggregators.h b/include/maths/ProbabilityAggregators.h index 884102dd30..dc9c537a3a 100644 --- a/include/maths/ProbabilityAggregators.h +++ b/include/maths/ProbabilityAggregators.h @@ -49,7 +49,7 @@ namespace maths class MATHS_EXPORT CJointProbabilityOfLessLikelySamples : private boost::addable { public: - typedef boost::optional TOptionalDouble; + using TOptionalDouble = boost::optional; //! Functor wrapper of CJointProbabilityOfLessLikelySamples::add. struct SAddProbability @@ -223,7 +223,7 @@ class MATHS_EXPORT CProbabilityOfExtremeSample : private boost::addable TMinValueAccumulator; + using TMinValueAccumulator = CBasicStatistics::COrderStatisticsStack; private: TMinValueAccumulator m_MinValue; @@ -311,7 +311,7 @@ class MATHS_EXPORT CLogProbabilityOfMFromNExtremeSamples : private boost::addabl uint64_t checksum(uint64_t seed) const; private: - typedef CBasicStatistics::COrderStatisticsHeap TMinValueAccumulator; + using TMinValueAccumulator = CBasicStatistics::COrderStatisticsHeap; private: TMinValueAccumulator m_MinValues; diff --git a/include/model/CAnnotatedProbabilityBuilder.h b/include/model/CAnnotatedProbabilityBuilder.h index 89125784a0..8376f0f47d 100644 --- a/include/model/CAnnotatedProbabilityBuilder.h +++ b/include/model/CAnnotatedProbabilityBuilder.h @@ -37,11 +37,11 @@ class CModel; class MODEL_EXPORT CAnnotatedProbabilityBuilder : private core::CNonCopyable { public: - typedef std::pair TSizeDoublePr; - typedef core::CSmallVector TDouble1Vec; - typedef core::CSmallVector TSize1Vec; - typedef core::CSmallVector TSizeDoublePr1Vec; - typedef core::CSmallVector TStoredStringPtr1Vec; + using TSizeDoublePr = std::pair; + using TDouble1Vec = core::CSmallVector; + using TSize1Vec = core::CSmallVector; + using TSizeDoublePr1Vec = core::CSmallVector; + using TStoredStringPtr1Vec = core::CSmallVector; public: CAnnotatedProbabilityBuilder(SAnnotatedProbability &annotatedProbability); @@ -73,7 +73,7 @@ class MODEL_EXPORT CAnnotatedProbabilityBuilder : private core::CNonCopyable void addDescriptiveData(void); private: - typedef maths::CBasicStatistics::COrderStatisticsHeap TMinAccumulator; + using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsHeap; private: SAnnotatedProbability &m_Result; diff --git a/include/model/CAnomalyDetector.h b/include/model/CAnomalyDetector.h index 6ce7c30df3..15b2e09d67 100644 --- a/include/model/CAnomalyDetector.h +++ b/include/model/CAnomalyDetector.h @@ -73,23 +73,23 @@ class CSearchKey; class MODEL_EXPORT CAnomalyDetector : private core::CNonCopyable { public: - typedef std::vector TStrVec; - typedef std::vector TStrCPtrVec; - typedef std::vector TModelPlotDataVec; + using TStrVec = std::vector; + using TStrCPtrVec = std::vector; + using TModelPlotDataVec = std::vector; - typedef boost::shared_ptr TDataGathererPtr; - typedef boost::shared_ptr TModelFactoryCPtr; - typedef boost::shared_ptr TModelPtr; + using TDataGathererPtr = boost::shared_ptr; + using TModelFactoryCPtr = boost::shared_ptr; + using TModelPtr = boost::shared_ptr; //! A shared pointer to an instance of this class - typedef boost::shared_ptr TAnomalyDetectorPtr; - - typedef std::function TOutputModelPlotDataFunc; - typedef CAnomalyDetectorModelConfig::TStrSet TStrSet; + using TAnomalyDetectorPtr = boost::shared_ptr; + + using TOutputModelPlotDataFunc = std::function; + using TStrSet = CAnomalyDetectorModelConfig::TStrSet; public: //! State version. This must be incremented every time a change to the diff --git a/include/model/CAnomalyDetectorModelConfig.h b/include/model/CAnomalyDetectorModelConfig.h index ff05b4698f..3136023dab 100644 --- a/include/model/CAnomalyDetectorModelConfig.h +++ b/include/model/CAnomalyDetectorModelConfig.h @@ -65,32 +65,32 @@ class MODEL_EXPORT CAnomalyDetectorModelConfig E_BadFactory }; - typedef std::set TStrSet; - typedef std::vector TSizeVec; - typedef std::vector TTimeVec; - typedef TTimeVec::const_iterator TTimeVecCItr; - typedef std::pair TDoubleDoublePr; - typedef std::vector TDoubleDoublePrVec; - typedef model_t::TFeatureVec TFeatureVec; - typedef std::vector TStrVec; - typedef TStrVec::const_iterator TStrVecCItr; - typedef boost::shared_ptr TModelFactoryPtr; - typedef boost::shared_ptr TModelFactoryCPtr; - typedef std::map TFactoryTypeFactoryPtrMap; - typedef TFactoryTypeFactoryPtrMap::iterator TFactoryTypeFactoryPtrMapItr; - typedef TFactoryTypeFactoryPtrMap::const_iterator TFactoryTypeFactoryPtrMapCItr; - typedef std::map TSearchKeyFactoryCPtrMap; + using TStrSet = std::set; + using TSizeVec = std::vector; + using TTimeVec = std::vector; + using TTimeVecCItr = TTimeVec::const_iterator; + using TDoubleDoublePr = std::pair; + using TDoubleDoublePrVec = std::vector; + using TFeatureVec = model_t::TFeatureVec; + using TStrVec = std::vector; + using TStrVecCItr = TStrVec::const_iterator; + using TModelFactoryPtr = boost::shared_ptr; + using TModelFactoryCPtr = boost::shared_ptr; + using TFactoryTypeFactoryPtrMap = std::map; + using TFactoryTypeFactoryPtrMapItr = TFactoryTypeFactoryPtrMap::iterator; + using TFactoryTypeFactoryPtrMapCItr = TFactoryTypeFactoryPtrMap::const_iterator; + using TSearchKeyFactoryCPtrMap = std::map; // Const ref to detection rules map - typedef std::vector TDetectionRuleVec; - typedef boost::reference_wrapper TDetectionRuleVecCRef; - typedef boost::unordered_map TIntDetectionRuleVecUMap; - typedef boost::reference_wrapper TIntDetectionRuleVecUMapCRef; - typedef TIntDetectionRuleVecUMap::const_iterator TIntDetectionRuleVecUMapCItr; - - typedef std::pair TStrDetectionRulePr; - typedef std::vector TStrDetectionRulePrVec; - typedef boost::reference_wrapper TStrDetectionRulePrVecCRef; + using TDetectionRuleVec = std::vector; + using TDetectionRuleVecCRef = boost::reference_wrapper; + using TIntDetectionRuleVecUMap = boost::unordered_map; + using TIntDetectionRuleVecUMapCRef = boost::reference_wrapper; + using TIntDetectionRuleVecUMapCItr = TIntDetectionRuleVecUMap::const_iterator; + + using TStrDetectionRulePr = std::pair; + using TStrDetectionRulePrVec = std::vector; + using TStrDetectionRulePrVecCRef = boost::reference_wrapper; public: //! The default value used to separate components of a multivariate feature diff --git a/include/model/CAnomalyScore.h b/include/model/CAnomalyScore.h index d40c692fda..2e3314ef65 100644 --- a/include/model/CAnomalyScore.h +++ b/include/model/CAnomalyScore.h @@ -49,12 +49,12 @@ class CLimits; class MODEL_EXPORT CAnomalyScore { public: - typedef std::vector TDoubleVec; - typedef TDoubleVec::iterator TDoubleVecItr; - typedef TDoubleVec::const_iterator TDoubleVecCItr; - typedef boost::optional TOptionalDouble; - typedef std::vector TOptionalDoubleVec; - typedef std::vector TStrVec; + using TDoubleVec = std::vector; + using TDoubleVecItr = TDoubleVec::iterator; + using TDoubleVecCItr = TDoubleVec::const_iterator; + using TOptionalDouble = boost::optional; + using TOptionalDoubleVec = std::vector; + using TStrVec = std::vector; //! Attributes for a persisted normalizer static const std::string MLCUE_ATTRIBUTE; @@ -178,11 +178,11 @@ class MODEL_EXPORT CAnomalyScore uint64_t checksum(void) const; private: - typedef std::pair TDoubleDoublePr; - typedef std::vector TDoubleDoublePrVec; - typedef TDoubleDoublePrVec::const_iterator TDoubleDoublePrVecCItr; - typedef std::greater TGreaterDouble; - typedef maths::CBasicStatistics::COrderStatisticsStack TMaxValueAccumulator; + using TDoubleDoublePr = std::pair; + using TDoubleDoublePrVec = std::vector; + using TDoubleDoublePrVecCItr = TDoubleDoublePrVec::const_iterator; + using TGreaterDouble = std::greater; + using TMaxValueAccumulator = maths::CBasicStatistics::COrderStatisticsStack; private: //! Used to convert raw scores in to integers so that we @@ -249,7 +249,7 @@ class MODEL_EXPORT CAnomalyScore double m_TimeToQuantileDecay; }; - typedef boost::shared_ptr TNormalizerP; + using TNormalizerP = boost::shared_ptr; public: //! Compute a joint anomaly score for a collection of probabilities. diff --git a/include/model/CBucketGatherer.h b/include/model/CBucketGatherer.h index 5c980c2709..854b53fcd8 100644 --- a/include/model/CBucketGatherer.h +++ b/include/model/CBucketGatherer.h @@ -64,38 +64,38 @@ class CResourceMonitor; class MODEL_EXPORT CBucketGatherer { public: - typedef std::vector TDoubleVec; - typedef core::CSmallVector TDouble1Vec; - typedef std::vector TSizeVec; - typedef std::vector TStrVec; - typedef TStrVec::const_iterator TStrVecCItr; - typedef std::vector TStrCPtrVec; - typedef std::pair TSizeUInt64Pr; - typedef std::vector TSizeUInt64PrVec; - typedef model_t::TFeatureVec TFeatureVec; - typedef boost::optional TOptionalDouble; - typedef std::pair TSizeSizePr; - typedef std::pair TSizeSizePrUInt64Pr; - typedef std::vector TSizeSizePrUInt64PrVec; - typedef core::CCompressedDictionary<2> TDictionary; - typedef TDictionary::CWordUMap::Type TWordSizeUMap; - typedef TWordSizeUMap::iterator TWordSizeUMapItr; - typedef TWordSizeUMap::const_iterator TWordSizeUMapCItr; - typedef boost::unordered_map TSizeSizePrUInt64UMap; - typedef TSizeSizePrUInt64UMap::iterator TSizeSizePrUInt64UMapItr; - typedef TSizeSizePrUInt64UMap::const_iterator TSizeSizePrUInt64UMapCItr; - typedef CBucketQueue TSizeSizePrUInt64UMapQueue; - typedef std::map TTimeSizeSizePrUInt64UMapMap; - typedef TSizeSizePrUInt64UMapQueue::iterator TSizeSizePrUInt64UMapQueueItr; - typedef TSizeSizePrUInt64UMapQueue::const_iterator TSizeSizePrUInt64UMapQueueCItr; - typedef TSizeSizePrUInt64UMapQueue::const_reverse_iterator TSizeSizePrUInt64UMapQueueCRItr; - typedef boost::unordered_set TSizeSizePrUSet; - typedef TSizeSizePrUSet::const_iterator TSizeSizePrUSetCItr; - typedef CBucketQueue TSizeSizePrUSetQueue; - typedef std::map TTimeSizeSizePrUSetMap; - typedef TSizeSizePrUSetQueue::const_iterator TSizeSizePrUSetQueueCItr; - typedef std::vector TStoredStringPtrVec; - typedef std::pair TSizeSizePrStoredStringPtrPr; + using TDoubleVec = std::vector; + using TDouble1Vec = core::CSmallVector; + using TSizeVec = std::vector; + using TStrVec = std::vector; + using TStrVecCItr = TStrVec::const_iterator; + using TStrCPtrVec = std::vector; + using TSizeUInt64Pr = std::pair; + using TSizeUInt64PrVec = std::vector; + using TFeatureVec = model_t::TFeatureVec; + using TOptionalDouble = boost::optional; + using TSizeSizePr = std::pair; + using TSizeSizePrUInt64Pr = std::pair; + using TSizeSizePrUInt64PrVec = std::vector; + using TDictionary = core::CCompressedDictionary<2>; + using TWordSizeUMap = TDictionary::CWordUMap::Type; + using TWordSizeUMapItr = TWordSizeUMap::iterator; + using TWordSizeUMapCItr = TWordSizeUMap::const_iterator; + using TSizeSizePrUInt64UMap = boost::unordered_map; + using TSizeSizePrUInt64UMapItr = TSizeSizePrUInt64UMap::iterator; + using TSizeSizePrUInt64UMapCItr = TSizeSizePrUInt64UMap::const_iterator; + using TSizeSizePrUInt64UMapQueue = CBucketQueue; + using TTimeSizeSizePrUInt64UMapMap = std::map; + using TSizeSizePrUInt64UMapQueueItr = TSizeSizePrUInt64UMapQueue::iterator; + using TSizeSizePrUInt64UMapQueueCItr = TSizeSizePrUInt64UMapQueue::const_iterator; + using TSizeSizePrUInt64UMapQueueCRItr = TSizeSizePrUInt64UMapQueue::const_reverse_iterator; + using TSizeSizePrUSet = boost::unordered_set; + using TSizeSizePrUSetCItr = TSizeSizePrUSet::const_iterator; + using TSizeSizePrUSetQueue = CBucketQueue; + using TTimeSizeSizePrUSetMap = std::map; + using TSizeSizePrUSetQueueCItr = TSizeSizePrUSetQueue::const_iterator; + using TStoredStringPtrVec = std::vector; + using TSizeSizePrStoredStringPtrPr = std::pair; //! \brief Hashes a ((size_t, size_t), string*) pair. struct MODEL_EXPORT SSizeSizePrStoredStringPtrPrHash @@ -119,22 +119,23 @@ class MODEL_EXPORT CBucketGatherer } }; - typedef boost::unordered_map TSizeSizePrStoredStringPtrPrUInt64UMap; - typedef TSizeSizePrStoredStringPtrPrUInt64UMap::const_iterator TSizeSizePrStoredStringPtrPrUInt64UMapCItr; - typedef TSizeSizePrStoredStringPtrPrUInt64UMap::iterator TSizeSizePrStoredStringPtrPrUInt64UMapItr; - typedef std::vector TSizeSizePrStoredStringPtrPrUInt64UMapVec; - typedef CBucketQueue TSizeSizePrStoredStringPtrPrUInt64UMapVecQueue; - typedef TSizeSizePrStoredStringPtrPrUInt64UMapVec::const_iterator TSizeSizePrStoredStringPtrPrUInt64UMapVecCItr; - typedef std::map TTimeSizeSizePrStoredStringPtrPrUInt64UMapVecMap; - typedef boost::reference_wrapper TSearchKeyCRef; - typedef std::pair TFeatureAnyPr; - typedef std::vector TFeatureAnyPrVec; - typedef std::vector TMetricCategoryVec; - typedef std::vector TTimeVec; - typedef TTimeVec::const_iterator TTimeVecCItr; + using TSizeSizePrStoredStringPtrPrUInt64UMap = + boost::unordered_map; + using TSizeSizePrStoredStringPtrPrUInt64UMapCItr = TSizeSizePrStoredStringPtrPrUInt64UMap::const_iterator; + using TSizeSizePrStoredStringPtrPrUInt64UMapItr = TSizeSizePrStoredStringPtrPrUInt64UMap::iterator; + using TSizeSizePrStoredStringPtrPrUInt64UMapVec = std::vector; + using TSizeSizePrStoredStringPtrPrUInt64UMapVecQueue = CBucketQueue; + using TSizeSizePrStoredStringPtrPrUInt64UMapVecCItr = TSizeSizePrStoredStringPtrPrUInt64UMapVec::const_iterator; + using TTimeSizeSizePrStoredStringPtrPrUInt64UMapVecMap = std::map; + using TSearchKeyCRef = boost::reference_wrapper; + using TFeatureAnyPr = std::pair; + using TFeatureAnyPrVec = std::vector; + using TMetricCategoryVec = std::vector; + using TTimeVec = std::vector; + using TTimeVecCItr = TTimeVec::const_iterator; public: static const std::string EVENTRATE_BUCKET_GATHERER_TAG; @@ -349,22 +350,20 @@ class MODEL_EXPORT CBucketGatherer const F &extractId, CBucketQueue &queue) { - typedef typename CBucketQueue::iterator TQueueItr; - - for (TQueueItr bucketItr = queue.begin(); bucketItr != queue.end(); ++bucketItr) + for (auto bucketItr = queue.begin(); bucketItr != queue.end(); ++bucketItr) { T &bucket = *bucketItr; - for (typename T::iterator i = bucket.begin(); i != bucket.end(); /**/) - { - if (std::binary_search(toRemove.begin(), toRemove.end(), extractId(*i))) - { - i = bucket.erase(i); - } - else - { - ++i; - } - } + for (auto i = bucket.begin(); i != bucket.end(); /**/) + { + if (std::binary_search(toRemove.begin(), toRemove.end(), extractId(*i))) + { + i = bucket.erase(i); + } + else + { + ++i; + } + } } } @@ -378,14 +377,12 @@ class MODEL_EXPORT CBucketGatherer const F &extractId, CBucketQueue > &queue) { - typedef typename CBucketQueue >::iterator TQueueItr; - - for (TQueueItr bucketItr = queue.begin(); bucketItr != queue.end(); ++bucketItr) + for (auto bucketItr = queue.begin(); bucketItr != queue.end(); ++bucketItr) { for (std::size_t i = 0u; i < bucketItr->size(); ++i) { T &bucket = (*bucketItr)[i]; - for (typename T::iterator j = bucket.begin(); j != bucket.end(); /**/) + for (auto j = bucket.begin(); j != bucket.end(); /**/) { if (std::binary_search(toRemove.begin(), toRemove.end(), extractId(j->first))) { diff --git a/include/model/CBucketQueue.h b/include/model/CBucketQueue.h index d2627ef9c8..be3d20c108 100644 --- a/include/model/CBucketQueue.h +++ b/include/model/CBucketQueue.h @@ -35,11 +35,11 @@ template class CBucketQueue { public: - typedef boost::circular_buffer TQueue; - typedef typename TQueue::value_type value_type; - typedef typename TQueue::iterator iterator; - typedef typename TQueue::const_iterator const_iterator; - typedef typename TQueue::const_reverse_iterator const_reverse_iterator; + using TQueue = boost::circular_buffer; + using value_type = typename TQueue::value_type; + using iterator = typename TQueue::iterator; + using const_iterator = typename TQueue::const_iterator; + using const_reverse_iterator = typename TQueue::const_reverse_iterator; public: static const std::string BUCKET_TAG; diff --git a/include/model/CCountingModel.h b/include/model/CCountingModel.h index e8e91ad0d8..77dccad67f 100644 --- a/include/model/CCountingModel.h +++ b/include/model/CCountingModel.h @@ -222,10 +222,10 @@ class MODEL_EXPORT CCountingModel : public CAnomalyDetectorModel virtual const TStr1Vec &scheduledEventDescriptions(core_t::TTime time) const; public: - typedef std::pair TSizeUInt64Pr; - typedef std::vector TSizeUInt64PrVec; - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef std::vector TMeanAccumulatorVec; + using TSizeUInt64Pr = std::pair; + using TSizeUInt64PrVec = std::vector; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; + using TMeanAccumulatorVec = std::vector; protected: //! Get the start time of the current bucket. @@ -282,7 +282,7 @@ class MODEL_EXPORT CCountingModel : public CAnomalyDetectorModel virtual CMemoryUsageEstimator *memoryUsageEstimator(void) const; private: - typedef boost::unordered_map TTimeStr1VecUMap; + using TTimeStr1VecUMap = boost::unordered_map; private: //! The start time of the last sampled bucket. diff --git a/include/model/CCountingModelFactory.h b/include/model/CCountingModelFactory.h index 5f78342935..e966475b73 100644 --- a/include/model/CCountingModelFactory.h +++ b/include/model/CCountingModelFactory.h @@ -123,7 +123,7 @@ class MODEL_EXPORT CCountingModelFactory : public CModelFactory virtual void features(const TFeatureVec &features); //! Set the bucket results delay - virtual void bucketResultsDelay(std::size_t bucketResultsDelay) ; + virtual void bucketResultsDelay(std::size_t bucketResultsDelay); //@} private: diff --git a/include/model/CDataGatherer.h b/include/model/CDataGatherer.h index ab3cc5f26a..981546bf5d 100644 --- a/include/model/CDataGatherer.h +++ b/include/model/CDataGatherer.h @@ -104,41 +104,41 @@ class CSearchKey; class MODEL_EXPORT CDataGatherer { public: - typedef std::vector TDoubleVec; - typedef core::CSmallVector TDouble1Vec; - typedef std::vector TSizeVec; - typedef std::vector TStrVec; - typedef TStrVec::const_iterator TStrVecCItr; - typedef std::vector TStrCPtrVec; - typedef std::pair TSizeUInt64Pr; - typedef std::vector TSizeUInt64PrVec; - typedef model_t::TFeatureVec TFeatureVec; - typedef TFeatureVec::const_iterator TFeatureVecCItr; - typedef std::pair TSizeSizePr; - typedef std::pair TSizeSizePrUInt64Pr; - typedef std::vector TSizeSizePrUInt64PrVec; - typedef boost::unordered_map TSizeSizePrUInt64UMap; - typedef TSizeSizePrUInt64UMap::iterator TSizeSizePrUInt64UMapItr; - typedef TSizeSizePrUInt64UMap::const_iterator TSizeSizePrUInt64UMapCItr; - typedef CBucketQueue TSizeSizePrUInt64UMapQueue; - typedef TSizeSizePrUInt64UMapQueue::iterator TSizeSizePrUInt64UMapQueueItr; - typedef TSizeSizePrUInt64UMapQueue::const_iterator TSizeSizePrUInt64UMapQueueCItr; - typedef TSizeSizePrUInt64UMapQueue::const_reverse_iterator TSizeSizePrUInt64UMapQueueCRItr; - typedef CBucketGatherer::TSizeSizePrStoredStringPtrPrUInt64UMap TSizeSizePrStoredStringPtrPrUInt64UMap; - typedef TSizeSizePrStoredStringPtrPrUInt64UMap::const_iterator TSizeSizePrStoredStringPtrPrUInt64UMapCItr; - typedef TSizeSizePrStoredStringPtrPrUInt64UMap::iterator TSizeSizePrStoredStringPtrPrUInt64UMapItr; - typedef std::vector TSizeSizePrStoredStringPtrPrUInt64UMapVec; - typedef CBucketQueue TSizeSizePrStoredStringPtrPrUInt64UMapVecQueue; - typedef boost::reference_wrapper TSearchKeyCRef; - typedef std::vector TBucketGathererPVec; - typedef TBucketGathererPVec::iterator TBucketGathererPVecItr; - typedef TBucketGathererPVec::const_iterator TBucketGathererPVecCItr; - typedef std::pair TFeatureAnyPr; - typedef std::vector TFeatureAnyPrVec; - typedef std::vector TMetricCategoryVec; - typedef boost::shared_ptr TSampleCountsPtr; - typedef std::vector TTimeVec; - typedef TTimeVec::const_iterator TTimeVecCItr; + using TDoubleVec = std::vector; + using TDouble1Vec = core::CSmallVector; + using TSizeVec = std::vector; + using TStrVec = std::vector; + using TStrVecCItr = TStrVec::const_iterator; + using TStrCPtrVec = std::vector; + using TSizeUInt64Pr = std::pair; + using TSizeUInt64PrVec = std::vector; + using TFeatureVec = model_t::TFeatureVec; + using TFeatureVecCItr = TFeatureVec::const_iterator; + using TSizeSizePr = std::pair; + using TSizeSizePrUInt64Pr = std::pair; + using TSizeSizePrUInt64PrVec = std::vector; + using TSizeSizePrUInt64UMap = boost::unordered_map; + using TSizeSizePrUInt64UMapItr = TSizeSizePrUInt64UMap::iterator; + using TSizeSizePrUInt64UMapCItr = TSizeSizePrUInt64UMap::const_iterator; + using TSizeSizePrUInt64UMapQueue = CBucketQueue; + using TSizeSizePrUInt64UMapQueueItr = TSizeSizePrUInt64UMapQueue::iterator; + using TSizeSizePrUInt64UMapQueueCItr = TSizeSizePrUInt64UMapQueue::const_iterator; + using TSizeSizePrUInt64UMapQueueCRItr = TSizeSizePrUInt64UMapQueue::const_reverse_iterator; + using TSizeSizePrStoredStringPtrPrUInt64UMap = CBucketGatherer::TSizeSizePrStoredStringPtrPrUInt64UMap; + using TSizeSizePrStoredStringPtrPrUInt64UMapCItr = TSizeSizePrStoredStringPtrPrUInt64UMap::const_iterator; + using TSizeSizePrStoredStringPtrPrUInt64UMapItr = TSizeSizePrStoredStringPtrPrUInt64UMap::iterator; + using TSizeSizePrStoredStringPtrPrUInt64UMapVec = std::vector; + using TSizeSizePrStoredStringPtrPrUInt64UMapVecQueue = CBucketQueue; + using TSearchKeyCRef = boost::reference_wrapper; + using TBucketGathererPVec = std::vector; + using TBucketGathererPVecItr = TBucketGathererPVec::iterator; + using TBucketGathererPVecCItr = TBucketGathererPVec::const_iterator; + using TFeatureAnyPr = std::pair; + using TFeatureAnyPrVec = std::vector; + using TMetricCategoryVec = std::vector; + using TSampleCountsPtr = boost::shared_ptr; + using TTimeVec = std::vector; + using TTimeVecCItr = TTimeVec::const_iterator; public: //! The summary count indicating an explicit null record. @@ -726,7 +726,7 @@ class MODEL_EXPORT CDataGatherer static const std::string EXPLICIT_NULL; private: - typedef boost::reference_wrapper TModelParamsCRef; + using TModelParamsCRef = boost::reference_wrapper; private: //! Select the correct bucket gatherer based on the time: if we have diff --git a/include/model/CDetectorEqualizer.h b/include/model/CDetectorEqualizer.h index c635d1f809..09d97b56b7 100644 --- a/include/model/CDetectorEqualizer.h +++ b/include/model/CDetectorEqualizer.h @@ -39,8 +39,8 @@ class CModelConfig; class MODEL_EXPORT CDetectorEqualizer { public: - typedef std::pair TIntQuantileSketchPr; - typedef std::vector TIntQuantileSketchPrVec; + using TIntQuantileSketchPr = std::pair; + using TIntQuantileSketchPrVec = std::vector; public: //! Add \p probability to the detector's quantile sketch. diff --git a/include/model/CDynamicStringIdRegistry.h b/include/model/CDynamicStringIdRegistry.h index e3ed49f780..a5c5f0203b 100644 --- a/include/model/CDynamicStringIdRegistry.h +++ b/include/model/CDynamicStringIdRegistry.h @@ -41,13 +41,13 @@ class CResourceMonitor; class MODEL_EXPORT CDynamicStringIdRegistry { public: - typedef core::CCompressedDictionary<2> TDictionary; - typedef TDictionary::CWordUMap::Type TWordSizeUMap; - typedef TWordSizeUMap::iterator TWordSizeUMapItr; - typedef TWordSizeUMap::const_iterator TWordSizeUMapCItr; - typedef std::vector TSizeVec; - typedef std::vector TStrVec; - typedef std::vector TStoredStringPtrVec; + using TDictionary = core::CCompressedDictionary<2>; + using TWordSizeUMap = TDictionary::CWordUMap::Type; + using TWordSizeUMapItr = TWordSizeUMap::iterator; + using TWordSizeUMapCItr = TWordSizeUMap::const_iterator; + using TSizeVec = std::vector; + using TStrVec = std::vector; + using TStoredStringPtrVec = std::vector; public: //! An identifier which will never be used for a real string. diff --git a/include/model/CEventData.h b/include/model/CEventData.h index dfc8eb3993..5bb7ff0935 100644 --- a/include/model/CEventData.h +++ b/include/model/CEventData.h @@ -47,18 +47,18 @@ namespace model class MODEL_EXPORT CEventData { public: - typedef core::CSmallVector TDouble1Vec; - typedef boost::optional TOptionalSize; - typedef std::vector TOptionalSizeVec; - typedef boost::optional TOptionalDouble; + using TDouble1Vec = core::CSmallVector; + using TOptionalSize = boost::optional; + using TOptionalSizeVec = std::vector; + using TOptionalDouble = boost::optional; // Fixed size array - one element per metric category - typedef boost::array TDouble1VecArray; + using TDouble1VecArray = boost::array; // Second element in pair stores count - typedef std::pair TDouble1VecArraySizePr; - typedef boost::optional TOptionalDouble1VecArraySizePr; - typedef std::vector TOptionalDouble1VecArraySizePrVec; - typedef boost::optional TOptionalStr; - typedef std::vector TOptionalStrVec; + using TDouble1VecArraySizePr = std::pair; + using TOptionalDouble1VecArraySizePr = boost::optional; + using TOptionalDouble1VecArraySizePrVec = std::vector; + using TOptionalStr = boost::optional; + using TOptionalStrVec = std::vector; public: //! Create uninitialized event data. diff --git a/include/model/CEventRateBucketGatherer.h b/include/model/CEventRateBucketGatherer.h index 1fbdfefe13..0d6cd145bf 100644 --- a/include/model/CEventRateBucketGatherer.h +++ b/include/model/CEventRateBucketGatherer.h @@ -38,21 +38,21 @@ namespace model class MODEL_EXPORT CUniqueStringFeatureData { public: - typedef core::CCompressedDictionary<1> TDictionary1; - typedef TDictionary1::CWord TWord; - typedef TDictionary1::TWordSet TWordSet; - typedef TWordSet::const_iterator TWordSetCItr; - typedef TDictionary1::CWordUMap::Type TWordStringUMap; - typedef TWordStringUMap::const_iterator TWordStringUMapCItr; - typedef boost::unordered_map TStoredStringPtrWordSetUMap; - typedef TStoredStringPtrWordSetUMap::const_iterator TStoredStringPtrWordSetUMapCItr; - typedef std::vector TStoredStringPtrWordSetUMapVec; - typedef SEventRateFeatureData::TStrCRef TStrCRef; - typedef SEventRateFeatureData::TDouble1Vec TDouble1Vec; - typedef SEventRateFeatureData::TDouble1VecDoublePr TDouble1VecDoublePr; - typedef SEventRateFeatureData::TStrCRefDouble1VecDoublePrPr TStrCRefDouble1VecDoublePrPr; - typedef SEventRateFeatureData::TStrCRefDouble1VecDoublePrPrVec TStrCRefDouble1VecDoublePrPrVec; - typedef CBucketGatherer::TStoredStringPtrVec TStoredStringPtrVec; + using TDictionary1 = core::CCompressedDictionary<1>; + using TWord = TDictionary1::CWord; + using TWordSet = TDictionary1::TWordSet; + using TWordSetCItr = TWordSet::const_iterator; + using TWordStringUMap = TDictionary1::CWordUMap::Type; + using TWordStringUMapCItr = TWordStringUMap::const_iterator; + using TStoredStringPtrWordSetUMap = boost::unordered_map; + using TStoredStringPtrWordSetUMapCItr = TStoredStringPtrWordSetUMap::const_iterator; + using TStoredStringPtrWordSetUMapVec = std::vector; + using TStrCRef = SEventRateFeatureData::TStrCRef; + using TDouble1Vec = SEventRateFeatureData::TDouble1Vec; + using TDouble1VecDoublePr = SEventRateFeatureData::TDouble1VecDoublePr; + using TStrCRefDouble1VecDoublePrPr = SEventRateFeatureData::TStrCRefDouble1VecDoublePrPr; + using TStrCRefDouble1VecDoublePrPrVec = SEventRateFeatureData::TStrCRefDouble1VecDoublePrPrVec; + using TStoredStringPtrVec = CBucketGatherer::TStoredStringPtrVec; public: //! Add a string into the collection @@ -98,17 +98,17 @@ class MODEL_EXPORT CUniqueStringFeatureData class MODEL_EXPORT CEventRateBucketGatherer : public CBucketGatherer { public: - typedef std::map TCategoryAnyMap; - typedef SEventRateFeatureData::TStrCRef TStrCRef; - typedef SEventRateFeatureData::TDouble1Vec TDouble1Vec; - typedef SEventRateFeatureData::TDouble1VecDoublePr TDouble1VecDoublePr; - typedef SEventRateFeatureData::TStrCRefDouble1VecDoublePrPr TStrCRefDouble1VecDoublePrPr; - typedef SEventRateFeatureData::TStrCRefDouble1VecDoublePrPrVec TStrCRefDouble1VecDoublePrPrVec; - typedef SEventRateFeatureData::TStrCRefDouble1VecDoublePrPrVecVec TStrCRefDouble1VecDoublePrPrVecVec; - typedef std::pair TSizeFeatureDataPr; - typedef std::vector TSizeFeatureDataPrVec; - typedef std::pair TSizeSizePrFeatureDataPr; - typedef std::vector TSizeSizePrFeatureDataPrVec; + using TCategoryAnyMap = std::map; + using TStrCRef = SEventRateFeatureData::TStrCRef; + using TDouble1Vec = SEventRateFeatureData::TDouble1Vec; + using TDouble1VecDoublePr = SEventRateFeatureData::TDouble1VecDoublePr; + using TStrCRefDouble1VecDoublePrPr = SEventRateFeatureData::TStrCRefDouble1VecDoublePrPr; + using TStrCRefDouble1VecDoublePrPrVec = SEventRateFeatureData::TStrCRefDouble1VecDoublePrPrVec; + using TStrCRefDouble1VecDoublePrPrVecVec = SEventRateFeatureData::TStrCRefDouble1VecDoublePrPrVecVec; + using TSizeFeatureDataPr = std::pair; + using TSizeFeatureDataPrVec = std::vector; + using TSizeSizePrFeatureDataPr = std::pair; + using TSizeSizePrFeatureDataPrVec = std::vector; public: //! \name Life-cycle diff --git a/include/model/CEventRateModelFactory.h b/include/model/CEventRateModelFactory.h index f84be8fdd6..a165506fda 100644 --- a/include/model/CEventRateModelFactory.h +++ b/include/model/CEventRateModelFactory.h @@ -133,7 +133,7 @@ class MODEL_EXPORT CEventRateModelFactory : public CModelFactory virtual void features(const TFeatureVec &features); //! Set the bucket results delay - virtual void bucketResultsDelay(std::size_t bucketResultsDelay) ; + virtual void bucketResultsDelay(std::size_t bucketResultsDelay); //@} private: diff --git a/include/model/CEventRatePopulationModelFactory.h b/include/model/CEventRatePopulationModelFactory.h index 61bba47f7a..2c650d4b09 100644 --- a/include/model/CEventRatePopulationModelFactory.h +++ b/include/model/CEventRatePopulationModelFactory.h @@ -135,7 +135,7 @@ class MODEL_EXPORT CEventRatePopulationModelFactory : public CModelFactory virtual void features(const TFeatureVec &features); //! Set the bucket results delay - virtual void bucketResultsDelay(std::size_t bucketResultsDelay) ; + virtual void bucketResultsDelay(std::size_t bucketResultsDelay); //@} private: diff --git a/include/model/CGathererTools.h b/include/model/CGathererTools.h index 65b001066e..3856757a11 100644 --- a/include/model/CGathererTools.h +++ b/include/model/CGathererTools.h @@ -59,17 +59,17 @@ namespace model class MODEL_EXPORT CGathererTools { public: - typedef std::vector TDoubleVec; - typedef boost::optional TOptionalDouble; - typedef std::vector TSampleVec; - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef maths::CFixedQuantileSketch TMedianAccumulator; - typedef maths::CBasicStatistics::COrderStatisticsStack TMinAccumulator; - typedef maths::CBasicStatistics::COrderStatisticsStack > TMaxAccumulator; - typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TVarianceAccumulator; - typedef CMetricMultivariateStatistic TMultivariateMeanAccumulator; - typedef CMetricMultivariateStatistic TMultivariateMinAccumulator; - typedef CMetricMultivariateStatistic TMultivariateMaxAccumulator; + using TDoubleVec = std::vector; + using TOptionalDouble = boost::optional; + using TSampleVec = std::vector; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; + using TMedianAccumulator = maths::CFixedQuantileSketch; + using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsStack; + using TMaxAccumulator = maths::CBasicStatistics::COrderStatisticsStack >; + using TVarianceAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; + using TMultivariateMeanAccumulator = CMetricMultivariateStatistic; + using TMultivariateMinAccumulator = CMetricMultivariateStatistic; + using TMultivariateMaxAccumulator = CMetricMultivariateStatistic; //! \brief Mean arrival time gatherer. //! @@ -79,7 +79,7 @@ class MODEL_EXPORT CGathererTools class MODEL_EXPORT CArrivalTimeGatherer { public: - typedef TMeanAccumulator TAccumulator; + using TAccumulator = TMeanAccumulator; public: //! The earliest possible time. @@ -153,22 +153,22 @@ class MODEL_EXPORT CGathererTools //! //! This also computes the mean of all measurements in the current //! bucketing interval. - typedef CSampleGatherer TMeanGatherer; + using TMeanGatherer = CSampleGatherer; //! \brief Multivariate mean statistic gatherer. //! //! See TMeanGatherer for details. - typedef CSampleGatherer TMultivariateMeanGatherer; + using TMultivariateMeanGatherer = CSampleGatherer; //! \brief Median statistic gatherer. //! //! DESCRIPTION:\n //! Wraps up the functionality to sample the median of a fixed number //! of measurements, which are supplied to the add function. - typedef CSampleGatherer TMedianGatherer; + using TMedianGatherer = CSampleGatherer; // TODO Add multivariate median. @@ -180,14 +180,14 @@ class MODEL_EXPORT CGathererTools //! //! This also computes the minimum of all measurements in the current //! bucketing interval. - typedef CSampleGatherer TMinGatherer; + using TMinGatherer = CSampleGatherer; //! \brief Multivariate minimum statistic gatherer. //! //! See TMinGatherer for details. - typedef CSampleGatherer TMultivariateMinGatherer; + using TMultivariateMinGatherer = CSampleGatherer; //! \brief Maximum statistic gatherer. //! @@ -197,14 +197,14 @@ class MODEL_EXPORT CGathererTools //! //! This also computes the maximum of all measurements in the current //! bucketing interval. - typedef CSampleGatherer TMaxGatherer; + using TMaxGatherer = CSampleGatherer; //! \brief Multivariate maximum statistic gatherer. //! //! See TMaxGatherer for details. - typedef CSampleGatherer TMultivariateMaxGatherer; + using TMultivariateMaxGatherer = CSampleGatherer; //! \brief Variance statistic gatherer. //! @@ -214,8 +214,8 @@ class MODEL_EXPORT CGathererTools //! //! This also computes the variance of all measurements in the current //! bucketing interval. - typedef CSampleGatherer TVarianceGatherer; + using TVarianceGatherer = CSampleGatherer; // TODO Add multivariate variance. @@ -227,20 +227,20 @@ class MODEL_EXPORT CGathererTools class MODEL_EXPORT CSumGatherer { public: - typedef core::CSmallVector TDouble1Vec; - typedef std::vector TStrVec; - typedef TStrVec::const_iterator TStrVecCItr; - typedef boost::optional TOptionalStr; - typedef std::vector TOptionalStrVec; - typedef CBucketQueue TSampleVecQueue; - typedef TSampleVecQueue::iterator TSampleVecQueueItr; - typedef TSampleVecQueue::const_iterator TSampleVecQueueCItr; - typedef boost::unordered_map TStoredStringPtrDoubleUMap; - typedef TStoredStringPtrDoubleUMap::const_iterator TStoredStringPtrDoubleUMapCItr; - typedef CBucketQueue TStoredStringPtrDoubleUMapQueue; - typedef TStoredStringPtrDoubleUMapQueue::const_reverse_iterator TStoredStringPtrDoubleUMapQueueCRItr; - typedef std::vector TStoredStringPtrDoubleUMapQueueVec; - typedef std::vector TStoredStringPtrVec; + using TDouble1Vec = core::CSmallVector; + using TStrVec = std::vector; + using TStrVecCItr = TStrVec::const_iterator; + using TOptionalStr = boost::optional; + using TOptionalStrVec = std::vector; + using TSampleVecQueue = CBucketQueue; + using TSampleVecQueueItr = TSampleVecQueue::iterator; + using TSampleVecQueueCItr = TSampleVecQueue::const_iterator; + using TStoredStringPtrDoubleUMap = boost::unordered_map; + using TStoredStringPtrDoubleUMapCItr = TStoredStringPtrDoubleUMap::const_iterator; + using TStoredStringPtrDoubleUMapQueue = CBucketQueue; + using TStoredStringPtrDoubleUMapQueueCRItr = TStoredStringPtrDoubleUMapQueue::const_reverse_iterator; + using TStoredStringPtrDoubleUMapQueueVec = std::vector; + using TStoredStringPtrVec = std::vector; public: CSumGatherer(const SModelParams ¶ms, diff --git a/include/model/CHierarchicalResults.h b/include/model/CHierarchicalResults.h index f65b195c6b..d7610433ff 100644 --- a/include/model/CHierarchicalResults.h +++ b/include/model/CHierarchicalResults.h @@ -43,11 +43,11 @@ class CLimits; namespace hierarchical_results_detail { -typedef std::vector TStoredStringPtrVec; -typedef std::pair TStoredStringPtrStoredStringPtrPr; -typedef std::pair TStoredStringPtrStoredStringPtrPrDoublePr; -typedef std::vector TStoredStringPtrStoredStringPtrPrDoublePrVec; -typedef core::CSmallVector TStr1Vec; +using TStoredStringPtrVec = std::vector; +using TStoredStringPtrStoredStringPtrPr = std::pair; +using TStoredStringPtrStoredStringPtrPrDoublePr = std::pair; +using TStoredStringPtrStoredStringPtrPrDoublePrVec = std::vector; +using TStr1Vec = core::CSmallVector; //! \brief The data fully describing a result node. //! @@ -136,11 +136,11 @@ struct MODEL_EXPORT SResultSpec //! \see buildHierarchicalResults for more details. struct MODEL_EXPORT SNode { - typedef std::vector TAttributeProbabilityVec; - typedef const SNode *TNodeCPtr; - typedef std::vector TNodeCPtrVec; - typedef boost::unordered_map TNodePtrSizeUMap; - typedef boost::unordered_map TSizeNodePtrUMap; + using TAttributeProbabilityVec = std::vector; + using TNodeCPtr = const SNode*; + using TNodeCPtrVec = std::vector; + using TNodePtrSizeUMap = boost::unordered_map; + using TSizeNodePtrUMap = boost::unordered_map; SNode(void); SNode(const SResultSpec &simpleSearch, SAnnotatedProbability &annotatedProbability); @@ -255,19 +255,20 @@ class CHierarchicalResultsVisitor; class MODEL_EXPORT CHierarchicalResults { public: - typedef std::vector TDoubleVec; - typedef std::vector TAttributeProbabilityVec; - typedef hierarchical_results_detail::SResultSpec TResultSpec; - typedef core::CStoredStringPtr TStoredStringPtr; - typedef hierarchical_results_detail::TStoredStringPtrStoredStringPtrPr TStoredStringPtrStoredStringPtrPr; - typedef hierarchical_results_detail::TStoredStringPtrStoredStringPtrPrDoublePr TStoredStringPtrStoredStringPtrPrDoublePr; - typedef hierarchical_results_detail::TStoredStringPtrStoredStringPtrPrDoublePrVec TStoredStringPtrStoredStringPtrPrDoublePrVec; - typedef hierarchical_results_detail::SNode TNode; - typedef hierarchical_results_detail::SNode::TNodePtrSizeUMap TNodePtrSizeUMap; - typedef hierarchical_results_detail::SNode::TSizeNodePtrUMap TSizeNodePtrUMap; - typedef std::deque TNodeDeque; - typedef std::map TStoredStringPtrStoredStringPtrPrNodeMap; - typedef std::map TStoredStringPtrNodeMap; + using TDoubleVec = std::vector; + using TAttributeProbabilityVec = std::vector; + using TResultSpec = hierarchical_results_detail::SResultSpec; + using TStoredStringPtr = core::CStoredStringPtr; + using TStoredStringPtrStoredStringPtrPr = hierarchical_results_detail::TStoredStringPtrStoredStringPtrPr; + using TStoredStringPtrStoredStringPtrPrDoublePr = hierarchical_results_detail::TStoredStringPtrStoredStringPtrPrDoublePr; + using TStoredStringPtrStoredStringPtrPrDoublePrVec = hierarchical_results_detail::TStoredStringPtrStoredStringPtrPrDoublePrVec; + using TNode = hierarchical_results_detail::SNode; + using TNodePtrSizeUMap = hierarchical_results_detail::SNode::TNodePtrSizeUMap; + using TSizeNodePtrUMap = hierarchical_results_detail::SNode::TSizeNodePtrUMap; + using TNodeDeque = std::deque; + using TStoredStringPtrStoredStringPtrPrNodeMap = + std::map; + using TStoredStringPtrNodeMap = std::map; public: CHierarchicalResults(void); @@ -425,7 +426,7 @@ class MODEL_EXPORT CHierarchicalResults class MODEL_EXPORT CHierarchicalResultsVisitor { public: - typedef CHierarchicalResults::TNode TNode; + using TNode = CHierarchicalResults::TNode; public: virtual ~CHierarchicalResultsVisitor(void); diff --git a/include/model/CHierarchicalResultsLevelSet.h b/include/model/CHierarchicalResultsLevelSet.h index 7a06cdfbb9..fd4e8c4628 100644 --- a/include/model/CHierarchicalResultsLevelSet.h +++ b/include/model/CHierarchicalResultsLevelSet.h @@ -45,14 +45,14 @@ template class CHierarchicalResultsLevelSet : public CHierarchicalResultsVisitor { protected: - typedef T Type; - typedef std::vector TTypePtrVec; - typedef core::CCompressedDictionary<1> TDictionary; - typedef TDictionary::CWord TWord; - typedef std::pair TWordTypePr; - typedef std::vector TWordTypePrVec; - typedef typename TWordTypePrVec::iterator TWordTypePrVecItr; - typedef typename TWordTypePrVec::const_iterator TWordTypePrVecCItr; + using Type = T; + using TTypePtrVec = std::vector; + using TDictionary = core::CCompressedDictionary<1>; + using TWord = TDictionary::CWord; + using TWordTypePr = std::pair; + using TWordTypePrVec = std::vector; + using TWordTypePrVecItr = typename TWordTypePrVec::iterator; + using TWordTypePrVecCItr = typename TWordTypePrVec::const_iterator; protected: explicit CHierarchicalResultsLevelSet(const T &bucketElement) : diff --git a/include/model/CHierarchicalResultsNormalizer.h b/include/model/CHierarchicalResultsNormalizer.h index 587a11f43c..0030b6860c 100644 --- a/include/model/CHierarchicalResultsNormalizer.h +++ b/include/model/CHierarchicalResultsNormalizer.h @@ -27,7 +27,7 @@ class CAnomalyDetectorModelConfig; namespace hierarchical_results_normalizer_detail { -typedef boost::shared_ptr TNormalizerPtr; +using TNormalizerPtr = boost::shared_ptr; //! \brief A normalizer instance and a descriptive string. struct MODEL_EXPORT SNormalizer @@ -87,12 +87,12 @@ class MODEL_EXPORT CHierarchicalResultsNormalizer : private core::CNonCopyable { public: - typedef CHierarchicalResultsLevelSet TBase; - typedef TBase::Type TNormalizer; - typedef TBase::TTypePtrVec TNormalizerPtrVec; - typedef TBase::TWordTypePr TWordNormalizerPr; - typedef TBase::TWordTypePrVec TWordNormalizerPrVec; - typedef std::vector TStrVec; + using TBase = CHierarchicalResultsLevelSet; + using TNormalizer = TBase::Type; + using TNormalizerPtrVec = TBase::TTypePtrVec; + using TWordNormalizerPr = TBase::TWordTypePr; + using TWordNormalizerPrVec = TBase::TWordTypePrVec; + using TStrVec = std::vector; //! Enumeration of the possible jobs that the normalizer can //! perform when invoked. diff --git a/include/model/CIndividualModelDetail.h b/include/model/CIndividualModelDetail.h index 67246c71ce..fcfcd3b65b 100644 --- a/include/model/CIndividualModelDetail.h +++ b/include/model/CIndividualModelDetail.h @@ -22,7 +22,7 @@ void CIndividualModel::currentBucketPersonIds(core_t::TTime time, const T &featureData, TSizeVec &result) const { - typedef boost::unordered_set TSizeUSet; + using TSizeUSet = boost::unordered_set; result.clear(); @@ -95,7 +95,7 @@ void CIndividualModel::sampleBucketStatistics(core_t::TTime startTime, this->CIndividualModel::sampleBucketStatistics(time, time + bucketLength, resourceMonitor); gatherer.featureData(time, bucketLength, featureData); - for (auto &&feature_ : featureData) + for (auto &feature_ : featureData) { T &data = feature_.second; LOG_TRACE(model_t::print(feature_.first) << " data = " << core::CContainerPrinter::print(data)); diff --git a/include/model/CInterimBucketCorrector.h b/include/model/CInterimBucketCorrector.h index e58f024e1d..f8f6e0ad53 100644 --- a/include/model/CInterimBucketCorrector.h +++ b/include/model/CInterimBucketCorrector.h @@ -44,9 +44,9 @@ namespace model class MODEL_EXPORT CInterimBucketCorrector { private: - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef core::CSmallVector TDouble1Vec; - typedef core::CSmallVector TDouble10Vec; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; + using TDouble1Vec = core::CSmallVector; + using TDouble10Vec = core::CSmallVector; public: //! Constructs an interim bucket corrector for buckets of length \p bucketLength diff --git a/include/model/CMemoryUsageEstimator.h b/include/model/CMemoryUsageEstimator.h index a000e1d1de..0e646752ae 100644 --- a/include/model/CMemoryUsageEstimator.h +++ b/include/model/CMemoryUsageEstimator.h @@ -51,8 +51,8 @@ class MODEL_EXPORT CMemoryUsageEstimator E_Correlations, E_NumberPredictors }; - typedef boost::array TSizeArray; - typedef boost::optional TOptionalSize; + using TSizeArray = boost::array; + using TOptionalSize = boost::optional; public: //! Constructor @@ -83,9 +83,9 @@ class MODEL_EXPORT CMemoryUsageEstimator bool acceptRestoreTraverser(core::CStateRestoreTraverser &traverser); private: - typedef std::pair TSizeArraySizePr; - typedef boost::circular_buffer TSizeArraySizePrBuf; - typedef TSizeArraySizePrBuf::const_iterator TSizeArraySizePrBufCItr; + using TSizeArraySizePr = std::pair; + using TSizeArraySizePrBuf = boost::circular_buffer; + using TSizeArraySizePrBufCItr = TSizeArraySizePrBuf::const_iterator; private: //! Get the maximum amount by which we'll extrapolate the memory usage. diff --git a/include/model/CMetricBucketGatherer.h b/include/model/CMetricBucketGatherer.h index 0d937da867..6140c5bea8 100644 --- a/include/model/CMetricBucketGatherer.h +++ b/include/model/CMetricBucketGatherer.h @@ -43,10 +43,10 @@ class CResourceMonitor; class MODEL_EXPORT CMetricBucketGatherer : public CBucketGatherer { public: - typedef std::pair TCategorySizePr; - typedef std::map TCategorySizePrAnyMap; - typedef TCategorySizePrAnyMap::iterator TCategorySizePrAnyMapItr; - typedef TCategorySizePrAnyMap::const_iterator TCategorySizePrAnyMapCItr; + using TCategorySizePr = std::pair; + using TCategorySizePrAnyMap = std::map; + using TCategorySizePrAnyMapItr = TCategorySizePrAnyMap::iterator; + using TCategorySizePrAnyMapCItr = TCategorySizePrAnyMap::const_iterator; public: //! \name Life-cycle diff --git a/include/model/CMetricModelFactory.h b/include/model/CMetricModelFactory.h index e9b800e769..fab453263f 100644 --- a/include/model/CMetricModelFactory.h +++ b/include/model/CMetricModelFactory.h @@ -136,7 +136,7 @@ class MODEL_EXPORT CMetricModelFactory : public CModelFactory virtual void bucketLength(core_t::TTime bucketLength); //! Set the bucket results delay - virtual void bucketResultsDelay(std::size_t bucketResultsDelay) ; + virtual void bucketResultsDelay(std::size_t bucketResultsDelay); //@} private: diff --git a/include/model/CMetricMultivariateStatistic.h b/include/model/CMetricMultivariateStatistic.h index 105642ce53..14a1ec0e9f 100644 --- a/include/model/CMetricMultivariateStatistic.h +++ b/include/model/CMetricMultivariateStatistic.h @@ -45,7 +45,7 @@ template class CMetricMultivariateStatistic { public: - typedef core::CSmallVector TDouble1Vec; + using TDouble1Vec = core::CSmallVector; public: static const std::string VALUE_TAG; @@ -186,7 +186,7 @@ class CMetricMultivariateStatistic } private: - typedef core::CSmallVector TStatistic2Vec; + using TStatistic2Vec = core::CSmallVector; private: TStatistic2Vec m_Values; diff --git a/include/model/CMetricPartialStatistic.h b/include/model/CMetricPartialStatistic.h index d11c9aa916..a551e3246f 100644 --- a/include/model/CMetricPartialStatistic.h +++ b/include/model/CMetricPartialStatistic.h @@ -50,8 +50,8 @@ template class CMetricPartialStatistic { public: - typedef core::CSmallVector TDouble1Vec; - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TDouble1Vec = core::CSmallVector; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; public: static const std::string VALUE_TAG; diff --git a/include/model/CMetricPopulationModelFactory.h b/include/model/CMetricPopulationModelFactory.h index 7d604db8f9..16e541d19a 100644 --- a/include/model/CMetricPopulationModelFactory.h +++ b/include/model/CMetricPopulationModelFactory.h @@ -135,7 +135,7 @@ class MODEL_EXPORT CMetricPopulationModelFactory : public CModelFactory virtual void features(const TFeatureVec &features); //! Set the bucket results delay - virtual void bucketResultsDelay(std::size_t bucketResultsDelay) ; + virtual void bucketResultsDelay(std::size_t bucketResultsDelay); //@} private: diff --git a/include/model/CMetricStatisticWrappers.h b/include/model/CMetricStatisticWrappers.h index bf6bed06bc..6e02006987 100644 --- a/include/model/CMetricStatisticWrappers.h +++ b/include/model/CMetricStatisticWrappers.h @@ -64,10 +64,10 @@ struct SMake > //! of which delegate to the appropriate statistic functions. struct MODEL_EXPORT CMetricStatisticWrappers { - typedef core::CSmallVector TDouble1Vec; - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TVarianceAccumulator; - typedef maths::CFixedQuantileSketch TMedianAccumulator; + using TDouble1Vec = core::CSmallVector; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; + using TVarianceAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; + using TMedianAccumulator = maths::CFixedQuantileSketch; //! Make a statistic. template diff --git a/include/model/CModelPlotData.h b/include/model/CModelPlotData.h index e27bffb052..d04ac0e4bc 100644 --- a/include/model/CModelPlotData.h +++ b/include/model/CModelPlotData.h @@ -31,8 +31,8 @@ namespace model class MODEL_EXPORT CModelPlotData { public: - typedef std::pair TStrDoublePr; - typedef std::vector TStrDoublePrVec; + using TStrDoublePr = std::pair; + using TStrDoublePrVec = std::vector; public: struct MODEL_EXPORT SByFieldData @@ -53,11 +53,11 @@ class MODEL_EXPORT CModelPlotData }; public: - typedef boost::unordered_map TStrByFieldDataUMap; - typedef std::pair TFeatureStrByFieldDataUMapPr; - typedef boost::unordered_map TFeatureStrByFieldDataUMapUMap; - typedef boost::unordered_map TIntStrByFieldDataUMapUMap; - typedef TFeatureStrByFieldDataUMapUMap::const_iterator TFeatureStrByFieldDataUMapUMapCItr; + using TStrByFieldDataUMap = boost::unordered_map; + using TFeatureStrByFieldDataUMapPr = std::pair; + using TFeatureStrByFieldDataUMapUMap = boost::unordered_map; + using TIntStrByFieldDataUMapUMap = boost::unordered_map; + using TFeatureStrByFieldDataUMapUMapCItr = TFeatureStrByFieldDataUMapUMap::const_iterator; public: CModelPlotData(void); diff --git a/include/model/CPopulationModel.h b/include/model/CPopulationModel.h index e4c64df869..05d26f0a26 100644 --- a/include/model/CPopulationModel.h +++ b/include/model/CPopulationModel.h @@ -63,12 +63,12 @@ namespace model class MODEL_EXPORT CPopulationModel : public CAnomalyDetectorModel { public: - typedef std::vector TTimeVec; - typedef std::pair TSizeUInt64Pr; - typedef std::vector TSizeUInt64PrVec; - typedef std::vector TCountMinSketchVec; - typedef std::vector TBjkstUniqueValuesVec; - typedef boost::unordered_map TSizeTimeUMap; + using TTimeVec = std::vector; + using TSizeUInt64Pr = std::pair; + using TSizeUInt64PrVec = std::vector; + using TCountMinSketchVec = std::vector; + using TBjkstUniqueValuesVec = std::vector; + using TSizeTimeUMap = boost::unordered_map; //! Lift the overloads of baselineBucketMean into the class scope. using CAnomalyDetectorModel::baselineBucketMean; diff --git a/include/model/CResourceMonitor.h b/include/model/CResourceMonitor.h index fb08ce8e3c..39a088d001 100644 --- a/include/model/CResourceMonitor.h +++ b/include/model/CResourceMonitor.h @@ -46,10 +46,10 @@ class MODEL_EXPORT CResourceMonitor }; public: - typedef std::pair TModelPtrSizePr; - typedef std::map TModelPtrSizeMap; - typedef std::function TMemoryUsageReporterFunc; - typedef std::map TTimeSizeMap; + using TModelPtrSizePr = std::pair; + using TModelPtrSizeMap = std::map; + using TMemoryUsageReporterFunc = std::function; + using TTimeSizeMap = std::map; //! The minimum time between prunes static const core_t::TTime MINIMUM_PRUNE_FREQUENCY; diff --git a/include/model/CResultsQueue.h b/include/model/CResultsQueue.h index 254a077d0f..ed790318e3 100644 --- a/include/model/CResultsQueue.h +++ b/include/model/CResultsQueue.h @@ -23,7 +23,7 @@ class CHierarchicalResults; class MODEL_EXPORT CResultsQueue { public: - typedef CBucketQueue THierarchicalResultsQueue; + using THierarchicalResultsQueue = CBucketQueue; public: //! Constructor diff --git a/include/model/CRuleCondition.h b/include/model/CRuleCondition.h index 606f5d197c..cf589d8063 100644 --- a/include/model/CRuleCondition.h +++ b/include/model/CRuleCondition.h @@ -35,7 +35,7 @@ class CAnomalyDetectorModel; class MODEL_EXPORT CRuleCondition { public: - typedef boost::reference_wrapper TPatternSetCRef; + using TPatternSetCRef = boost::reference_wrapper; public: enum ERuleConditionType diff --git a/include/model/CSample.h b/include/model/CSample.h index 595b3e1864..6164571354 100644 --- a/include/model/CSample.h +++ b/include/model/CSample.h @@ -25,7 +25,7 @@ namespace model class MODEL_EXPORT CSample { public: - typedef core::CSmallVector TDouble1Vec; + using TDouble1Vec = core::CSmallVector; struct MODEL_EXPORT SToString { diff --git a/include/model/CSampleCounts.h b/include/model/CSampleCounts.h index 1940a23c38..78106cda11 100644 --- a/include/model/CSampleCounts.h +++ b/include/model/CSampleCounts.h @@ -42,9 +42,9 @@ class CDataGatherer; class MODEL_EXPORT CSampleCounts { public: - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef std::vector TMeanAccumulatorVec; - typedef std::vector TSizeVec; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; + using TMeanAccumulatorVec = std::vector; + using TSizeVec = std::vector; public: explicit CSampleCounts(unsigned int sampleCountOverride = 0); @@ -109,7 +109,7 @@ class MODEL_EXPORT CSampleCounts void clear(void); private: - typedef std::vector TUIntVec; + using TUIntVec = std::vector; private: //! Get the name of the entity identified by \p id. diff --git a/include/model/CSampleGatherer.h b/include/model/CSampleGatherer.h index d5ccc0d369..9a7c0d68b1 100644 --- a/include/model/CSampleGatherer.h +++ b/include/model/CSampleGatherer.h @@ -289,7 +289,7 @@ class CSampleGatherer void startNewBucket(core_t::TTime time) { m_BucketStats.push(TMetricPartialStatistic(m_Dimension), time); - for (auto &&stats : m_InfluencerBucketStats) + for (auto &stats : m_InfluencerBucketStats) { stats.push(TStoredStringPtrStatUMap(1), time); } @@ -300,7 +300,7 @@ class CSampleGatherer void resetBucket(core_t::TTime bucketStart) { m_BucketStats.get(bucketStart) = TMetricPartialStatistic(m_Dimension); - for (auto &&stats : m_InfluencerBucketStats) + for (auto &stats : m_InfluencerBucketStats) { stats.get(bucketStart) = TStoredStringPtrStatUMap(1); } diff --git a/include/model/CSampleQueue.h b/include/model/CSampleQueue.h index 7cccaa25f7..4d7adf75c4 100644 --- a/include/model/CSampleQueue.h +++ b/include/model/CSampleQueue.h @@ -56,8 +56,8 @@ template class CSampleQueue { private: - typedef core::CSmallVector TDouble1Vec; - typedef CMetricPartialStatistic TMetricPartialStatistic; + using TDouble1Vec = core::CSmallVector; + using TMetricPartialStatistic = CMetricPartialStatistic; private: //! A struct grouping together the data that form a sub-sample. @@ -209,12 +209,12 @@ class CSampleQueue }; public: - typedef boost::circular_buffer TQueue; - typedef typename TQueue::iterator iterator; - typedef typename TQueue::reverse_iterator reverse_iterator; - typedef typename TQueue::const_reverse_iterator const_reverse_iterator; - typedef std::vector TSampleVec; - typedef boost::optional TOptionalSubSample; + using TQueue = boost::circular_buffer; + using iterator = typename TQueue::iterator; + using reverse_iterator = typename TQueue::reverse_iterator; + using const_reverse_iterator = typename TQueue::const_reverse_iterator; + using TSampleVec = std::vector; + using TOptionalSubSample = boost::optional; public: static const std::string SUB_SAMPLE_TAG; diff --git a/include/model/CSearchKey.h b/include/model/CSearchKey.h index 4f66be1c65..a6b7993786 100644 --- a/include/model/CSearchKey.h +++ b/include/model/CSearchKey.h @@ -75,19 +75,19 @@ namespace model class MODEL_EXPORT CSearchKey { public: - typedef std::vector TStrVec; - typedef std::vector TStoredStringPtrVec; + using TStrVec = std::vector; + using TStoredStringPtrVec = std::vector; //! The type of a search key which mixes in the partition field //! value. - typedef std::pair TStrKeyPr; + using TStrKeyPr = std::pair; //! The type of a constant reference string search key pair. //! //! \note This is intended for map lookups when one doesn't want //! to copy the strings. - typedef std::pair, - boost::reference_wrapper > TStrCRefKeyCRefPr; + using TStrCRefKeyCRefPr = std::pair, + boost::reference_wrapper>; public: //! If the "by" field name is "count" then the key represents diff --git a/include/model/FunctionTypes.h b/include/model/FunctionTypes.h index 2743d8acab..67fdd09d21 100644 --- a/include/model/FunctionTypes.h +++ b/include/model/FunctionTypes.h @@ -209,7 +209,7 @@ enum EFunction E_PeersTimeOfWeek = 414 }; -typedef std::vector TFunctionVec; +using TFunctionVec = std::vector; //! Is this function for use with the individual models? MODEL_EXPORT diff --git a/include/model/ModelTypes.h b/include/model/ModelTypes.h index c1905c83f0..a1b3240410 100644 --- a/include/model/ModelTypes.h +++ b/include/model/ModelTypes.h @@ -44,11 +44,11 @@ struct SModelParams; namespace model_t { -typedef core::CSmallVector TDouble1Vec; -typedef core::CSmallVector TDouble2Vec; -typedef core::CSmallVector TDouble2Vec1Vec; -typedef std::pair TDouble1VecDouble1VecPr; -typedef boost::shared_ptr TInfluenceCalculatorCPtr; +using TDouble1Vec = core::CSmallVector; +using TDouble2Vec = core::CSmallVector; +using TDouble2Vec1Vec = core::CSmallVector; +using TDouble1VecDouble1VecPr = std::pair; +using TInfluenceCalculatorCPtr = boost::shared_ptr; //! The types of model available. //! @@ -445,7 +445,7 @@ enum EFeature E_PeersMedianByPersonAndAttribute = 508 }; -typedef std::vector TFeatureVec; +using TFeatureVec = std::vector; //! Get the dimension of the feature \p feature. MODEL_EXPORT diff --git a/include/test/CTestRunner.h b/include/test/CTestRunner.h index 525256c232..04369f286c 100644 --- a/include/test/CTestRunner.h +++ b/include/test/CTestRunner.h @@ -108,8 +108,8 @@ class TEST_EXPORT CTestRunner : public CppUnit::TextTestRunner void processCmdLine(int argc, const char **argv); private: - typedef std::vector TStrVec; - typedef TStrVec::iterator TStrVecItr; + using TStrVec = std::vector; + using TStrVecItr = TStrVec::iterator; TStrVec m_TestCases; std::string m_ExeName; diff --git a/include/test/CTestTimer.h b/include/test/CTestTimer.h index c31ac29e46..7629864773 100644 --- a/include/test/CTestTimer.h +++ b/include/test/CTestTimer.h @@ -61,8 +61,8 @@ class TEST_EXPORT CTestTimer : public CppUnit::TestListener //! Used to time each test core::CStopWatch m_StopWatch; - typedef std::map TStrUInt64Map; - typedef TStrUInt64Map::const_iterator TStrUInt64MapCItr; + using TStrUInt64Map = std::map; + using TStrUInt64MapCItr = TStrUInt64Map::const_iterator; //! Map of test name to time taken (in ms) TStrUInt64Map m_TestTimes; diff --git a/include/test/CTimeSeriesTestData.h b/include/test/CTimeSeriesTestData.h index 7811ee1b53..e4db732618 100644 --- a/include/test/CTimeSeriesTestData.h +++ b/include/test/CTimeSeriesTestData.h @@ -27,15 +27,15 @@ namespace test class TEST_EXPORT CTimeSeriesTestData { public: - typedef std::vector TDoubleVec; - typedef TDoubleVec::iterator TDoubleVecItr; - typedef std::pair TTimeDoublePr; - typedef std::vector TTimeDoublePrVec; - typedef TTimeDoublePrVec::iterator TTimeDoublePrVecItr; - typedef TTimeDoublePrVec::reverse_iterator TTimeDoublePrVecRItr; - typedef TTimeDoublePrVec::const_iterator TTimeDoublePrVecCItr; - typedef std::pair TTimeDoubleVecPr; - typedef std::vector TTimeDoubleVecPrVec; + using TDoubleVec = std::vector; + using TDoubleVecItr = TDoubleVec::iterator; + using TTimeDoublePr = std::pair; + using TTimeDoublePrVec = std::vector; + using TTimeDoublePrVecItr = TTimeDoublePrVec::iterator; + using TTimeDoublePrVecRItr = TTimeDoublePrVec::reverse_iterator; + using TTimeDoublePrVecCItr = TTimeDoublePrVec::const_iterator; + using TTimeDoubleVecPr = std::pair; + using TTimeDoubleVecPrVec = std::vector; public: //! The default regular expression to extract the date diff --git a/lib/api/CAnomalyJob.cc b/lib/api/CAnomalyJob.cc index 3088727020..47a30fa288 100644 --- a/lib/api/CAnomalyJob.cc +++ b/lib/api/CAnomalyJob.cc @@ -57,7 +57,7 @@ namespace api // We use short field names to reduce the state size namespace { -typedef boost::reference_wrapper TStrCRef; +using TStrCRef = boost::reference_wrapper; //! Convert a (string, key) pair to something readable. template @@ -607,7 +607,7 @@ bool CAnomalyJob::parseTimeRangeInControlMessage(const std::string &controlMessa core_t::TTime &start, core_t::TTime &end) { - typedef core::CStringUtils::TStrVec TStrVec; + using TStrVec = core::CStringUtils::TStrVec; TStrVec tokens; std::string remainder; core::CStringUtils::tokenise(" ", controlMessage.substr(1, std::string::npos), tokens, remainder); @@ -652,8 +652,8 @@ void CAnomalyJob::doForecast(const std::string &controlMessage) void CAnomalyJob::outputResults(core_t::TTime bucketStartTime) { - typedef TKeyAnomalyDetectorPtrUMap::const_iterator TKeyAnomalyDetectorPtrUMapCItr; - typedef std::vector TKeyAnomalyDetectorPtrUMapCItrVec; + using TKeyAnomalyDetectorPtrUMapCItr = TKeyAnomalyDetectorPtrUMap::const_iterator; + using TKeyAnomalyDetectorPtrUMapCItrVec = std::vector; static uint64_t cumulativeTime = 0; @@ -791,7 +791,7 @@ void CAnomalyJob::writeOutResults(bool interim, model::CHierarchicalResults &res results.root()->s_NormalizedAnomalyScore << ", count " << results.resultCount() << " at " << bucketTime); - typedef ml::core::CScopedRapidJsonPoolAllocator TScopedAllocator; + using TScopedAllocator = ml::core::CScopedRapidJsonPoolAllocator; static const std::string ALLOCATOR_ID("CAnomalyJob::writeOutResults"); TScopedAllocator scopedAllocator(ALLOCATOR_ID, m_JsonOutputWriter); diff --git a/lib/api/CBaseTokenListDataTyper.cc b/lib/api/CBaseTokenListDataTyper.cc index 4419a51d89..01497b7f3e 100644 --- a/lib/api/CBaseTokenListDataTyper.cc +++ b/lib/api/CBaseTokenListDataTyper.cc @@ -300,7 +300,7 @@ bool CBaseTokenListDataTyper::createReverseSearch(int type, // Determine the rarest tokens that we can afford within the available // length - typedef std::multimap TSizeSizeSizePrMMap; + using TSizeSizeSizePrMMap = std::multimap; TSizeSizeSizePrMMap rareIdsWithCost; size_t lowestCost(std::numeric_limits::max()); for (const auto &commonUniqueTokenId : commonUniqueTokenIds) @@ -318,7 +318,7 @@ bool CBaseTokenListDataTyper::createReverseSearch(int type, lowestCost = std::min(cost, lowestCost); } - typedef std::set TSizeSet; + using TSizeSet = std::set; TSizeSet costedCommonUniqueTokenIds; size_t cheapestCost(std::numeric_limits::max()); auto cheapestIter = rareIdsWithCost.end(); diff --git a/lib/api/CBenchMarker.cc b/lib/api/CBenchMarker.cc index 24228bb217..7eee152557 100644 --- a/lib/api/CBenchMarker.cc +++ b/lib/api/CBenchMarker.cc @@ -101,9 +101,9 @@ void CBenchMarker::addResult(const std::string &message, void CBenchMarker::dumpResults(void) const { // Sort the results in descending order of actual type occurrence - typedef std::pair TSizeRegexIntSizeStrPrMapPrVecCItrPr; - typedef std::vector TSizeRegexIntSizeStrPrMapPrVecCItrPrVec; - typedef TSizeRegexIntSizeStrPrMapPrVecCItrPrVec::const_iterator TSizeRegexIntSizeStrPrMapPrVecCItrPrVecCItr; + using TSizeRegexIntSizeStrPrMapPrVecCItrPr = std::pair; + using TSizeRegexIntSizeStrPrMapPrVecCItrPrVec = std::vector; + using TSizeRegexIntSizeStrPrMapPrVecCItrPrVecCItr = TSizeRegexIntSizeStrPrMapPrVecCItrPrVec::const_iterator; TSizeRegexIntSizeStrPrMapPrVecCItrPrVec sortVec; sortVec.reserve(m_Measures.size()); @@ -126,14 +126,14 @@ void CBenchMarker::dumpResults(void) const } // Sort descending - typedef std::greater TGreaterSizeRegexIntSizeStrPrMapPrVecCItrPr; + using TGreaterSizeRegexIntSizeStrPrMapPrVecCItrPr = std::greater; TGreaterSizeRegexIntSizeStrPrMapPrVecCItrPr comp; std::sort(sortVec.begin(), sortVec.end(), comp); std::ostringstream strm; strm << "Results:" << core_t::LINE_ENDING; - typedef std::set TIntSet; + using TIntSet = std::set; TIntSet usedTypes; size_t observedActuals(0); diff --git a/lib/api/CCsvOutputWriter.cc b/lib/api/CCsvOutputWriter.cc index b4a0d62db9..51549bbc2f 100644 --- a/lib/api/CCsvOutputWriter.cc +++ b/lib/api/CCsvOutputWriter.cc @@ -166,7 +166,7 @@ bool CCsvOutputWriter::writeRow(const TStrStrUMap &dataRowFields, // all gets written to the stream m_WorkRecord.clear(); - typedef std::equal_to TStrEqualTo; + using TStrEqualTo = std::equal_to; TStrEqualTo pred; TStrVecCItr fieldNameIter = m_FieldNames.begin(); diff --git a/lib/api/CFieldConfig.cc b/lib/api/CFieldConfig.cc index 5b4a7442b0..76262783a4 100644 --- a/lib/api/CFieldConfig.cc +++ b/lib/api/CFieldConfig.cc @@ -311,13 +311,13 @@ bool CFieldConfig::tokenise(const std::string &clause, { // Tokenise on spaces or commas. Double quotes are used // for quoting, and the escape character is a backslash. - typedef boost::escaped_list_separator TCharEscapedListSeparator; + using TCharEscapedListSeparator = boost::escaped_list_separator; TCharEscapedListSeparator els("\\", core::CStringUtils::WHITESPACE_CHARS + ',', "\""); try { - typedef boost::tokenizer TCharEscapedListSeparatorTokenizer; + using TCharEscapedListSeparatorTokenizer = boost::tokenizer; TCharEscapedListSeparatorTokenizer tokenizer(clause, els); for (TCharEscapedListSeparatorTokenizer::iterator iter = tokenizer.begin(); @@ -549,7 +549,7 @@ bool CFieldConfig::initFromClause(const TStrVec &tokens) bool CFieldConfig::addOptions(const CFieldOptions &options) { - typedef std::pair TFieldOptionsMIndexItrBoolPr; + using TFieldOptionsMIndexItrBoolPr = std::pair; TFieldOptionsMIndexItrBoolPr result(m_FieldOptions.insert(options)); if (result.second == false) { @@ -704,7 +704,7 @@ bool CFieldConfig::parseClause(bool allowMultipleFunctions, options.description(description); } - typedef std::pair TFieldOptionsMIndexItrBoolPr; + using TFieldOptionsMIndexItrBoolPr = std::pair; TFieldOptionsMIndexItrBoolPr result(optionsIndex.insert(options)); if (result.second == false) { diff --git a/lib/api/CHierarchicalResultsWriter.cc b/lib/api/CHierarchicalResultsWriter.cc index 8c1d6e7030..8dade91da1 100644 --- a/lib/api/CHierarchicalResultsWriter.cc +++ b/lib/api/CHierarchicalResultsWriter.cc @@ -19,9 +19,9 @@ namespace api namespace { -typedef boost::optional TOptionalDouble; -typedef boost::optional TOptionalUInt64; -typedef core::CSmallVector TDouble1Vec; +using TOptionalDouble = boost::optional; +using TOptionalUInt64 = boost::optional; +using TDouble1Vec = core::CSmallVector; const std::string COUNT_NAME("count"); const std::string EMPTY_STRING; const CHierarchicalResultsWriter::TStr1Vec EMPTY_STRING_LIST; diff --git a/lib/api/CJsonOutputWriter.cc b/lib/api/CJsonOutputWriter.cc index 240dae344e..0394a64a7d 100644 --- a/lib/api/CJsonOutputWriter.cc +++ b/lib/api/CJsonOutputWriter.cc @@ -788,12 +788,12 @@ void CJsonOutputWriter::addInfluences(const CHierarchicalResultsWriter::TStoredS //! influenceResults. These strings must exist up to the time the results //! are written - typedef std::pair TCharPtrDoublePr; - typedef std::vector TCharPtrDoublePrVec; - typedef TCharPtrDoublePrVec::iterator TCharPtrDoublePrVecIter; - typedef std::pair TCharPtrCharPtrDoublePrVecPr; - typedef boost::unordered_map TStrCharPtrCharPtrDoublePrVecPrUMap; - typedef TStrCharPtrCharPtrDoublePrVecPrUMap::iterator TStrCharPtrCharPtrDoublePrVecPrUMapIter; + using TCharPtrDoublePr = std::pair; + using TCharPtrDoublePrVec = std::vector; + using TCharPtrDoublePrVecIter = TCharPtrDoublePrVec::iterator; + using TCharPtrCharPtrDoublePrVecPr = std::pair; + using TStrCharPtrCharPtrDoublePrVecPrUMap = boost::unordered_map; + using TStrCharPtrCharPtrDoublePrVecPrUMapIter = TStrCharPtrCharPtrDoublePrVecPrUMap::iterator; TStrCharPtrCharPtrDoublePrVecPrUMap influences; diff --git a/lib/api/COutputChainer.cc b/lib/api/COutputChainer.cc index 733b2129cf..73808ce14a 100644 --- a/lib/api/COutputChainer.cc +++ b/lib/api/COutputChainer.cc @@ -85,7 +85,7 @@ bool COutputChainer::writeRow(const TStrStrUMap &dataRowFields, return false; } - typedef std::equal_to TStrEqualTo; + using TStrEqualTo = std::equal_to; TStrEqualTo pred; TPreComputedHashVecCItr preComputedHashIter = m_Hashes.begin(); diff --git a/lib/api/unittest/CAnomalyJobLimitTest.cc b/lib/api/unittest/CAnomalyJobLimitTest.cc index 4269523d4c..c1467182e2 100644 --- a/lib/api/unittest/CAnomalyJobLimitTest.cc +++ b/lib/api/unittest/CAnomalyJobLimitTest.cc @@ -213,7 +213,7 @@ void CAnomalyJobLimitTest::testAccuracy(void) void CAnomalyJobLimitTest::testLimit(void) { - typedef std::set TStrSet; + using TStrSet = std::set; std::stringstream outputStrm; { diff --git a/lib/api/unittest/CConfigUpdaterTest.cc b/lib/api/unittest/CConfigUpdaterTest.cc index e25e8a12e3..fe26f8481d 100644 --- a/lib/api/unittest/CConfigUpdaterTest.cc +++ b/lib/api/unittest/CConfigUpdaterTest.cc @@ -65,7 +65,7 @@ void CConfigUpdaterTest::testUpdateGivenUnknownStanzas(void) void CConfigUpdaterTest::testUpdateGivenModelPlotConfig(void) { - typedef model::CAnomalyDetectorModelConfig::TStrSet TStrSet; + using TStrSet = model::CAnomalyDetectorModelConfig::TStrSet; CFieldConfig fieldConfig; model::CAnomalyDetectorModelConfig modelConfig = model::CAnomalyDetectorModelConfig::defaultConfig(); diff --git a/lib/api/unittest/CCsvInputParserTest.cc b/lib/api/unittest/CCsvInputParserTest.cc index 447fd43556..b15df1013b 100644 --- a/lib/api/unittest/CCsvInputParserTest.cc +++ b/lib/api/unittest/CCsvInputParserTest.cc @@ -118,7 +118,7 @@ class CVisitor class CTimeCheckingVisitor { public: - typedef std::vector TTimeVec; + using TTimeVec = std::vector; public: CTimeCheckingVisitor(const std::string &timeField, diff --git a/lib/api/unittest/CDetectionRulesJsonParserTest.cc b/lib/api/unittest/CDetectionRulesJsonParserTest.cc index 4be823f8f7..b946a0fbb0 100644 --- a/lib/api/unittest/CDetectionRulesJsonParserTest.cc +++ b/lib/api/unittest/CDetectionRulesJsonParserTest.cc @@ -17,7 +17,7 @@ using namespace api; namespace { -typedef CDetectionRulesJsonParser::TStrPatternSetUMap TStrPatternSetUMap; +using TStrPatternSetUMap = CDetectionRulesJsonParser::TStrPatternSetUMap; TStrPatternSetUMap EMPTY_VALUE_FILTER_MAP; } diff --git a/lib/api/unittest/CJsonOutputWriterTest.cc b/lib/api/unittest/CJsonOutputWriterTest.cc index 30eaa4f506..8112898565 100644 --- a/lib/api/unittest/CJsonOutputWriterTest.cc +++ b/lib/api/unittest/CJsonOutputWriterTest.cc @@ -208,7 +208,7 @@ void CJsonOutputWriterTest::testWriteNonAnomalousBucket(void) arrayDoc.Parse(sstream.str().c_str()); rapidjson::StringBuffer strbuf; - typedef rapidjson::PrettyWriter TStringBufferPrettyWriter; + using TStringBufferPrettyWriter = rapidjson::PrettyWriter; TStringBufferPrettyWriter prettyPrinter(strbuf); arrayDoc.Accept(prettyPrinter); LOG_DEBUG("Results:\n" << strbuf.GetString()); @@ -250,7 +250,7 @@ void CJsonOutputWriterTest::testFlush(void) CPPUNIT_ASSERT_EQUAL(rapidjson::SizeType(1), arrayDoc.Size()); rapidjson::StringBuffer strbuf; - typedef rapidjson::PrettyWriter TStringBufferPrettyWriter; + using TStringBufferPrettyWriter = rapidjson::PrettyWriter; TStringBufferPrettyWriter writer(strbuf); arrayDoc.Accept(writer); LOG_DEBUG("Flush:\n" << strbuf.GetString()); @@ -275,7 +275,7 @@ void CJsonOutputWriterTest::testWriteCategoryDefinition(void) std::string terms("foo bar"); std::string regex(".*?foo.+?bar.*"); std::size_t maxMatchingLength(132); - typedef std::set TStrSet; + using TStrSet = std::set; TStrSet examples; examples.insert("User foo failed to log in"); examples.insert("User bar failed to log in"); @@ -296,7 +296,7 @@ void CJsonOutputWriterTest::testWriteCategoryDefinition(void) CPPUNIT_ASSERT_EQUAL(rapidjson::SizeType(1), arrayDoc.Size()); rapidjson::StringBuffer strbuf; - typedef rapidjson::PrettyWriter TStringBufferPrettyWriter; + using TStringBufferPrettyWriter = rapidjson::PrettyWriter; TStringBufferPrettyWriter writer(strbuf); arrayDoc.Accept(writer); LOG_DEBUG("CategoryDefinition:\n" << strbuf.GetString()); @@ -799,7 +799,7 @@ void CJsonOutputWriterTest::testBucketWriteHelper(bool isInterim) CPPUNIT_ASSERT(!arrayDoc.HasParseError()); rapidjson::StringBuffer strbuf; - typedef rapidjson::PrettyWriter TStringBufferPrettyWriter; + using TStringBufferPrettyWriter = rapidjson::PrettyWriter; TStringBufferPrettyWriter writer(strbuf); arrayDoc.Accept(writer); LOG_DEBUG("Results:\n" << strbuf.GetString()); @@ -1633,7 +1633,7 @@ void CJsonOutputWriterTest::testLimitedRecordsWriteHelper(bool isInterim) arrayDoc.Parse(sstream.str().c_str()); rapidjson::StringBuffer strbuf; - typedef rapidjson::PrettyWriter TStringBufferPrettyWriter; + using TStringBufferPrettyWriter = rapidjson::PrettyWriter; TStringBufferPrettyWriter writer(strbuf); arrayDoc.Accept(writer); LOG_DEBUG("Results:\n" << strbuf.GetString()); @@ -1851,7 +1851,7 @@ void CJsonOutputWriterTest::testWriteInfluencers(void) // Debug print record rapidjson::StringBuffer strbuf; - typedef rapidjson::PrettyWriter TStringBufferPrettyWriter; + using TStringBufferPrettyWriter = rapidjson::PrettyWriter; TStringBufferPrettyWriter writer(strbuf); doc.Accept(writer); LOG_DEBUG("influencers:\n" << strbuf.GetString()); @@ -1981,7 +1981,7 @@ void CJsonOutputWriterTest::testWriteInfluencersWithLimit(void) rapidjson::StringBuffer strbuf; - typedef rapidjson::PrettyWriter TStringBufferPrettyWriter; + using TStringBufferPrettyWriter = rapidjson::PrettyWriter; TStringBufferPrettyWriter writer(strbuf); doc.Accept(writer); @@ -2138,7 +2138,7 @@ void CJsonOutputWriterTest::testWriteWithInfluences(void) // Debug print record { rapidjson::StringBuffer strbuf; - typedef rapidjson::PrettyWriter TStringBufferPrettyWriter; + using TStringBufferPrettyWriter = rapidjson::PrettyWriter; TStringBufferPrettyWriter writer(strbuf); doc.Accept(writer); LOG_DEBUG("Results:\n" << strbuf.GetString()); @@ -2449,7 +2449,7 @@ void CJsonOutputWriterTest::testWriteScheduledEvent(void) // Debug print record { rapidjson::StringBuffer strbuf; - typedef rapidjson::PrettyWriter TStringBufferPrettyWriter; + using TStringBufferPrettyWriter = rapidjson::PrettyWriter; TStringBufferPrettyWriter writer(strbuf); doc.Accept(writer); LOG_DEBUG("Results:\n" << strbuf.GetString()); @@ -2645,7 +2645,7 @@ void CJsonOutputWriterTest::testThroughputHelper(bool useScopedAllocator) { if (useScopedAllocator) { - typedef ml::core::CScopedRapidJsonPoolAllocator TScopedAllocator; + using TScopedAllocator = ml::core::CScopedRapidJsonPoolAllocator; static const std::string ALLOCATOR_ID("CAnomalyJob::writeOutResults"); TScopedAllocator scopedAllocator(ALLOCATOR_ID, writer); diff --git a/lib/api/unittest/CMultiFileDataAdderTest.cc b/lib/api/unittest/CMultiFileDataAdderTest.cc index 8a3ee2577b..3cd9beb0ef 100644 --- a/lib/api/unittest/CMultiFileDataAdderTest.cc +++ b/lib/api/unittest/CMultiFileDataAdderTest.cc @@ -41,7 +41,7 @@ namespace { -typedef std::vector TStrVec; +using TStrVec = std::vector; void reportPersistComplete(ml::api::CModelSnapshotJsonWriter::SModelSnapshotReport modelSnapshotReport, std::string &snapshotIdOut, diff --git a/lib/api/unittest/CTokenListDataTyperTest.cc b/lib/api/unittest/CTokenListDataTyperTest.cc index 5851ad0a79..72947a5861 100644 --- a/lib/api/unittest/CTokenListDataTyperTest.cc +++ b/lib/api/unittest/CTokenListDataTyperTest.cc @@ -19,17 +19,17 @@ namespace { -typedef ml::api::CTokenListDataTyper - TTokenListDataTyperKeepsFields; +using TTokenListDataTyperKeepsFields = + ml::api::CTokenListDataTyper; const TTokenListDataTyperKeepsFields::TTokenListReverseSearchCreatorIntfCPtr NO_REVERSE_SEARCH_CREATOR; diff --git a/lib/config/CAutoconfigurer.cc b/lib/config/CAutoconfigurer.cc index 69ea7066cf..42e67dc514 100644 --- a/lib/config/CAutoconfigurer.cc +++ b/lib/config/CAutoconfigurer.cc @@ -58,9 +58,9 @@ const core_t::TTime UPDATE_SCORE_TIME_INTERVAL = 172800; class CONFIG_EXPORT CAutoconfigurerImpl : public core::CNonCopyable { public: - typedef std::vector TStrVec; - typedef boost::unordered_map TStrStrUMap; - typedef TStrStrUMap::const_iterator TStrStrUMapCItr; + using TStrVec = std::vector; + using TStrStrUMap = boost::unordered_map; + using TStrStrUMapCItr = TStrStrUMap::const_iterator; public: CAutoconfigurerImpl(const CAutoconfigurerParams ¶ms, CReportWriter &reportWriter); @@ -78,11 +78,11 @@ class CONFIG_EXPORT CAutoconfigurerImpl : public core::CNonCopyable uint64_t numRecordsHandled(void) const; private: - typedef std::pair TTimeStrStrUMapPr; - typedef std::vector TTimeStrStrUMapPrVec; - typedef boost::optional TOptionalUserDataType; - typedef std::vector TDetectorSpecificationVec; - typedef std::vector TFieldStatisticsVec; + using TTimeStrStrUMapPr = std::pair; + using TTimeStrStrUMapPrVec = std::vector; + using TOptionalUserDataType = boost::optional; + using TDetectorSpecificationVec = std::vector; + using TFieldStatisticsVec = std::vector; private: //! Extract the time from \p fieldValues. @@ -418,8 +418,8 @@ void CAutoconfigurerImpl::generateCandidateDetectorsOnce(void) LOG_DEBUG("Generate Candidate Detectors:"); - typedef void (CDetectorEnumerator::*TAddField)(const std::string &); - typedef bool (CAutoconfigurerParams::*TCanUse)(const std::string &) const; + using TAddField = void (CDetectorEnumerator::*)(const std::string &); + using TCanUse = bool (CAutoconfigurerParams::*)(const std::string &) const; CDetectorEnumerator enumerator(m_Params); for (std::size_t i = 0u; i < m_Params.functionsCategoriesToConfigure().size(); ++i) diff --git a/lib/config/CAutoconfigurerFieldRolePenalties.cc b/lib/config/CAutoconfigurerFieldRolePenalties.cc index 38513c41b5..6506330c8f 100644 --- a/lib/config/CAutoconfigurerFieldRolePenalties.cc +++ b/lib/config/CAutoconfigurerFieldRolePenalties.cc @@ -27,7 +27,7 @@ const std::size_t RARE_BY_INDEX = 3u; const std::size_t OVER_INDEX = 4u; const std::size_t PARTITION_INDEX = 5u; -typedef std::size_t (CAutoconfigurerParams::*TCountThreshold)(void) const; +using TCountThreshold = std::size_t (CAutoconfigurerParams::*)(void) const; const std::size_t PENALTY_INDICES[] = { diff --git a/lib/config/CAutoconfigurerParams.cc b/lib/config/CAutoconfigurerParams.cc index 8f9a9dca2d..8b391df99f 100644 --- a/lib/config/CAutoconfigurerParams.cc +++ b/lib/config/CAutoconfigurerParams.cc @@ -29,7 +29,7 @@ namespace config { namespace { -typedef std::vector TStrVec; +using TStrVec = std::vector; //! \brief A constraint which applies to a value of type T. template @@ -63,7 +63,7 @@ template class CConstraintConjunction : public CConstraint { public: - typedef boost::shared_ptr > TConstraintCPtr; + using TConstraintCPtr = boost::shared_ptr>; public: CConstraintConjunction *addConstraint(const CConstraint *constraint) @@ -238,7 +238,7 @@ template class CBuiltinParameter : public CParameter { public: - typedef boost::shared_ptr > TConstraintCPtr; + using TConstraintCPtr = boost::shared_ptr>; public: CBuiltinParameter(T &value) : @@ -330,7 +330,7 @@ class CBuiltinVectorParameter : public CParameter private: std::vector &m_Value; - boost::shared_ptr > m_Constraint; + boost::shared_ptr> m_Constraint; }; //! \brief A parameter which is a vector of strings. @@ -369,7 +369,7 @@ class COptionalStrVecParameter : public CParameter private: CAutoconfigurerParams::TOptionalStrVec &m_Value; - boost::shared_ptr > m_Constraint; + boost::shared_ptr> m_Constraint; }; //! \brief The field data type parameter. @@ -496,7 +496,7 @@ class CFunctionCategoryParameter : public CParameter private: CAutoconfigurerParams::TFunctionCategoryVec &m_Value; - boost::shared_ptr > m_Constraint; + boost::shared_ptr> m_Constraint; }; //! boost::ini_parser doesn't like UTF-8 ini files that begin with @@ -688,7 +688,7 @@ bool CAutoconfigurerParams::init(const std::string &file) return true; } - typedef boost::shared_ptr TParameterPtr; + using TParameterPtr = boost::shared_ptr; boost::property_tree::ptree propTree; try diff --git a/lib/config/CDataCountStatistics.cc b/lib/config/CDataCountStatistics.cc index 4ac270247e..2effae74fc 100644 --- a/lib/config/CDataCountStatistics.cc +++ b/lib/config/CDataCountStatistics.cc @@ -37,7 +37,7 @@ namespace config namespace { -typedef std::vector TBoolVec; +using TBoolVec = std::vector; //! We sample a subset of short bucket lengths buckets for runtime. TBoolVec bucketSampleMask(core_t::TTime bucketLength) @@ -50,7 +50,7 @@ TBoolVec bucketSampleMask(core_t::TTime bucketLength) //! Insert with the same semantics as boost::unordered_map/set::emplace. template -std::size_t emplace(const std::string *name, std::vector > &stats) +std::size_t emplace(const std::string *name, std::vector> &stats) { std::size_t i = static_cast( std::lower_bound(stats.begin(), stats.end(), @@ -160,8 +160,8 @@ void CBucketCountStatistics::add(const TSizeSizeSizeTr &partition, void CBucketCountStatistics::capture(void) { - typedef TSizeSizeSizeTrUInt64UMap::const_iterator TSizeSizeSizeTrUInt64UMapCItr; - typedef TSizeSizeSizeTrArgumentDataUMap::iterator TSizeSizeSizeTrArgumentDataUMapItr; + using TSizeSizeSizeTrUInt64UMapCItr = TSizeSizeSizeTrUInt64UMap::const_iterator; + using TSizeSizeSizeTrArgumentDataUMapItr = TSizeSizeSizeTrArgumentDataUMap::iterator; m_BucketPartitionCount += m_CurrentBucketPartitionCounts.size(); for (TSizeSizeSizeTrUInt64UMapCItr i = m_CurrentBucketPartitionCounts.begin(); @@ -211,7 +211,7 @@ const CBucketCountStatistics::TSizeSizePrQuantileUMap &CBucketCountStatistics::c const CBucketCountStatistics::TSizeSizePrArgumentMomentsUMap & CBucketCountStatistics::argumentMomentsPerPartition(const std::string &name) const { - typedef TStrCPtrSizeSizePrArgumentMomentsUMapPrVec::const_iterator TStrCPtrPartitionArgumentMomentsUMapPrVecCItr; + using TStrCPtrPartitionArgumentMomentsUMapPrVecCItr = TStrCPtrSizeSizePrArgumentMomentsUMapPrVec::const_iterator; static const TSizeSizePrArgumentMomentsUMap EMPTY; TStrCPtrPartitionArgumentMomentsUMapPrVecCItr result = std::lower_bound(m_ArgumentMomentsPerPartition.begin(), @@ -404,7 +404,7 @@ void CByOverAndPartitionDataCountStatistics::add(TDetectorRecordCItr beginRecord return; } - typedef TSizeSizePrCBjkstUMap::iterator TSizeSizePrCBjkstUMapItr; + using TSizeSizePrCBjkstUMapItr = TSizeSizePrCBjkstUMap::iterator; this->CDataCountStatistics::add(beginRecords, endRecords); @@ -433,9 +433,8 @@ CDataCountStatisticsDirectAddressTable::CDataCountStatisticsDirectAddressTable(c void CDataCountStatisticsDirectAddressTable::build(const TDetectorSpecificationVec &specs) { - typedef boost::unordered_map TCountStatisticsKeySizeUMap; + using TCountStatisticsKeySizeUMap = + boost::unordered_map; std::size_t size = 0u; for (std::size_t i = 0u; i < specs.size(); ++i) @@ -468,7 +467,7 @@ void CDataCountStatisticsDirectAddressTable::build(const TDetectorSpecificationV void CDataCountStatisticsDirectAddressTable::pruneUnsed(const TDetectorSpecificationVec &specs) { - typedef boost::unordered_set TSizeUSet; + using TSizeUSet = boost::unordered_set; TSizeUSet used; for (std::size_t i = 0u; i < specs.size(); ++i) @@ -515,7 +514,7 @@ const CDataCountStatistics & CDataCountStatisticsDirectAddressTable::TDataCountStatisticsPtr CDataCountStatisticsDirectAddressTable::stats(const CDetectorSpecification &spec) const { - typedef CDataCountStatistics *(*TStatistics)(const CAutoconfigurerParams &); + using TStatistics = CDataCountStatistics *(*)(const CAutoconfigurerParams &); static TStatistics STATISTICS[] = { &partitionCountStatistics, diff --git a/lib/config/CDataSemantics.cc b/lib/config/CDataSemantics.cc index f16e83d034..d535fb165e 100644 --- a/lib/config/CDataSemantics.cc +++ b/lib/config/CDataSemantics.cc @@ -20,8 +20,8 @@ namespace config { namespace { -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; //! \brief Wraps up a mixture model. //! @@ -44,7 +44,7 @@ class CMixtureData //! Compute the scale for a mixture of \p m. double scale(std::size_t m) { - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; TSizeVec split; m_Classifier.naturalBreaks(m, 2, split); @@ -110,8 +110,8 @@ class CMixtureData } private: - typedef std::vector > TNormalVec; - typedef maths::CMixtureDistribution > TGMM; + using TNormalVec = std::vector>; + using TGMM = maths::CMixtureDistribution>; private: void clear(void) @@ -274,7 +274,7 @@ bool CDataSemantics::GMMGoodFit(void) const // The idea is to check the goodness-of-fit of a categorical model // to the data verses a normal mixture. - typedef TOrdinalSizeUMap::const_iterator TOrdinalSizeUMapCItr; + using TOrdinalSizeUMapCItr = TOrdinalSizeUMap::const_iterator; std::size_t N = m_EmpiricalDistribution.size(); LOG_TRACE("N = " << N); diff --git a/lib/config/CDataSummaryStatistics.cc b/lib/config/CDataSummaryStatistics.cc index 7ae5a63483..c336e853a7 100644 --- a/lib/config/CDataSummaryStatistics.cc +++ b/lib/config/CDataSummaryStatistics.cc @@ -25,8 +25,8 @@ namespace config namespace { -typedef core::CFunctional::SDereference TDerefSecondLess; -typedef core::CFunctional::SDereference TDerefSecondGreater; +using TDerefSecondLess = core::CFunctional::SDereference; +using TDerefSecondGreater = core::CFunctional::SDereference; std::size_t topNSize(std::size_t n) { @@ -242,7 +242,7 @@ void CCategoricalDataSummaryStatistics::addNGrams(std::size_t n, const std::stri void CCategoricalDataSummaryStatistics::approximateIfCardinalityTooHigh(void) { - typedef TSizeUInt64UMap::const_iterator TSizeUInt64UMapCItr; + using TSizeUInt64UMapCItr = TSizeUInt64UMap::const_iterator; if (m_ValueCounts.size() >= m_ToApproximate) { @@ -284,7 +284,7 @@ double CCategoricalDataSummaryStatistics::calibratedCount(std::size_t category) return static_cast(m_ValueCounts.find(category)->second); } - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; TMeanAccumulator error; if (m_CountSketch.sketched()) @@ -300,7 +300,7 @@ double CCategoricalDataSummaryStatistics::calibratedCount(std::size_t category) void CCategoricalDataSummaryStatistics::findLowestTopN(void) { - typedef maths::CBasicStatistics::COrderStatisticsStack TMinAccumulator; + using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsStack; TMinAccumulator lowest; for (TStrUInt64UMapItr i = m_TopN.begin(); i != m_TopN.end(); ++i) { @@ -311,7 +311,7 @@ void CCategoricalDataSummaryStatistics::findLowestTopN(void) void CCategoricalDataSummaryStatistics::topN(TStrUInt64UMapCItrVec &result) const { - typedef maths::CBasicStatistics::COrderStatisticsHeap TMaxAccumulator; + using TMaxAccumulator = maths::CBasicStatistics::COrderStatisticsHeap; TMaxAccumulator topN(m_N); for (TStrUInt64UMapCItr i = m_TopN.begin(); i != m_TopN.end(); ++i) { @@ -397,9 +397,9 @@ bool CNumericDataSummaryStatistics::densityChart(TDoubleDoublePrVec &result) con return true; } - typedef std::vector TDoubleVec; - typedef std::vector > TNormalVec; - typedef maths::CMixtureDistribution > TGMM; + using TDoubleVec = std::vector; + using TNormalVec = std::vector>; + using TGMM = maths::CMixtureDistribution>; const maths::CXMeansOnline1d::TClusterVec &clusters = m_Clusters.clusters(); std::size_t n = clusters.size(); diff --git a/lib/config/CDetectorEnumerator.cc b/lib/config/CDetectorEnumerator.cc index eea22fc465..15b2376d7b 100644 --- a/lib/config/CDetectorEnumerator.cc +++ b/lib/config/CDetectorEnumerator.cc @@ -23,9 +23,9 @@ namespace config namespace { -typedef std::vector TStrVec; -typedef boost::reference_wrapper TStrVecCRef; -typedef std::vector TStrVecCRefVec; +using TStrVec = std::vector; +using TStrVecCRef = boost::reference_wrapper; +using TStrVecCRefVec = std::vector; //! Add detectors for the partitioning fields \p candidates. void add(std::size_t p, diff --git a/lib/config/CDetectorFieldRolePenalty.cc b/lib/config/CDetectorFieldRolePenalty.cc index 6b4f97d40d..e7a693b17c 100644 --- a/lib/config/CDetectorFieldRolePenalty.cc +++ b/lib/config/CDetectorFieldRolePenalty.cc @@ -21,7 +21,7 @@ namespace config namespace { -typedef const CFieldStatistics *(CDetectorSpecification::*TGetStatistics)(void) const; +using TGetStatistics = const CFieldStatistics *(CDetectorSpecification::*)(void) const; const TGetStatistics STATISTIC[] = { &CDetectorSpecification::argumentFieldStatistics, diff --git a/lib/config/CDetectorRecord.cc b/lib/config/CDetectorRecord.cc index c880544936..1eaaba644a 100644 --- a/lib/config/CDetectorRecord.cc +++ b/lib/config/CDetectorRecord.cc @@ -23,7 +23,7 @@ namespace config namespace { -typedef const CDetectorSpecification::TOptionalStr &(CDetectorSpecification::*TField)(void) const; +using TField = const CDetectorSpecification::TOptionalStr &(CDetectorSpecification::*)(void) const; const TField FIELDS[] = { &CDetectorSpecification::argumentField, @@ -139,8 +139,8 @@ std::string CDetectorRecord::print(void) const void CDetectorRecordDirectAddressTable::build(const TDetectorSpecificationVec &specs) { - typedef boost::unordered_map TStrSizeUMap; - typedef TStrSizeUMap::const_iterator TStrSizeUMapCItr; + using TStrSizeUMap = boost::unordered_map; + using TStrSizeUMapCItr = TStrSizeUMap::const_iterator; this->clear(); @@ -193,7 +193,7 @@ void CDetectorRecordDirectAddressTable::detectorRecords(core_t::TTime time, return; } - typedef TStrStrUMap::const_iterator TStrStrUMapCItr; + using TStrStrUMapCItr = TStrStrUMap::const_iterator; std::size_t size = 0u; for (std::size_t i = 0u; i < specs.size(); ++i) diff --git a/lib/config/CDetectorSpecification.cc b/lib/config/CDetectorSpecification.cc index 51932b1eb1..bce6f35898 100644 --- a/lib/config/CDetectorSpecification.cc +++ b/lib/config/CDetectorSpecification.cc @@ -29,8 +29,8 @@ namespace config namespace { -typedef std::vector TSizeVec; -typedef std::vector TDoubleVec; +using TSizeVec = std::vector; +using TDoubleVec = std::vector; //! \brief Checks if the name of some statistics matches a specified value. class CNameEquals @@ -466,10 +466,9 @@ std::string CDetectorSpecification::detectorConfig(void) const return ""; } - typedef std::pair TDoubleTimePr; - typedef maths::CBasicStatistics::COrderStatisticsStack TMaxAccumulator; + using TDoubleTimePr = std::pair; + using TMaxAccumulator = maths::CBasicStatistics::COrderStatisticsStack; const TTimeVec &candidates = this->params().candidateBucketLengths(); diff --git a/lib/config/CLongTailPenalty.cc b/lib/config/CLongTailPenalty.cc index b3940336e8..b184c270cd 100644 --- a/lib/config/CLongTailPenalty.cc +++ b/lib/config/CLongTailPenalty.cc @@ -124,9 +124,9 @@ void CLongTailPenalty::extractTailCounts(const MAP &counts, TSizeUInt64UMap &totals, TSizeUInt64UMap &tail) const { - typedef maths::CBasicStatistics::COrderStatisticsStack TMinAccumulator; - typedef boost::unordered_map TSizeMinAccumulatorUMap; - typedef typename MAP::const_iterator TItr; + using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsStack; + using TSizeMinAccumulatorUMap = boost::unordered_map; + using TItr = typename MAP::const_iterator; TSizeMinAccumulatorUMap mins; @@ -154,8 +154,8 @@ void CLongTailPenalty::extractTailCounts(const MAP &counts, double CLongTailPenalty::penaltyFor(TSizeUInt64UMap &tail, TSizeUInt64UMap &totals) const { - typedef TSizeUInt64UMap::const_iterator TSizeUInt64UMapCItr; - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TSizeUInt64UMapCItr = TSizeUInt64UMap::const_iterator; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; TMeanAccumulator result; for (TSizeUInt64UMapCItr i = tail.begin(); i != tail.end(); ++i) { diff --git a/lib/config/CLowVariationPenalty.cc b/lib/config/CLowVariationPenalty.cc index 1170f073fe..19cdadcd16 100644 --- a/lib/config/CLowVariationPenalty.cc +++ b/lib/config/CLowVariationPenalty.cc @@ -24,12 +24,12 @@ namespace config namespace { -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; -typedef std::vector TStrVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef maths::CBasicStatistics::SSampleMeanVarSkew::TAccumulator TMomentsAccumulator; -typedef boost::unordered_map TSizeMomentsUMap; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; +using TStrVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMomentsAccumulator = maths::CBasicStatistics::SSampleMeanVarSkew::TAccumulator; +using TSizeMomentsUMap = boost::unordered_map; const double MIN = 0.9 * constants::DETECTOR_SCORE_EPSILON / constants::MAXIMUM_DETECTOR_SCORE; const double INF = boost::numeric::bounds::highest(); diff --git a/lib/config/CNotEnoughDataPenalty.cc b/lib/config/CNotEnoughDataPenalty.cc index b62023ee00..80d7826301 100644 --- a/lib/config/CNotEnoughDataPenalty.cc +++ b/lib/config/CNotEnoughDataPenalty.cc @@ -26,7 +26,7 @@ namespace config { namespace { -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; //! Get the description prefix. std::string descriptionPrefix(const CDetectorSpecification &spec, @@ -118,7 +118,7 @@ void CNotEnoughDataPenalty::penaltyFor(const TUInt64Vec &bucketCounts, const TBucketCountStatisticsVec &statistics, CDetectorSpecification &spec) const { - typedef CBucketCountStatistics::TSizeSizePrMomentsUMap::const_iterator TSizeSizePrMomentsUMapCItr; + using TSizeSizePrMomentsUMapCItr = CBucketCountStatistics::TSizeSizePrMomentsUMap::const_iterator; const CAutoconfigurerParams::TTimeVec &candidates = this->params().candidateBucketLengths(); diff --git a/lib/config/CPolledDataPenalty.cc b/lib/config/CPolledDataPenalty.cc index afa7cd172a..7f6b7c59b9 100644 --- a/lib/config/CPolledDataPenalty.cc +++ b/lib/config/CPolledDataPenalty.cc @@ -86,8 +86,9 @@ void CPolledDataPenalty::penaltyFromMe(CDetectorSpecification &spec) const CPolledDataPenalty::TOptionalTime CPolledDataPenalty::pollingInterval(const CDataCountStatistics &stats) const { - typedef maths::CBasicStatistics::COrderStatisticsStack TMaxAccumulator; + using TMaxAccumulator = + maths::CBasicStatistics::COrderStatisticsStack; const maths::CQuantileSketch &F = stats.arrivalTimeDistribution(); const maths::CQuantileSketch::TFloatFloatPrVec &knots = F.knots(); diff --git a/lib/config/CReportWriter.cc b/lib/config/CReportWriter.cc index be80741d6a..6acd7abdc8 100644 --- a/lib/config/CReportWriter.cc +++ b/lib/config/CReportWriter.cc @@ -24,9 +24,9 @@ namespace config namespace { -typedef std::vector TSizeVec; -typedef std::vector TStrVec; -typedef std::vector TStrVecVec; +using TSizeVec = std::vector; +using TStrVec = std::vector; +using TStrVecVec = std::vector; //! Pad \p value. inline std::string pad(std::size_t padTo, const std::string &value) @@ -68,7 +68,7 @@ inline std::string print(const std::pair &p, std::size_t padTo = 0) //! Write out a vector of pairs new line delimited. template -inline std::string print(const std::vector > &v, std::size_t padTo = 0) +inline std::string print(const std::vector> &v, std::size_t padTo = 0) { std::string result; for (std::size_t i = 0u; i < v.size(); ++i) diff --git a/lib/config/CSparseCountPenalty.cc b/lib/config/CSparseCountPenalty.cc index 5d323ccd2f..103b194573 100644 --- a/lib/config/CSparseCountPenalty.cc +++ b/lib/config/CSparseCountPenalty.cc @@ -26,7 +26,7 @@ namespace config namespace { -typedef std::vector TDoubleVec; +using TDoubleVec = std::vector; //! Extract the \p n quantiles from \p quantiles. void extract(const maths::CQuantileSketch &quantiles, std::size_t n, TDoubleVec &result) @@ -92,13 +92,13 @@ void CSparseCountPenalty::penaltyFromMe(CDetectorSpecification &spec) const return; } - typedef std::vector TDoubleVecVec; - typedef CBucketCountStatistics::TSizeSizePrQuantileUMap TSizeSizePrQuantileUMap; - typedef TSizeSizePrQuantileUMap::const_iterator TSizeSizePrQuantileUMapCItr; - typedef std::vector TSizeSizePrQuantileUMapCPtrVec; - typedef std::vector TSizeSizePrMomentsUMapCPtrVec; - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef std::vector TMeanAccumulatorVec; + using TDoubleVecVec = std::vector; + using TSizeSizePrQuantileUMap = CBucketCountStatistics::TSizeSizePrQuantileUMap; + using TSizeSizePrQuantileUMapCItr = TSizeSizePrQuantileUMap::const_iterator; + using TSizeSizePrQuantileUMapCPtrVec = std::vector; + using TSizeSizePrMomentsUMapCPtrVec = std::vector; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; + using TMeanAccumulatorVec = std::vector; if (const CDataCountStatistics *stats = spec.countStatistics()) { diff --git a/lib/config/CTooMuchDataPenalty.cc b/lib/config/CTooMuchDataPenalty.cc index 85b49b71c7..29a91dc510 100644 --- a/lib/config/CTooMuchDataPenalty.cc +++ b/lib/config/CTooMuchDataPenalty.cc @@ -24,7 +24,7 @@ namespace config { namespace { -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; //! Get the description prefix. std::string descriptionPrefix(const CDetectorSpecification &spec, @@ -115,7 +115,7 @@ void CTooMuchDataPenalty::penaltyFor(const TUInt64Vec &bucketCounts, const TBucketCountStatisticsVec &statistics, CDetectorSpecification &spec) const { - typedef CBucketCountStatistics::TSizeSizePrMomentsUMap::const_iterator TSizeSizePrMomentsUMapCItr; + using TSizeSizePrMomentsUMapCItr = CBucketCountStatistics::TSizeSizePrMomentsUMap::const_iterator; const CAutoconfigurerParams::TTimeVec &candidates = this->params().candidateBucketLengths(); diff --git a/lib/config/unittest/CDataSemanticsTest.cc b/lib/config/unittest/CDataSemanticsTest.cc index 1118b930a8..281e8005c2 100644 --- a/lib/config/unittest/CDataSemanticsTest.cc +++ b/lib/config/unittest/CDataSemanticsTest.cc @@ -18,9 +18,9 @@ using namespace ml; -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; -typedef std::vector TStrVec; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; +using TStrVec = std::vector; void CDataSemanticsTest::testBinary(void) { diff --git a/lib/config/unittest/CDataSummaryStatisticsTest.cc b/lib/config/unittest/CDataSummaryStatisticsTest.cc index b9f8ede888..acc9d79129 100644 --- a/lib/config/unittest/CDataSummaryStatisticsTest.cc +++ b/lib/config/unittest/CDataSummaryStatisticsTest.cc @@ -26,10 +26,10 @@ using namespace ml; -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; -typedef std::vector TStrVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; +using TStrVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; void CDataSummaryStatisticsTest::testRate(void) { diff --git a/lib/config/unittest/CReportWriterTest.cc b/lib/config/unittest/CReportWriterTest.cc index 6b3735eaab..74556abd37 100644 --- a/lib/config/unittest/CReportWriterTest.cc +++ b/lib/config/unittest/CReportWriterTest.cc @@ -19,9 +19,9 @@ using namespace ml; -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; -typedef std::vector TStrVec; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; +using TStrVec = std::vector; void CReportWriterTest::testPretty(void) { diff --git a/lib/core/CDetachedProcessSpawner.cc b/lib/core/CDetachedProcessSpawner.cc index 7552a64b75..e5747d1335 100644 --- a/lib/core/CDetachedProcessSpawner.cc +++ b/lib/core/CDetachedProcessSpawner.cc @@ -97,7 +97,7 @@ namespace detail class CTrackerThread : public CThread { public: - typedef std::set TPidSet; + using TPidSet = std::set; public: CTrackerThread(void) @@ -308,7 +308,7 @@ bool CDetachedProcessSpawner::spawn(const std::string &processPath, return false; } - typedef std::vector TCharPVec; + using TCharPVec = std::vector; // Size of argv is two bigger than the number of arguments because: // 1) We add the program name at the beginning // 2) The list of arguments must be terminated by a NULL pointer diff --git a/lib/core/CDetachedProcessSpawner_Windows.cc b/lib/core/CDetachedProcessSpawner_Windows.cc index 9c0fda0fd6..d3f9b4c158 100644 --- a/lib/core/CDetachedProcessSpawner_Windows.cc +++ b/lib/core/CDetachedProcessSpawner_Windows.cc @@ -29,7 +29,7 @@ namespace detail class CTrackerThread : public CThread { public: - typedef std::map TPidHandleMap; + using TPidHandleMap = std::map; public: CTrackerThread(void) diff --git a/lib/core/CHashing.cc b/lib/core/CHashing.cc index b83088e9fb..2135afae59 100644 --- a/lib/core/CHashing.cc +++ b/lib/core/CHashing.cc @@ -27,7 +27,7 @@ namespace core namespace { -typedef boost::random::uniform_int_distribution TUniform32; +using TUniform32 = boost::random::uniform_int_distribution; } @@ -313,7 +313,7 @@ void CHashing::CUniversalHash::generateHashes(std::size_t k, uint32_t m, TUInt32VecHashVec &result) { - typedef std::vector TUInt32VecVec; + using TUInt32VecVec = std::vector; TUInt32VecVec a; TUInt32Vec b; diff --git a/lib/core/CJsonLogLayout.cc b/lib/core/CJsonLogLayout.cc index 557ffdf2a0..31dbca4fdd 100644 --- a/lib/core/CJsonLogLayout.cc +++ b/lib/core/CJsonLogLayout.cc @@ -106,7 +106,7 @@ void CJsonLogLayout::format(LogString &output, const spi::LoggingEventPtr &event, Pool &/*p*/) const { - typedef rapidjson::Writer TStringBufferWriter; + using TStringBufferWriter = rapidjson::Writer; rapidjson::StringBuffer buffer; TStringBufferWriter writer(buffer); diff --git a/lib/core/CLogger.cc b/lib/core/CLogger.cc index 887163b1fe..c759ac79f9 100644 --- a/lib/core/CLogger.cc +++ b/lib/core/CLogger.cc @@ -442,8 +442,8 @@ void CLogger::massageProperties(log4cxx::helpers::Properties &props) const mappings.insert(TLogCharLogStrMap::value_type(static_cast('P'), logStr)); // Map the properties - typedef std::vector TLogStringVec; - typedef TLogStringVec::const_iterator TLogStringVecCItr; + using TLogStringVec = std::vector; + using TLogStringVecCItr = TLogStringVec::const_iterator; TLogStringVec propNames(props.propertyNames()); for (TLogStringVecCItr iter = propNames.begin(); diff --git a/lib/core/CMemoryUsage.cc b/lib/core/CMemoryUsage.cc index 5893bf1c0c..1175b85894 100644 --- a/lib/core/CMemoryUsage.cc +++ b/lib/core/CMemoryUsage.cc @@ -179,8 +179,8 @@ void CMemoryUsage::summary(CMemoryUsageJsonWriter &writer) const void CMemoryUsage::compress(void) { - typedef std::map TStrSizeMap; - typedef TStrSizeMap::const_iterator TStrSizeMapCItr; + using TStrSizeMap = std::map; + using TStrSizeMapCItr = TStrSizeMap::const_iterator; if (!m_Children.empty()) { diff --git a/lib/core/CNamedPipeFactory.cc b/lib/core/CNamedPipeFactory.cc index 2a096a2318..264bcc1ef4 100644 --- a/lib/core/CNamedPipeFactory.cc +++ b/lib/core/CNamedPipeFactory.cc @@ -133,7 +133,7 @@ CNamedPipeFactory::TIStreamP CNamedPipeFactory::openPipeStreamRead(const std::st { return TIStreamP(); } - typedef boost::iostreams::stream TFileDescriptorSourceStream; + using TFileDescriptorSourceStream = boost::iostreams::stream; return TIStreamP(new TFileDescriptorSourceStream( boost::iostreams::file_descriptor_source(fd, boost::iostreams::close_handle))); } @@ -145,7 +145,7 @@ CNamedPipeFactory::TOStreamP CNamedPipeFactory::openPipeStreamWrite(const std::s { return TOStreamP(); } - typedef boost::iostreams::stream TRetryingFileDescriptorSinkStream; + using TRetryingFileDescriptorSinkStream = boost::iostreams::stream; return TOStreamP(new TRetryingFileDescriptorSinkStream( CRetryingFileDescriptorSink(fd, boost::iostreams::close_handle))); } diff --git a/lib/core/CNamedPipeFactory_Windows.cc b/lib/core/CNamedPipeFactory_Windows.cc index 8d8a9ee6d6..56ecde11ff 100644 --- a/lib/core/CNamedPipeFactory_Windows.cc +++ b/lib/core/CNamedPipeFactory_Windows.cc @@ -50,7 +50,7 @@ CNamedPipeFactory::TIStreamP CNamedPipeFactory::openPipeStreamRead(const std::st { return TIStreamP(); } - typedef boost::iostreams::stream TFileDescriptorSourceStream; + using TFileDescriptorSourceStream = boost::iostreams::stream; return TIStreamP(new TFileDescriptorSourceStream( boost::iostreams::file_descriptor_source(handle, boost::iostreams::close_handle))); } @@ -62,7 +62,7 @@ CNamedPipeFactory::TOStreamP CNamedPipeFactory::openPipeStreamWrite(const std::s { return TOStreamP(); } - typedef boost::iostreams::stream TFileDescriptorSinkStream; + using TFileDescriptorSinkStream = boost::iostreams::stream; return TOStreamP(new TFileDescriptorSinkStream( boost::iostreams::file_descriptor_sink(handle, boost::iostreams::close_handle))); } diff --git a/lib/core/CProcess_Windows.cc b/lib/core/CProcess_Windows.cc index ca97aaf964..2452c8fa49 100644 --- a/lib/core/CProcess_Windows.cc +++ b/lib/core/CProcess_Windows.cc @@ -249,7 +249,7 @@ void WINAPI CProcess::serviceMain(DWORD argc, char *argv[]) if (process.m_MlMainFunc != 0) { - typedef boost::scoped_array TScopedCharPArray; + using TScopedCharPArray = boost::scoped_array; // Merge the arguments from the service itself with the arguments // passed to the original main() call diff --git a/lib/core/CStatistics.cc b/lib/core/CStatistics.cc index 461ba7b5c7..8e7aed4e81 100644 --- a/lib/core/CStatistics.cc +++ b/lib/core/CStatistics.cc @@ -26,7 +26,7 @@ namespace core namespace { -typedef core::CRapidJsonLineWriter TGenericLineWriter; +using TGenericLineWriter = core::CRapidJsonLineWriter; static const std::string NAME_TYPE("name"); static const std::string DESCRIPTION_TYPE("description"); diff --git a/lib/core/CStringUtils.cc b/lib/core/CStringUtils.cc index 2e09b5c26a..6be51dcc4d 100644 --- a/lib/core/CStringUtils.cc +++ b/lib/core/CStringUtils.cc @@ -1048,7 +1048,7 @@ std::string CStringUtils::longestCommonSubstr(const std::string &str1, size_t secondLen(str2.length()); // Set up the matrix - typedef boost::multi_array T2DSizeArray; + using T2DSizeArray = boost::multi_array; T2DSizeArray matrix(boost::extents[firstLen][secondLen]); size_t maxLen(0); @@ -1110,7 +1110,7 @@ std::string CStringUtils::longestCommonSubsequence(const std::string &str1, size_t secondLen(str2.length()); // Set up the matrix - dimensions are one bigger than the string lengths - typedef boost::multi_array T2DSizeArray; + using T2DSizeArray = boost::multi_array; T2DSizeArray matrix(boost::extents[firstLen + 1][secondLen + 1]); // Initialise the top row and left column of the matrix to zero @@ -1196,7 +1196,7 @@ std::string CStringUtils::wideToNarrow(const std::wstring &wideStr) // Note: this won't always work for non-ASCII data, and it can't // cope with UTF8 either, so we should replace it with a proper // string conversion library, e.g. ICU - typedef std::ctype TWCharTCType; + using TWCharTCType = std::ctype; std::use_facet(CStringUtils::locale()).narrow(wideStr.data(), wideStr.data() + wideStr.length(), '?', @@ -1213,7 +1213,7 @@ std::wstring CStringUtils::narrowToWide(const std::string &narrowStr) // Note: this won't always work for non-ASCII data, and it can't // cope with UTF8 either, so we should replace it with a proper // string conversion library, e.g. ICU - typedef std::ctype TWCharTCType; + using TWCharTCType = std::ctype; std::use_facet(CStringUtils::locale()).widen(narrowStr.data(), narrowStr.data() + narrowStr.length(), &wideStr[0]); diff --git a/lib/core/CUname_Windows.cc b/lib/core/CUname_Windows.cc index 8f418fca43..cce2313040 100644 --- a/lib/core/CUname_Windows.cc +++ b/lib/core/CUname_Windows.cc @@ -42,7 +42,7 @@ bool queryKernelVersion(uint16_t &major, uint16_t &minor, uint16_t &build) return false; } - typedef boost::scoped_array TScopedCharArray; + using TScopedCharArray = boost::scoped_array; TScopedCharArray buffer(new char[size]); if (GetFileVersionInfo(KERNEL32_DLL, handle, size, buffer.get()) == FALSE) { @@ -99,7 +99,7 @@ std::string CUname::nodeName(void) return std::string(); } - typedef std::vector TCharVec; + using TCharVec = std::vector; TCharVec buffer(size); res = GetComputerNameEx(ComputerNameDnsHostname, diff --git a/lib/core/CXmlParser.cc b/lib/core/CXmlParser.cc index 5bf03ede22..20ab3bad12 100644 --- a/lib/core/CXmlParser.cc +++ b/lib/core/CXmlParser.cc @@ -1024,7 +1024,7 @@ bool CXmlParser::stringLatin1ToUtf8(std::string &str) // The UTF-8 character corresponding to each Latin1 character will require // either 1 or 2 bytes of storage (but note that some UTF-8 characters can // require 3 bytes) - typedef boost::scoped_array TCharArray; + using TCharArray = boost::scoped_array; size_t bufferSize(1 + 2 * str.length()); TCharArray buffer(new char[bufferSize]); ::memset(&buffer[0], 0, bufferSize); diff --git a/lib/core/unittest/CAllocationStrategyTest.cc b/lib/core/unittest/CAllocationStrategyTest.cc index 984f497978..4d0be348c4 100644 --- a/lib/core/unittest/CAllocationStrategyTest.cc +++ b/lib/core/unittest/CAllocationStrategyTest.cc @@ -31,7 +31,7 @@ void assertSize(const T &t) void CAllocationStrategyTest::test(void) { - typedef std::vector TIntVec; + using TIntVec = std::vector; { TIntVec v; diff --git a/lib/core/unittest/CBase64FilterTest.cc b/lib/core/unittest/CBase64FilterTest.cc index 95fa58d1e7..c4673f1583 100644 --- a/lib/core/unittest/CBase64FilterTest.cc +++ b/lib/core/unittest/CBase64FilterTest.cc @@ -13,10 +13,10 @@ #include #include -typedef boost::mt19937 TRandom; -typedef boost::uniform_int<> TDistribution; -typedef boost::random::variate_generator TGenerator; -typedef boost::generator_iterator TGeneratorItr; +using TRandom = boost::mt19937; +using TDistribution = boost::uniform_int<>; +using TGenerator = boost::random::variate_generator; +using TGeneratorItr = boost::generator_iterator; using namespace ml; using namespace core; @@ -24,14 +24,14 @@ using namespace core; namespace { -typedef boost::iostreams::filtering_stream TFilteredOutput; -typedef boost::iostreams::filtering_stream TFilteredInput; +using TFilteredOutput = boost::iostreams::filtering_stream; +using TFilteredInput = boost::iostreams::filtering_stream; // Implements the boost::iostreams Source template interface class CMockSource { public: - typedef char char_type; + using char_type = char; struct category : public boost::iostreams::source_tag @@ -68,7 +68,7 @@ class CMockSource class CMockSink { public: - typedef char char_type; + using char_type = char; struct category : public boost::iostreams::sink_tag, diff --git a/lib/core/unittest/CBlockingMessageQueueTest.cc b/lib/core/unittest/CBlockingMessageQueueTest.cc index f737a2c74d..f74cc5275e 100644 --- a/lib/core/unittest/CBlockingMessageQueueTest.cc +++ b/lib/core/unittest/CBlockingMessageQueueTest.cc @@ -42,7 +42,7 @@ namespace } private: - typedef std::vector TStrVec; + using TStrVec = std::vector; TStrVec m_Strings; }; diff --git a/lib/core/unittest/CCompressedDictionaryTest.cc b/lib/core/unittest/CCompressedDictionaryTest.cc index f3d7cb7d50..3f48e9b3d1 100644 --- a/lib/core/unittest/CCompressedDictionaryTest.cc +++ b/lib/core/unittest/CCompressedDictionaryTest.cc @@ -20,9 +20,9 @@ using namespace test; void CCompressedDictionaryTest::testAll(void) { - typedef std::vector TStrVec; - typedef CCompressedDictionary<2> TDictionary; - typedef TDictionary::TWordUSet TWordUSet; + using TStrVec = std::vector; + using TDictionary = CCompressedDictionary<2>; + using TWordUSet = TDictionary::TWordUSet; // Don't set this too high as it slows down every build - it can be // temporarily set high in uncommitted code for a thorough soak test @@ -57,10 +57,10 @@ void CCompressedDictionaryTest::testAll(void) void CCompressedDictionaryTest::testPersist(void) { - typedef CCompressedDictionary<1> TDictionary1; - typedef CCompressedDictionary<2> TDictionary2; - typedef CCompressedDictionary<3> TDictionary3; - typedef CCompressedDictionary<4> TDictionary4; + using TDictionary1 = CCompressedDictionary<1>; + using TDictionary2 = CCompressedDictionary<2>; + using TDictionary3 = CCompressedDictionary<3>; + using TDictionary4 = CCompressedDictionary<4>; { TDictionary1 dictionary; diff --git a/lib/core/unittest/CContainerPrinterTest.cc b/lib/core/unittest/CContainerPrinterTest.cc index 908430e319..dc014dcb52 100644 --- a/lib/core/unittest/CContainerPrinterTest.cc +++ b/lib/core/unittest/CContainerPrinterTest.cc @@ -32,7 +32,7 @@ void CContainerPrinterTest::testAll(void) CPPUNIT_ASSERT_EQUAL(std::string("[1.1, 3.2]"), CContainerPrinter::print(vec)); - std::list > list; + std::list> list; list.push_back(std::make_pair(1, 2)); list.push_back(std::make_pair(2, 2)); list.push_back(std::make_pair(3, 2)); @@ -40,7 +40,7 @@ void CContainerPrinterTest::testAll(void) CPPUNIT_ASSERT_EQUAL(std::string("[(1, 2), (2, 2), (3, 2)]"), CContainerPrinter::print(list)); - std::list > plist; + std::list> plist; plist.push_back(boost::shared_ptr()); plist.push_back(boost::shared_ptr(new double(3.0))); plist.push_back(boost::shared_ptr(new double(1.1))); @@ -68,14 +68,14 @@ void CContainerPrinterTest::testAll(void) CPPUNIT_ASSERT_EQUAL(std::string("[2, 3, 2]"), CContainerPrinter::print(boost::begin(pints), boost::end(pints))); - std::vector > ovec(2, boost::optional()); + std::vector> ovec(2, boost::optional()); LOG_DEBUG("ovec = " << CContainerPrinter::print(ovec)); CPPUNIT_ASSERT_EQUAL(std::string("[\"null\", \"null\"]"), CContainerPrinter::print(ovec)); - std::vector >, double> > aggregate; + std::vector>, double>> aggregate; aggregate.push_back(std::make_pair(list, 1.3)); - aggregate.push_back(std::make_pair(std::list >(), 0.0)); + aggregate.push_back(std::make_pair(std::list>(), 0.0)); aggregate.push_back(std::make_pair(list, 5.1)); LOG_DEBUG("aggregate = " << CContainerPrinter::print(aggregate)); CPPUNIT_ASSERT_EQUAL(std::string("[([(1, 2), (2, 2), (3, 2)], 1.3), ([], 0), ([(1, 2), (2, 2), (3, 2)], 5.1)]"), diff --git a/lib/core/unittest/CContainerThroughputTest.cc b/lib/core/unittest/CContainerThroughputTest.cc index 6540a061d5..0707738e33 100644 --- a/lib/core/unittest/CContainerThroughputTest.cc +++ b/lib/core/unittest/CContainerThroughputTest.cc @@ -55,7 +55,7 @@ void CContainerThroughputTest::setUp(void) void CContainerThroughputTest::testVector(void) { - typedef std::vector TContentVec; + using TContentVec = std::vector; TContentVec testVec; testVec.reserve(FILL_SIZE); @@ -90,7 +90,7 @@ void CContainerThroughputTest::testVector(void) void CContainerThroughputTest::testList(void) { - typedef std::list TContentList; + using TContentList = std::list; TContentList testList; ml::core_t::TTime start(ml::core::CTimeUtils::now()); @@ -124,7 +124,7 @@ void CContainerThroughputTest::testList(void) void CContainerThroughputTest::testDeque(void) { - typedef std::deque TContentDeque; + using TContentDeque = std::deque; TContentDeque testDeque; ml::core_t::TTime start(ml::core::CTimeUtils::now()); @@ -158,7 +158,7 @@ void CContainerThroughputTest::testDeque(void) void CContainerThroughputTest::testMap(void) { - typedef std::map TSizeContentMap; + using TSizeContentMap = std::map; TSizeContentMap testMap; ml::core_t::TTime start(ml::core::CTimeUtils::now()); @@ -192,7 +192,7 @@ void CContainerThroughputTest::testMap(void) void CContainerThroughputTest::testCircBuf(void) { - typedef boost::circular_buffer TContentCircBuf; + using TContentCircBuf = boost::circular_buffer; TContentCircBuf testCircBuf(FILL_SIZE); ml::core_t::TTime start(ml::core::CTimeUtils::now()); @@ -226,14 +226,14 @@ void CContainerThroughputTest::testCircBuf(void) void CContainerThroughputTest::testMultiIndex(void) { - typedef boost::multi_index::multi_index_container< + using TContentMIndex = boost::multi_index::multi_index_container< SContent, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< BOOST_MULTI_INDEX_MEMBER(SContent, size_t, s_Size) > > - > TContentMIndex; + >; TContentMIndex testMultiIndex; ml::core_t::TTime start(ml::core::CTimeUtils::now()); diff --git a/lib/core/unittest/CFunctionalTest.cc b/lib/core/unittest/CFunctionalTest.cc index 1d368ef474..d759b4e175 100644 --- a/lib/core/unittest/CFunctionalTest.cc +++ b/lib/core/unittest/CFunctionalTest.cc @@ -53,7 +53,7 @@ void CFunctionalTest::testDereference(void) CPPUNIT_ASSERT(!derefIsNull(notNull)); std::less less; - core::CFunctional::SDereference > derefLess; + core::CFunctional::SDereference> derefLess; const double *values[] = { &one, &two, &three }; for (std::size_t i = 0u; i < boost::size(values); ++i) { diff --git a/lib/core/unittest/CHashingTest.cc b/lib/core/unittest/CHashingTest.cc index bb262a4519..e0f8121676 100644 --- a/lib/core/unittest/CHashingTest.cc +++ b/lib/core/unittest/CHashingTest.cc @@ -101,11 +101,11 @@ void CHashingTest::testUniversalHash(void) // We test a large u and m non exhaustively by choosing sufficient // different numbers of pairs to hash. - typedef std::vector TUInt32Vec; - typedef std::pair TUInt32Pr; - typedef std::set TUInt32PrSet; - typedef std::map TUint32PrUIntMap; - typedef TUint32PrUIntMap::const_iterator TUint32PrUIntMapCItr; + using TUInt32Vec = std::vector; + using TUInt32Pr = std::pair; + using TUInt32PrSet = std::set; + using TUint32PrUIntMap = std::map; + using TUint32PrUIntMapCItr = TUint32PrUIntMap::const_iterator; { LOG_DEBUG("**** m = " << 10000 << ", U = [" << 10000000 << "] ****"); @@ -250,9 +250,9 @@ void CHashingTest::testMurmurHash(void) CPPUNIT_ASSERT_EQUAL(uint64_t(7291323361835448266ull), result); } - typedef std::vector TStrVec; - typedef std::map TSizeSizeMap; - typedef TSizeSizeMap::const_iterator TSizeSizeMapCItr; + using TStrVec = std::vector; + using TSizeSizeMap = std::map; + using TSizeSizeMapCItr = TSizeSizeMap::const_iterator; const std::size_t stringSize = 32u; const std::size_t numberStrings = 500000u; @@ -366,8 +366,8 @@ void CHashingTest::testHashCombine(void) CHashing::CMurmurHash2String hasher; - typedef std::vector TStrVec; - typedef std::set TSizeSet; + using TStrVec = std::vector; + using TSizeSet = std::set; const std::size_t stringSize = 32u; const std::size_t numberStrings = 2000000u; diff --git a/lib/core/unittest/CMapPopulationTest.h b/lib/core/unittest/CMapPopulationTest.h index bb6f5109a3..ee994fb1b1 100644 --- a/lib/core/unittest/CMapPopulationTest.h +++ b/lib/core/unittest/CMapPopulationTest.h @@ -41,8 +41,8 @@ class CMapPopulationTest : public CppUnit::TestFixture class CTestData { public: - typedef std::vector TStrVec; - typedef std::vector TCharPVec; + using TStrVec = std::vector ; + using TCharPVec = std::vector; public: CTestData(size_t fillSize); @@ -61,10 +61,10 @@ class CMapPopulationTest : public CppUnit::TestFixture }; private: - typedef std::map TStrStrMap; - typedef std::vector TStrStrMapVec; - typedef boost::unordered_map TStrStrUMap; - typedef std::vector TStrStrUMapVec; + using TStrStrMap = std::map; + using TStrStrMapVec = std::vector; + using TStrStrUMap = boost::unordered_map; + using TStrStrUMapVec = std::vector; template void addInsert(const INPUT_CONTAINER &keys, diff --git a/lib/core/unittest/CMemoryUsageTest.cc b/lib/core/unittest/CMemoryUsageTest.cc index 08781f217b..cf0a5f9da6 100644 --- a/lib/core/unittest/CMemoryUsageTest.cc +++ b/lib/core/unittest/CMemoryUsageTest.cc @@ -40,8 +40,8 @@ enum EFeature E_IndividualHighCountsByBucketAndPerson }; -typedef std::vector TIntVec; -typedef std::vector TStrVec; +using TIntVec = std::vector; +using TStrVec = std::vector; struct SPod { @@ -93,7 +93,7 @@ struct SFooWrapper struct SBar { - typedef std::vector TFooVec; + using TFooVec = std::vector; explicit SBar(std::size_t key = 0) : s_Key(key), s_State() {} bool operator<(const SBar &rhs) const { return s_Key < rhs.s_Key; } @@ -109,7 +109,7 @@ struct SBar struct SBarDebug { - typedef std::vector TFooVec; + using TFooVec = std::vector; explicit SBarDebug(std::size_t key = 0) : s_Key(key), s_State() {} bool operator<(const SBarDebug &rhs) const { return s_Key < rhs.s_Key; } @@ -131,7 +131,7 @@ struct SBarDebug struct SBarVectorDebug { - typedef std::vector TFooVec; + using TFooVec = std::vector; explicit SBarVectorDebug(std::size_t key = 0) : s_Key(key), s_State() {} bool operator<(const SBarVectorDebug &rhs) const { return s_Key < rhs.s_Key; } @@ -222,20 +222,20 @@ template class CTrackingAllocator { public: - typedef T value_type; - typedef value_type *pointer; - typedef const value_type *const_pointer; - typedef value_type &reference; - typedef const value_type &const_reference; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; + using value_type = T; + using pointer = value_type*; + using const_pointer = const value_type*; + using reference = value_type&; + using const_reference = const value_type&; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; public: // convert an allocator to allocator template struct rebind { - typedef CTrackingAllocator other; + using other = CTrackingAllocator; }; public: @@ -314,27 +314,27 @@ std::size_t CTrackingAllocator::ms_Allocated = 0; void CMemoryUsageTest::testUsage(void) { - typedef std::vector TFooVec; - typedef std::vector TFooWithMemoryVec; - typedef std::list TFooList; - typedef std::list TFooWithMemoryList; - typedef std::deque TFooDeque; - typedef std::deque TFooWithMemoryDeque; - typedef boost::circular_buffer TFooCircBuf; - typedef boost::circular_buffer TFooWithMemoryCircBuf; - typedef std::map TFooFooMap; - typedef std::map TFooWithMemoryFooWithMemoryMap; - typedef boost::unordered_map TFooFooUMap; - typedef boost::container::flat_set TFooFSet; - typedef boost::unordered_map TFooWithMemoryFooWithMemoryUMap; - typedef std::vector TBarVec; - typedef std::map TBarBarMap; - typedef boost::unordered_map TBarBarUMap; - typedef boost::container::flat_map TBarBarFMap; - typedef boost::shared_ptr TBarPtr; - typedef boost::shared_ptr TBasePtr; - typedef std::vector TDerivedVec; - typedef std::vector TBasePtrVec; + using TFooVec = std::vector; + using TFooWithMemoryVec = std::vector; + using TFooList = std::list; + using TFooWithMemoryList = std::list; + using TFooDeque = std::deque; + using TFooWithMemoryDeque = std::deque; + using TFooCircBuf = boost::circular_buffer; + using TFooWithMemoryCircBuf = boost::circular_buffer; + using TFooFooMap = std::map; + using TFooWithMemoryFooWithMemoryMap = std::map; + using TFooFooUMap = boost::unordered_map; + using TFooFSet = boost::container::flat_set; + using TFooWithMemoryFooWithMemoryUMap = boost::unordered_map; + using TBarVec = std::vector; + using TBarBarMap = std::map; + using TBarBarUMap = boost::unordered_map; + using TBarBarFMap = boost::container::flat_map; + using TBarPtr = boost::shared_ptr; + using TBasePtr = boost::shared_ptr; + using TDerivedVec = std::vector; + using TBasePtrVec = std::vector; // We want various invariants to hold for dynamic size: // 1) The dynamic size is not affected by adding a memoryUsage @@ -559,8 +559,8 @@ void CMemoryUsageTest::testUsage(void) { LOG_DEBUG("*** boost::any ***"); - typedef std::vector TDoubleVec; - typedef std::vector TAnyVec; + using TDoubleVec = std::vector; + using TAnyVec = std::vector; TDoubleVec a(10); TFooVec b(20); @@ -717,8 +717,8 @@ void CMemoryUsageTest::testUsage(void) void CMemoryUsageTest::testDebug(void) { - typedef std::vector TBarVec; - typedef boost::shared_ptr TBarVecPtr; + using TBarVec = std::vector; + using TBarVecPtr = boost::shared_ptr; // Check that we can get debug info out of classes with vectors of varying size { @@ -773,8 +773,8 @@ void CMemoryUsageTest::testDebug(void) CPPUNIT_ASSERT_EQUAL(core::CMemory::dynamicSize(t), memoryUsage.usage()); } { - typedef std::pair TFeatureBarVecPtrPr; - typedef std::vector TFeatureBarVecPtrPrVec; + using TFeatureBarVecPtrPr = std::pair; + using TFeatureBarVecPtrPrVec = std::vector; TFeatureBarVecPtrPrVec t; TBarVecPtr vec(new TBarVec()); @@ -828,23 +828,23 @@ void CMemoryUsageTest::testDynamicSizeAlwaysZero(void) CPPUNIT_ASSERT_EQUAL(true, test); test = core::memory_detail::SDynamicSizeAlwaysZero::value(); CPPUNIT_ASSERT_EQUAL(haveStructPodCompilerSupport, test); - test = core::memory_detail::SDynamicSizeAlwaysZero >::value(); + test = core::memory_detail::SDynamicSizeAlwaysZero>::value(); CPPUNIT_ASSERT_EQUAL(true, test); - test = core::memory_detail::SDynamicSizeAlwaysZero >::value(); + test = core::memory_detail::SDynamicSizeAlwaysZero>::value(); CPPUNIT_ASSERT_EQUAL(haveStructPodCompilerSupport, test); - test = core::memory_detail::SDynamicSizeAlwaysZero >::value(); + test = core::memory_detail::SDynamicSizeAlwaysZero>::value(); CPPUNIT_ASSERT_EQUAL(true, test); test = boost::is_pod::value; CPPUNIT_ASSERT_EQUAL(false, test); test = core::memory_detail::SDynamicSizeAlwaysZero::value(); CPPUNIT_ASSERT_EQUAL(true, test); - test = core::memory_detail::SDynamicSizeAlwaysZero, SFoo> >::value(); + test = core::memory_detail::SDynamicSizeAlwaysZero, SFoo>>::value(); CPPUNIT_ASSERT_EQUAL(true, test); test = core::memory_detail::SDynamicSizeAlwaysZero::value(); CPPUNIT_ASSERT_EQUAL(true, test); test = core::memory_detail::SDynamicSizeAlwaysZero::value(); CPPUNIT_ASSERT_EQUAL(true, test); - test = core::memory_detail::SDynamicSizeAlwaysZero >::value(); + test = core::memory_detail::SDynamicSizeAlwaysZero>::value(); CPPUNIT_ASSERT_EQUAL(false, test); test = core::memory_detail::SDynamicSizeAlwaysZero::value(); CPPUNIT_ASSERT_EQUAL(false, test); @@ -1058,7 +1058,7 @@ void CMemoryUsageTest::testStringBehaviour(void) LOG_INFO("On this platform clearing can reduce string capacity"); } - typedef std::vector TSizeVec; + using TSizeVec = std::vector; std::string grower; TSizeVec capacities(1, grower.capacity()); for (size_t count = 0; count < 50000; ++count) @@ -1092,8 +1092,8 @@ void CMemoryUsageTest::testStringBehaviour(void) void CMemoryUsageTest::testStringMemory(void) { - typedef ::CTrackingAllocator TAllocator; - typedef std::basic_string, TAllocator> TString; + using TAllocator = ::CTrackingAllocator; + using TString = std::basic_string, TAllocator>; for (std::size_t i = 0; i < 1500; ++i) { @@ -1113,8 +1113,8 @@ void CMemoryUsageTest::testStringMemory(void) void CMemoryUsageTest::testStringClear(void) { - typedef ::CTrackingAllocator TAllocator; - typedef std::basic_string, TAllocator> TString; + using TAllocator = ::CTrackingAllocator; + using TString = std::basic_string, TAllocator>; TString empty; TString something1("something"); @@ -1140,11 +1140,11 @@ void CMemoryUsageTest::testStringClear(void) void CMemoryUsageTest::testSharedPointer(void) { LOG_DEBUG("*** testSharedPointer ***"); - typedef std::vector TIntVec; - typedef boost::shared_ptr TIntVecPtr; - typedef std::vector TIntVecPtrVec; - typedef boost::shared_ptr TStrPtr; - typedef std::vector TStrPtrVec; + using TIntVec = std::vector; + using TIntVecPtr = boost::shared_ptr; + using TIntVecPtrVec = std::vector; + using TStrPtr = boost::shared_ptr; + using TStrPtrVec = std::vector; TStrPtrVec strings; TIntVecPtrVec vec1; diff --git a/lib/core/unittest/CMessageBufferTest.cc b/lib/core/unittest/CMessageBufferTest.cc index 575b5620da..eb07b1537d 100644 --- a/lib/core/unittest/CMessageBufferTest.cc +++ b/lib/core/unittest/CMessageBufferTest.cc @@ -27,7 +27,7 @@ namespace class CBuffer { public: - typedef std::vector TStrVec; + using TStrVec = std::vector; public: CBuffer(uint32_t flushInterval) : m_FlushInterval(flushInterval) diff --git a/lib/core/unittest/CMessageQueueTest.cc b/lib/core/unittest/CMessageQueueTest.cc index 4a47aee185..f1b801b540 100644 --- a/lib/core/unittest/CMessageQueueTest.cc +++ b/lib/core/unittest/CMessageQueueTest.cc @@ -60,7 +60,7 @@ namespace } private: - typedef std::vector TStrVec; + using TStrVec = std::vector; TStrVec m_Strings; diff --git a/lib/core/unittest/CPersistUtilsTest.cc b/lib/core/unittest/CPersistUtilsTest.cc index 29d2d8afdf..e917ecdf4b 100644 --- a/lib/core/unittest/CPersistUtilsTest.cc +++ b/lib/core/unittest/CPersistUtilsTest.cc @@ -24,18 +24,18 @@ using namespace ml; -typedef std::vector TDoubleVec; -typedef std::pair TSizeDoublePr; -typedef std::map TSizeDoubleMap; -typedef std::set TIntSet; -typedef std::vector TDoubleVecVec; -typedef std::vector TStrVec; -typedef std::vector TStrVecVec; -typedef boost::unordered_map TStrIntUMap; -typedef boost::unordered_map TStrDoubleVecVecUMap; -typedef boost::unordered_set TSizeUSet; -typedef std::vector TSizeUSetVec; -typedef boost::circular_buffer TSizeDoublePrBuf; +using TDoubleVec = std::vector; +using TSizeDoublePr = std::pair; +using TSizeDoubleMap = std::map; +using TIntSet = std::set; +using TDoubleVecVec = std::vector; +using TStrVec = std::vector; +using TStrVecVec = std::vector; +using TStrIntUMap = boost::unordered_map; +using TStrDoubleVecVecUMap = boost::unordered_map; +using TSizeUSet = boost::unordered_set; +using TSizeUSetVec = std::vector; +using TSizeDoublePrBuf = boost::circular_buffer; namespace { @@ -46,18 +46,18 @@ class ContainerCompare {}; template struct enable_if_type { - typedef R type; + using type = R; }; template struct compare_container_selector { - typedef BasicCompare value; + using value = BasicCompare; }; template struct compare_container_selector::type> { - typedef ContainerCompare value; + using value = ContainerCompare; }; template class CCompareImpl {}; @@ -126,7 +126,7 @@ class CCompareImpl template static bool dispatch(const T &lhs, const T &rhs) { - typedef typename T::const_iterator TCItr; + using TCItr = typename T::const_iterator; if (lhs.size() != rhs.size()) { return false; @@ -145,7 +145,7 @@ class CCompareImpl static bool dispatch(const boost::unordered_map &lhs, const boost::unordered_map &rhs) { - typedef std::vector > TVec; + using TVec = std::vector>; TVec lKeys(lhs.begin(), lhs.end()); TVec rKeys(rhs.begin(), rhs.end()); std::sort(lKeys.begin(), lKeys.end(), SFirstLess()); @@ -157,7 +157,7 @@ class CCompareImpl static bool dispatch(const boost::unordered_set &lhs, const boost::unordered_set &rhs) { - typedef std::vector TVec; + using TVec = std::vector; TVec lKeys(lhs.begin(), lhs.end()); TVec rKeys(rhs.begin(), rhs.end()); std::sort(lKeys.begin(), lKeys.end()); diff --git a/lib/core/unittest/CPolymorphicStackObjectCPtrTest.cc b/lib/core/unittest/CPolymorphicStackObjectCPtrTest.cc index aaeb90ca00..0485306fc0 100644 --- a/lib/core/unittest/CPolymorphicStackObjectCPtrTest.cc +++ b/lib/core/unittest/CPolymorphicStackObjectCPtrTest.cc @@ -50,8 +50,8 @@ class CDerived4 : public CBase void CPolymorphicStackObjectCPtrTest::testAll(void) { - typedef core::CPolymorphicStackObjectCPtr TStackPtr12; - typedef core::CPolymorphicStackObjectCPtr TStackPtr1234; + using TStackPtr12 = core::CPolymorphicStackObjectCPtr; + using TStackPtr1234 = core::CPolymorphicStackObjectCPtr; TStackPtr12 test1((CDerived1())); CPPUNIT_ASSERT_EQUAL(std::string("d1"), test1->iam()); diff --git a/lib/core/unittest/CRapidJsonWriterBaseTest.cc b/lib/core/unittest/CRapidJsonWriterBaseTest.cc index 2d3324cc59..0bec0a002a 100644 --- a/lib/core/unittest/CRapidJsonWriterBaseTest.cc +++ b/lib/core/unittest/CRapidJsonWriterBaseTest.cc @@ -53,8 +53,9 @@ void CRapidJsonWriterBaseTest::testAddFields(void) { std::ostringstream strm; rapidjson::OStreamWrapper writeStream(strm); - typedef ml::core::CRapidJsonWriterBase, rapidjson::UTF8<>, - rapidjson::CrtAllocator> TGenericLineWriter; + using TGenericLineWriter = + ml::core::CRapidJsonWriterBase, rapidjson::UTF8<>, + rapidjson::CrtAllocator>; TGenericLineWriter writer(writeStream); rapidjson::Document doc = writer.makeDoc();; @@ -106,8 +107,9 @@ void CRapidJsonWriterBaseTest::testRemoveMemberIfPresent(void) { std::ostringstream strm; rapidjson::OStreamWrapper writeStream(strm); - typedef ml::core::CRapidJsonWriterBase, rapidjson::UTF8<>, - rapidjson::CrtAllocator> TGenericLineWriter; + using TGenericLineWriter = + ml::core::CRapidJsonWriterBase, rapidjson::UTF8<>, + rapidjson::CrtAllocator>; TGenericLineWriter writer(writeStream); rapidjson::Document doc = writer.makeDoc();; diff --git a/lib/core/unittest/CStateCompressorTest.cc b/lib/core/unittest/CStateCompressorTest.cc index 84f4ea65e2..fa494f7626 100644 --- a/lib/core/unittest/CStateCompressorTest.cc +++ b/lib/core/unittest/CStateCompressorTest.cc @@ -21,18 +21,18 @@ using namespace ml; using namespace core; -typedef boost::mt19937 TRandom; -typedef boost::uniform_int<> TDistribution; -typedef boost::random::variate_generator TGenerator; -typedef boost::generator_iterator TGeneratorItr; +using TRandom = boost::mt19937; +using TDistribution = boost::uniform_int<>; +using TGenerator = boost::random::variate_generator; +using TGeneratorItr = boost::generator_iterator; namespace { -typedef std::map TSizeStrMap; -typedef TSizeStrMap::const_iterator TSizeStrMapCItr; -typedef core::CDataAdder::TOStreamP TOStreamP; -typedef core::CDataSearcher::TIStreamP TIStreamP; +using TSizeStrMap = std::map; +using TSizeStrMapCItr = TSizeStrMap::const_iterator; +using TOStreamP = core::CDataAdder::TOStreamP; +using TIStreamP = core::CDataSearcher::TIStreamP; void insert3rdLevel(ml::core::CStatePersistInserter &inserter) { diff --git a/lib/core/unittest/CStateMachineTest.cc b/lib/core/unittest/CStateMachineTest.cc index 8a08ca7fce..85eb03a870 100644 --- a/lib/core/unittest/CStateMachineTest.cc +++ b/lib/core/unittest/CStateMachineTest.cc @@ -25,9 +25,9 @@ using namespace ml; namespace { -typedef std::vector TSizeVec; -typedef std::vector TSizeVecVec; -typedef std::vector TStrVec; +using TSizeVec = std::vector; +using TSizeVecVec = std::vector; +using TStrVec = std::vector; class CStateMachineClearer : core::CStateMachine { @@ -61,12 +61,12 @@ struct SMachine } }; -typedef std::vector TMachineVec; +using TMachineVec = std::vector; class CTestThread : public core::CThread { public: - typedef boost::shared_ptr TCppUnitExceptionP; + using TCppUnitExceptionP = boost::shared_ptr; public: CTestThread(const TMachineVec &machines) : @@ -241,8 +241,8 @@ void CStateMachineTest::testMultithreaded(void) std::sort(machines.begin(), machines.end()); machines.erase(std::unique(machines.begin(), machines.end()), machines.end()); - typedef boost::shared_ptr TThreadPtr; - typedef std::vector TThreadVec; + using TThreadPtr = boost::shared_ptr; + using TThreadVec = std::vector; TThreadVec threads; for (std::size_t i = 0u; i < 20; ++i) { diff --git a/lib/core/unittest/CStringSimilarityTesterTest.cc b/lib/core/unittest/CStringSimilarityTesterTest.cc index 5ebf6a8158..560c1718b1 100644 --- a/lib/core/unittest/CStringSimilarityTesterTest.cc +++ b/lib/core/unittest/CStringSimilarityTesterTest.cc @@ -184,7 +184,7 @@ void CStringSimilarityTesterTest::testLevensteinDistance2(void) { ml::core::CStringSimilarityTester sst; - typedef std::vector TStrVec; + using TStrVec = std::vector; TStrVec sourceShutDown1; sourceShutDown1.push_back("ml13"); @@ -261,7 +261,7 @@ void CStringSimilarityTesterTest::testLevensteinDistanceThroughputDifferent(void { ml::core::CStringSimilarityTester sst; - typedef std::vector TStrVec; + using TStrVec = std::vector; static const size_t TEST_SIZE(700); static const int MAX_LEN(40); @@ -307,7 +307,7 @@ void CStringSimilarityTesterTest::testLevensteinDistanceThroughputSimilar(void) { ml::core::CStringSimilarityTester sst; - typedef std::vector TStrVec; + using TStrVec = std::vector; static const size_t TEST_SIZE(700); static const int EXTRA_CHARS(4); @@ -388,8 +388,8 @@ void CStringSimilarityTesterTest::testWeightedEditDistance(void) { ml::core::CStringSimilarityTester sst; - typedef std::pair TStrSizePr; - typedef std::vector TStrSizePrVec; + using TStrSizePr = std::pair; + using TStrSizePrVec = std::vector; // These tests give a weight of 3 to dictionary words and 1 to other tokens diff --git a/lib/core/unittest/CStringUtilsTest.cc b/lib/core/unittest/CStringUtilsTest.cc index 55ca66a1b3..9264d1f3d2 100644 --- a/lib/core/unittest/CStringUtilsTest.cc +++ b/lib/core/unittest/CStringUtilsTest.cc @@ -589,8 +589,8 @@ void CStringUtilsTest::testJoin(void) LOG_DEBUG("*** testJoin ***") using namespace ml; using namespace core; - typedef std::vector TStrVec; - typedef std::set TStrSet; + using TStrVec = std::vector; + using TStrSet = std::set; TStrVec strVec; diff --git a/lib/core/unittest/CThreadFarmTest.cc b/lib/core/unittest/CThreadFarmTest.cc index f06be97af5..13e6a5918a 100644 --- a/lib/core/unittest/CThreadFarmTest.cc +++ b/lib/core/unittest/CThreadFarmTest.cc @@ -108,7 +108,7 @@ namespace } private: - typedef std::set TStrSet; + using TStrSet = std::set; TStrSet m_OutstandingOutput; ml::core::CMutex m_Mutex; diff --git a/lib/core/unittest/CTripleTest.cc b/lib/core/unittest/CTripleTest.cc index fbea3645b5..1c615cde4a 100644 --- a/lib/core/unittest/CTripleTest.cc +++ b/lib/core/unittest/CTripleTest.cc @@ -66,8 +66,8 @@ void CTripleTest::testOperators(void) void CTripleTest::testBoostHashReady(void) { - typedef ml::core::CTriple TStringSizeShortTriple; - typedef boost::unordered_map TStringSizeShortTripleSizeMap; + using TStringSizeShortTriple = ml::core::CTriple; + using TStringSizeShortTripleSizeMap = boost::unordered_map; TStringSizeShortTripleSizeMap map; map.emplace(ml::core::make_triple(std::string("foo"), std::size_t(10), short(3)), 1); diff --git a/lib/maths/CAgglomerativeClusterer.cc b/lib/maths/CAgglomerativeClusterer.cc index 2a600dc4fe..caf8f36e88 100644 --- a/lib/maths/CAgglomerativeClusterer.cc +++ b/lib/maths/CAgglomerativeClusterer.cc @@ -31,15 +31,15 @@ namespace maths namespace { -typedef std::pair TSizeSizePr; -typedef std::pair TDoubleSizeSizePrPr; -typedef std::vector TDoubleSizeSizePrPrVec; -typedef CAgglomerativeClusterer::TSizeVec TSizeVec; -typedef CAgglomerativeClusterer::TDoubleVec TDoubleVec; -typedef CAgglomerativeClusterer::TDoubleVecVec TDoubleVecVec; -typedef CAgglomerativeClusterer::CNode TNode; -typedef CAgglomerativeClusterer::TNodeVec TNodeVec; -typedef std::vector TNodePtrVec; +using TSizeSizePr = std::pair; +using TDoubleSizeSizePrPr = std::pair; +using TDoubleSizeSizePrPrVec = std::vector; +using TSizeVec = CAgglomerativeClusterer::TSizeVec; +using TDoubleVec = CAgglomerativeClusterer::TDoubleVec; +using TDoubleVecVec = CAgglomerativeClusterer::TDoubleVecVec; +using TNode = CAgglomerativeClusterer::CNode; +using TNodeVec = CAgglomerativeClusterer::TNodeVec; +using TNodePtrVec = std::vector; const double INF = boost::numeric::bounds::highest(); diff --git a/lib/maths/CAssignment.cc b/lib/maths/CAssignment.cc index 200f892887..93f78fcbf2 100644 --- a/lib/maths/CAssignment.cc +++ b/lib/maths/CAssignment.cc @@ -21,13 +21,13 @@ namespace maths namespace { -typedef std::vector TBoolVec; -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; -typedef std::pair TDoubleDoublePr; -typedef std::vector TSizeVec; -typedef std::pair TSizeSizePr; -typedef std::vector TSizeSizePrVec; +using TBoolVec = std::vector; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; +using TDoubleDoublePr = std::pair; +using TSizeVec = std::vector; +using TSizeSizePr = std::pair; +using TSizeSizePrVec = std::vector; const std::size_t UNMATCHED = boost::numeric::bounds::highest(); const double MAXIMUM_COST = boost::numeric::bounds::highest(); diff --git a/lib/maths/CBjkstUniqueValues.cc b/lib/maths/CBjkstUniqueValues.cc index 5ee89cbfce..4d9e6df741 100644 --- a/lib/maths/CBjkstUniqueValues.cc +++ b/lib/maths/CBjkstUniqueValues.cc @@ -29,9 +29,9 @@ namespace namespace detail { -typedef std::vector TUInt8Vec; -typedef TUInt8Vec::iterator TUInt8VecItr; -typedef TUInt8Vec::const_iterator TUInt8VecCItr; +using TUInt8Vec = std::vector; +using TUInt8VecItr = TUInt8Vec::iterator; +using TUInt8VecCItr = TUInt8Vec::const_iterator; //! Convert the decomposition of the hash into two 8 bit integers //! bask into the original hash value. @@ -44,7 +44,7 @@ inline uint16_t from8Bit(uint8_t leading, uint8_t trailing) ); } -typedef std::pair TUInt8UInt8Pr; +using TUInt8UInt8Pr = std::pair; //! \brief Random access iterator wrapper for B set iterator. //! @@ -60,7 +60,7 @@ typedef std::pair TUInt8UInt8Pr; class CHashIterator : public std::iterator, private boost::less_than_comparable > > + boost::subtractable> > { public: //! The STL that comes with g++ requires a default constructor - this @@ -222,7 +222,7 @@ void prune(TUInt8Vec &b, uint8_t z) } // detail:: -typedef boost::optional TOptionalSize; +using TOptionalSize = boost::optional; const char DELIMITER(':'); const char PAIR_DELIMITER(';'); @@ -775,7 +775,7 @@ void CBjkstUniqueValues::SSketch::remove(uint32_t value) uint32_t CBjkstUniqueValues::SSketch::number(void) const { - typedef std::vector TUInt32Vec; + using TUInt32Vec = std::vector; // This uses the median trick to reduce the error. diff --git a/lib/maths/CCalendarComponentAdaptiveBucketing.cc b/lib/maths/CCalendarComponentAdaptiveBucketing.cc index 6b14676f48..30548949f9 100644 --- a/lib/maths/CCalendarComponentAdaptiveBucketing.cc +++ b/lib/maths/CCalendarComponentAdaptiveBucketing.cc @@ -153,7 +153,7 @@ void CCalendarComponentAdaptiveBucketing::propagateForwardsByTime(double time) { double factor{::exp(-this->CAdaptiveBucketing::decayRate() * time)}; this->CAdaptiveBucketing::age(factor); - for (auto &&value : m_Values) + for (auto &value : m_Values) { value.age(factor); } diff --git a/lib/maths/CConstantPrior.cc b/lib/maths/CConstantPrior.cc index 71cb228c61..d5acefb3ac 100644 --- a/lib/maths/CConstantPrior.cc +++ b/lib/maths/CConstantPrior.cc @@ -31,7 +31,7 @@ namespace maths namespace { -typedef boost::optional TOptionalDouble; +using TOptionalDouble = boost::optional; //! Set the constant, validating the input. void setConstant(double value, TOptionalDouble &result) diff --git a/lib/maths/CCooccurrences.cc b/lib/maths/CCooccurrences.cc index cc40fc9ae0..bfae8c9a50 100644 --- a/lib/maths/CCooccurrences.cc +++ b/lib/maths/CCooccurrences.cc @@ -28,15 +28,15 @@ namespace maths namespace { -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; -typedef std::vector TSizeVec; -typedef std::vector TSizeVecVec; -typedef std::pair TSizeSizePr; -typedef boost::unordered_set TSizeSizePrUSet; -typedef CVector TPoint; -typedef std::vector TPointVec; -typedef std::vector TPackedBitVectorVec; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; +using TSizeVec = std::vector; +using TSizeVecVec = std::vector; +using TSizeSizePr = std::pair; +using TSizeSizePrUSet = boost::unordered_set; +using TPoint = CVector; +using TPointVec = std::vector; +using TPackedBitVectorVec = std::vector; //! \brief Counts the (co-)occurrences of two variables. struct SCooccurrence @@ -58,7 +58,7 @@ struct SCooccurrence std::size_t s_X, s_Y; }; -typedef CBasicStatistics::COrderStatisticsHeap TMostSignificant; +using TMostSignificant = CBasicStatistics::COrderStatisticsHeap; //! Compute \p x * \p x. double pow2(double x) diff --git a/lib/maths/CCountMinSketch.cc b/lib/maths/CCountMinSketch.cc index 6f5a506270..95109d1fcd 100644 --- a/lib/maths/CCountMinSketch.cc +++ b/lib/maths/CCountMinSketch.cc @@ -335,7 +335,7 @@ double CCountMinSketch::totalCount(void) const double CCountMinSketch::count(uint32_t category) const { - typedef CBasicStatistics::COrderStatisticsStack TMinAccumulator; + using TMinAccumulator = CBasicStatistics::COrderStatisticsStack; const TUInt32FloatPrVec *counts = boost::get(&m_Sketch); if (counts) diff --git a/lib/maths/CDecompositionComponent.cc b/lib/maths/CDecompositionComponent.cc index 9cfd7e15bd..284930f06f 100644 --- a/lib/maths/CDecompositionComponent.cc +++ b/lib/maths/CDecompositionComponent.cc @@ -32,7 +32,7 @@ namespace maths namespace { -typedef maths_t::TDoubleDoublePr TDoubleDoublePr; +using TDoubleDoublePr = maths_t::TDoubleDoublePr; const std::string MAX_SIZE_TAG{"a"}; const std::string RNG_TAG{"b"}; @@ -227,7 +227,7 @@ double CDecompositionComponent::heteroscedasticity(void) const return 0.0; } - typedef CBasicStatistics::SMax::TAccumulator TMaxAccumulator; + using TMaxAccumulator = CBasicStatistics::SMax::TAccumulator; TMaxAccumulator result; @@ -345,7 +345,7 @@ void CDecompositionComponent::CPackedSplines::clear(void) void CDecompositionComponent::CPackedSplines::shift(ESpline spline, double shift) { - for (auto &&value : m_Values[static_cast(spline)]) + for (auto &value : m_Values[static_cast(spline)]) { value += shift; } diff --git a/lib/maths/CGammaRateConjugate.cc b/lib/maths/CGammaRateConjugate.cc index 192aa05fb6..634da15d9c 100644 --- a/lib/maths/CGammaRateConjugate.cc +++ b/lib/maths/CGammaRateConjugate.cc @@ -50,13 +50,13 @@ namespace namespace detail { -typedef std::pair TDoubleDoublePr; -typedef maths_t::TWeightStyleVec TWeightStyleVec; -typedef core::CSmallVector TDouble1Vec; -typedef core::CSmallVector TDouble4Vec; -typedef core::CSmallVector TDouble4Vec1Vec; -typedef CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; +using TDoubleDoublePr = std::pair; +using TWeightStyleVec = maths_t::TWeightStyleVec; +using TDouble1Vec = core::CSmallVector; +using TDouble4Vec = core::CSmallVector; +using TDouble4Vec1Vec = core::CSmallVector; +using TMeanAccumulator = CBasicStatistics::SSampleMean::TAccumulator; +using TMeanVarAccumulator = CBasicStatistics::SSampleMeanVar::TAccumulator; const double NON_INFORMATIVE_COUNT = 3.5; @@ -1597,7 +1597,7 @@ bool CGammaRateConjugate::minusLogJointCdf(const TWeightStyleVec &weightStyles, double &lowerBound, double &upperBound) const { - typedef detail::CEvaluateOnSamples TMinusLogCdf; + using TMinusLogCdf = detail::CEvaluateOnSamples; lowerBound = upperBound = 0.0; @@ -1647,7 +1647,7 @@ bool CGammaRateConjugate::minusLogJointCdfComplement(const TWeightStyleVec &weig double &lowerBound, double &upperBound) const { - typedef detail::CEvaluateOnSamples TMinusLogCdfComplement; + using TMinusLogCdfComplement = detail::CEvaluateOnSamples; lowerBound = upperBound = 0.0; diff --git a/lib/maths/CKMeansOnline1d.cc b/lib/maths/CKMeansOnline1d.cc index 7e1de99e31..4ba1ff9261 100644 --- a/lib/maths/CKMeansOnline1d.cc +++ b/lib/maths/CKMeansOnline1d.cc @@ -32,11 +32,11 @@ namespace maths namespace { -typedef core::CSmallVector TDouble1Vec; -typedef core::CSmallVector TDouble4Vec; -typedef core::CSmallVector TDouble4Vec1Vec; -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleDoublePrVec; +using TDouble1Vec = core::CSmallVector; +using TDouble4Vec = core::CSmallVector; +using TDouble4Vec1Vec = core::CSmallVector; +using TDoubleDoublePr = std::pair; +using TDoubleDoublePrVec = std::vector; namespace detail { diff --git a/lib/maths/CKMostCorrelated.cc b/lib/maths/CKMostCorrelated.cc index 855e30da8e..0df547e1b9 100644 --- a/lib/maths/CKMostCorrelated.cc +++ b/lib/maths/CKMostCorrelated.cc @@ -40,11 +40,11 @@ namespace maths namespace { -typedef std::pair TSizeSizePr; -typedef boost::unordered_set TSizeSizePrUSet; -typedef boost::array TPoint; -typedef std::pair TPointSizePr; -typedef std::vector TPointSizePrVec; +using TSizeSizePr = std::pair; +using TSizeSizePrUSet = boost::unordered_set; +using TPoint = boost::array; +using TPointSizePr = std::pair; +using TPointSizePrVec = std::vector; //! \brief Unary predicate to check variables, corresponding //! to labeled points, are not equal to a specified variable. @@ -442,9 +442,9 @@ std::size_t CKMostCorrelated::memoryUsage(void) const void CKMostCorrelated::mostCorrelated(TCorrelationVec &result) const { - typedef CBasicStatistics::COrderStatisticsStack > TMaxDoubleAccumulator; - typedef CBasicStatistics::COrderStatisticsHeap TMaxCorrelationAccumulator; - typedef bgi::rtree > TPointRTree; + using TMaxDoubleAccumulator = CBasicStatistics::COrderStatisticsStack>; + using TMaxCorrelationAccumulator = CBasicStatistics::COrderStatisticsHeap; + using TPointRTree = bgi::rtree>; result.clear(); diff --git a/lib/maths/CLassoLogisticRegression.cc b/lib/maths/CLassoLogisticRegression.cc index 22fe95049a..ed8144d219 100644 --- a/lib/maths/CLassoLogisticRegression.cc +++ b/lib/maths/CLassoLogisticRegression.cc @@ -25,7 +25,7 @@ namespace maths namespace { -typedef std::vector TDoubleVec; +using TDoubleVec = std::vector; //! An upper bound on the second derivative of minus the log of the //! logistic link function in a ball, i.e. @@ -95,7 +95,7 @@ double logLikelihood(const MATRIX &x, const TDoubleVec &lambda, const TDoubleVec &beta) { - typedef typename MATRIX::iterator iterator; + using iterator = typename MATRIX::iterator; double result = 0.0; TDoubleVec f(y.size(), 0.0); @@ -133,7 +133,7 @@ void CLG(std::size_t maxIterations, TDoubleVec &r, std::size_t &numberIterations) { - typedef typename MATRIX::iterator iterator; + using iterator = typename MATRIX::iterator; std::size_t d = x.columns(); LOG_DEBUG("d = " << d << ", n = " << y.size()); @@ -492,11 +492,11 @@ namespace { using namespace lasso_logistic_regression_detail; -typedef std::vector TDoubleVecVec; -typedef std::pair TSizeDoublePr; -typedef std::vector TSizeDoublePrVec; -typedef std::vector TSizeDoublePrVecVec; -typedef boost::unordered_set TSizeUSet; +using TDoubleVecVec = std::vector; +using TSizeDoublePr = std::pair; +using TSizeDoublePrVec = std::vector; +using TSizeDoublePrVecVec = std::vector; +using TSizeUSet = boost::unordered_set; //! Set up the masked training data. //! @@ -655,7 +655,7 @@ double element(const TSizeDoublePr &xij) template double l22Norm(const STORAGE &x) { - typedef CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = CBasicStatistics::SSampleMean::TAccumulator; TMeanAccumulator result; for (std::size_t i = 0u; i < x.size(); ++i) { @@ -688,7 +688,7 @@ template class C2FoldCrossValidatedLogLikelihood { public: - typedef double result_type; + using result_type = double; public: C2FoldCrossValidatedLogLikelihood(std::size_t d) : @@ -742,7 +742,7 @@ class C2FoldCrossValidatedLogLikelihood } private: - typedef std::vector TMatrixVec; + using TMatrixVec = std::vector; private: //! The feature vector dimension. @@ -784,7 +784,7 @@ void CLassoLogisticRegression::doLearnHyperparameter(EHyperparametersSt return; } - typedef std::vector TSizeVec; + using TSizeVec = std::vector; std::size_t n = m_X.size(); LOG_DEBUG("d = " << m_D << ", n = " << n); diff --git a/lib/maths/CLinearAlgebraTools.cc b/lib/maths/CLinearAlgebraTools.cc index 82d4aa8c3c..71b02bd56e 100644 --- a/lib/maths/CLinearAlgebraTools.cc +++ b/lib/maths/CLinearAlgebraTools.cc @@ -373,14 +373,14 @@ SAMPLE_GAUSSIAN(double, 5) void sampleGaussian(std::size_t d, const CVector &mean, const CSymmetricMatrix &covariance, - std::vector > &result) + std::vector> &result) { return CSampleGaussian>::Type>::generate(d, mean, covariance, result); } void sampleGaussian(std::size_t d, const CVector &mean, const CSymmetricMatrix &covariance, - std::vector > &result) + std::vector> &result) { return CSampleGaussian>::Type>::generate(d, mean, covariance, result); } diff --git a/lib/maths/CLogNormalMeanPrecConjugate.cc b/lib/maths/CLogNormalMeanPrecConjugate.cc index 00f34db475..89bfeea8a6 100644 --- a/lib/maths/CLogNormalMeanPrecConjugate.cc +++ b/lib/maths/CLogNormalMeanPrecConjugate.cc @@ -48,13 +48,13 @@ namespace maths namespace { -typedef core::CSmallVector TDouble1Vec; -typedef core::CSmallVector TDouble4Vec; -typedef core::CSmallVector TDouble4Vec1Vec; -typedef std::vector TSizeVec; -typedef CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; -typedef maths_t::TWeightStyleVec TWeightStyleVec; +using TDouble1Vec = core::CSmallVector; +using TDouble4Vec = core::CSmallVector; +using TDouble4Vec1Vec = core::CSmallVector; +using TSizeVec = std::vector; +using TMeanAccumulator = CBasicStatistics::SSampleMean::TAccumulator; +using TMeanVarAccumulator = CBasicStatistics::SSampleMeanVar::TAccumulator; +using TWeightStyleVec = maths_t::TWeightStyleVec; //! Compute x * x. inline double pow2(double x) @@ -67,8 +67,8 @@ const double MINIMUM_LOGNORMAL_SHAPE = 100.0; namespace detail { -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleDoublePrVec; +using TDoubleDoublePr = std::pair; +using TDoubleDoublePrVec = std::vector; //! \brief Adds "weight" x "right operand" to the "left operand". struct SPlusWeight @@ -307,7 +307,7 @@ class CEvaluateOnSamples : core::CNonCopyable class CMeanKernel { public: - typedef CVectorNx1 TValue; + using TValue = CVectorNx1; public: CMeanKernel(double m, double p, double a, double b) : @@ -346,7 +346,7 @@ class CMeanKernel class CVarianceKernel { public: - typedef CVectorNx1 TValue; + using TValue = CVectorNx1; public: CVarianceKernel(double mean, double m, double p, double a, double b) : @@ -1542,7 +1542,7 @@ bool CLogNormalMeanPrecConjugate::minusLogJointCdf(const TWeightStyleVec &weight double &lowerBound, double &upperBound) const { - typedef detail::CEvaluateOnSamples TMinusLogCdf; + using TMinusLogCdf = detail::CEvaluateOnSamples; lowerBound = upperBound = 0.0; @@ -1593,7 +1593,7 @@ bool CLogNormalMeanPrecConjugate::minusLogJointCdfComplement(const TWeightStyleV double &lowerBound, double &upperBound) const { - typedef detail::CEvaluateOnSamples TMinusLogCdfComplement; + using TMinusLogCdfComplement = detail::CEvaluateOnSamples; lowerBound = upperBound = 0.0; diff --git a/lib/maths/CMixtureDistribution.cc b/lib/maths/CMixtureDistribution.cc index a866ddc82d..54bc73529f 100644 --- a/lib/maths/CMixtureDistribution.cc +++ b/lib/maths/CMixtureDistribution.cc @@ -15,7 +15,7 @@ namespace maths namespace { -typedef std::pair TDoubleDoublePr; +using TDoubleDoublePr = std::pair; //! brief Invokes the support function on a distribution. struct SSupport @@ -92,7 +92,7 @@ template class CUnaryVisitor { public: - typedef RESULT result_type; + using result_type = RESULT; public: template @@ -110,7 +110,7 @@ template class CBinaryVisitor { public: - typedef RESULT result_type; + using result_type = RESULT; public: template diff --git a/lib/maths/CMultimodalPrior.cc b/lib/maths/CMultimodalPrior.cc index 937f802b97..e7e0da2c8d 100644 --- a/lib/maths/CMultimodalPrior.cc +++ b/lib/maths/CMultimodalPrior.cc @@ -49,10 +49,10 @@ namespace maths namespace { -typedef std::pair TSizeDoublePr; -typedef core::CSmallVector TSizeDoublePr2Vec; -typedef std::pair TDoubleDoublePr; -typedef std::set TSizeSet; +using TSizeDoublePr = std::pair; +using TSizeDoublePr2Vec = core::CSmallVector; +using TDoubleDoublePr = std::pair; +using TSizeSet = std::set; const std::size_t MODE_SPLIT_NUMBER_SAMPLES(50u); const std::size_t MODE_MERGE_NUMBER_SAMPLES(25u); diff --git a/lib/maths/CMultinomialConjugate.cc b/lib/maths/CMultinomialConjugate.cc index 0f68ba4ea0..55e2096375 100644 --- a/lib/maths/CMultinomialConjugate.cc +++ b/lib/maths/CMultinomialConjugate.cc @@ -44,13 +44,13 @@ namespace maths namespace { -typedef std::vector TDoubleVec; -typedef TDoubleVec::const_iterator TDoubleVecCItr; -typedef core::CSmallVector TDouble7Vec; +using TDoubleVec = std::vector; +using TDoubleVecCItr = TDoubleVec::const_iterator; +using TDouble7Vec = core::CSmallVector; namespace detail { -typedef std::pair TDoubleDoublePr; +using TDoubleDoublePr = std::pair; //! Truncate \p to fit into a signed integer. int truncate(std::size_t x) @@ -279,11 +279,11 @@ void generateBetaSamples(double a, } // detail:: -typedef std::map TDoubleDoubleMap; -typedef TDoubleDoubleMap::const_iterator TDoubleDoubleMapCItr; -typedef boost::tuples::tuple TDoubleDoubleSizeTr; -typedef std::vector TDoubleDoubleSizeTrVec; -typedef CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; +using TDoubleDoubleMap = std::map; +using TDoubleDoubleMapCItr = TDoubleDoubleMap::const_iterator; +using TDoubleDoubleSizeTr = boost::tuples::tuple; +using TDoubleDoubleSizeTrVec = std::vector; +using TMeanAccumulator = CBasicStatistics::SSampleMean::TAccumulator; // We use short field names to reduce the state size const std::string NUMBER_AVAILABLE_CATEGORIES_TAG("a"); @@ -630,7 +630,7 @@ double CMultinomialConjugate::marginalLikelihoodMode(const TWeightStyleVec &/*we double CMultinomialConjugate::marginalLikelihoodVariance(const TWeightStyleVec &/*weightStyles*/, const TDouble4Vec &/*weights*/) const { - typedef CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; + using TMeanVarAccumulator = CBasicStatistics::SSampleMeanVar::TAccumulator; if (this->isNonInformative()) { @@ -1105,7 +1105,7 @@ bool CMultinomialConjugate::probabilityOfLessLikelySamples(maths_t::EProbability // P(i in L). In this case we just fall back to using (3) which isn't // sharp. - typedef std::vector TSizeVec; + using TSizeVec = std::vector; tail = maths_t::E_MixedOrNeitherTail; diff --git a/lib/maths/CMultivariateConstantPrior.cc b/lib/maths/CMultivariateConstantPrior.cc index 0ea84043c2..35b9f03f15 100644 --- a/lib/maths/CMultivariateConstantPrior.cc +++ b/lib/maths/CMultivariateConstantPrior.cc @@ -36,8 +36,8 @@ namespace maths namespace { -typedef core::CSmallVector TDouble10Vec; -typedef boost::optional TOptionalDouble10Vec; +using TDouble10Vec = core::CSmallVector; +using TOptionalDouble10Vec = boost::optional; //! \brief Converts a constant value to a string. class CConstantToString diff --git a/lib/maths/CMultivariateMultimodalPrior.cc b/lib/maths/CMultivariateMultimodalPrior.cc index 17ee2d9eba..413ca7c97a 100644 --- a/lib/maths/CMultivariateMultimodalPrior.cc +++ b/lib/maths/CMultivariateMultimodalPrior.cc @@ -18,9 +18,9 @@ namespace maths namespace multivariate_multimodal_prior_detail { -typedef std::vector TDoubleVec; -typedef CMultivariatePrior::TDouble10Vec TDouble10Vec; -typedef CMultivariatePrior::TDouble10Vec4Vec TDouble10Vec4Vec; +using TDoubleVec = std::vector; +using TDouble10Vec = CMultivariatePrior::TDouble10Vec; +using TDouble10Vec4Vec = CMultivariatePrior::TDouble10Vec4Vec; namespace { @@ -145,7 +145,7 @@ void sampleMarginalLikelihood(const TModeVec &modes, normalizedWeights.push_back(weight); Z += weight; } - for (auto &&weight : normalizedWeights) + for (auto &weight : normalizedWeights) { weight /= Z; } @@ -200,7 +200,7 @@ void modeMergeCallback(std::size_t dimension, LOG_TRACE("Merging modes with indices " << leftMergeIndex << " " << rightMergeIndex); - typedef std::set TSizeSet; + using TSizeSet = std::set; // Create the new mode. TMode newMode(targetIndex, seedPrior); diff --git a/lib/maths/CMultivariateMultimodalPriorFactory.cc b/lib/maths/CMultivariateMultimodalPriorFactory.cc index 8dc009e0dc..0fd34ac79e 100644 --- a/lib/maths/CMultivariateMultimodalPriorFactory.cc +++ b/lib/maths/CMultivariateMultimodalPriorFactory.cc @@ -37,7 +37,7 @@ class CFactory double minimumCategoryCount, const CMultivariatePrior &seedPrior) { - boost::scoped_ptr > > clusterer( + boost::scoped_ptr> > clusterer( CXMeansOnlineFactory::make(dataType, weightCalc, decayRate, diff --git a/lib/maths/CMultivariateOneOfNPrior.cc b/lib/maths/CMultivariateOneOfNPrior.cc index 11cf9f5b64..65281862f8 100644 --- a/lib/maths/CMultivariateOneOfNPrior.cc +++ b/lib/maths/CMultivariateOneOfNPrior.cc @@ -39,16 +39,16 @@ namespace maths namespace { -typedef core::CSmallVector TBool3Vec; -typedef CMultivariateOneOfNPrior::TDouble3Vec TDouble3Vec; -typedef CMultivariateOneOfNPrior::TDouble10Vec TDouble10Vec; -typedef CMultivariateOneOfNPrior::TDouble10VecDouble10VecPr TDouble10VecDouble10VecPr; -typedef CMultivariateOneOfNPrior::TDouble10Vec1Vec TDouble10Vec1Vec; -typedef CMultivariateOneOfNPrior::TDouble10Vec10Vec TDouble10Vec10Vec; -typedef CMultivariateOneOfNPrior::TDouble10Vec4Vec1Vec TDouble10Vec4Vec1Vec; -typedef CMultivariateOneOfNPrior::TPriorPtr TPriorPtr; -typedef CMultivariateOneOfNPrior::TWeightPriorPtrPr TWeightPriorPtrPr; -typedef CMultivariateOneOfNPrior::TWeightPriorPtrPrVec TWeightPriorPtrPrVec; +using TBool3Vec = core::CSmallVector; +using TDouble3Vec = CMultivariateOneOfNPrior::TDouble3Vec; +using TDouble10Vec = CMultivariateOneOfNPrior::TDouble10Vec; +using TDouble10VecDouble10VecPr = CMultivariateOneOfNPrior::TDouble10VecDouble10VecPr; +using TDouble10Vec1Vec = CMultivariateOneOfNPrior::TDouble10Vec1Vec; +using TDouble10Vec10Vec = CMultivariateOneOfNPrior::TDouble10Vec10Vec; +using TDouble10Vec4Vec1Vec = CMultivariateOneOfNPrior::TDouble10Vec4Vec1Vec; +using TPriorPtr = CMultivariateOneOfNPrior::TPriorPtr; +using TWeightPriorPtrPr = CMultivariateOneOfNPrior::TWeightPriorPtrPr; +using TWeightPriorPtrPrVec = CMultivariateOneOfNPrior::TWeightPriorPtrPrVec; // We use short field names to reduce the state size const std::string MODEL_TAG("a"); @@ -313,7 +313,7 @@ std::size_t CMultivariateOneOfNPrior::dimension(void) const void CMultivariateOneOfNPrior::dataType(maths_t::EDataType value) { this->CMultivariatePrior::dataType(value); - for (auto &&model : m_Models) + for (auto &model : m_Models) { model.second->dataType(value); } @@ -322,7 +322,7 @@ void CMultivariateOneOfNPrior::dataType(maths_t::EDataType value) void CMultivariateOneOfNPrior::decayRate(double value) { this->CMultivariatePrior::decayRate(value); - for (auto &&model : m_Models) + for (auto &model : m_Models) { model.second->decayRate(this->decayRate()); } @@ -330,7 +330,7 @@ void CMultivariateOneOfNPrior::decayRate(double value) void CMultivariateOneOfNPrior::setToNonInformative(double offset, double decayRate) { - for (auto &&model : m_Models) + for (auto &model : m_Models) { model.first.age(0.0); model.second->setToNonInformative(offset, decayRate); @@ -343,7 +343,7 @@ void CMultivariateOneOfNPrior::adjustOffset(const TWeightStyleVec &weightStyles, const TDouble10Vec1Vec &samples, const TDouble10Vec4Vec1Vec &weights) { - for (auto &&model : m_Models) + for (auto &model : m_Models) { model.second->adjustOffset(weightStyles, samples, weights); } @@ -381,7 +381,7 @@ void CMultivariateOneOfNPrior::addSamples(const TWeightStyleVec &weightStyles, TDouble3Vec logLikelihoods; TMaxAccumulator maxLogLikelihood; TBool3Vec used, uses; - for (auto &&model : m_Models) + for (auto &model : m_Models) { bool use = model.second->participatesInModelSelection(); @@ -485,7 +485,7 @@ void CMultivariateOneOfNPrior::propagateForwardsByTime(double time) double alpha = ::exp(-this->scaledDecayRate() * time); - for (auto &&model : m_Models) + for (auto &model : m_Models) { if (!this->isForForecasting()) { @@ -806,7 +806,7 @@ void CMultivariateOneOfNPrior::sampleMarginalLikelihood(std::size_t numberSample weights.push_back(model.first); Z += model.first; } - for (auto &&weight : weights) + for (auto &weight : weights) { weight /= Z; } @@ -925,7 +925,7 @@ void CMultivariateOneOfNPrior::acceptPersistInserter(core::CStatePersistInserter CMultivariateOneOfNPrior::TDouble3Vec CMultivariateOneOfNPrior::weights(void) const { TDouble3Vec result = this->logWeights(); - for (auto &&weight : result) + for (auto &weight : result) { weight = ::exp(weight); } @@ -943,7 +943,7 @@ CMultivariateOneOfNPrior::TDouble3Vec CMultivariateOneOfNPrior::logWeights(void) Z += ::exp(result.back()); } Z = ::log(Z); - for (auto &&weight : result) + for (auto &weight : result) { weight -= Z; } diff --git a/lib/maths/CNaturalBreaksClassifier.cc b/lib/maths/CNaturalBreaksClassifier.cc index 007a44816f..afc371ef09 100644 --- a/lib/maths/CNaturalBreaksClassifier.cc +++ b/lib/maths/CNaturalBreaksClassifier.cc @@ -490,7 +490,7 @@ void CNaturalBreaksClassifier::sample(std::size_t numberSamples, return; } - typedef CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = CBasicStatistics::SSampleMean::TAccumulator; static const double ALMOST_ONE = 0.99999; @@ -680,8 +680,8 @@ bool CNaturalBreaksClassifier::naturalBreaksImpl(const std::vector &categ double pp = static_cast(p); - typedef std::vector TDoubleVecVec; - typedef std::vector TSizeVecVec; + using TDoubleVecVec = std::vector; + using TSizeVecVec = std::vector; std::size_t N = categories.size(); diff --git a/lib/maths/CNormalMeanPrecConjugate.cc b/lib/maths/CNormalMeanPrecConjugate.cc index 3a071fd271..c3f848e8ec 100644 --- a/lib/maths/CNormalMeanPrecConjugate.cc +++ b/lib/maths/CNormalMeanPrecConjugate.cc @@ -45,19 +45,19 @@ namespace maths namespace { -typedef CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; +using TMeanVarAccumulator = CBasicStatistics::SSampleMeanVar::TAccumulator; const double MINIMUM_GAUSSIAN_SHAPE = 100.0; namespace detail { -typedef maths_t::TWeightStyleVec TWeightStyleVec; -typedef core::CSmallVector TDouble1Vec; -typedef core::CSmallVector TDouble4Vec; -typedef core::CSmallVector TDouble4Vec1Vec; -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleDoublePrVec; +using TWeightStyleVec = maths_t::TWeightStyleVec; +using TDouble1Vec = core::CSmallVector; +using TDouble4Vec = core::CSmallVector; +using TDouble4Vec1Vec = core::CSmallVector; +using TDoubleDoublePr = std::pair; +using TDoubleDoublePrVec = std::vector; //! Adds "weight" x "right operand" to the "left operand". struct SPlusWeight @@ -1237,7 +1237,7 @@ bool CNormalMeanPrecConjugate::minusLogJointCdf(const TWeightStyleVec &weightSty double &lowerBound, double &upperBound) const { - typedef detail::CEvaluateOnSamples TMinusLogCdf; + using TMinusLogCdf = detail::CEvaluateOnSamples; lowerBound = upperBound = 0.0; @@ -1288,7 +1288,7 @@ bool CNormalMeanPrecConjugate::minusLogJointCdfComplement(const TWeightStyleVec double &lowerBound, double &upperBound) const { - typedef detail::CEvaluateOnSamples TMinusLogCdfComplement; + using TMinusLogCdfComplement = detail::CEvaluateOnSamples; lowerBound = upperBound = 0.0; diff --git a/lib/maths/COneOfNPrior.cc b/lib/maths/COneOfNPrior.cc index dacd750303..c274df8a5c 100644 --- a/lib/maths/COneOfNPrior.cc +++ b/lib/maths/COneOfNPrior.cc @@ -41,9 +41,9 @@ namespace maths namespace { -typedef core::CSmallVector TBool5Vec; -typedef core::CSmallVector TDouble5Vec; -typedef CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; +using TBool5Vec = core::CSmallVector; +using TDouble5Vec = core::CSmallVector; +using TMeanAccumulator = CBasicStatistics::SSampleMean::TAccumulator; //! Compute the log of \p n. double logn(std::size_t n) @@ -200,7 +200,7 @@ COneOfNPrior *COneOfNPrior::clone(void) const void COneOfNPrior::dataType(maths_t::EDataType value) { this->CPrior::dataType(value); - for (auto &&model : m_Models) + for (auto &model : m_Models) { model.second->dataType(value); } @@ -209,7 +209,7 @@ void COneOfNPrior::dataType(maths_t::EDataType value) void COneOfNPrior::decayRate(double value) { this->CPrior::decayRate(value); - for (auto &&model : m_Models) + for (auto &model : m_Models) { model.second->decayRate(this->decayRate()); } @@ -217,7 +217,7 @@ void COneOfNPrior::decayRate(double value) void COneOfNPrior::setToNonInformative(double offset, double decayRate) { - for (auto &&model : m_Models) + for (auto &model : m_Models) { model.first.age(0.0); model.second->setToNonInformative(offset, decayRate); @@ -264,7 +264,7 @@ double COneOfNPrior::adjustOffset(const TWeightStyleVec &weightStyles, TMeanAccumulator result; TDouble5Vec penalties; - for (auto &&model : m_Models) + for (auto &model : m_Models) { double penalty = model.second->adjustOffset(weightStyles, samples, weights); penalties.push_back(penalty); @@ -380,7 +380,7 @@ void COneOfNPrior::addSamples(const TWeightStyleVec &weightStyles, TDouble5Vec logLikelihoods; TMaxAccumulator maxLogLikelihood; TBool5Vec used, uses; - for (auto &&model : m_Models) + for (auto &model : m_Models) { bool use = model.second->participatesInModelSelection(); @@ -488,7 +488,7 @@ void COneOfNPrior::propagateForwardsByTime(double time) double alpha = std::exp(-this->decayRate() * time); - for (auto &&model : m_Models) + for (auto &model : m_Models) { model.first.age(alpha); model.second->propagateForwardsByTime(time); @@ -784,7 +784,7 @@ void COneOfNPrior::sampleMarginalLikelihood(std::size_t numberSamples, weights.push_back(model.first); Z += model.first; } - for (auto &&weight : weights) + for (auto &weight : weights) { weight /= Z; } @@ -980,8 +980,8 @@ bool COneOfNPrior::probabilityOfLessLikelySamples(maths_t::EProbabilityCalculati // from the m'th model and // P(m) is the prior probability the data are from the m'th model. - typedef std::pair TDoubleTailPr; - typedef CBasicStatistics::SMax::TAccumulator TMaxAccumulator; + using TDoubleTailPr = std::pair; + using TMaxAccumulator = CBasicStatistics::SMax::TAccumulator; TDoubleSizePr5Vec logWeights = this->normalizedLogWeights(); @@ -1126,7 +1126,7 @@ void COneOfNPrior::acceptPersistInserter(core::CStatePersistInserter &inserter) COneOfNPrior::TDoubleVec COneOfNPrior::weights(void) const { TDoubleVec result = this->logWeights(); - for (auto &&weight : result) + for (auto &weight : result) { weight = std::exp(weight); } @@ -1145,7 +1145,7 @@ COneOfNPrior::TDoubleVec COneOfNPrior::logWeights(void) const Z += std::exp(result.back()); } Z = std::log(Z); - for (auto &&weight : result) + for (auto &weight : result) { weight -= Z; } @@ -1215,7 +1215,7 @@ COneOfNPrior::TDoubleSizePr5Vec COneOfNPrior::normalizedLogWeights(void) const } } Z = std::log(Z); - for (auto &&logWeight : result) + for (auto &logWeight : result) { logWeight.first -= Z; } diff --git a/lib/maths/CPeriodicityHypothesisTests.cc b/lib/maths/CPeriodicityHypothesisTests.cc index 2696c362f0..93eb4d8416 100644 --- a/lib/maths/CPeriodicityHypothesisTests.cc +++ b/lib/maths/CPeriodicityHypothesisTests.cc @@ -204,7 +204,7 @@ void removeLinearTrend(TFloatMeanAccumulatorVec &values) time += dt; } time = dt / 2.0; - for (auto &&value : values) + for (auto &value : values) { CBasicStatistics::moment<0>(value) -= trend.predict(time); time += dt; diff --git a/lib/maths/CPoissonMeanConjugate.cc b/lib/maths/CPoissonMeanConjugate.cc index cd16bf3c1d..b330480a29 100644 --- a/lib/maths/CPoissonMeanConjugate.cc +++ b/lib/maths/CPoissonMeanConjugate.cc @@ -61,10 +61,10 @@ struct SStaticCast namespace detail { -typedef core::CSmallVector TDouble1Vec; -typedef core::CSmallVector TDouble4Vec; -typedef core::CSmallVector TDouble4Vec1Vec; -typedef maths_t::TWeightStyleVec TWeightStyleVec; +using TDouble1Vec = core::CSmallVector; +using TDouble4Vec = core::CSmallVector; +using TDouble4Vec1Vec = core::CSmallVector; +using TWeightStyleVec = maths_t::TWeightStyleVec; //! Adds "weight" x "right operand" to the "left operand". struct SPlusWeight @@ -334,7 +334,7 @@ double CPoissonMeanConjugate::adjustOffset(const TWeightStyleVec &/*weightStyles return 0.0; } - for (auto &&sample : resamples) + for (auto &sample : resamples) { sample = std::max(sample, OFFSET_MARGIN - offset); } @@ -812,9 +812,9 @@ void CPoissonMeanConjugate::sampleMarginalLikelihood(std::size_t numberSamples, using boost::math::policies::discrete_quantile; using boost::math::policies::real; - typedef policy > TRealQuantilePolicy; - typedef boost::math::negative_binomial_distribution< - double, TRealQuantilePolicy> TNegativeBinomialRealQuantile; + using TRealQuantilePolicy = policy>; + using TNegativeBinomialRealQuantile = + boost::math::negative_binomial_distribution; try { diff --git a/lib/maths/CQDigest.cc b/lib/maths/CQDigest.cc index 2f386dd8b7..223d7fa728 100644 --- a/lib/maths/CQDigest.cc +++ b/lib/maths/CQDigest.cc @@ -171,8 +171,8 @@ void CQDigest::propagateForwardsByTime(double time) bool CQDigest::scale(double factor) { - typedef boost::tuple TUInt32UInt32UInt64Tr; - typedef std::vector TUInt32UInt32UInt64TrVec; + using TUInt32UInt32UInt64Tr = boost::tuple; + using TUInt32UInt32UInt64TrVec = std::vector; if (factor <= 0.0) { @@ -888,7 +888,7 @@ uint64_t CQDigest::CNode::age(double factor) { m_SubtreeCount = 0u; - for (auto &&descendant : m_Descendants) + for (auto &descendant : m_Descendants) { m_SubtreeCount += descendant->age(factor); } diff --git a/lib/maths/CQuantileSketch.cc b/lib/maths/CQuantileSketch.cc index 84c3168b05..b41a894039 100644 --- a/lib/maths/CQuantileSketch.cc +++ b/lib/maths/CQuantileSketch.cc @@ -30,10 +30,10 @@ namespace maths namespace { -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleDoublePrVec; -typedef CQuantileSketch::TFloatFloatPr TFloatFloatPr; -typedef CQuantileSketch::TFloatFloatPrVec TFloatFloatPrVec; +using TDoubleDoublePr = std::pair; +using TDoubleDoublePrVec = std::vector; +using TFloatFloatPr = CQuantileSketch::TFloatFloatPr; +using TFloatFloatPrVec = CQuantileSketch::TFloatFloatPrVec; //! \brief Orders two indices of a value vector by increasing value. class CIndexingGreater @@ -56,7 +56,7 @@ class CIndexingGreater //! \brief An iterator over just the unique knot values. class CUniqueIterator : private boost::addable2< CUniqueIterator, ptrdiff_t, boost::subtractable2< CUniqueIterator, ptrdiff_t, - boost::equality_comparable< CUniqueIterator > > > + boost::equality_comparable< CUniqueIterator >> > { public: CUniqueIterator(TFloatFloatPrVec &knots, std::size_t i) : @@ -458,7 +458,7 @@ std::string CQuantileSketch::print(void) const void CQuantileSketch::reduce(void) { - typedef std::vector TSizeVec; + using TSizeVec = std::vector; CPRNG::CXorOShiro128Plus rng(static_cast(m_Count)); boost::random::uniform_01 u01; diff --git a/lib/maths/CSampling.cc b/lib/maths/CSampling.cc index a3a9d71a19..f918dc02c3 100644 --- a/lib/maths/CSampling.cc +++ b/lib/maths/CSampling.cc @@ -389,7 +389,7 @@ void doMultivariateNormalSample(RNG &rng, const CVectorNx1 &mean, const CSymmetricMatrixNxN &covariance, std::size_t n, - std::vector > &samples) + std::vector> &samples) { using TDenseVector = typename SDenseVector>::Type; using TDenseMatrix = typename SDenseMatrix>::Type; @@ -849,9 +849,9 @@ void CSampling::weightedSample(std::size_t n, // that Sum_i{ w(i) } != 1.0 we round the number of samples to // the nearest integer to n * Sum_i{ p(i) }. - typedef std::vector TUIntVec; - typedef std::pair TDoubleSizePr; - typedef std::vector TDoubleSizePrVec; + using TUIntVec = std::vector; + using TDoubleSizePr = std::pair; + using TDoubleSizePrVec = std::vector; LOG_TRACE("Number samples = " << n); diff --git a/lib/maths/CStatisticalTests.cc b/lib/maths/CStatisticalTests.cc index ffcd369c9b..36ee37ae9a 100644 --- a/lib/maths/CStatisticalTests.cc +++ b/lib/maths/CStatisticalTests.cc @@ -208,7 +208,7 @@ void CStatisticalTests::CCramerVonMises::acceptPersistInserter(core::CStatePersi void CStatisticalTests::CCramerVonMises::addF(double f) { - typedef std::vector TDoubleVec; + using TDoubleVec = std::vector; if (m_F.size() == m_Size) { diff --git a/lib/maths/CTimeSeriesDecompositionDetail.cc b/lib/maths/CTimeSeriesDecompositionDetail.cc index 9bf2eb5ec0..2331c2af7f 100644 --- a/lib/maths/CTimeSeriesDecompositionDetail.cc +++ b/lib/maths/CTimeSeriesDecompositionDetail.cc @@ -589,7 +589,7 @@ void CTimeSeriesDecompositionDetail::CPeriodicityTest::handle(const SAddValue &m switch (m_Machine.state()) { case PT_TEST: - for (auto &&window : m_Windows) + for (auto &window : m_Windows) { if (window) { @@ -2034,7 +2034,7 @@ bool CTimeSeriesDecompositionDetail::CComponents::SSeasonal::prune(core_t::TTime { if (windowed.count(shift.first) > 0) { - for (auto &&component : s_Components) + for (auto &component : s_Components) { if (shift.first == component.time().window()) { @@ -2046,7 +2046,7 @@ bool CTimeSeriesDecompositionDetail::CComponents::SSeasonal::prune(core_t::TTime else { bool fallback = true; - for (auto &&component : s_Components) + for (auto &component : s_Components) { if (!component.time().windowed()) { @@ -2059,7 +2059,7 @@ bool CTimeSeriesDecompositionDetail::CComponents::SSeasonal::prune(core_t::TTime { TTimeTimePrVec shifted; shifted.reserve(s_Components.size()); - for (auto &&component : s_Components) + for (auto &component : s_Components) { const CSeasonalTime &time_ = component.time(); if (std::find_if(shifted.begin(), shifted.end(), diff --git a/lib/maths/CTrendTests.cc b/lib/maths/CTrendTests.cc index 4f23041856..fd1d3745c9 100644 --- a/lib/maths/CTrendTests.cc +++ b/lib/maths/CTrendTests.cc @@ -89,7 +89,7 @@ void zeroMean(TDoubleVec &samples) { mean.add(sample); } - for (auto &&sample : samples) + for (auto &sample : samples) { sample -= CBasicStatistics::mean(mean); } diff --git a/lib/maths/CXMeansOnline1d.cc b/lib/maths/CXMeansOnline1d.cc index a946a4a05b..85ab20eabf 100644 --- a/lib/maths/CXMeansOnline1d.cc +++ b/lib/maths/CXMeansOnline1d.cc @@ -49,18 +49,18 @@ namespace maths namespace { -typedef core::CSmallVector TDouble1Vec; -typedef core::CSmallVector TDouble4Vec; -typedef core::CSmallVector TDouble4Vec1Vec; -typedef std::pair TDoubleDoublePr; -typedef std::vector TSizeVec; -typedef CNaturalBreaksClassifier::TTuple TTuple; -typedef CNaturalBreaksClassifier::TTupleVec TTupleVec; +using TDouble1Vec = core::CSmallVector; +using TDouble4Vec = core::CSmallVector; +using TDouble4Vec1Vec = core::CSmallVector; +using TDoubleDoublePr = std::pair; +using TSizeVec = std::vector; +using TTuple = CNaturalBreaksClassifier::TTuple; +using TTupleVec = CNaturalBreaksClassifier::TTupleVec; namespace detail { -typedef CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; +using TMeanVarAccumulator = CBasicStatistics::SSampleMeanVar::TAccumulator; //! \brief Orders two clusters by their centres. struct SClusterCentreLess @@ -512,7 +512,7 @@ bool splitSearch(double minimumCount, const TTupleVec &categories, TSizeVec &result) { - typedef std::pair TSizeSizePr; + using TSizeSizePr = std::pair; LOG_TRACE("begin split search"); diff --git a/lib/maths/ProbabilityAggregators.cc b/lib/maths/ProbabilityAggregators.cc index 0c935d1708..becec07414 100644 --- a/lib/maths/ProbabilityAggregators.cc +++ b/lib/maths/ProbabilityAggregators.cc @@ -28,8 +28,8 @@ namespace maths namespace { -typedef std::vector TDoubleVec; -typedef std::pair TDoubleDoublePr; +using TDoubleVec = std::vector; +using TDoubleDoublePr = std::pair; //! Compute \f$x^2\f$. inline double square(double x) @@ -238,7 +238,7 @@ double logOneMinusX(double x) class CNumericalLogProbabilityOfMFromNExtremeSamples { public: - typedef CBasicStatistics::COrderStatisticsHeap TMinValueAccumulator; + using TMinValueAccumulator = CBasicStatistics::COrderStatisticsHeap; //! A recursive integrand for the multi-variable integration. class CLogIntegrand diff --git a/lib/maths/unittest/CAgglomerativeClustererTest.cc b/lib/maths/unittest/CAgglomerativeClustererTest.cc index dab3b84047..7ac438b487 100644 --- a/lib/maths/unittest/CAgglomerativeClustererTest.cc +++ b/lib/maths/unittest/CAgglomerativeClustererTest.cc @@ -25,12 +25,12 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; -typedef std::vector TSizeVec; -typedef std::vector TSizeVecVec; -typedef std::pair TDoubleSizeVecPr; -typedef std::vector TDoubleSizeVecPrVec; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; +using TSizeVec = std::vector; +using TSizeVecVec = std::vector; +using TDoubleSizeVecPr = std::pair; +using TDoubleSizeVecPrVec = std::vector; class CCluster { @@ -80,7 +80,7 @@ class CCluster TSizeVec m_Points; }; -typedef std::vector TClusterVec; +using TClusterVec = std::vector; class CSlinkObjective { diff --git a/lib/maths/unittest/CAssignmentTest.cc b/lib/maths/unittest/CAssignmentTest.cc index 1b5034abb3..1984aef87d 100644 --- a/lib/maths/unittest/CAssignmentTest.cc +++ b/lib/maths/unittest/CAssignmentTest.cc @@ -24,11 +24,11 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; -typedef std::vector TSizeVec; -typedef std::pair TSizeSizePr; -typedef std::vector TSizeSizePrVec; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; +using TSizeVec = std::vector; +using TSizeSizePr = std::pair; +using TSizeSizePrVec = std::vector; template void fill(const double (&costs)[N][M], TDoubleVecVec &result) diff --git a/lib/maths/unittest/CBasicStatisticsTest.cc b/lib/maths/unittest/CBasicStatisticsTest.cc index e416920dcc..067e203641 100644 --- a/lib/maths/unittest/CBasicStatisticsTest.cc +++ b/lib/maths/unittest/CBasicStatisticsTest.cc @@ -28,21 +28,21 @@ namespace { -typedef ml::maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef ml::maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; -typedef ml::maths::CBasicStatistics::SSampleMeanVarSkew::TAccumulator TMeanVarSkewAccumulator; -typedef ml::core::CSmallVector TMeanAccumulator2Vec; -typedef ml::core::CSmallVector TMeanVarAccumulator2Vec; -typedef ml::core::CSmallVector TMeanVarSkewAccumulator2Vec; -typedef std::vector TMeanAccumulatorVec; -typedef std::vector TMeanVarAccumulatorVec; -typedef std::vector TMeanVarSkewAccumulatorVec; +using TMeanAccumulator = ml::maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMeanVarAccumulator = ml::maths::CBasicStatistics::SSampleMeanVar::TAccumulator; +using TMeanVarSkewAccumulator = ml::maths::CBasicStatistics::SSampleMeanVarSkew::TAccumulator; +using TMeanAccumulator2Vec = ml::core::CSmallVector; +using TMeanVarAccumulator2Vec = ml::core::CSmallVector; +using TMeanVarSkewAccumulator2Vec = ml::core::CSmallVector; +using TMeanAccumulatorVec = std::vector; +using TMeanVarAccumulatorVec = std::vector; +using TMeanVarSkewAccumulatorVec = std::vector; const std::string TAG("a"); struct SRestore { - typedef bool result_type; + using result_type = bool; template bool operator()(std::vector &restored, ml::core::CStateRestoreTraverser &traverser) const @@ -114,7 +114,7 @@ void CBasicStatisticsTest::testCentralMoments(void) LOG_DEBUG("| CBasicStatisticsTest::testCentralMoments |"); LOG_DEBUG("+--------------------------------------------+"); - typedef std::vector TDoubleVec; + using TDoubleVec = std::vector; LOG_DEBUG("Test mean double"); { @@ -139,7 +139,7 @@ void CBasicStatisticsTest::testCentralMoments(void) LOG_DEBUG("Test mean float"); { - typedef ml::maths::CBasicStatistics::SSampleMean::TAccumulator TFloatMeanAccumulator; + using TFloatMeanAccumulator = ml::maths::CBasicStatistics::SSampleMean::TAccumulator; float samples[] = { 0.9f, 10.0f, 5.6f, 1.23f, -12.3f, 7.2f, 0.0f, 1.2f }; @@ -479,9 +479,9 @@ void CBasicStatisticsTest::testCentralMoments(void) LOG_DEBUG("test vector") { - typedef ml::maths::CBasicStatistics::SSampleMean >::TAccumulator TVectorMeanAccumulator; - typedef ml::maths::CBasicStatistics::SSampleMeanVar >::TAccumulator TVectorMeanVarAccumulator; - typedef ml::maths::CBasicStatistics::SSampleMeanVarSkew >::TAccumulator TVectorMeanVarSkewAccumulator; + using TVectorMeanAccumulator = ml::maths::CBasicStatistics::SSampleMean>::TAccumulator; + using TVectorMeanVarAccumulator = ml::maths::CBasicStatistics::SSampleMeanVar>::TAccumulator; + using TVectorMeanVarSkewAccumulator = ml::maths::CBasicStatistics::SSampleMeanVarSkew>::TAccumulator; ml::test::CRandomNumbers rng; @@ -759,8 +759,8 @@ void CBasicStatisticsTest::testVectorCentralMoments(void) LOG_DEBUG("| CBasicStatisticsTest::testVectorCentralMoments |"); LOG_DEBUG("+--------------------------------------------------+"); - typedef ml::core::CSmallVector TDouble2Vec; - typedef std::vector TDoubleVec; + using TDouble2Vec = ml::core::CSmallVector; + using TDoubleVec = std::vector; { TMeanAccumulator2Vec moments1(2); @@ -905,12 +905,12 @@ void CBasicStatisticsTest::testCovariances(void) } bool dynamicSizeAlwaysZero = ml::core::memory_detail::SDynamicSizeAlwaysZero< - ml::maths::CBasicStatistics::SSampleCovariances >::value(); + ml::maths::CBasicStatistics::SSampleCovariances>::value(); CPPUNIT_ASSERT_EQUAL(true, dynamicSizeAlwaysZero); } { - typedef std::vector > TVectorVec; + using TVectorVec = std::vector>; double mean_[] = { 1.0, 3.0, 2.0, 7.0 }; ml::maths::CVectorNx1 mean(mean_); @@ -974,7 +974,7 @@ void CBasicStatisticsTest::testCovariances(void) std::vector coordinates; rng.generateUniformSamples(5.0, 10.0, 400, coordinates); - std::vector > points; + std::vector> points; for (std::size_t i = 0u; i < coordinates.size(); i += 4) { double c[] = @@ -1012,11 +1012,11 @@ void CBasicStatisticsTest::testCovariancesLedoitWolf(void) LOG_DEBUG("| CBasicStatisticsTest::testCovariancesLedoitWolf |"); LOG_DEBUG("+---------------------------------------------------+"); - typedef std::vector TDoubleVec; - typedef std::vector TDoubleVecVec; - typedef ml::maths::CVectorNx1 TVector2; - typedef std::vector TVector2Vec; - typedef ml::maths::CSymmetricMatrixNxN TMatrix2; + using TDoubleVec = std::vector; + using TDoubleVecVec = std::vector; + using TVector2 = ml::maths::CVectorNx1; + using TVector2Vec = std::vector; + using TMatrix2 = ml::maths::CSymmetricMatrixNxN; ml::test::CRandomNumbers rng; @@ -1167,10 +1167,10 @@ void CBasicStatisticsTest::testOrderStatistics(void) // Test that the order statistics accumulators work for finding min and max // elements of a collection. - typedef ml::maths::CBasicStatistics::COrderStatisticsStack TMinStatsStack; - typedef ml::maths::CBasicStatistics::COrderStatisticsStack > TMaxStatsStack; - typedef ml::maths::CBasicStatistics::COrderStatisticsHeap TMinStatsHeap; - typedef ml::maths::CBasicStatistics::COrderStatisticsHeap > TMaxStatsHeap; + using TMinStatsStack = ml::maths::CBasicStatistics::COrderStatisticsStack; + using TMaxStatsStack = ml::maths::CBasicStatistics::COrderStatisticsStack>; + using TMinStatsHeap = ml::maths::CBasicStatistics::COrderStatisticsHeap; + using TMaxStatsHeap = ml::maths::CBasicStatistics::COrderStatisticsHeap>; { // Test on the stack min, max, combine and persist and restore. @@ -1362,7 +1362,7 @@ void CBasicStatisticsTest::testMinMax(void) LOG_DEBUG("| CBasicStatisticsTest::testMinMax |"); LOG_DEBUG("+------------------------------------+"); - typedef std::vector TDoubleVec; + using TDoubleVec = std::vector; TDoubleVec positive{1.0, 2.7, 4.0, 0.3, 11.7}; TDoubleVec negative{-3.7, -0.8, -18.2, -0.8}; diff --git a/lib/maths/unittest/CBjkstUniqueValuesTest.cc b/lib/maths/unittest/CBjkstUniqueValuesTest.cc index 470e9b38c8..b9bf29fe61 100644 --- a/lib/maths/unittest/CBjkstUniqueValuesTest.cc +++ b/lib/maths/unittest/CBjkstUniqueValuesTest.cc @@ -23,10 +23,10 @@ using namespace test; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; -typedef std::set TUInt32Set; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; +using TUInt32Set = std::set; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; uint8_t trailingZeros(uint32_t x) { diff --git a/lib/maths/unittest/CBootstrapClustererTest.cc b/lib/maths/unittest/CBootstrapClustererTest.cc index 7c1eb6205c..d81809d34e 100644 --- a/lib/maths/unittest/CBootstrapClustererTest.cc +++ b/lib/maths/unittest/CBootstrapClustererTest.cc @@ -23,16 +23,16 @@ using namespace ml; namespace { -typedef std::vector TBoolVec; -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; -typedef std::vector TSizeVecVec; -typedef maths::CVectorNx1 TVector2; -typedef std::vector TVector2Vec; -typedef std::vector TVector2VecVec; -typedef maths::CSymmetricMatrixNxN TMatrix2; -typedef std::vector TMatrix2Vec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; +using TBoolVec = std::vector; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; +using TSizeVecVec = std::vector; +using TVector2 = maths::CVectorNx1; +using TVector2Vec = std::vector; +using TVector2VecVec = std::vector; +using TMatrix2 = maths::CSymmetricMatrixNxN; +using TMatrix2Vec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; struct SVector2Hash { @@ -41,17 +41,17 @@ struct SVector2Hash return static_cast(x.checksum()); } }; -typedef boost::unordered_map TVector2SizeUMap; +using TVector2SizeUMap = boost::unordered_map; template class CBootstrapClustererForTest : public maths::CBootstrapClusterer { public: - typedef typename maths::CBootstrapClusterer::TBoolVec TBoolVec; - typedef typename maths::CBootstrapClusterer::TSizeVec TSizeVec; - typedef typename maths::CBootstrapClusterer::TSizeVecVecVec TSizeVecVecVec; - typedef typename maths::CBootstrapClusterer::TPointVec TPointVec; - typedef typename maths::CBootstrapClusterer::TGraph TGraph; + using TBoolVec = typename maths::CBootstrapClusterer::TBoolVec; + using TSizeVec = typename maths::CBootstrapClusterer::TSizeVec; + using TSizeVecVecVec = typename maths::CBootstrapClusterer::TSizeVecVecVec; + using TPointVec = typename maths::CBootstrapClusterer::TPointVec; + using TGraph = typename maths::CBootstrapClusterer::TGraph; public: CBootstrapClustererForTest(double overlapThreshold, double chainingFactor) : @@ -91,11 +91,11 @@ class CBootstrapClustererForTest : public maths::CBootstrapClusterer } }; -typedef CBootstrapClustererForTest TBootstrapClustererForTest2; -typedef TBootstrapClustererForTest2::TGraph TGraph; -typedef boost::graph_traits::vertex_iterator TVertexItr; -typedef boost::graph_traits::edge_iterator TEdgeItr; -typedef boost::graph_traits::adjacency_iterator TAdjacencyItr; +using TBootstrapClustererForTest2 = CBootstrapClustererForTest; +using TGraph = TBootstrapClustererForTest2::TGraph; +using TVertexItr = boost::graph_traits::vertex_iterator; +using TEdgeItr = boost::graph_traits::edge_iterator; +using TAdjacencyItr = boost::graph_traits::adjacency_iterator; void clique(std::size_t a, std::size_t b, TGraph &graph) { @@ -153,11 +153,11 @@ void CBootstrapClustererTest::testFacade(void) std::sort(points.begin(), points.end()); { - maths::CXMeans > xmeans(20); + maths::CXMeans> xmeans(20); maths::CSampling::seed(); - maths::CBootstrapClustererFacade > > clusterer( + maths::CBootstrapClustererFacade> > clusterer( xmeans, improveParamsKmeansIterations, improveStructureClusterSeeds, @@ -709,7 +709,7 @@ void CBootstrapClustererTest::testNonConvexClustering(void) flatPoints.push_back(point); lookup[point] = i; } - maths::CXMeans > xmeans(20); + maths::CXMeans> xmeans(20); TVector2VecVec bootstrapClusters; maths::bootstrapCluster(flatPoints, @@ -863,7 +863,7 @@ void CBootstrapClustererTest::testClusteringStability(void) points2.begin() + (3 * points2.size()) / 4); TVector2VecVec bootstrapClusters; - maths::CXMeans > xmeans(20); + maths::CXMeans> xmeans(20); maths::bootstrapCluster(points, 20, // trials xmeans, diff --git a/lib/maths/unittest/CBoundingBoxTest.cc b/lib/maths/unittest/CBoundingBoxTest.cc index 83ed4078f2..ca298bed0d 100644 --- a/lib/maths/unittest/CBoundingBoxTest.cc +++ b/lib/maths/unittest/CBoundingBoxTest.cc @@ -16,11 +16,11 @@ using namespace ml; -typedef std::vector TDoubleVec; -typedef maths::CVectorNx1 TVector2; -typedef maths::CVectorNx1 TVector4; -typedef maths::CBoundingBox TBoundingBox2; -typedef maths::CBoundingBox TBoundingBox4; +using TDoubleVec = std::vector; +using TVector2 = maths::CVectorNx1; +using TVector4 = maths::CVectorNx1; +using TBoundingBox2 = maths::CBoundingBox; +using TBoundingBox4 = maths::CBoundingBox; namespace { diff --git a/lib/maths/unittest/CCalendarComponentAdaptiveBucketingTest.cc b/lib/maths/unittest/CCalendarComponentAdaptiveBucketingTest.cc index a1ffb04858..1ca041317d 100644 --- a/lib/maths/unittest/CCalendarComponentAdaptiveBucketingTest.cc +++ b/lib/maths/unittest/CCalendarComponentAdaptiveBucketingTest.cc @@ -24,11 +24,11 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TFloatVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef maths::CBasicStatistics::SMin::TAccumulator TMinAccumulator; -typedef maths::CBasicStatistics::SMax::TAccumulator TMaxAccumulator; +using TDoubleVec = std::vector; +using TFloatVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMinAccumulator = maths::CBasicStatistics::SMin::TAccumulator; +using TMaxAccumulator = maths::CBasicStatistics::SMax::TAccumulator; } void CCalendarComponentAdaptiveBucketingTest::setUp(void) diff --git a/lib/maths/unittest/CCalendarFeatureTest.cc b/lib/maths/unittest/CCalendarFeatureTest.cc index b2be50ff7e..8b0efd4af0 100644 --- a/lib/maths/unittest/CCalendarFeatureTest.cc +++ b/lib/maths/unittest/CCalendarFeatureTest.cc @@ -19,9 +19,9 @@ using namespace ml; -typedef std::vector TSizeVec; -typedef std::vector TTimeVec; -typedef std::vector TCalendarFeatureVec; +using TSizeVec = std::vector; +using TTimeVec = std::vector; +using TCalendarFeatureVec = std::vector; namespace { diff --git a/lib/maths/unittest/CCategoricalToolsTest.cc b/lib/maths/unittest/CCategoricalToolsTest.cc index 5e1f591379..23642d8a5c 100644 --- a/lib/maths/unittest/CCategoricalToolsTest.cc +++ b/lib/maths/unittest/CCategoricalToolsTest.cc @@ -18,8 +18,8 @@ #include -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; using namespace ml; @@ -45,8 +45,8 @@ void CCategoricalToolsTest::testExpectedDistinctCategories(void) LOG_DEBUG("| CCategoricalToolsTest::testExpectedDistinctCategories |"); LOG_DEBUG("+---------------------------------------------------------+"); - typedef std::vector TDoubleVecVec; - typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; + using TDoubleVecVec = std::vector; + using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; static const std::size_t nTrials = 4000u; diff --git a/lib/maths/unittest/CChecksumTest.cc b/lib/maths/unittest/CChecksumTest.cc index 312aaa76c3..855f1c47d4 100644 --- a/lib/maths/unittest/CChecksumTest.cc +++ b/lib/maths/unittest/CChecksumTest.cc @@ -60,18 +60,18 @@ struct SBar uint64_t s_Key; }; -typedef std::vector TIntVec; -typedef std::map TSizeAnEnumMap; -typedef std::set TStrSet; -typedef TStrSet::const_iterator TStrSetCItr; -typedef boost::optional TOptionalDouble; -typedef std::vector TOptionalDoubleVec; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; -typedef boost::shared_ptr TMeanVarAccumulatorPtr; -typedef std::pair TDoubleMeanVarAccumulatorPr; -typedef std::list TDoubleMeanVarAccumulatorPrList; -typedef std::deque TFooDeque; -typedef std::vector TBarVec; +using TIntVec = std::vector; +using TSizeAnEnumMap = std::map; +using TStrSet = std::set; +using TStrSetCItr = TStrSet::const_iterator; +using TOptionalDouble = boost::optional; +using TOptionalDoubleVec = std::vector; +using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; +using TMeanVarAccumulatorPtr = boost::shared_ptr; +using TDoubleMeanVarAccumulatorPr = std::pair; +using TDoubleMeanVarAccumulatorPrList = std::list; +using TFooDeque = std::deque; +using TBarVec = std::vector; } diff --git a/lib/maths/unittest/CClustererTest.cc b/lib/maths/unittest/CClustererTest.cc index c61be36df5..ec5a8d17ed 100644 --- a/lib/maths/unittest/CClustererTest.cc +++ b/lib/maths/unittest/CClustererTest.cc @@ -28,10 +28,10 @@ void CClustererTest::testIndexGenerator(void) // 2) The highest index in the set is less than the // maximum set size to date. - typedef std::vector TSizeVec; - typedef std::vector TDoubleVec; - typedef std::set > TSizeSet; - typedef TSizeSet::iterator TSizeSetItr; + using TSizeVec = std::vector; + using TDoubleVec = std::vector; + using TSizeSet = std::set>; + using TSizeSetItr = TSizeSet::iterator; test::CRandomNumbers rng; diff --git a/lib/maths/unittest/CCountMinSketchTest.cc b/lib/maths/unittest/CCountMinSketchTest.cc index 028060aabe..cd9c49f0ff 100644 --- a/lib/maths/unittest/CCountMinSketchTest.cc +++ b/lib/maths/unittest/CCountMinSketchTest.cc @@ -17,7 +17,7 @@ using namespace ml; -typedef std::vector TDoubleVec; +using TDoubleVec = std::vector; void CCountMinSketchTest::testCounts(void) { @@ -25,7 +25,7 @@ void CCountMinSketchTest::testCounts(void) LOG_DEBUG("| CCountMinSketchTest::testCounts |"); LOG_DEBUG("+-----------------------------------+"); - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; test::CRandomNumbers rng; diff --git a/lib/maths/unittest/CEntropySketchTest.cc b/lib/maths/unittest/CEntropySketchTest.cc index 19dc321590..06e0b2fd27 100644 --- a/lib/maths/unittest/CEntropySketchTest.cc +++ b/lib/maths/unittest/CEntropySketchTest.cc @@ -27,16 +27,16 @@ void CEntropySketchTest::testAll(void) LOG_DEBUG("| CBjkstUniqueValuesTest::testPersist |"); LOG_DEBUG("+---------------------------------------+"); - typedef std::vector TSizeVec; - typedef boost::unordered_map TSizeDoubleUMap; - typedef TSizeDoubleUMap::const_iterator TSizeDoubleUMapCItr; + using TSizeVec = std::vector; + using TSizeDoubleUMap = boost::unordered_map; + using TSizeDoubleUMapCItr = TSizeDoubleUMap::const_iterator; test::CRandomNumbers rng; TSizeVec numberCategories; rng.generateUniformSamples(500, 1001, 1000, numberCategories); - maths::CBasicStatistics::COrderStatisticsStack > maxError[3]; + maths::CBasicStatistics::COrderStatisticsStack> maxError[3]; maths::CBasicStatistics::SSampleMean::TAccumulator meanError[3]; double K[] = { 20.0, 40.0, 60.0 }; diff --git a/lib/maths/unittest/CGammaRateConjugateTest.cc b/lib/maths/unittest/CGammaRateConjugateTest.cc index 78fd05d963..b9519d1821 100644 --- a/lib/maths/unittest/CGammaRateConjugateTest.cc +++ b/lib/maths/unittest/CGammaRateConjugateTest.cc @@ -37,12 +37,12 @@ using namespace handy_typedefs; namespace { -typedef std::vector TDoubleVec; -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleDoublePrVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; -typedef CPriorTestInterfaceMixin CGammaRateConjugate; +using TDoubleVec = std::vector; +using TDoubleDoublePr = std::pair; +using TDoubleDoublePrVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; +using CGammaRateConjugate = CPriorTestInterfaceMixin; CGammaRateConjugate makePrior(maths_t::EDataType dataType = maths_t::E_ContinuousData, const double &offset = 0.0, @@ -87,7 +87,7 @@ void CGammaRateConjugateTest::testMultipleUpdate(void) } filter2.addSamples(samples); - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_RelativeTolerance, 1e-3); CPPUNIT_ASSERT(filter1.equalTolerance(filter2, equal)); } @@ -114,7 +114,7 @@ void CGammaRateConjugateTest::testMultipleUpdate(void) scaledSamples, TDouble4Vec1Vec(scaledSamples.size(), TDouble4Vec(1, 2.0))); - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_RelativeTolerance, 0.03); CPPUNIT_ASSERT(filter1.equalTolerance(filter2, equal)); } @@ -137,7 +137,7 @@ void CGammaRateConjugateTest::testMultipleUpdate(void) TDouble1Vec(1, x), TDouble4Vec1Vec(1, TDouble4Vec(1, static_cast(count)))); - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_RelativeTolerance, 0.01); CPPUNIT_ASSERT(filter1.equalTolerance(filter2, equal)); } @@ -211,7 +211,7 @@ void CGammaRateConjugateTest::testShapeEstimation(void) TDoubleVec samples; rng.generateGammaSamples(shape, scale, 5050, samples); - typedef std::vector TGammaRateConjugateVec; + using TGammaRateConjugateVec = std::vector; unsigned int nAggregate = 50u; TGammaRateConjugateVec filters(nAggregate, makePrior(maths_t::E_ContinuousData, 0.0, decayRates[i])); @@ -1040,7 +1040,7 @@ void CGammaRateConjugateTest::testAnomalyScore(void) // 1) high probability of detecting the anomalies, and // 2) a very low rate of false positives. - typedef std::vector TUIntVec; + using TUIntVec = std::vector; const double decayRates[] = { 0.0, 0.001, 0.01 }; @@ -1235,7 +1235,7 @@ void CGammaRateConjugateTest::testOffset(void) CPPUNIT_ASSERT_DOUBLES_EQUAL(probability1, probability2, eps); } - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_AbsoluteTolerance, eps); CPPUNIT_ASSERT(filter1.equalTolerance(filter2, equal)); } @@ -1284,7 +1284,7 @@ void CGammaRateConjugateTest::testIntegerData(void) filter2.addSamples(sample); } - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_RelativeTolerance, 0.02); CPPUNIT_ASSERT(filter1.equalTolerance(filter2, equal)); } @@ -1795,7 +1795,7 @@ void CGammaRateConjugateTest::testNegativeSample(void) CPPUNIT_ASSERT_EQUAL(filter1.numberSamples(), filter2.numberSamples()); - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_RelativeTolerance, 0.1); CPPUNIT_ASSERT(filter1.equalTolerance(filter2, equal)); } diff --git a/lib/maths/unittest/CGramSchmidtTest.cc b/lib/maths/unittest/CGramSchmidtTest.cc index 3788c476d9..38299d963d 100644 --- a/lib/maths/unittest/CGramSchmidtTest.cc +++ b/lib/maths/unittest/CGramSchmidtTest.cc @@ -21,10 +21,10 @@ using namespace ml; -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; -typedef maths::CVectorNx1 TVector4; -typedef std::vector TVector4Vec; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; +using TVector4 = maths::CVectorNx1; +using TVector4Vec = std::vector; namespace { diff --git a/lib/maths/unittest/CInformationCriteriaTest.cc b/lib/maths/unittest/CInformationCriteriaTest.cc index cb8d006ace..95cd51bee3 100644 --- a/lib/maths/unittest/CInformationCriteriaTest.cc +++ b/lib/maths/unittest/CInformationCriteriaTest.cc @@ -19,20 +19,20 @@ using namespace ml; namespace { -typedef std::vector TSizeVec; -typedef std::vector TSizeVecVec; -typedef maths::CVectorNx1 TVector2; -typedef std::vector TVector2Vec; -typedef TVector2Vec::const_iterator TVector2VecCItr; -typedef std::vector TVector2VecVec; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVar2Accumulator; -typedef maths::CSymmetricMatrixNxN TMatrix2; -typedef std::vector TMatrix2Vec; -typedef maths::CVectorNx1 TVector4; -typedef std::vector TVector4Vec; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVar4Accumulator; -typedef maths::CSymmetricMatrixNxN TMatrix4; -typedef std::vector TMatrix4Vec; +using TSizeVec = std::vector; +using TSizeVecVec = std::vector; +using TVector2 = maths::CVectorNx1; +using TVector2Vec = std::vector; +using TVector2VecCItr = TVector2Vec::const_iterator; +using TVector2VecVec = std::vector; +using TMeanVar2Accumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; +using TMatrix2 = maths::CSymmetricMatrixNxN; +using TMatrix2Vec = std::vector; +using TVector4 = maths::CVectorNx1; +using TVector4Vec = std::vector; +using TMeanVar4Accumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; +using TMatrix4 = maths::CSymmetricMatrixNxN; +using TMatrix4Vec = std::vector; template double logfSphericalGaussian(const POINT &mean, @@ -240,9 +240,9 @@ void CInformationCriteriaTest::testSphericalGaussianWithSphericalCluster(void) // same result working with clusters of points or their // spherical cluster representation. - typedef maths::CSphericalCluster::Type TSphericalCluster2; - typedef std::vector TSphericalCluster2Vec; - typedef std::vector TSphericalCluster2VecVec; + using TSphericalCluster2 = maths::CSphericalCluster::Type; + using TSphericalCluster2Vec = std::vector; + using TSphericalCluster2VecVec = std::vector; maths::CSampling::seed(); @@ -472,9 +472,9 @@ void CInformationCriteriaTest::testGaussianWithSphericalCluster(void) LOG_DEBUG("| CInformationCriteriaTest::testGaussianWithSphericalCluster |"); LOG_DEBUG("+--------------------------------------------------------------+"); - typedef maths::CSphericalCluster::Type TSphericalCluster2; - typedef std::vector TSphericalCluster2Vec; - typedef std::vector TSphericalCluster2VecVec; + using TSphericalCluster2 = maths::CSphericalCluster::Type; + using TSphericalCluster2Vec = std::vector; + using TSphericalCluster2VecVec = std::vector; maths::CSampling::seed(); diff --git a/lib/maths/unittest/CIntegerToolsTest.cc b/lib/maths/unittest/CIntegerToolsTest.cc index 5cf6ab24b0..0bccde328a 100644 --- a/lib/maths/unittest/CIntegerToolsTest.cc +++ b/lib/maths/unittest/CIntegerToolsTest.cc @@ -24,7 +24,7 @@ using namespace ml; namespace { -typedef std::vector TSizeVec; +using TSizeVec = std::vector; std::string printBits(uint64_t x) { diff --git a/lib/maths/unittest/CIntegrationTest.cc b/lib/maths/unittest/CIntegrationTest.cc index 9252789698..5b3e5ad0d0 100644 --- a/lib/maths/unittest/CIntegrationTest.cc +++ b/lib/maths/unittest/CIntegrationTest.cc @@ -98,7 +98,7 @@ template class CMultivariatePolynomialFunction { public: - typedef CVectorNx1 TVector; + using TVector = CVectorNx1; struct SMonomial { @@ -111,7 +111,7 @@ class CMultivariatePolynomialFunction double s_Powers[DIMENSION]; }; - typedef std::vector TMonomialVec; + using TMonomialVec = std::vector; public: void add(double coefficient, double powers[DIMENSION]) @@ -179,7 +179,7 @@ std::ostream &operator<<(std::ostream &o, const CMultivariatePolynomialFunction< return o; } -typedef std::vector TDoubleVec; +using TDoubleVec = std::vector; template double integrate(const CMultivariatePolynomialFunction &f, @@ -201,13 +201,13 @@ double integrate(const CMultivariatePolynomialFunction &f, } -typedef std::vector TDoubleVecVec; +using TDoubleVecVec = std::vector; bool readGrid(const std::string &file, TDoubleVec &weights, TDoubleVecVec &points) { - typedef std::vector TStrVec; + using TStrVec = std::vector; std::ifstream d2_l1; d2_l1.open(file.c_str()); if (!d2_l1) @@ -252,7 +252,7 @@ bool readGrid(const std::string &file, class CSmoothHeavySide { public: - typedef double result_type; + using result_type = double; public: CSmoothHeavySide(double slope, double offset) : @@ -276,7 +276,7 @@ class CSmoothHeavySide class CNormal { public: - typedef double result_type; + using result_type = double; public: CNormal(double mean, double std) : @@ -312,17 +312,17 @@ void CIntegrationTest::testAllSingleVariate(void) // Test that "low" order polynomials are integrated exactly // (as they should be for a higher order quadrature). - typedef CPolynomialFunction<0u> TConstant; - typedef CPolynomialFunction<1u> TLinear; - typedef CPolynomialFunction<2u> TQuadratic; - typedef CPolynomialFunction<3u> TCubic; - typedef CPolynomialFunction<4u> TQuartic; - typedef CPolynomialFunction<5u> TQuintic; - typedef CPolynomialFunction<6u> THexic; - typedef CPolynomialFunction<7u> THeptic; - typedef CPolynomialFunction<8u> TOctic; - typedef CPolynomialFunction<9u> TNonic; - typedef CPolynomialFunction<10u> TDecic; + using TConstant = CPolynomialFunction<0u>; + using TLinear = CPolynomialFunction<1u>; + using TQuadratic = CPolynomialFunction<2u>; + using TCubic = CPolynomialFunction<3u>; + using TQuartic = CPolynomialFunction<4u>; + using TQuintic = CPolynomialFunction<5u>; + using THexic = CPolynomialFunction<6u>; + using THeptic = CPolynomialFunction<7u>; + using TOctic = CPolynomialFunction<8u>; + using TNonic = CPolynomialFunction<9u>; + using TDecic = CPolynomialFunction<10u>; static const double EPS = 1e-6; @@ -877,8 +877,8 @@ void CIntegrationTest::testAdaptive(void) LOG_DEBUG("| CIntegerToolsTest::testAdaptive |"); LOG_DEBUG("+-----------------------------------+"); - typedef std::pair TDoubleDoublePr; - typedef std::vector TDoubleDoublePrVec; + using TDoubleDoublePr = std::pair; + using TDoubleDoublePrVec = std::vector; { LOG_DEBUG("*** Smooth unit step at 20 ***"); @@ -1022,10 +1022,10 @@ void CIntegrationTest::testSparseGrid(void) expectedWeights, expectedPoints)); - typedef CIntegration::CSparseGaussLegendreQuadrature Sparse2do1; + using TSparse2do1 = CIntegration::CSparseGaussLegendreQuadrature; - const Sparse2do1 &sparse = Sparse2do1::instance(); + const TSparse2do1 &sparse = TSparse2do1::instance(); LOG_DEBUG("# points = " << sparse.weights().size()); CPPUNIT_ASSERT_EQUAL(expectedWeights.size(), sparse.weights().size()); @@ -1055,10 +1055,10 @@ void CIntegrationTest::testSparseGrid(void) expectedWeights, expectedPoints)); - typedef CIntegration::CSparseGaussLegendreQuadrature Sparse2do2; + using TSparse2do2 = CIntegration::CSparseGaussLegendreQuadrature; - const Sparse2do2 &sparse = Sparse2do2::instance(); + const TSparse2do2 &sparse = TSparse2do2::instance(); LOG_DEBUG("# points = " << sparse.weights().size()); CPPUNIT_ASSERT_EQUAL(expectedWeights.size(), sparse.weights().size()); @@ -1088,10 +1088,10 @@ void CIntegrationTest::testSparseGrid(void) expectedWeights, expectedPoints)); - typedef CIntegration::CSparseGaussLegendreQuadrature Sparse2do4; + using TSparse2do4 = CIntegration::CSparseGaussLegendreQuadrature; - const Sparse2do4 &sparse = Sparse2do4::instance(); + const TSparse2do4 &sparse = TSparse2do4::instance(); LOG_DEBUG("# points = " << sparse.weights().size()); CPPUNIT_ASSERT_EQUAL(expectedWeights.size(), sparse.weights().size()); @@ -1121,10 +1121,10 @@ void CIntegrationTest::testSparseGrid(void) expectedWeights, expectedPoints)); - typedef CIntegration::CSparseGaussLegendreQuadrature Sparse7do3; + using TSparse7do3 = CIntegration::CSparseGaussLegendreQuadrature; - const Sparse7do3 &sparse = Sparse7do3::instance(); + const TSparse7do3 &sparse = TSparse7do3::instance(); LOG_DEBUG("# points = " << sparse.weights().size()); CPPUNIT_ASSERT_EQUAL(expectedWeights.size(), sparse.weights().size()); @@ -1154,10 +1154,10 @@ void CIntegrationTest::testSparseGrid(void) expectedWeights, expectedPoints)); - typedef CIntegration::CSparseGaussLegendreQuadrature Sparse7do5; + using TSparse7do5 = CIntegration::CSparseGaussLegendreQuadrature; - const Sparse7do5 &sparse = Sparse7do5::instance(); + const TSparse7do5 &sparse = TSparse7do5::instance(); LOG_DEBUG("# points = " << sparse.weights().size()); CPPUNIT_ASSERT_EQUAL(expectedWeights.size(), sparse.weights().size()); @@ -1265,7 +1265,7 @@ void CIntegrationTest::testMultivariateSmooth(void) // if its order is no more than 2l - 1. A polynomial order is // the largest sum of exponents in any term. - typedef std::vector TSizeVec; + using TSizeVec = std::vector; test::CRandomNumbers rng; diff --git a/lib/maths/unittest/CKMeansFastTest.cc b/lib/maths/unittest/CKMeansFastTest.cc index a3e51e0307..751d10305c 100644 --- a/lib/maths/unittest/CKMeansFastTest.cc +++ b/lib/maths/unittest/CKMeansFastTest.cc @@ -26,28 +26,28 @@ template class CKMeansFastForTest : maths::CKMeansFast { public: - typedef typename maths::CKMeansFast::TBoundingBox TBoundingBox; - typedef typename maths::CKMeansFast::CKdTreeNodeData TKdTreeNodeData; - typedef typename maths::CKMeansFast::SDataPropagator TDataPropagator; - typedef typename maths::CKMeansFast::CCentreFilter TCentreFilter; - typedef typename maths::CKMeansFast::CCentroidComputer TCentroidComputer; - typedef typename maths::CKMeansFast::CClosestPointsCollector TClosestPointsCollector; + using TBoundingBox = typename maths::CKMeansFast::TBoundingBox; + using TKdTreeNodeData = typename maths::CKMeansFast::CKdTreeNodeData; + using TDataPropagator = typename maths::CKMeansFast::SDataPropagator; + using TCentreFilter = typename maths::CKMeansFast::CCentreFilter; + using TCentroidComputer = typename maths::CKMeansFast::CCentroidComputer; + using TClosestPointsCollector = typename maths::CKMeansFast::CClosestPointsCollector; }; } -typedef std::vector TDoubleVec; -typedef maths::CVectorNx1 TVector2; -typedef std::vector TVector2Vec; -typedef std::vector TVector2VecVec; -typedef maths::CSymmetricMatrixNxN TMatrix2; -typedef std::vector TMatrix2Vec; -typedef maths::CVectorNx1 TVector4; -typedef std::vector TVector4Vec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMean2Accumulator; -typedef std::vector TMean2AccumulatorVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMean4Accumulator; -typedef std::vector TMean4AccumulatorVec; +using TDoubleVec = std::vector; +using TVector2 = maths::CVectorNx1; +using TVector2Vec = std::vector; +using TVector2VecVec = std::vector; +using TMatrix2 = maths::CSymmetricMatrixNxN; +using TMatrix2Vec = std::vector; +using TVector4 = maths::CVectorNx1; +using TVector4Vec = std::vector; +using TMean2Accumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMean2AccumulatorVec = std::vector; +using TMean4Accumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMean4AccumulatorVec = std::vector; namespace { @@ -55,9 +55,9 @@ namespace template struct SKdTreeDataInvariantsChecker { - typedef typename CKMeansFastForTest::TKdTreeNodeData TData; - typedef typename maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef typename CKMeansFastForTest::TBoundingBox TBoundingBox; + using TData = typename CKMeansFastForTest::TKdTreeNodeData; + using TMeanAccumulator = typename maths::CBasicStatistics::SSampleMean::TAccumulator; + using TBoundingBox = typename CKMeansFastForTest::TBoundingBox; void operator()(const typename maths::CKdTree::SNode &node) const { @@ -87,10 +87,10 @@ template class CCentreFilterChecker { public: - typedef std::vector TSizeVec; - typedef std::vector TPointVec; - typedef typename CKMeansFastForTest::TKdTreeNodeData TData; - typedef typename CKMeansFastForTest::TCentreFilter TCentreFilter; + using TSizeVec = std::vector; + using TPointVec = std::vector; + using TData = typename CKMeansFastForTest::TKdTreeNodeData; + using TCentreFilter = typename CKMeansFastForTest::TCentreFilter; public: CCentreFilterChecker(const TPointVec ¢res, @@ -102,7 +102,7 @@ class CCentreFilterChecker bool operator()(const typename maths::CKdTree::SNode &node) const { - typedef std::pair TDoubleSizePr; + using TDoubleSizePr = std::pair; m_CentreFilter.prune(node.boundingBox()); const TSizeVec &filtered = m_CentreFilter.filter(); @@ -156,7 +156,7 @@ bool kmeans(const std::vector &points, std::size_t iterations, std::vector ¢res) { - typedef typename maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumlator; + using TMeanAccumlator = typename maths::CBasicStatistics::SSampleMean::TAccumulator; std::vector centroids; for (std::size_t i = 0u; i < iterations; ++i) @@ -422,8 +422,8 @@ void CKMeansFastTest::testClosestPoints(void) // Check the obvious invariant that the closest point to each // centre is closer to that centre than any other. - typedef std::vector TVector2VecVec; - typedef std::vector TVector4VecVec; + using TVector2VecVec = std::vector; + using TVector4VecVec = std::vector; test::CRandomNumbers rng; @@ -560,9 +560,9 @@ void CKMeansFastTest::testRunWithSphericalClusters(void) // same result working with clusters of points or their // spherical cluster representation. - typedef maths::CSphericalCluster::Type TSphericalCluster2; - typedef std::vector TSphericalCluster2Vec; - typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVar2Accumulator; + using TSphericalCluster2 = maths::CSphericalCluster::Type; + using TSphericalCluster2Vec = std::vector; + using TMeanVar2Accumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; double means[][2] = { @@ -652,9 +652,9 @@ void CKMeansFastTest::testPlusPlus(void) // clusters present in the data and generally results in lower // square residuals of the points from the cluster centres. - typedef std::vector TSizeVec; - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef TVector2Vec::const_iterator TVector2VecCItr; + using TSizeVec = std::vector; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; + using TVector2VecCItr = TVector2Vec::const_iterator; maths::CSampling::seed(); diff --git a/lib/maths/unittest/CKMeansOnlineTest.cc b/lib/maths/unittest/CKMeansOnlineTest.cc index 44eb8338d4..22ac4838e9 100644 --- a/lib/maths/unittest/CKMeansOnlineTest.cc +++ b/lib/maths/unittest/CKMeansOnlineTest.cc @@ -23,26 +23,26 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; -typedef std::vector TSizeVecVec; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; -typedef maths::CVectorNx1 TVector2; -typedef std::vector TVector2Vec; -typedef std::vector TVector2VecVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMean2Accumulator; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVar2Accumulator; -typedef maths::CVectorNx1 TVector5; -typedef std::vector TVector5Vec; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVar5Accumulator; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; +using TSizeVecVec = std::vector; +using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; +using TVector2 = maths::CVectorNx1; +using TVector2Vec = std::vector; +using TVector2VecVec = std::vector; +using TMean2Accumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMeanVar2Accumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; +using TVector5 = maths::CVectorNx1; +using TVector5Vec = std::vector; +using TMeanVar5Accumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; template class CKMeansOnlineTestForTest : public maths::CKMeansOnline { public: - typedef typename maths::CKMeansOnline::TSphericalClusterVec TSphericalClusterVec; - typedef typename maths::CKMeansOnline::TDoubleMeanVarAccumulator TDoubleMeanVarAccumulator; - typedef typename maths::CKMeansOnline::TFloatMeanAccumulatorDoublePr TFloatMeanAccumulatorDoublePr; + using TSphericalClusterVec = typename maths::CKMeansOnline::TSphericalClusterVec; + using TDoubleMeanVarAccumulator = typename maths::CKMeansOnline::TDoubleMeanVarAccumulator; + using TFloatMeanAccumulatorDoublePr = typename maths::CKMeansOnline::TFloatMeanAccumulatorDoublePr; public: CKMeansOnlineTestForTest(std::size_t k, double decayRate = 0.0) : @@ -130,7 +130,7 @@ void CKMeansOnlineTest::testAdd(void) // Test that we correctly compute the mean and spherical // variance. - typedef std::pair TMean2AccumulatorDoublePr; + using TMean2AccumulatorDoublePr = std::pair; test::CRandomNumbers rng; @@ -422,7 +422,7 @@ void CKMeansOnlineTest::testSplit(void) // Test that the clusters are divided amoung the clusterers // in the split as expected. - typedef std::vector > TKMeansOnline2Vec; + using TKMeansOnline2Vec = std::vector>; test::CRandomNumbers rng; @@ -635,7 +635,7 @@ void CKMeansOnlineTest::testSample(void) // exactly the points we have added and for a large number // of samples we sample the modes of the mixture correctly. - typedef maths::CSymmetricMatrixNxN TMatrix2; + using TMatrix2 = maths::CSymmetricMatrixNxN; maths::CSampling::seed(); diff --git a/lib/maths/unittest/CKMostCorrelatedTest.cc b/lib/maths/unittest/CKMostCorrelatedTest.cc index b7ac0f1380..f84f299f69 100644 --- a/lib/maths/unittest/CKMostCorrelatedTest.cc +++ b/lib/maths/unittest/CKMostCorrelatedTest.cc @@ -29,21 +29,21 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; -typedef maths::CVectorNx1 TVector2; -typedef std::vector TVector2Vec; -typedef maths::CSymmetricMatrixNxN TMatrix2; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; +using TDoubleVec = std::vector; +using TVector2 = maths::CVectorNx1; +using TVector2Vec = std::vector; +using TMatrix2 = maths::CSymmetricMatrixNxN; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; class CKMostCorrelatedForTest : public maths::CKMostCorrelated { public: - typedef maths::CKMostCorrelated::SCorrelation TCorrelation; - typedef maths::CKMostCorrelated::TCorrelationVec TCorrelationVec; - typedef maths::CKMostCorrelated::TSizeVectorPackedBitVectorPrUMap TSizeVectorPackedBitVectorPrUMap; - typedef maths::CKMostCorrelated::TSizeVectorPackedBitVectorPrUMapCItr TSizeVectorPackedBitVectorPrUMapCItr; - typedef maths::CKMostCorrelated::TMeanVarAccumulatorVec TMeanVarAccumulatorVec; + using TCorrelation = maths::CKMostCorrelated::SCorrelation; + using TCorrelationVec = maths::CKMostCorrelated::TCorrelationVec; + using TSizeVectorPackedBitVectorPrUMap = maths::CKMostCorrelated::TSizeVectorPackedBitVectorPrUMap; + using TSizeVectorPackedBitVectorPrUMapCItr = maths::CKMostCorrelated::TSizeVectorPackedBitVectorPrUMapCItr; + using TMeanVarAccumulatorVec = maths::CKMostCorrelated::TMeanVarAccumulatorVec; using maths::CKMostCorrelated::mostCorrelated; using maths::CKMostCorrelated::correlations; @@ -125,9 +125,9 @@ void estimateCorrelation(const std::size_t trials, const TMatrix2 &covariance, TMeanVarAccumulator &correlationEstimate) { - typedef maths::CVectorNx1 TVector10; - typedef std::vector TVector10Vec; - typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVar2Accumulator; + using TVector10 = maths::CVectorNx1; + using TVector10Vec = std::vector; + using TMeanVar2Accumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; test::CRandomNumbers rng; @@ -256,7 +256,7 @@ void CKMostCorrelatedTest::testNextProjection(void) // Test that aging happens correctly and that the projections // are have low mutual information. - typedef std::vector TDoubleVecVec; + using TDoubleVecVec = std::vector; maths::CSampling::seed(); @@ -398,7 +398,7 @@ void CKMostCorrelatedTest::testMostCorrelated(void) // Check the variables with the highest estimated correlation emerge. - typedef maths::CBasicStatistics::COrderStatisticsHeap TMaxCorrelationAccumulator; + using TMaxCorrelationAccumulator = maths::CBasicStatistics::COrderStatisticsHeap; maths::CSampling::seed(); @@ -802,8 +802,8 @@ void CKMostCorrelatedTest::testScale(void) // Test runtime is approximately linear in the number of variables // if we look for O(number of variables) correlations. - typedef std::vector TSizeVec; - typedef std::vector TDoubleVecVec; + using TSizeVec = std::vector; + using TDoubleVecVec = std::vector; maths::CSampling::seed(); @@ -880,7 +880,7 @@ void CKMostCorrelatedTest::testScale(void) LOG_DEBUG("elapsed time = " << elapsed[s] << "ms"); - //std::vector > pairs; + //std::vector> pairs; //mostCorrelated.mostCorrelated(n[s] / 2, pairs); //LOG_DEBUG("pairs = " << core::CContainerPrinter::print(pairs)); //TDoubleVec correlations; diff --git a/lib/maths/unittest/CKdTreeTest.cc b/lib/maths/unittest/CKdTreeTest.cc index f3ccbd1507..c9beb3c0bc 100644 --- a/lib/maths/unittest/CKdTreeTest.cc +++ b/lib/maths/unittest/CKdTreeTest.cc @@ -20,13 +20,13 @@ using namespace ml; -typedef std::vector TDoubleVec; -typedef maths::CVectorNx1 TVector2; -typedef std::pair TDoubleVector2Pr; -typedef std::vector TVector2Vec; -typedef maths::CVectorNx1 TVector5; -typedef std::pair TDoubleVector5Pr; -typedef std::vector TVector5Vec; +using TDoubleVec = std::vector; +using TVector2 = maths::CVectorNx1; +using TDoubleVector2Pr = std::pair; +using TVector2Vec = std::vector; +using TVector5 = maths::CVectorNx1; +using TDoubleVector5Pr = std::pair; +using TVector5Vec = std::vector; template std::string print(const T &t) @@ -118,10 +118,8 @@ void CKdTreeTest::testNearestNeighbour(void) } for (std::size_t j = 0u; j < tests.size(); ++j) { - typedef maths::CBasicStatistics::COrderStatisticsStack< - TDoubleVector2Pr, - 1, - maths::COrderings::SFirstLess> TMinAccumulator; + using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsStack< + TDoubleVector2Pr, 1, maths::COrderings::SFirstLess>; TMinAccumulator expectedNearest; for (std::size_t k = 0u; k < points.size(); ++k) diff --git a/lib/maths/unittest/CLassoLogisticRegressionTest.cc b/lib/maths/unittest/CLassoLogisticRegressionTest.cc index 1798369440..69df244e42 100644 --- a/lib/maths/unittest/CLassoLogisticRegressionTest.cc +++ b/lib/maths/unittest/CLassoLogisticRegressionTest.cc @@ -25,11 +25,11 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; -typedef std::pair TSizeSizePr; -typedef std::pair TSizeSizePrDoublePr; -typedef std::vector TSizeSizePrDoublePrVec; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; +using TSizeSizePr = std::pair; +using TSizeSizePrDoublePr = std::pair; +using TSizeSizePrDoublePrVec = std::vector; template void initializeMatrix(const ARRAY &x_, TDoubleVecVec &x) diff --git a/lib/maths/unittest/CLinearAlgebraTest.cc b/lib/maths/unittest/CLinearAlgebraTest.cc index de870e9696..e3dc6fc0c4 100644 --- a/lib/maths/unittest/CLinearAlgebraTest.cc +++ b/lib/maths/unittest/CLinearAlgebraTest.cc @@ -19,8 +19,8 @@ using namespace ml; -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; void CLinearAlgebraTest::testSymmetricMatrixNxN(void) { @@ -1088,7 +1088,7 @@ void CLinearAlgebraTest::testSampleGaussian(void) + 5.0 * maths::CSymmetricMatrixNxN(maths::E_OuterProduct, e2 / e2.euclidean()) + 5.0 * maths::CSymmetricMatrixNxN(maths::E_OuterProduct, e3 / e3.euclidean())); - std::vector > samples; + std::vector> samples; maths::sampleGaussian(100, mean, covariance, samples); CPPUNIT_ASSERT_EQUAL(std::size_t(99), samples.size()); @@ -1139,7 +1139,7 @@ void CLinearAlgebraTest::testSampleGaussian(void) + 5.0 * maths::CSymmetricMatrixNxN(maths::E_OuterProduct, e3 / e3.euclidean()) + 2.0 * maths::CSymmetricMatrixNxN(maths::E_OuterProduct, e4 / e4.euclidean())); - std::vector > samples; + std::vector> samples; maths::sampleGaussian(100, mean, covariance, samples); CPPUNIT_ASSERT_EQUAL(std::size_t(100), samples.size()); @@ -1271,7 +1271,7 @@ void CLinearAlgebraTest::testProjected(void) LOG_DEBUG("| CLinearAlgebraTest::testProjected |"); LOG_DEBUG("+-------------------------------------+"); - typedef std::vector TSizeVec; + using TSizeVec = std::vector; const double m[][5] = { diff --git a/lib/maths/unittest/CLogNormalMeanPrecConjugateTest.cc b/lib/maths/unittest/CLogNormalMeanPrecConjugateTest.cc index feb8e6086b..6e6a6680f3 100644 --- a/lib/maths/unittest/CLogNormalMeanPrecConjugateTest.cc +++ b/lib/maths/unittest/CLogNormalMeanPrecConjugateTest.cc @@ -38,12 +38,12 @@ using namespace handy_typedefs; namespace { -typedef std::vector TDoubleVec; -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleDoublePrVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; -typedef CPriorTestInterfaceMixin CLogNormalMeanPrecConjugate; +using TDoubleVec = std::vector; +using TDoubleDoublePr = std::pair; +using TDoubleDoublePrVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; +using CLogNormalMeanPrecConjugate = CPriorTestInterfaceMixin; CLogNormalMeanPrecConjugate makePrior(maths_t::EDataType dataType = maths_t::E_ContinuousData, const double &offset = 0.0, @@ -63,7 +63,7 @@ void CLogNormalMeanPrecConjugateTest::testMultipleUpdate(void) // Test that we get the same result updating once with a vector of 100 // samples of an R.V. versus updating individually 100 times. - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; const maths_t::EDataType dataTypes[] = { @@ -1073,7 +1073,7 @@ void CLogNormalMeanPrecConjugateTest::testAnomalyScore(void) // 1) high probability of detecting the anomalies, and // 2) a very low rate of false positives. - typedef std::vector TUIntVec; + using TUIntVec = std::vector; const double decayRates[] = { 0.0, 0.001, 0.01 }; @@ -1268,7 +1268,7 @@ void CLogNormalMeanPrecConjugateTest::testOffset(void) CPPUNIT_ASSERT_DOUBLES_EQUAL(probability1, probability2, eps); } - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_AbsoluteTolerance, eps); CPPUNIT_ASSERT(filter1.equalTolerance(filter2, equal)); } @@ -1317,7 +1317,7 @@ void CLogNormalMeanPrecConjugateTest::testIntegerData(void) filter2.addSamples(sample); } - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_RelativeTolerance, 0.01); CPPUNIT_ASSERT(filter1.equalTolerance(filter2, equal)); @@ -1911,7 +1911,7 @@ void CLogNormalMeanPrecConjugateTest::testNegativeSample(void) CPPUNIT_ASSERT_EQUAL(filter1.numberSamples(), filter2.numberSamples()); - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_RelativeTolerance, 0.1); CPPUNIT_ASSERT(filter1.equalTolerance(filter2, equal)); } diff --git a/lib/maths/unittest/CLogTDistributionTest.cc b/lib/maths/unittest/CLogTDistributionTest.cc index 732edc4ca1..0f661d9209 100644 --- a/lib/maths/unittest/CLogTDistributionTest.cc +++ b/lib/maths/unittest/CLogTDistributionTest.cc @@ -20,9 +20,9 @@ using namespace ml; using namespace maths; using namespace test; -typedef std::vector TDoubleVec; -typedef TDoubleVec::iterator TDoubleVecItr; -typedef TDoubleVec::const_iterator TDoubleVecCItr; +using TDoubleVec = std::vector; +using TDoubleVecItr = TDoubleVec::iterator; +using TDoubleVecCItr = TDoubleVec::const_iterator; void CLogTDistributionTest::testMode(void) { diff --git a/lib/maths/unittest/CMathsFuncsTest.cc b/lib/maths/unittest/CMathsFuncsTest.cc index f4b5b21acc..7ccededdf6 100644 --- a/lib/maths/unittest/CMathsFuncsTest.cc +++ b/lib/maths/unittest/CMathsFuncsTest.cc @@ -50,7 +50,7 @@ void CMathsFuncsTest::testIsInf(void) void CMathsFuncsTest::testIsFinite(void) { - typedef std::vector TDoubleVec; + using TDoubleVec = std::vector; CPPUNIT_ASSERT(maths::CMathsFuncs::isFinite(0.0)); CPPUNIT_ASSERT(maths::CMathsFuncs::isFinite(1.3e7)); diff --git a/lib/maths/unittest/CMathsMemoryTest.cc b/lib/maths/unittest/CMathsMemoryTest.cc index 9a70455dd6..4459a9dfe5 100644 --- a/lib/maths/unittest/CMathsMemoryTest.cc +++ b/lib/maths/unittest/CMathsMemoryTest.cc @@ -128,7 +128,7 @@ void CMathsMemoryTest::testPriors(void) void CMathsMemoryTest::testBjkstVec(void) { - typedef std::vector TBjkstValuesVec; + using TBjkstValuesVec = std::vector; { // Test empty TBjkstValuesVec values; diff --git a/lib/maths/unittest/CMixtureDistributionTest.cc b/lib/maths/unittest/CMixtureDistributionTest.cc index e28369583f..bed0420a78 100644 --- a/lib/maths/unittest/CMixtureDistributionTest.cc +++ b/lib/maths/unittest/CMixtureDistributionTest.cc @@ -19,10 +19,10 @@ using namespace ml; using namespace maths; using namespace test; -typedef std::vector TDoubleVec; -typedef std::vector > TNormalVec; -typedef std::vector > TLogNormalVec; -typedef std::vector > TGammaVec; +using TDoubleVec = std::vector; +using TNormalVec = std::vector>; +using TLogNormalVec = std::vector>; +using TGammaVec = std::vector>; void CMixtureDistributionTest::testSupport(void) { @@ -39,7 +39,7 @@ void CMixtureDistributionTest::testSupport(void) TNormalVec modes; modes.push_back(n1); modes.push_back(n2); - CMixtureDistribution > mixture(weights, modes); + CMixtureDistribution> mixture(weights, modes); CPPUNIT_ASSERT_EQUAL(core::CContainerPrinter::print(boost::math::support(n1)), core::CContainerPrinter::print(support(mixture))); } @@ -52,7 +52,7 @@ void CMixtureDistributionTest::testSupport(void) TLogNormalVec modes; modes.push_back(l1); modes.push_back(l2); - CMixtureDistribution > mixture(weights, modes); + CMixtureDistribution> mixture(weights, modes); CPPUNIT_ASSERT_EQUAL(core::CContainerPrinter::print(boost::math::support(l1)), core::CContainerPrinter::print(support(mixture))); } @@ -98,7 +98,7 @@ void CMixtureDistributionTest::testMode(void) TNormalVec modes; modes.push_back(n1); modes.push_back(n2); - CMixtureDistribution > mixture(weights, modes); + CMixtureDistribution> mixture(weights, modes); double x = mode(mixture); @@ -132,7 +132,7 @@ void CMixtureDistributionTest::testMode(void) modes.push_back(n1); modes.push_back(n2); modes.push_back(n3); - CMixtureDistribution > mixture(weights, modes); + CMixtureDistribution> mixture(weights, modes); double x = mode(mixture); @@ -161,7 +161,7 @@ void CMixtureDistributionTest::testMode(void) TLogNormalVec modes; modes.push_back(l1); modes.push_back(l2); - CMixtureDistribution > mixture(weights, modes); + CMixtureDistribution> mixture(weights, modes); double x = mode(mixture); @@ -249,7 +249,7 @@ void CMixtureDistributionTest::testPdf(void) TNormalVec modes; modes.push_back(n1); modes.push_back(n2); - CMixtureDistribution > mixture(w, modes); + CMixtureDistribution> mixture(w, modes); for (unsigned int p = 1; p < 100; ++p) { @@ -339,7 +339,7 @@ void CMixtureDistributionTest::testCdf(void) TGammaVec modes; modes.push_back(g1); modes.push_back(g2); - CMixtureDistribution > mixture(w, modes); + CMixtureDistribution> mixture(w, modes); // Check the data percentiles. for (unsigned int p = 1; p < 100; ++p) @@ -409,7 +409,7 @@ void CMixtureDistributionTest::testQuantile(void) modes.push_back(l1); modes.push_back(l2); modes.push_back(l3); - CMixtureDistribution > mixture(w, modes); + CMixtureDistribution> mixture(w, modes); for (unsigned int p = 1; p < 100; ++p) { diff --git a/lib/maths/unittest/CMultimodalPriorTest.cc b/lib/maths/unittest/CMultimodalPriorTest.cc index b6351149e4..d819d7f340 100644 --- a/lib/maths/unittest/CMultimodalPriorTest.cc +++ b/lib/maths/unittest/CMultimodalPriorTest.cc @@ -42,15 +42,15 @@ using namespace handy_typedefs; namespace { -typedef std::vector TDoubleVec; -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleDoublePrVec; -typedef boost::shared_ptr TPriorPtr; -typedef CPriorTestInterfaceMixin CGammaRateConjugate; -typedef CPriorTestInterfaceMixin CLogNormalMeanPrecConjugate; -typedef CPriorTestInterfaceMixin CNormalMeanPrecConjugate; -typedef CPriorTestInterfaceMixin CMultimodalPrior; -typedef CPriorTestInterfaceMixin COneOfNPrior; +using TDoubleVec = std::vector; +using TDoubleDoublePr = std::pair; +using TDoubleDoublePrVec = std::vector; +using TPriorPtr = boost::shared_ptr; +using CGammaRateConjugate = CPriorTestInterfaceMixin; +using CLogNormalMeanPrecConjugate = CPriorTestInterfaceMixin; +using CNormalMeanPrecConjugate = CPriorTestInterfaceMixin; +using CMultimodalPrior = CPriorTestInterfaceMixin; +using COneOfNPrior = CPriorTestInterfaceMixin; //! Make the default mode prior. COneOfNPrior makeModePrior(const double &decayRate = 0.0) @@ -140,7 +140,7 @@ void probabilityOfLessLikelySample(const maths::CMixtureDistribution &mixture double &probability, double &deviation) { - typedef typename maths::CMixtureDistribution::TModeVec TModeVec; + using TModeVec = typename maths::CMixtureDistribution::TModeVec; static const double NUMBER_SAMPLES = 10000.0; @@ -229,7 +229,7 @@ void CMultimodalPriorTest::testPropagation(void) // mean and the marginal likelihood confidence intervals increase // (due to influence of the prior uncertainty) after propagation. - typedef std::pair TDoubleDoublePr; + using TDoubleDoublePr = std::pair; double eps = 0.01; @@ -300,7 +300,7 @@ void CMultimodalPriorTest::testSingleMode(void) // that the generating distribution doesn't necessarily have // a larger likelihood because we are using a finite sample. - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; test::CRandomNumbers rng; @@ -464,7 +464,7 @@ void CMultimodalPriorTest::testMultipleModes(void) // have a larger likelihood because we are using a finite // sample. - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; test::CRandomNumbers rng; @@ -759,7 +759,7 @@ void CMultimodalPriorTest::testMarginalLikelihood(void) LOG_DEBUG("| CMultimodalPriorTest::testMarginalLikelihood |"); LOG_DEBUG("+------------------------------------------------+"); - typedef std::vector > TNormalVec; + using TNormalVec = std::vector>; // Check that the c.d.f. <= 1 at extreme. { @@ -930,7 +930,7 @@ void CMultimodalPriorTest::testMarginalLikelihood(void) modes.push_back(boost::math::normal_distribution<>(mean1, variance1)); modes.push_back(boost::math::normal_distribution<>(mean2, variance2)); modes.push_back(boost::math::normal_distribution<>(mean3, variance3)); - maths::CMixtureDistribution > f(weights, modes); + maths::CMixtureDistribution> f(weights, modes); double expectedDifferentialEntropy = maths::CTools::differentialEntropy(f); double differentialEntropy = 0.0; @@ -1082,7 +1082,7 @@ void CMultimodalPriorTest::testMarginalLikelihoodConfidenceInterval(void) // Test that marginal likelihood confidence intervals are // what we'd expect for various variance scales. - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; LOG_DEBUG("Synthetic"); { @@ -1220,9 +1220,9 @@ void CMultimodalPriorTest::testSampleMarginalLikelihood(void) // jointLogMarginalLikelihood and minusLogJointCdf so use these // to compute the mean and percentiles. - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; - typedef maths::CBasicStatistics::SSampleMeanVarSkew::TAccumulator TMeanVarSkewAccumulator; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; + using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; + using TMeanVarSkewAccumulator = maths::CBasicStatistics::SSampleMeanVarSkew::TAccumulator; const double eps = 1e-3; @@ -1407,9 +1407,9 @@ void CMultimodalPriorTest::testProbabilityOfLessLikelySamples(void) LOG_DEBUG("| CMultimodalPriorTest::testProbabilityOfLessLikelySamples |"); LOG_DEBUG("+------------------------------------------------------------+"); - typedef std::vector > TNormalVec; - typedef std::vector > TLogNormalVec; - typedef std::vector > TGammaVec; + using TNormalVec = std::vector>; + using TLogNormalVec = std::vector>; + using TGammaVec = std::vector>; test::CRandomNumbers rng; @@ -1437,7 +1437,7 @@ void CMultimodalPriorTest::testProbabilityOfLessLikelySamples(void) TNormalVec modes; modes.push_back(boost::math::normal_distribution<>(mean1, variance1)); modes.push_back(boost::math::normal_distribution<>(mean2, variance2)); - maths::CMixtureDistribution > mixture(weights, modes); + maths::CMixtureDistribution> mixture(weights, modes); CMultimodalPrior filter(makePrior()); filter.addSamples(samples); @@ -1524,7 +1524,7 @@ void CMultimodalPriorTest::testProbabilityOfLessLikelySamples(void) modes.push_back(boost::math::lognormal_distribution<>(locations[0], ::sqrt(squareScales[0]))); modes.push_back(boost::math::lognormal_distribution<>(locations[1], ::sqrt(squareScales[1]))); modes.push_back(boost::math::lognormal_distribution<>(locations[2], ::sqrt(squareScales[2]))); - maths::CMixtureDistribution > mixture(mixtureWeights, modes); + maths::CMixtureDistribution> mixture(mixtureWeights, modes); CMultimodalPrior filter(makePrior()); filter.addSamples(samples); @@ -1586,7 +1586,7 @@ void CMultimodalPriorTest::testProbabilityOfLessLikelySamples(void) TGammaVec modes; modes.push_back(boost::math::gamma_distribution<>(shapes[0], scales[0])); modes.push_back(boost::math::gamma_distribution<>(shapes[1], scales[1])); - maths::CMixtureDistribution > mixture(mixtureWeights, modes); + maths::CMixtureDistribution> mixture(mixtureWeights, modes); CMultimodalPrior filter(makePrior()); filter.addSamples(samples); diff --git a/lib/maths/unittest/CMultinomialConjugateTest.cc b/lib/maths/unittest/CMultinomialConjugateTest.cc index b90a57931b..abc86dcbe9 100644 --- a/lib/maths/unittest/CMultinomialConjugateTest.cc +++ b/lib/maths/unittest/CMultinomialConjugateTest.cc @@ -33,12 +33,12 @@ using namespace ml; using namespace handy_typedefs; -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; -typedef std::vector TUIntVec; -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleDoublePrVec; -typedef CPriorTestInterfaceMixin CMultinomialConjugate; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; +using TUIntVec = std::vector; +using TDoubleDoublePr = std::pair; +using TDoubleDoublePrVec = std::vector; +using CMultinomialConjugate = CPriorTestInterfaceMixin; void CMultinomialConjugateTest::testMultipleUpdate(void) { @@ -68,7 +68,7 @@ void CMultinomialConjugateTest::testMultipleUpdate(void) } filter2.addSamples(samples); - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_AbsoluteTolerance, 1e-5); CPPUNIT_ASSERT(filter1.equalTolerance(filter2, equal)); } @@ -110,7 +110,7 @@ void CMultinomialConjugateTest::testPropagation(void) << ", propagatedExpectedProbabilities = " << core::CContainerPrinter::print(propagatedExpectedProbabilities)); - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_AbsoluteTolerance, 1e-12); CPPUNIT_ASSERT(std::equal(expectedProbabilities.begin(), expectedProbabilities.end(), @@ -518,8 +518,8 @@ void CMultinomialConjugateTest::testProbabilityOfLessLikelySamples(void) LOG_DEBUG("| CMultinomialConjugateTest::testProbabilityOfLessLikelySamples |"); LOG_DEBUG("+-----------------------------------------------------------------+"); - typedef std::pair TDoubleSizePr; - typedef std::vector TDoubleSizePrVec; + using TDoubleSizePr = std::pair; + using TDoubleSizePrVec = std::vector; // We test the definition of the various sided calculations: // - one sided below: P(R) = P(y <= x) @@ -711,10 +711,10 @@ void CMultinomialConjugateTest::testProbabilityOfLessLikelySamples(void) } } { - typedef std::map TDoubleDoubleVecMap; - typedef TDoubleDoubleVecMap::const_iterator TDoubleDoubleVecMapCItr; - typedef std::map TDoubleVecDoubleMap; - typedef TDoubleVecDoubleMap::const_iterator TDoubleVecDoubleMapCItr; + using TDoubleDoubleVecMap = std::map; + using TDoubleDoubleVecMapCItr = TDoubleDoubleVecMap::const_iterator; + using TDoubleVecDoubleMap = std::map; + using TDoubleVecDoubleMapCItr = TDoubleVecDoubleMap::const_iterator; double categoryProbabilities[] = { 0.10, 0.12, 0.29, 0.39, 0.04, 0.06 }; TDoubleDoubleVecMap categoryPairProbabilities; diff --git a/lib/maths/unittest/CMultivariateMultimodalPriorTest.cc b/lib/maths/unittest/CMultivariateMultimodalPriorTest.cc index df34dc0ab0..2ff50dc905 100644 --- a/lib/maths/unittest/CMultivariateMultimodalPriorTest.cc +++ b/lib/maths/unittest/CMultivariateMultimodalPriorTest.cc @@ -27,13 +27,13 @@ using namespace ml; using namespace handy_typedefs; -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; -typedef std::vector TDoubleVecVecVec; -typedef std::vector TSizeVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMean2Accumulator; -typedef maths::CBasicStatistics::SSampleCovariances TCovariances2; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; +using TDoubleVecVecVec = std::vector; +using TSizeVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMean2Accumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TCovariances2 = maths::CBasicStatistics::SSampleCovariances; namespace { @@ -47,8 +47,8 @@ template class CMultivariateMultimodalPriorForTest : public maths::CMultivariateMultimodalPrior { public: - typedef typename maths::CMultivariateMultimodalPrior::TClusterer TClusterer; - typedef typename maths::CMultivariateMultimodalPrior::TModeVec TModeVec; + using TClusterer = typename maths::CMultivariateMultimodalPrior::TClusterer; + using TModeVec = typename maths::CMultivariateMultimodalPrior::TModeVec; public: CMultivariateMultimodalPriorForTest(const maths::CMultivariateMultimodalPrior &prior) : @@ -476,7 +476,7 @@ void CMultivariateMultimodalPriorTest::testSplitAndMerge(void) // Test clustering which changes over time. - typedef std::vector TDoubleVecVecVec; + using TDoubleVecVecVec = std::vector; maths::CSampling::seed(); @@ -818,7 +818,7 @@ void CMultivariateMultimodalPriorTest::testMarginalLikelihoodMode(void) // Test that the sample mode is close to the generating distribution mode. - typedef maths::CBasicStatistics::COrderStatisticsStack > TMaxAccumulator; + using TMaxAccumulator = maths::CBasicStatistics::COrderStatisticsStack>; maths::CSampling::seed(); @@ -1133,8 +1133,8 @@ void CMultivariateMultimodalPriorTest::testLatLongData(void) LOG_DEBUG("| CMultivariateMultimodalPriorTest::testLatLongData |"); LOG_DEBUG("+-----------------------------------------------------+"); - typedef std::pair TTimeDoubleVecPr; - typedef std::vector TTimeDoubleVecPrVec; + using TTimeDoubleVecPr = std::pair; + using TTimeDoubleVecPrVec = std::vector; TTimeDoubleVecPrVec timeseries; CPPUNIT_ASSERT(test::CTimeSeriesTestData::parse("testfiles/lat_lng.csv", diff --git a/lib/maths/unittest/CMultivariateNormalConjugateTest.cc b/lib/maths/unittest/CMultivariateNormalConjugateTest.cc index 64465f005d..2aebd8955d 100644 --- a/lib/maths/unittest/CMultivariateNormalConjugateTest.cc +++ b/lib/maths/unittest/CMultivariateNormalConjugateTest.cc @@ -22,11 +22,11 @@ using namespace ml; using namespace handy_typedefs; -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleDoublePrVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; +using TDoubleDoublePr = std::pair; +using TDoubleDoublePrVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; namespace { @@ -1080,8 +1080,8 @@ void CMultivariateNormalConjugateTest::calibrationExperiment(void) LOG_DEBUG("| CMultivariateNormalConjugateTest::calibrationExperiment |"); LOG_DEBUG("+-----------------------------------------------------------+"); - typedef maths::CVectorNx1 TVector10; - typedef maths::CSymmetricMatrixNxN TMatrix10; + using TVector10 = maths::CVectorNx1; + using TMatrix10 = maths::CSymmetricMatrixNxN; double means[] = { 10.0, 10.0, 20.0, 20.0, 30.0, 20.0, 10.0, 40.0, 30.0, 20.0 }; double covariances[] = { 10.0, diff --git a/lib/maths/unittest/CMultivariateOneOfNPriorTest.cc b/lib/maths/unittest/CMultivariateOneOfNPriorTest.cc index 0220944a71..3424d23d5a 100644 --- a/lib/maths/unittest/CMultivariateOneOfNPriorTest.cc +++ b/lib/maths/unittest/CMultivariateOneOfNPriorTest.cc @@ -34,11 +34,11 @@ using namespace handy_typedefs; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; -typedef maths::CMultivariateOneOfNPrior::TPriorPtr TPriorPtr; -typedef maths::CMultivariateOneOfNPrior::TPriorPtrVec TPriorPtrVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; +using TPriorPtr = maths::CMultivariateOneOfNPrior::TPriorPtr; +using TPriorPtrVec = maths::CMultivariateOneOfNPrior::TPriorPtrVec; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; const maths_t::TWeightStyleVec COUNT_WEIGHT(1, maths_t::E_SampleCountWeight); const maths_t::TWeightStyleVec VARIANCE_WEIGHT(1, maths_t::E_SampleCountVarianceScaleWeight); @@ -351,7 +351,7 @@ void CMultivariateOneOfNPriorTest::testWeightUpdate(void) TDouble10Vec1Vec samples; gaussianSamples(rng, boost::size(n), n, mean, covariance, samples); - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_AbsoluteTolerance, 1e-10); const double decayRates[] = { 0.0, 0.004, 0.04 }; @@ -482,7 +482,7 @@ void CMultivariateOneOfNPriorTest::testMarginalLikelihood(void) // 3) E[(X - m)^2] w.r.t. the marginal likelihood is equal to the predictive // distribution covariance matrix. - typedef std::vector TSizeVec; + using TSizeVec = std::vector; maths::CSampling::seed(); @@ -733,10 +733,10 @@ void CMultivariateOneOfNPriorTest::testMarginalLikelihoodMean(void) // Test that the marginal likelihood mean is close to the sample // mean for a variety of models. - typedef std::vector TSizeVec; - typedef std::vector TSizeVecVec; - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMean2Accumulator; + using TSizeVec = std::vector; + using TSizeVecVec = std::vector; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; + using TMean2Accumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; maths::CSampling::seed(); diff --git a/lib/maths/unittest/CNaturalBreaksClassifierTest.cc b/lib/maths/unittest/CNaturalBreaksClassifierTest.cc index 597a934b35..3f1438116e 100644 --- a/lib/maths/unittest/CNaturalBreaksClassifierTest.cc +++ b/lib/maths/unittest/CNaturalBreaksClassifierTest.cc @@ -26,9 +26,9 @@ using namespace maths; namespace { -typedef std::vector TDoubleVec; -typedef CNaturalBreaksClassifier::TTuple TTuple; -typedef std::vector TTupleVec; +using TDoubleVec = std::vector; +using TTuple = CNaturalBreaksClassifier::TTuple; +using TTupleVec = std::vector; //! Computes the deviation of a category.mac1Password @@ -48,7 +48,7 @@ bool naturalBreaksBranchAndBound(const TTupleVec &categories, std::size_t p, TTupleVec &result) { - typedef std::vector TSizeVec; + using TSizeVec = std::vector; // Find the minimum variance partition. // @@ -568,7 +568,7 @@ void CNaturalBreaksClassifierTest::testSample(void) // the points we have added and for a large number of samples we // sample the modes of the mixture correctly. - typedef CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; + using TMeanVarAccumulator = CBasicStatistics::SSampleMeanVar::TAccumulator; static const double NEG_INF = boost::numeric::bounds::lowest(); static const double POS_INF = boost::numeric::bounds::highest(); diff --git a/lib/maths/unittest/CNormalMeanPrecConjugateTest.cc b/lib/maths/unittest/CNormalMeanPrecConjugateTest.cc index 2cc40857db..9ca7c12965 100644 --- a/lib/maths/unittest/CNormalMeanPrecConjugateTest.cc +++ b/lib/maths/unittest/CNormalMeanPrecConjugateTest.cc @@ -38,12 +38,12 @@ using namespace handy_typedefs; namespace { -typedef std::vector TDoubleVec; -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleDoublePrVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; -typedef CPriorTestInterfaceMixin CNormalMeanPrecConjugate; +using TDoubleVec = std::vector; +using TDoubleDoublePr = std::pair; +using TDoubleDoublePrVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; +using CNormalMeanPrecConjugate = CPriorTestInterfaceMixin; CNormalMeanPrecConjugate makePrior(maths_t::EDataType dataType = maths_t::E_ContinuousData, const double &decayRate = 0.0) @@ -62,7 +62,7 @@ void CNormalMeanPrecConjugateTest::testMultipleUpdate(void) // Test that we get the same result updating once with a vector of 100 // samples of an R.V. versus updating individually 100 times. - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; const maths_t::EDataType dataTypes[] = { @@ -1027,7 +1027,7 @@ void CNormalMeanPrecConjugateTest::testAnomalyScore(void) // 1) high probability of detecting the anomalies, and // 2) a very low rate of false positives. - typedef std::vector TUIntVec; + using TUIntVec = std::vector; const double decayRates[] = { 0.0, 0.001, 0.01 }; @@ -1190,7 +1190,7 @@ void CNormalMeanPrecConjugateTest::testIntegerData(void) filter2.addSamples(sample); } - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_RelativeTolerance, 0.001); CPPUNIT_ASSERT(filter1.equalTolerance(filter2, equal)); diff --git a/lib/maths/unittest/COneOfNPriorTest.cc b/lib/maths/unittest/COneOfNPriorTest.cc index 69966136c5..3ca038f8be 100644 --- a/lib/maths/unittest/COneOfNPriorTest.cc +++ b/lib/maths/unittest/COneOfNPriorTest.cc @@ -44,20 +44,20 @@ using namespace handy_typedefs; namespace { -typedef std::vector TUIntVec; -typedef std::vector TDoubleVec; -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleDoublePrVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef boost::shared_ptr TPriorPtr; -typedef std::vector TPriorPtrVec; -typedef boost::optional TOptionalDouble; -typedef CPriorTestInterfaceMixin CGammaRateConjugate; -typedef CPriorTestInterfaceMixin CLogNormalMeanPrecConjugate; -typedef CPriorTestInterfaceMixin CMultimodalPrior; -typedef CPriorTestInterfaceMixin CNormalMeanPrecConjugate; -typedef CPriorTestInterfaceMixin COneOfNPrior; -typedef CPriorTestInterfaceMixin CPoissonMeanConjugate; +using TUIntVec = std::vector; +using TDoubleVec = std::vector; +using TDoubleDoublePr = std::pair; +using TDoubleDoublePrVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TPriorPtr = boost::shared_ptr; +using TPriorPtrVec = std::vector; +using TOptionalDouble = boost::optional; +using CGammaRateConjugate = CPriorTestInterfaceMixin; +using CLogNormalMeanPrecConjugate = CPriorTestInterfaceMixin; +using CMultimodalPrior = CPriorTestInterfaceMixin; +using CNormalMeanPrecConjugate = CPriorTestInterfaceMixin; +using COneOfNPrior = CPriorTestInterfaceMixin; +using CPoissonMeanConjugate = CPriorTestInterfaceMixin; COneOfNPrior::TPriorPtrVec clone(const TPriorPtrVec &models, const TOptionalDouble &decayRate = TOptionalDouble()) @@ -143,7 +143,7 @@ void COneOfNPriorTest::testMultipleUpdate(void) // Test that we get the same result updating once with a vector of 100 // samples of an R.V. versus updating individually 100 times. - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TPriorPtrVec models; models.push_back(TPriorPtr(maths::CPoissonMeanConjugate::nonInformativePrior().clone())); @@ -241,7 +241,7 @@ void COneOfNPriorTest::testWeights(void) models.push_back(TPriorPtr(CPoissonMeanConjugate::nonInformativePrior().clone())); models.push_back(TPriorPtr(CNormalMeanPrecConjugate::nonInformativePrior(E_ContinuousData).clone())); - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_AbsoluteTolerance, 1e-10); const double decayRates[] = { 0.0, 0.001, 0.01 }; diff --git a/lib/maths/unittest/COrdinalTest.cc b/lib/maths/unittest/COrdinalTest.cc index 6d1701eb94..426e372aae 100644 --- a/lib/maths/unittest/COrdinalTest.cc +++ b/lib/maths/unittest/COrdinalTest.cc @@ -25,7 +25,7 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; +using TDoubleVec = std::vector; template std::string precisePrint(T x) @@ -310,7 +310,7 @@ void COrdinalTest::testHash(void) // Test that hashing works over the full range of the distinct types. - typedef boost::unordered_set TSizeUSet; + using TSizeUSet = boost::unordered_set; test::CRandomNumbers rng; diff --git a/lib/maths/unittest/CPRNGTest.cc b/lib/maths/unittest/CPRNGTest.cc index d64bd789ba..8bb464d9b5 100644 --- a/lib/maths/unittest/CPRNGTest.cc +++ b/lib/maths/unittest/CPRNGTest.cc @@ -32,7 +32,7 @@ void CPRNGTest::testSplitMix64(void) // Test min and max. maths::CBasicStatistics::COrderStatisticsStack min; - maths::CBasicStatistics::COrderStatisticsStack > max; + maths::CBasicStatistics::COrderStatisticsStack> max; for (std::size_t i = 0u; i < 10000; ++i) { uint64_t x = rng1(); @@ -146,7 +146,7 @@ void CPRNGTest::testXorOShiro128Plus(void) // Test min and max. maths::CBasicStatistics::COrderStatisticsStack min; - maths::CBasicStatistics::COrderStatisticsStack > max; + maths::CBasicStatistics::COrderStatisticsStack> max; for (std::size_t i = 0u; i < 10000; ++i) { uint64_t x = rng1(); @@ -278,7 +278,7 @@ void CPRNGTest::testXorShift1024Mult(void) // Test min and max. maths::CBasicStatistics::COrderStatisticsStack min; - maths::CBasicStatistics::COrderStatisticsStack > max; + maths::CBasicStatistics::COrderStatisticsStack> max; for (std::size_t i = 0u; i < 10000; ++i) { uint64_t x = rng1(); diff --git a/lib/maths/unittest/CPackedBitVectorTest.cc b/lib/maths/unittest/CPackedBitVectorTest.cc index 437668617b..fe2f0fdd0d 100644 --- a/lib/maths/unittest/CPackedBitVectorTest.cc +++ b/lib/maths/unittest/CPackedBitVectorTest.cc @@ -21,9 +21,9 @@ using namespace ml; -typedef std::vector TBoolVec; -typedef std::vector TSizeVec; -typedef std::vector TPackedBitVectorVec; +using TBoolVec = std::vector; +using TSizeVec = std::vector; +using TPackedBitVectorVec = std::vector; namespace { @@ -286,8 +286,8 @@ void CPackedBitVectorTest::testInner(void) LOG_DEBUG("| CPackedBitVectorTest::testInner |"); LOG_DEBUG("+-----------------------------------+"); - typedef maths::CVector TVector; - typedef std::vector TVectorVec; + using TVector = maths::CVector; + using TVectorVec = std::vector; maths::CPackedBitVector test1(10, true); maths::CPackedBitVector test2(10, false); @@ -362,7 +362,7 @@ void CPackedBitVectorTest::testBitwiseOr(void) LOG_DEBUG("| CPackedBitVectorTest::testBitwiseOr |"); LOG_DEBUG("+---------------------------------------+"); - typedef std::vector > TBitSetVec; + using TBitSetVec = std::vector>; test::CRandomNumbers rng; diff --git a/lib/maths/unittest/CPoissonMeanConjugateTest.cc b/lib/maths/unittest/CPoissonMeanConjugateTest.cc index ba9e357dbe..0471eede9c 100644 --- a/lib/maths/unittest/CPoissonMeanConjugateTest.cc +++ b/lib/maths/unittest/CPoissonMeanConjugateTest.cc @@ -37,13 +37,13 @@ using namespace handy_typedefs; namespace { -typedef std::vector TUIntVec; -typedef std::vector TDoubleVec; -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleDoublePrVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; -typedef CPriorTestInterfaceMixin CPoissonMeanConjugate; +using TUIntVec = std::vector; +using TDoubleVec = std::vector; +using TDoubleDoublePr = std::pair; +using TDoubleDoublePrVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; +using CPoissonMeanConjugate = CPriorTestInterfaceMixin; } @@ -56,7 +56,7 @@ void CPoissonMeanConjugateTest::testMultipleUpdate(void) // Test that we get the same result updating once with a vector of 100 // samples of an R.V. versus updating individually 100 times. - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; const double rate = 5.0; @@ -970,7 +970,7 @@ void CPoissonMeanConjugateTest::testOffset(void) CPPUNIT_ASSERT_DOUBLES_EQUAL(probability1, probability2, eps); } - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_AbsoluteTolerance, eps); CPPUNIT_ASSERT(filter1.equalTolerance(filter2, equal)); } @@ -1073,7 +1073,7 @@ void CPoissonMeanConjugateTest::testNegativeSample(void) CPPUNIT_ASSERT_EQUAL(filter1.numberSamples(), filter2.numberSamples()); - typedef maths::CEqualWithTolerance TEqual; + using TEqual = maths::CEqualWithTolerance; TEqual equal(maths::CToleranceTypes::E_RelativeTolerance, 0.002); CPPUNIT_ASSERT(filter1.equalTolerance(filter2, equal)); } diff --git a/lib/maths/unittest/CPriorTest.cc b/lib/maths/unittest/CPriorTest.cc index eba2a20926..8b64065411 100644 --- a/lib/maths/unittest/CPriorTest.cc +++ b/lib/maths/unittest/CPriorTest.cc @@ -29,7 +29,7 @@ using namespace handy_typedefs; namespace { -typedef std::vector TDoubleVec; +using TDoubleVec = std::vector; class CX { @@ -59,7 +59,7 @@ class CVariance class CMinusLogLikelihood { public: - typedef std::vector TDoubleVecVec; + using TDoubleVecVec = std::vector; public: CMinusLogLikelihood(const maths::CPrior &prior) : @@ -96,8 +96,8 @@ void CPriorTest::testExpectation(void) LOG_DEBUG("| CPriorTest::testExpectation |"); LOG_DEBUG("+-------------------------------+"); - typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; - typedef CPriorTestInterfaceMixin CNormalMeanPrecConjugate; + using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; + using CNormalMeanPrecConjugate = CPriorTestInterfaceMixin; test::CRandomNumbers rng; diff --git a/lib/maths/unittest/CProbabilityAggregatorsTest.cc b/lib/maths/unittest/CProbabilityAggregatorsTest.cc index c0260a4414..a8f661b6de 100644 --- a/lib/maths/unittest/CProbabilityAggregatorsTest.cc +++ b/lib/maths/unittest/CProbabilityAggregatorsTest.cc @@ -26,7 +26,7 @@ using namespace test; namespace { -typedef std::vector TDoubleVec; +using TDoubleVec = std::vector; class CGammaKernel { @@ -91,7 +91,7 @@ double logUpperIncompleteGamma(double s, double x) class CExpectedLogProbabilityOfMFromNExtremeSamples { public: - typedef CBasicStatistics::COrderStatisticsHeap TMinValueAccumulator; + using TMinValueAccumulator = CBasicStatistics::COrderStatisticsHeap; class CLogIntegrand { @@ -479,7 +479,7 @@ void CProbabilityAggregatorsTest::testProbabilityOfExtremeSample(void) rng.generateNormalSamples(0.0, 1.0, sampleSizes[i], samples); boost::math::normal_distribution<> normal(0.0, ::sqrt(1.0)); - typedef CBasicStatistics::COrderStatisticsStack TMinValue; + using TMinValue = CBasicStatistics::COrderStatisticsStack; TMinValue minValue; for (std::size_t l = 0u; l < samples.size(); ++l) @@ -576,7 +576,7 @@ void CProbabilityAggregatorsTest::testProbabilityOfMFromNExtremeSamples(void) { CPPUNIT_ASSERT(i <= numberProbabilities); - typedef std::vector TSizeVec; + using TSizeVec = std::vector; TSizeVec index(i, 0); for (std::size_t j = 1; j < i; ++j) @@ -626,7 +626,7 @@ void CProbabilityAggregatorsTest::testProbabilityOfMFromNExtremeSamples(void) rng.generateNormalSamples(0.0, 1.0, numberSamples, samples); boost::math::normal_distribution<> normal(0.0, ::sqrt(1.0)); - typedef CBasicStatistics::COrderStatisticsHeap TMinValues; + using TMinValues = CBasicStatistics::COrderStatisticsHeap; TMinValues minValues(i); for (std::size_t k = 0u; k < samples.size(); ++k) diff --git a/lib/maths/unittest/CProbabilityCalibratorTest.cc b/lib/maths/unittest/CProbabilityCalibratorTest.cc index 7264fbba1a..7ec384cc4c 100644 --- a/lib/maths/unittest/CProbabilityCalibratorTest.cc +++ b/lib/maths/unittest/CProbabilityCalibratorTest.cc @@ -29,9 +29,9 @@ void CProbabilityCalibratorTest::testCalibration(void) LOG_DEBUG("| CProbabilityCalibratorTest::testCalibration |"); LOG_DEBUG("+-----------------------------------------------+"); - typedef std::vector TDoubleVec; - typedef CPriorTestInterfaceMixin CLogNormalMeanPrecConjugate; - typedef CPriorTestInterfaceMixin CNormalMeanPrecConjugate; + using TDoubleVec = std::vector; + using CLogNormalMeanPrecConjugate = CPriorTestInterfaceMixin; + using CNormalMeanPrecConjugate = CPriorTestInterfaceMixin; // Test some things which we know will give poorly calibrated // probabilities, i.e. fitting a normal a log-normal and multi- diff --git a/lib/maths/unittest/CQDigestTest.cc b/lib/maths/unittest/CQDigestTest.cc index 2f3332be23..87de28e36b 100644 --- a/lib/maths/unittest/CQDigestTest.cc +++ b/lib/maths/unittest/CQDigestTest.cc @@ -26,9 +26,9 @@ using namespace ml; using namespace maths; using namespace test; -typedef std::vector TDoubleVec; -typedef std::pair TUInt32UInt64Pr; -typedef std::vector TUInt32UInt64PrVec; +using TDoubleVec = std::vector; +using TUInt32UInt64Pr = std::pair; +using TUInt32UInt64PrVec = std::vector; void CQDigestTest::testAdd(void) { @@ -82,7 +82,7 @@ void CQDigestTest::testAdd(void) // Large n uniform random. { - typedef std::multiset TUInt64Set; + using TUInt64Set = std::multiset; const double expectedMaxErrors[] = { 0.007, 0.01, 0.12, 0.011, 0.016, 0.018, 0.023, 0.025, 0.02 }; @@ -309,7 +309,7 @@ void CQDigestTest::testPropagateForwardByTime(void) LOG_DEBUG("| CQDigestTest::testPropagateForwardByTime |"); LOG_DEBUG("+--------------------------------------------+"); - typedef CBasicStatistics::SSampleMean::TAccumulator TMeanAccumlator; + using TMeanAccumlator = CBasicStatistics::SSampleMean::TAccumulator; { // Check a simple case where exact aging is possible. diff --git a/lib/maths/unittest/CQuantileSketchTest.cc b/lib/maths/unittest/CQuantileSketchTest.cc index 1d4ae3608c..5316c70e9b 100644 --- a/lib/maths/unittest/CQuantileSketchTest.cc +++ b/lib/maths/unittest/CQuantileSketchTest.cc @@ -26,8 +26,8 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; +using TDoubleVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; void testSketch(maths::CQuantileSketch::EInterpolation interpolation, std::size_t n, diff --git a/lib/maths/unittest/CRadialBasisFunctionTest.cc b/lib/maths/unittest/CRadialBasisFunctionTest.cc index 47be048a90..b39a3713c9 100644 --- a/lib/maths/unittest/CRadialBasisFunctionTest.cc +++ b/lib/maths/unittest/CRadialBasisFunctionTest.cc @@ -22,7 +22,7 @@ namespace class CValueAdaptor { public: - typedef double result_type; + using result_type = double; public: CValueAdaptor(const maths::CRadialBasisFunction &function, diff --git a/lib/maths/unittest/CRandomProjectionClustererTest.cc b/lib/maths/unittest/CRandomProjectionClustererTest.cc index 280a89fb03..4283dc35c5 100644 --- a/lib/maths/unittest/CRandomProjectionClustererTest.cc +++ b/lib/maths/unittest/CRandomProjectionClustererTest.cc @@ -17,13 +17,13 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; -typedef std::vector TSizeVec; -typedef std::vector TSizeVecVec; -typedef maths::CVector TVector; -typedef maths::CVectorNx1 TVector5; -typedef maths::CBasicStatistics::SSampleCovariances TCovariances; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; +using TSizeVec = std::vector; +using TSizeVecVec = std::vector; +using TVector = maths::CVector; +using TVector5 = maths::CVectorNx1; +using TCovariances = maths::CBasicStatistics::SSampleCovariances; struct SFirstLess { @@ -37,12 +37,12 @@ template class CRandomProjectionClustererForTest : public maths::CRandomProjectionClustererBatch { public: - typedef typename maths::CRandomProjectionClustererBatch::TVectorArrayVec TVectorArrayVec; - typedef typename maths::CRandomProjectionClustererBatch::TDoubleVecVec TDoubleVecVec; - typedef typename maths::CRandomProjectionClustererBatch::TVectorNx1VecVec TVectorNx1VecVec; - typedef typename maths::CRandomProjectionClustererBatch::TSvdNxNVecVec TSvdNxNVecVec; - typedef typename maths::CRandomProjectionClustererBatch::TSizeUSet TSizeUSet; - typedef typename maths::CRandomProjectionClustererBatch::TMeanAccumulatorVecVec TMeanAccumulatorVecVec; + using TVectorArrayVec = typename maths::CRandomProjectionClustererBatch::TVectorArrayVec; + using TDoubleVecVec = typename maths::CRandomProjectionClustererBatch::TDoubleVecVec; + using TVectorNx1VecVec = typename maths::CRandomProjectionClustererBatch::TVectorNx1VecVec; + using TSvdNxNVecVec = typename maths::CRandomProjectionClustererBatch::TSvdNxNVecVec; + using TSizeUSet = typename maths::CRandomProjectionClustererBatch::TSizeUSet; + using TMeanAccumulatorVecVec = typename maths::CRandomProjectionClustererBatch::TMeanAccumulatorVecVec; public: CRandomProjectionClustererForTest(double compression = 1.0) : @@ -98,9 +98,9 @@ void CRandomProjectionClustererTest::testGenerateProjections(void) LOG_DEBUG("| CRandomProjectionClustererTest::testGenerateProjections |"); LOG_DEBUG("+-----------------------------------------------------------+"); - typedef CRandomProjectionClustererForTest<5>::TVectorArrayVec TVectorArrayVec; - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; + using TVectorArrayVec = CRandomProjectionClustererForTest<5>::TVectorArrayVec; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; + using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; // Test corner case when projected dimension is greater // than the data dimension. @@ -300,8 +300,8 @@ void CRandomProjectionClustererTest::testNeighbourhoods(void) // isn't perfect because we don't store the full points so are // computing distances projections. - typedef maths::CVector TVector; - typedef std::vector TVectorVec; + using TVector = maths::CVector; + using TVectorVec = std::vector; test::CRandomNumbers rng; diff --git a/lib/maths/unittest/CSamplingTest.cc b/lib/maths/unittest/CSamplingTest.cc index c27e9cffbb..0baab4b5c7 100644 --- a/lib/maths/unittest/CSamplingTest.cc +++ b/lib/maths/unittest/CSamplingTest.cc @@ -17,15 +17,15 @@ #include -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; using namespace ml; namespace { -typedef std::vector TDoubleVecVec; +using TDoubleVecVec = std::vector; double multinomialProbability(const TDoubleVec &probabilities, const TSizeVec &counts) @@ -149,8 +149,8 @@ void CSamplingTest::testMultinomialSample(void) LOG_DEBUG("| CSamplingTest::testMultinomialSample |"); LOG_DEBUG("+----------------------------------------+"); - typedef std::map TSizeVecDoubleMap; - typedef TSizeVecDoubleMap::const_iterator TSizeVecDoubleMapCItr; + using TSizeVecDoubleMap = std::map; + using TSizeVecDoubleMapCItr = TSizeVecDoubleMap::const_iterator; maths::CSampling::seed(); @@ -199,7 +199,7 @@ void CSamplingTest::testMultivariateNormalSample(void) LOG_DEBUG("| CSamplingTest::testMultivariateNormalSample |"); LOG_DEBUG("+-----------------------------------------------+"); - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; maths::CSampling::seed(); diff --git a/lib/maths/unittest/CSeasonalComponentAdaptiveBucketingTest.cc b/lib/maths/unittest/CSeasonalComponentAdaptiveBucketingTest.cc index 2b18a4d371..7f822c776d 100644 --- a/lib/maths/unittest/CSeasonalComponentAdaptiveBucketingTest.cc +++ b/lib/maths/unittest/CSeasonalComponentAdaptiveBucketingTest.cc @@ -28,12 +28,12 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TFloatVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; -typedef maths::CBasicStatistics::SMin::TAccumulator TMinAccumulator; -typedef maths::CBasicStatistics::SMax::TAccumulator TMaxAccumulator; +using TDoubleVec = std::vector; +using TFloatVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; +using TMinAccumulator = maths::CBasicStatistics::SMin::TAccumulator; +using TMaxAccumulator = maths::CBasicStatistics::SMax::TAccumulator; } void CSeasonalComponentAdaptiveBucketingTest::testInitialize(void) diff --git a/lib/maths/unittest/CSeasonalComponentTest.cc b/lib/maths/unittest/CSeasonalComponentTest.cc index 3a6e491860..06550ea35d 100644 --- a/lib/maths/unittest/CSeasonalComponentTest.cc +++ b/lib/maths/unittest/CSeasonalComponentTest.cc @@ -30,11 +30,11 @@ using namespace ml; namespace { -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleVec; -typedef std::vector TTimeVec; -typedef std::pair TTimeDoublePr; -typedef std::vector TTimeDoublePrVec; +using TDoubleDoublePr = std::pair; +using TDoubleVec = std::vector; +using TTimeVec = std::vector; +using TTimeDoublePr = std::pair; +using TTimeDoublePrVec = std::vector; class CTestSeasonalComponent : public maths::CSeasonalComponent { @@ -92,7 +92,7 @@ void generateSeasonalValues(test::CRandomNumbers &rng, std::size_t numberSamples, TTimeDoublePrVec &samples) { - typedef std::vector TSizeVec; + using TSizeVec = std::vector; // Generate time uniformly at random in the interval // [startTime, endTime). @@ -760,7 +760,7 @@ void CSeasonalComponentTest::testVariance(void) LOG_DEBUG("| CSeasonalComponentTest::testVariance |"); LOG_DEBUG("+----------------------------------------+"); - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; // Check that we estimate a periodic variance. diff --git a/lib/maths/unittest/CSetToolsTest.cc b/lib/maths/unittest/CSetToolsTest.cc index 0f34b762d7..82790dfd80 100644 --- a/lib/maths/unittest/CSetToolsTest.cc +++ b/lib/maths/unittest/CSetToolsTest.cc @@ -21,8 +21,8 @@ using namespace ml; -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; void CSetToolsTest::testInplaceSetDifference(void) { diff --git a/lib/maths/unittest/CSolversTest.cc b/lib/maths/unittest/CSolversTest.cc index 99ac1ff90c..80c85e11f1 100644 --- a/lib/maths/unittest/CSolversTest.cc +++ b/lib/maths/unittest/CSolversTest.cc @@ -70,7 +70,7 @@ double f6(const double &x) class CLog { public: - typedef double result_type; + using result_type = double; public: double operator()(const double &x) const @@ -424,7 +424,7 @@ void CSolversTest::testBrent(void) void CSolversTest::testSublevelSet(void) { - typedef std::pair TDoubleDoublePr; + using TDoubleDoublePr = std::pair; // Should converge immediately to minimum of quadratic. TDoubleDoublePr sublevelSet; diff --git a/lib/maths/unittest/CSplineTest.cc b/lib/maths/unittest/CSplineTest.cc index 5213a4bc3f..07416e69d5 100644 --- a/lib/maths/unittest/CSplineTest.cc +++ b/lib/maths/unittest/CSplineTest.cc @@ -22,8 +22,8 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; class CSplineFunctor { @@ -581,10 +581,10 @@ void CSplineTest::testSplineReference(void) LOG_DEBUG("| CSplineTest::testSplineReference |"); LOG_DEBUG("+------------------------------------+"); - typedef std::vector TFloatVec; - typedef boost::reference_wrapper TFloatVecRef; - typedef boost::reference_wrapper TDoubleVecRef; - typedef maths::CSpline TSplineRef; + using TFloatVec = std::vector; + using TFloatVecRef = boost::reference_wrapper; + using TDoubleVecRef = boost::reference_wrapper; + using TSplineRef = maths::CSpline; double x_[] = { 0.0, 0.1, 0.3, 0.33, 0.5, 0.75, 0.8, 1.0 }; TDoubleVec x(boost::begin(x_), boost::end(x_)); diff --git a/lib/maths/unittest/CStatisticalTestsTest.cc b/lib/maths/unittest/CStatisticalTestsTest.cc index 0cf564aa96..50a3a0e244 100644 --- a/lib/maths/unittest/CStatisticalTestsTest.cc +++ b/lib/maths/unittest/CStatisticalTestsTest.cc @@ -29,7 +29,7 @@ using namespace ml; -typedef std::vector TDoubleVec; +using TDoubleVec = std::vector; void CStatisticalTestsTest::testCramerVonMises(void) { diff --git a/lib/maths/unittest/CTimeSeriesModelTest.cc b/lib/maths/unittest/CTimeSeriesModelTest.cc index f5fd12320c..a3fec73ad0 100644 --- a/lib/maths/unittest/CTimeSeriesModelTest.cc +++ b/lib/maths/unittest/CTimeSeriesModelTest.cc @@ -178,7 +178,7 @@ void reinitializePrior(double learnRate, } if (controllers) { - for (auto &&trend : trends) + for (auto &trend : trends) { trend->decayRate(trend->decayRate() / (*controllers)[0].multiplier()); } @@ -337,7 +337,7 @@ void CTimeSeriesModelTest::testMode(void) maths::CUnivariateTimeSeriesModel model{params(bucketLength), 0, trend, prior}; core_t::TTime time{0}; - for (auto &&sample : samples) + for (auto &sample : samples) { sample += 20.0 + 10.0 * ::sin( boost::math::double_constants::two_pi * static_cast(time) @@ -457,7 +457,7 @@ void CTimeSeriesModelTest::testMode(void) maths::CMultivariateTimeSeriesModel model{params(bucketLength), *trends[0], prior}; core_t::TTime time{0}; - for (auto &&sample : samples) + for (auto &sample : samples) { double amplitude{10.0}; for (std::size_t i = 0u; i < sample.size(); ++i) @@ -847,7 +847,7 @@ void CTimeSeriesModelTest::testAddSamples(void) TDouble2Vec4VecVec weights{{{1.0, 1.0, 1.0}}}; core_t::TTime time{0}; - for (auto &&sample : samples) + for (auto &sample : samples) { bool reinitialize{false}; bool hasTrend{false}; @@ -1063,9 +1063,9 @@ void CTimeSeriesModelTest::testPredict(void) TDouble2Vec4VecVec weights{maths::CConstantWeights::unit(3)}; core_t::TTime time{0}; - for (auto &&sample : samples) + for (auto &sample : samples) { - for (auto &&coordinate : sample) + for (auto &coordinate : sample) { coordinate += 10.0 + 5.0 * ::sin( boost::math::double_constants::two_pi * static_cast(time) / 86400.0); @@ -1328,7 +1328,7 @@ void CTimeSeriesModelTest::testProbability(void) core_t::TTime time{0}; const TDouble2Vec4VecVec weight{maths::CConstantWeights::unit(3)}; - for (auto &&sample : samples) + for (auto &sample : samples) { maths::CModelAddSamplesParams params; params.integer(false) @@ -1342,7 +1342,7 @@ void CTimeSeriesModelTest::testProbability(void) double trend{5.0 + 5.0 * ::sin( boost::math::double_constants::two_pi * static_cast(time) / 86400.0)}; - for (auto &&component : sample_) + for (auto &component : sample_) { component += trend; } @@ -1453,7 +1453,7 @@ void CTimeSeriesModelTest::testProbability(void) TDouble2Vec4VecVec weights{weight}; std::size_t bucket{0}; core_t::TTime time{0}; - for (auto &&sample : samples) + for (auto &sample : samples) { if (std::binary_search(anomalies.begin(), anomalies.end(), bucket++)) { @@ -1603,7 +1603,7 @@ void CTimeSeriesModelTest::testWeights(void) TDouble10Vec4Vec1Vec weight{{{1.0, 1.0, 1.0}}}; TDouble2Vec4VecVec weights{{{1.0, 1.0, 1.0}}}; core_t::TTime time{0}; - for (auto &&sample : samples) + for (auto &sample : samples) { double scale{10.0 + 5.0 * ::sin( boost::math::double_constants::two_pi * static_cast(time) / 86400.0)}; @@ -1742,7 +1742,7 @@ void CTimeSeriesModelTest::testMemoryUsage(void) .weightStyles(maths::CConstantWeights::COUNT) .trendWeights(weights) .priorWeights(weights); - for (auto &&coordinate : sample) + for (auto &coordinate : sample) { coordinate += 10.0 + 5.0 * ::sin( boost::math::double_constants::two_pi * static_cast(time) / 86400.0); @@ -2099,7 +2099,7 @@ void CTimeSeriesModelTest::testAnomalyModel(void) TDouble2Vec4VecVec weights{weight}; std::size_t bucket{0}; core_t::TTime time{0}; - for (auto &&sample : samples) + for (auto &sample : samples) { if (std::binary_search(anomalies.begin(), anomalies.end(), bucket++)) { @@ -2190,9 +2190,9 @@ void CTimeSeriesModelTest::testAnomalyModel(void) TDouble2Vec4VecVec weights{weight}; core_t::TTime time{0}; std::size_t bucket{0}; - for (auto &&sample : samples) + for (auto &sample : samples) { - for (auto &&coordinate : sample) + for (auto &coordinate : sample) { if (std::binary_search(anomalies.begin(), anomalies.end(), bucket)) { diff --git a/lib/maths/unittest/CToolsTest.cc b/lib/maths/unittest/CToolsTest.cc index 87395c1db1..56e9c42aca 100644 --- a/lib/maths/unittest/CToolsTest.cc +++ b/lib/maths/unittest/CToolsTest.cc @@ -33,9 +33,9 @@ using namespace test; namespace { -typedef std::pair TDoubleDoublePr; -typedef std::pair TDoubleBoolPr; -typedef std::vector TDoubleVec; +using TDoubleDoublePr = std::pair; +using TDoubleBoolPr = std::pair; +using TDoubleVec = std::vector; namespace adapters { @@ -293,7 +293,7 @@ template class CPdf { public: - typedef double result_type; + using result_type = double; public: CPdf(const DISTRIBUTION &distribution) : @@ -314,7 +314,7 @@ class CPdf class CIdentity { public: - typedef double result_type; + using result_type = double; public: bool operator()(double x, double &result) const @@ -1015,7 +1015,7 @@ void CToolsTest::testMixtureProbabilityOfLessLikelySample(void) LOG_DEBUG("| CToolsTest::testMixtureProbabilityOfLessLikelySample |"); LOG_DEBUG("+--------------------------------------------------------+"); - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; test::CRandomNumbers rng; diff --git a/lib/maths/unittest/CTrendComponentTest.cc b/lib/maths/unittest/CTrendComponentTest.cc index 54cfcd9621..21319eeb31 100644 --- a/lib/maths/unittest/CTrendComponentTest.cc +++ b/lib/maths/unittest/CTrendComponentTest.cc @@ -335,7 +335,7 @@ void CTrendComponentTest::testForecast() TMeanAccumulator meanError; TMeanAccumulator meanErrorAt95; - for (auto &&errorbar : forecast) + for (auto &errorbar : forecast) { core_t::TTime bucket{(time - start) / bucketLength}; meanError.add( std::fabs((values[bucket] - errorbar[1]) diff --git a/lib/maths/unittest/CTrendTestsTest.cc b/lib/maths/unittest/CTrendTestsTest.cc index 7ce075a152..1a15d6aa20 100644 --- a/lib/maths/unittest/CTrendTestsTest.cc +++ b/lib/maths/unittest/CTrendTestsTest.cc @@ -50,7 +50,7 @@ void CTrendTestsTest::testRandomizedPeriodicity(void) using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; - using TMaxAccumulator = maths::CBasicStatistics::COrderStatisticsStack >; + using TMaxAccumulator = maths::CBasicStatistics::COrderStatisticsStack>; using TFunction = double (*)(core_t::TTime); test::CRandomNumbers rng; diff --git a/lib/maths/unittest/CXMeansOnline1dTest.cc b/lib/maths/unittest/CXMeansOnline1dTest.cc index b8f3e813de..f181589167 100644 --- a/lib/maths/unittest/CXMeansOnline1dTest.cc +++ b/lib/maths/unittest/CXMeansOnline1dTest.cc @@ -29,9 +29,9 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; -typedef maths::CXMeansOnline1d::TClusterVec TClusterVec; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; +using TDoubleVec = std::vector; +using TClusterVec = maths::CXMeansOnline1d::TClusterVec; +using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; bool restore(const maths::SDistributionRestoreParams ¶ms, core::CRapidXmlStateRestoreTraverser &traverser, @@ -726,8 +726,8 @@ void CXMeansOnline1dTest::testManyClusters(void) LOG_DEBUG("| CXMeansOnline1dTest::testManyClusters |"); LOG_DEBUG("+-----------------------------------------+"); - typedef std::pair TTimeDoublePr; - typedef std::vector TTimeDoublePrVec; + using TTimeDoublePr = std::pair; + using TTimeDoublePrVec = std::vector; TTimeDoublePrVec timeseries; core_t::TTime startTime; diff --git a/lib/maths/unittest/CXMeansOnlineTest.cc b/lib/maths/unittest/CXMeansOnlineTest.cc index 233684db2b..f46af59735 100644 --- a/lib/maths/unittest/CXMeansOnlineTest.cc +++ b/lib/maths/unittest/CXMeansOnlineTest.cc @@ -24,25 +24,25 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; -typedef std::vector TSizeVec; -typedef maths::CBasicStatistics::SSampleCovariances TCovariances2; -typedef std::vector TCovariances2Vec; -typedef maths::CXMeansOnline TXMeans2; -typedef TXMeans2::TPointPrecise TPoint; -typedef std::vector TPointVec; -typedef std::vector TPointVecVec; -typedef TXMeans2::TMatrixPrecise TMatrix; -typedef std::vector TMatrixVec; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; +using TSizeVec = std::vector; +using TCovariances2 = maths::CBasicStatistics::SSampleCovariances; +using TCovariances2Vec = std::vector; +using TXMeans2 = maths::CXMeansOnline; +using TPoint = TXMeans2::TPointPrecise; +using TPointVec = std::vector; +using TPointVecVec = std::vector; +using TMatrix = TXMeans2::TMatrixPrecise; +using TMatrixVec = std::vector; template class CXMeansOnlineForTest : public maths::CXMeansOnline { public: - typedef typename maths::CXMeansOnline::TSizeDoublePr2Vec TSizeDoublePr2Vec; - typedef typename maths::CXMeansOnline::TPointPrecise TPoint; - typedef typename maths::CXMeansOnline::TClusterVec TClusterVec; + using TSizeDoublePr2Vec = typename maths::CXMeansOnline::TSizeDoublePr2Vec; + using TPoint = typename maths::CXMeansOnline::TPointPrecise; + using TClusterVec = typename maths::CXMeansOnline::TClusterVec; using maths::CXMeansOnline::add; public: @@ -65,8 +65,8 @@ class CXMeansOnlineForTest : public maths::CXMeansOnline } }; -typedef CXMeansOnlineForTest TXMeans2ForTest; -typedef CXMeansOnlineForTest TXMeans2FloatForTest; +using TXMeans2ForTest = CXMeansOnlineForTest; +using TXMeans2FloatForTest = CXMeansOnlineForTest; bool restore(const maths::SDistributionRestoreParams ¶ms, core::CRapidXmlStateRestoreTraverser &traverser, @@ -519,7 +519,7 @@ void CXMeansOnlineTest::testManyClusters(void) LOG_DEBUG("| CXMeansOnlineTest::testManyClusters |"); LOG_DEBUG("+---------------------------------------+"); - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; maths::CSampling::seed(); @@ -620,7 +620,7 @@ void CXMeansOnlineTest::testAdaption(void) // Specifically, the data set starts with one cluster then // a new cluster appears and subsequently disappears. - typedef std::vector TDoubleVecVecVec; + using TDoubleVecVecVec = std::vector; maths::CSampling::seed(); @@ -795,9 +795,9 @@ void CXMeansOnlineTest::testLatLongData(void) LOG_DEBUG("| CXMeansOnlineTest::testLatLongData |"); LOG_DEBUG("+--------------------------------------+"); - typedef std::pair TTimeDoubleVecPr; - typedef std::vector TTimeDoubleVecPrVec; - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TTimeDoubleVecPr = std::pair; + using TTimeDoubleVecPrVec = std::vector; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; TTimeDoubleVecPrVec timeseries; CPPUNIT_ASSERT(test::CTimeSeriesTestData::parse("testfiles/lat_lng.csv", diff --git a/lib/maths/unittest/CXMeansTest.cc b/lib/maths/unittest/CXMeansTest.cc index 9bda884412..569d3e9e8f 100644 --- a/lib/maths/unittest/CXMeansTest.cc +++ b/lib/maths/unittest/CXMeansTest.cc @@ -26,32 +26,32 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; -typedef std::vector TSizeVecVec; -typedef std::vector TUInt64Vec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; -typedef maths::CVectorNx1 TVector2; -typedef std::vector TVector2Vec; -typedef TVector2Vec::const_iterator TVector2VecCItr; -typedef std::vector TVector2VecVec; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVar2Accumulator; -typedef maths::CSymmetricMatrixNxN TMatrix2; -typedef std::vector TMatrix2Vec; -typedef maths::CVectorNx1 TVector4; -typedef std::vector TVector4Vec; -typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVar4Accumulator; -typedef maths::CSymmetricMatrixNxN TMatrix4; -typedef std::vector TMatrix4Vec; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; +using TSizeVecVec = std::vector; +using TUInt64Vec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; +using TVector2 = maths::CVectorNx1; +using TVector2Vec = std::vector; +using TVector2VecCItr = TVector2Vec::const_iterator; +using TVector2VecVec = std::vector; +using TMeanVar2Accumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; +using TMatrix2 = maths::CSymmetricMatrixNxN; +using TMatrix2Vec = std::vector; +using TVector4 = maths::CVectorNx1; +using TVector4Vec = std::vector; +using TMeanVar4Accumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; +using TMatrix4 = maths::CSymmetricMatrixNxN; +using TMatrix4Vec = std::vector; //! \brief Expose internals of x-means for testing. template > + typename COST = maths::CSphericalGaussianInfoCriterion> class CXMeansForTest : public maths::CXMeans { public: - typedef typename maths::CXMeans::TUInt64USet TUInt64USet; + using TUInt64USet = typename maths::CXMeans::TUInt64USet; public: CXMeansForTest(std::size_t kmax) : @@ -149,7 +149,7 @@ void CXMeansTest::testCluster(void) // Test basic accessors and checksum functionality of cluster. - typedef std::vector TDoubleVec; + using TDoubleVec = std::vector; maths::CSampling::seed(); @@ -220,7 +220,7 @@ void CXMeansTest::testImproveStructure(void) // Test improve structure finds an obvious split of the data. - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; maths::CSampling::seed(); @@ -467,7 +467,7 @@ void CXMeansTest::testFiveClusters(void) std::size_t ne = flatPoints.size(); - maths::CXMeans > xmeans(10); + maths::CXMeans> xmeans(10); xmeans.setPoints(flatPoints); xmeans.run(3, 3, 5); @@ -597,7 +597,7 @@ void CXMeansTest::testTwentyClusters(void) std::size_t ne = flatPoints.size(); - maths::CXMeans > xmeans(40); + maths::CXMeans> xmeans(40); xmeans.setPoints(flatPoints); xmeans.run(4, 4, 5); @@ -743,7 +743,7 @@ void CXMeansTest::testPoorlyConditioned(void) } std::sort(cluster3.begin(), cluster3.end()); - maths::CXMeans > xmeans(5); + maths::CXMeans> xmeans(5); for (std::size_t t = 0u; t < 10; ++t) { LOG_DEBUG("*** test = " << t << " ***"); diff --git a/lib/model/CAnomalyDetectorModel.cc b/lib/model/CAnomalyDetectorModel.cc index 54789b0293..df21840741 100644 --- a/lib/model/CAnomalyDetectorModel.cc +++ b/lib/model/CAnomalyDetectorModel.cc @@ -57,7 +57,7 @@ bool checkRules(const SModelParams::TDetectionRuleVec &detectionRules, core_t::TTime time) { bool isIgnored{false}; - for (auto &&rule : detectionRules) + for (auto &rule : detectionRules) { isIgnored = isIgnored || rule.apply(action, model, @@ -78,7 +78,7 @@ bool checkScheduledEvents(const SModelParams::TStrDetectionRulePrVec &scheduledE core_t::TTime time) { bool isIgnored{false}; - for (auto &&event : scheduledEvents) + for (auto &event : scheduledEvents) { isIgnored = isIgnored || event.second.apply(action, model, @@ -104,7 +104,7 @@ CAnomalyDetectorModel::CAnomalyDetectorModel(const SModelParams ¶ms, { LOG_ABORT("Must provide a data gatherer"); } - for (auto &&calculators : m_InfluenceCalculators) + for (auto &calculators : m_InfluenceCalculators) { std::sort(calculators.begin(), calculators.end(), maths::COrderings::SFirstLess()); } diff --git a/lib/model/CAnomalyDetectorModelConfig.cc b/lib/model/CAnomalyDetectorModelConfig.cc index b116195d50..e295406c00 100644 --- a/lib/model/CAnomalyDetectorModelConfig.cc +++ b/lib/model/CAnomalyDetectorModelConfig.cc @@ -38,8 +38,8 @@ namespace model namespace { -typedef std::vector TSizeVec; -typedef std::vector TTimeVec; +using TSizeVec = std::vector; +using TTimeVec = std::vector; const CAnomalyDetectorModelConfig::TIntDetectionRuleVecUMap EMPTY_RULES_MAP; const CAnomalyDetectorModelConfig::TStrDetectionRulePrVec EMPTY_EVENTS; @@ -197,7 +197,7 @@ CAnomalyDetectorModelConfig::CAnomalyDetectorModelConfig(void) : void CAnomalyDetectorModelConfig::bucketLength(core_t::TTime length) { m_BucketLength = length; - for (auto &&factory : m_Factories) + for (auto &factory : m_Factories) { factory.second->updateBucketLength(length); } @@ -515,7 +515,7 @@ bool CAnomalyDetectorModelConfig::configureModelPlot(const boost::property_tree: { std::string valueStr(propTree.get(TERMS_PROPERTY)); - typedef core::CStringUtils::TStrVec TStrVec; + using TStrVec = core::CStringUtils::TStrVec; TStrVec tokens; std::string remainder; core::CStringUtils::tokenise(",", valueStr, tokens, remainder); @@ -754,7 +754,7 @@ CAnomalyDetectorModelConfig::factory(int identifier, void CAnomalyDetectorModelConfig::decayRate(double value) { - for (auto &&factory : m_Factories) + for (auto &factory : m_Factories) { factory.second->decayRate(value); } @@ -891,7 +891,7 @@ const std::string PER_PARTITION_NORMALIZATION_PROPERTY("perPartitionNormalizatio bool CAnomalyDetectorModelConfig::processStanza(const boost::property_tree::ptree &propertyTree) { - typedef std::vector TStrVec; + using TStrVec = std::vector; bool result = true; @@ -912,7 +912,7 @@ bool CAnomalyDetectorModelConfig::processStanza(const boost::property_tree::ptre } learnRate *= bucketNormalizationFactor(this->bucketLength()); - for (auto &&factory : m_Factories) + for (auto &factory : m_Factories) { factory.second->learnRate(learnRate); } @@ -928,7 +928,7 @@ bool CAnomalyDetectorModelConfig::processStanza(const boost::property_tree::ptre } decayRate *= bucketNormalizationFactor(this->bucketLength()); - for (auto &&factory : m_Factories) + for (auto &factory : m_Factories) { factory.second->decayRate(decayRate); } @@ -943,7 +943,7 @@ bool CAnomalyDetectorModelConfig::processStanza(const boost::property_tree::ptre continue; } - for (auto &&factory : m_Factories) + for (auto &factory : m_Factories) { factory.second->initialDecayRateMultiplier(multiplier); } @@ -959,7 +959,7 @@ bool CAnomalyDetectorModelConfig::processStanza(const boost::property_tree::ptre continue; } - for (auto &&factory : m_Factories) + for (auto &factory : m_Factories) { factory.second->maximumUpdatesPerBucket(maximumUpdatesPerBucket); } @@ -974,7 +974,7 @@ bool CAnomalyDetectorModelConfig::processStanza(const boost::property_tree::ptre result = false; continue; } - for (auto &&factory : m_Factories) + for (auto &factory : m_Factories) { factory.second->totalProbabilityCalcSamplingSize(totalProbabilityCalcSamplingSize); } @@ -1048,7 +1048,7 @@ bool CAnomalyDetectorModelConfig::processStanza(const boost::property_tree::ptre result = false; continue; } - for (auto &&factory : m_Factories) + for (auto &factory : m_Factories) { factory.second->componentSize(componentSize); } @@ -1062,7 +1062,7 @@ bool CAnomalyDetectorModelConfig::processStanza(const boost::property_tree::ptre result = false; continue; } - for (auto &&factory : m_Factories) + for (auto &factory : m_Factories) { factory.second->sampleCountFactor(factor); } @@ -1076,7 +1076,7 @@ bool CAnomalyDetectorModelConfig::processStanza(const boost::property_tree::ptre result = false; continue; } - for (auto &&factory : m_Factories) + for (auto &factory : m_Factories) { factory.second->pruneWindowScaleMinimum(factor); } @@ -1090,7 +1090,7 @@ bool CAnomalyDetectorModelConfig::processStanza(const boost::property_tree::ptre result = false; continue; } - for (auto &&factory : m_Factories) + for (auto &factory : m_Factories) { factory.second->pruneWindowScaleMaximum(factor); } diff --git a/lib/model/CAnomalyScore.cc b/lib/model/CAnomalyScore.cc index bab954cc5f..ae1cb36eb2 100644 --- a/lib/model/CAnomalyScore.cc +++ b/lib/model/CAnomalyScore.cc @@ -38,7 +38,7 @@ namespace model namespace { -typedef std::vector TDoubleVec; +using TDoubleVec = std::vector; //! Add valid \p probabilities to \p aggregator and return the //! number of valid probabilities. @@ -607,8 +607,8 @@ bool CAnomalyScore::CNormalizer::updateQuantiles(const TDoubleVec &scores) bool CAnomalyScore::CNormalizer::updateQuantiles(double score) { - typedef std::pair TUInt32UInt64Pr; - typedef std::vector TUInt32UInt64PrVec; + using TUInt32UInt64Pr = std::pair; + using TUInt32UInt64PrVec = std::vector; bool bigChange(false); double oldMaxScore(m_MaxScore.count() == 0 ? 0.0 : m_MaxScore[0]); diff --git a/lib/model/CCountingModel.cc b/lib/model/CCountingModel.cc index 2da5e1f057..c4047c5e99 100644 --- a/lib/model/CCountingModel.cc +++ b/lib/model/CCountingModel.cc @@ -186,7 +186,7 @@ CCountingModel::TDouble1Vec void CCountingModel::currentBucketPersonIds(core_t::TTime time, TSizeVec &result) const { - typedef boost::unordered_set TSizeUSet; + using TSizeUSet = boost::unordered_set; result.clear(); @@ -278,7 +278,7 @@ void CCountingModel::setMatchedEventsDescriptions(core_t::TTime sampleTime, core if (matchedEvents.empty() == false) { TStr1Vec descriptions; - for (auto &&event : matchedEvents) + for (auto &event : matchedEvents) { descriptions.push_back(event.first); } @@ -292,7 +292,7 @@ CCountingModel::checkScheduledEvents(core_t::TTime sampleTime) const const SModelParams::TStrDetectionRulePrVec &events = this->params().s_ScheduledEvents.get(); SModelParams::TStrDetectionRulePrVec matchedEvents; - for (auto &&event : events) + for (auto &event : events) { // Note that as the counting model is not aware of partitions // scheduled events cannot support partitions as the code stands. diff --git a/lib/model/CDataGatherer.cc b/lib/model/CDataGatherer.cc index a90740484e..9d510e6372 100644 --- a/lib/model/CDataGatherer.cc +++ b/lib/model/CDataGatherer.cc @@ -838,7 +838,7 @@ void CDataGatherer::releaseMemory(core_t::TTime samplingCutoffTime) { if (this->isPopulation()) { - for (auto &&gatherer : m_Gatherers) + for (auto &gatherer : m_Gatherers) { gatherer->releaseMemory(samplingCutoffTime); } diff --git a/lib/model/CDetectorEqualizer.cc b/lib/model/CDetectorEqualizer.cc index 30d81d3f26..d89a85cc0c 100644 --- a/lib/model/CDetectorEqualizer.cc +++ b/lib/model/CDetectorEqualizer.cc @@ -141,7 +141,7 @@ void CDetectorEqualizer::clear(void) void CDetectorEqualizer::age(double factor) { - for (auto &&sketch : m_Sketches) + for (auto &sketch : m_Sketches) { sketch.second.age(factor); } diff --git a/lib/model/CDynamicStringIdRegistry.cc b/lib/model/CDynamicStringIdRegistry.cc index 783437f7a4..0e012320a3 100644 --- a/lib/model/CDynamicStringIdRegistry.cc +++ b/lib/model/CDynamicStringIdRegistry.cc @@ -211,7 +211,7 @@ CDynamicStringIdRegistry::TSizeVec &CDynamicStringIdRegistry::recycledIds(void) bool CDynamicStringIdRegistry::checkInvariants(void) const { - typedef boost::unordered_set TSizeUSet; + using TSizeUSet = boost::unordered_set; bool result = true; if (m_Uids.size() > m_Names.size()) @@ -249,8 +249,8 @@ void CDynamicStringIdRegistry::clear(void) uint64_t CDynamicStringIdRegistry::checksum(void) const { - typedef boost::reference_wrapper TStrCRef; - typedef std::vector TStrCRefVec; + using TStrCRef = boost::reference_wrapper; + using TStrCRefVec = std::vector; TStrCRefVec people; people.reserve(m_Names.size()); diff --git a/lib/model/CEventRateBucketGatherer.cc b/lib/model/CEventRateBucketGatherer.cc index 551a835266..2867d4e462 100644 --- a/lib/model/CEventRateBucketGatherer.cc +++ b/lib/model/CEventRateBucketGatherer.cc @@ -44,23 +44,23 @@ namespace model namespace { -typedef std::vector TSizeVec; -typedef std::vector TStrVec; -typedef std::map TStrUInt64Map; -typedef std::pair TSizeSizePr; -typedef std::vector TSizeSizePrVec; -typedef std::vector TUInt64Vec; -typedef boost::unordered_set TSizeUSet; -typedef TSizeUSet::const_iterator TSizeUSetCItr; -typedef std::vector TSizeUSetVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef boost::unordered_map TSizeSizePrMeanAccumulatorUMap; -typedef std::map TSizeSizePrUInt64Map; -typedef CBucketQueue TSizeSizePrMeanAccumulatorUMapQueue; -typedef CEventRateBucketGatherer::TCategoryAnyMap TCategoryAnyMap; -typedef boost::unordered_map TSizeSizePrStrDataUMap; -typedef CBucketQueue TSizeSizePrStrDataUMapQueue; -typedef CBucketGatherer::TStoredStringPtrVec TStoredStringPtrVec; +using TSizeVec = std::vector; +using TStrVec = std::vector; +using TStrUInt64Map = std::map; +using TSizeSizePr = std::pair; +using TSizeSizePrVec = std::vector; +using TUInt64Vec = std::vector; +using TSizeUSet = boost::unordered_set; +using TSizeUSetCItr = TSizeUSet::const_iterator; +using TSizeUSetVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TSizeSizePrMeanAccumulatorUMap = boost::unordered_map; +using TSizeSizePrUInt64Map = std::map; +using TSizeSizePrMeanAccumulatorUMapQueue = CBucketQueue; +using TCategoryAnyMap = CEventRateBucketGatherer::TCategoryAnyMap; +using TSizeSizePrStrDataUMap = boost::unordered_map; +using TSizeSizePrStrDataUMapQueue = CBucketQueue; +using TStoredStringPtrVec = CBucketGatherer::TStoredStringPtrVec; // We use short field names to reduce the state size const std::string BASE_TAG("a"); @@ -351,8 +351,8 @@ const std::string &overField(bool population, const TStrVec &fieldNames) } template struct SMaybeConst {}; -template struct SMaybeConst { typedef T &TRef; }; -template struct SMaybeConst { typedef const T &TRef; }; +template struct SMaybeConst { using TRef = T &; }; +template struct SMaybeConst { using TRef = const T &; }; //! Apply a function \p f to all the data held in [\p begin, \p end). template @@ -429,7 +429,7 @@ struct SRemovePeople std::size_t lowestPersonToRemove, std::size_t endPeople) const { - for (auto &&bucket : peopleAttributeUniqueValues) + for (auto &bucket : peopleAttributeUniqueValues) { for (auto i = bucket.begin(); i != bucket.end(); /**/) { @@ -456,7 +456,7 @@ struct SRemovePeople std::size_t lowestPersonToRemove, std::size_t endPeople) const { - for (auto &&bucket : arrivalTimes) + for (auto &bucket : arrivalTimes) { for (auto i = bucket.begin(); i != bucket.end(); /**/) { @@ -504,7 +504,7 @@ struct SRemoveAttributes void operator()(TSizeSizePrStrDataUMapQueue &peopleAttributeUniqueValues, std::size_t lowestAttributeToRemove) const { - for (auto &&bucket : peopleAttributeUniqueValues) + for (auto &bucket : peopleAttributeUniqueValues) { for (auto i = bucket.begin(); i != bucket.end(); /**/) { @@ -529,7 +529,7 @@ struct SRemoveAttributes void operator()(TSizeSizePrMeanAccumulatorUMapQueue &arrivalTimes, std::size_t lowestAttributeToRemove) const { - for (auto &&bucket : arrivalTimes) + for (auto &bucket : arrivalTimes) { for (auto i = bucket.begin(); i != bucket.end(); /**/) { @@ -560,8 +560,8 @@ struct SChecksum const CDataGatherer &gatherer, TStrUInt64Map &hashes) const { - typedef boost::reference_wrapper TStrCRef; - typedef std::vector TStrCRefVec; + using TStrCRef = boost::reference_wrapper; + using TStrCRefVec = std::vector; for (std::size_t cid = 0u; cid < attributePeople.size(); ++cid) { @@ -606,7 +606,7 @@ struct SChecksum const CDataGatherer &gatherer, TStrUInt64Map &hashes) const { - typedef boost::unordered_map TSizeUInt64VecUMap; + using TSizeUInt64VecUMap = boost::unordered_map; TSizeUInt64VecUMap attributeHashes; @@ -620,7 +620,7 @@ struct SChecksum } } - for (auto &&hash_ : attributeHashes) + for (auto &hash_ : attributeHashes) { std::sort(hash_.second.begin(), hash_.second.end()); uint64_t &hash = hashes[gatherer.attributeName(hash_.first)]; @@ -754,7 +754,7 @@ const std::string UNIQUE_WORD_TAG("b"); void persistUniqueStrings(const CUniqueStringFeatureData::TWordStringUMap &map, core::CStatePersistInserter &inserter) { - typedef std::vector TWordVec; + using TWordVec = std::vector; if (!map.empty()) { @@ -794,7 +794,7 @@ bool restoreUniqueStrings(core::CStateRestoreTraverser &traverser, void persistInfluencerUniqueStrings(const CUniqueStringFeatureData::TStoredStringPtrWordSetUMap &map, core::CStatePersistInserter &inserter) { - typedef std::vector TStoredStringPtrVec; + using TStoredStringPtrVec = std::vector; if (!map.empty()) { @@ -1023,8 +1023,8 @@ bool CEventRateBucketGatherer::processFields(const TStrCPtrVec &fieldValues, CEventData &result, CResourceMonitor &resourceMonitor) { - typedef boost::optional TOptionalSize; - typedef boost::optional TOptionalStr; + using TOptionalSize = boost::optional; + using TOptionalStr = boost::optional; if (fieldValues.size() != m_FieldNames.size()) { @@ -2083,7 +2083,7 @@ void CUniqueStringFeatureData::populateDistinctCountFeatureData(SEventRateFeatur void CUniqueStringFeatureData::populateInfoContentFeatureData(SEventRateFeatureData &featureData) const { - typedef std::vector TStrCRefVec; + using TStrCRefVec = std::vector; featureData.s_InfluenceValues.clear(); core::CCompressUtils compressor(true); diff --git a/lib/model/CEventRateModel.cc b/lib/model/CEventRateModel.cc index b7f1d09ea1..342ff17cd2 100644 --- a/lib/model/CEventRateModel.cc +++ b/lib/model/CEventRateModel.cc @@ -214,7 +214,7 @@ CEventRateModel::TDouble1Vec CEventRateModel::baselineBucketMean(model_t::EFeatu { probability = 1.0; } - for (auto &&coord : result) + for (auto &coord : result) { coord = probability * model_t::inverseOffsetCountToZero(feature, coord); } @@ -276,7 +276,7 @@ void CEventRateModel::sample(core_t::TTime startTime, maths::CModel::TTimeDouble2VecSizeTrVec values; maths::CModelAddSamplesParams::TDouble2Vec4VecVec weights(1); - for (auto &&featureData : m_CurrentBucketStats.s_FeatureData) + for (auto &featureData : m_CurrentBucketStats.s_FeatureData) { model_t::EFeature feature = featureData.first; TSizeFeatureDataPrVec &data = featureData.second; diff --git a/lib/model/CEventRatePopulationModel.cc b/lib/model/CEventRatePopulationModel.cc index b7f7e90513..a8c2f67f91 100644 --- a/lib/model/CEventRatePopulationModel.cc +++ b/lib/model/CEventRatePopulationModel.cc @@ -230,9 +230,9 @@ bool CEventRatePopulationModel::acceptRestoreTraverser(core::CStateRestoreTraver } while (traverser.next()); - for (auto &&feature : m_FeatureModels) + for (auto &feature : m_FeatureModels) { - for (auto &&model : feature.s_Models) + for (auto &model : feature.s_Models) { for (const auto &correlates : m_FeatureCorrelatesModels) { @@ -305,7 +305,7 @@ CEventRatePopulationModel::TDouble1Vec { probability = 1.0; } - for (auto &&coord : result) + for (auto &coord : result) { coord = probability * model_t::inverseOffsetCountToZero(feature, coord); } @@ -348,7 +348,7 @@ void CEventRatePopulationModel::sampleBucketStatistics(core_t::TTime startTime, TFeatureSizeSizePrFeatureDataPrVecPrVec featureData; gatherer.featureData(time, bucketLength, featureData); - for (auto &&featureData_ : featureData) + for (auto &featureData_ : featureData) { model_t::EFeature feature = featureData_.first; TSizeSizePrFeatureDataPrVec &data = m_CurrentBucketStats.s_FeatureData[feature]; @@ -401,7 +401,7 @@ void CEventRatePopulationModel::sample(core_t::TTime startTime, this->applyFilter(model_t::E_XF_Over, true, this->personFilter(), personCounts); - for (auto &&featureData_ : featureData) + for (auto &featureData_ : featureData) { model_t::EFeature feature = featureData_.first; TSizeSizePrFeatureDataPrVec &data = m_CurrentBucketStats.s_FeatureData[feature]; @@ -446,7 +446,7 @@ void CEventRatePopulationModel::sample(core_t::TTime startTime, uint64_t count = CDataGatherer::extractData(data_).s_Count; fuzzy[cid].add({static_cast(count)}); } - for (auto &&fuzzy_ : fuzzy) + for (auto &fuzzy_ : fuzzy) { fuzzy_.second.computeEpsilons(bucketLength, this->params().s_MinimumToDeduplicate); @@ -505,7 +505,7 @@ void CEventRatePopulationModel::sample(core_t::TTime startTime, } } - for (auto &&attribute : attributes) + for (auto &attribute : attributes) { std::size_t cid = attribute.first; maths::CModelAddSamplesParams params; @@ -563,7 +563,7 @@ void CEventRatePopulationModel::prune(std::size_t maximumAge) { TFeatureSizeSizePrFeatureDataPrVecPrVec featureData; gatherer.featureData(m_CurrentBucketStats.s_StartTime, gatherer.bucketLength(), featureData); - for (auto &&feature : featureData) + for (auto &feature : featureData) { m_CurrentBucketStats.s_FeatureData[feature.first].swap(feature.second); } @@ -989,7 +989,7 @@ void CEventRatePopulationModel::createNewModels(std::size_t n, std::size_t m) { if (m > 0) { - for (auto &&feature : m_FeatureModels) + for (auto &feature : m_FeatureModels) { std::size_t newM = feature.s_Models.size() + m; core::CAllocationStrategy::reserve(feature.s_Models, newM); @@ -1014,7 +1014,7 @@ void CEventRatePopulationModel::updateRecycledModels(void) CDataGatherer &gatherer = this->dataGatherer(); for (auto cid : gatherer.recycledAttributeIds()) { - for (auto &&feature : m_FeatureModels) + for (auto &feature : m_FeatureModels) { feature.s_Models[cid].reset(feature.s_NewModel->clone(cid)); for (const auto &correlates : m_FeatureCorrelatesModels) @@ -1037,7 +1037,7 @@ void CEventRatePopulationModel::refreshCorrelationModels(std::size_t resourceLim auto memoryUsage = boost::bind(&CAnomalyDetectorModel::estimateMemoryUsageOrComputeAndUpdate, this, n, 0, _1); CTimeSeriesCorrelateModelAllocator allocator(resourceMonitor, memoryUsage, resourceLimit, static_cast(maxNumberCorrelations + 0.5)); - for (auto &&feature : m_FeatureCorrelatesModels) + for (auto &feature : m_FeatureCorrelatesModels) { allocator.prototypePrior(feature.s_ModelPrior); feature.s_Models->refresh(allocator); @@ -1049,7 +1049,7 @@ void CEventRatePopulationModel::clearPrunedResources(const TSizeVec &/*people*/, { for (auto cid : attributes) { - for (auto &&feature : m_FeatureModels) + for (auto &feature : m_FeatureModels) { feature.s_Models[cid].reset(this->tinyModel()); } @@ -1059,7 +1059,7 @@ void CEventRatePopulationModel::clearPrunedResources(const TSizeVec &/*people*/, void CEventRatePopulationModel::doSkipSampling(core_t::TTime startTime, core_t::TTime endTime) { core_t::TTime gap = endTime - startTime; - for (auto &&feature : m_FeatureModels) + for (auto &feature : m_FeatureModels) { for (auto &model : feature.s_Models) { diff --git a/lib/model/CGathererTools.cc b/lib/model/CGathererTools.cc index 3c10ff3053..c0c76f806c 100644 --- a/lib/model/CGathererTools.cc +++ b/lib/model/CGathererTools.cc @@ -46,7 +46,7 @@ const std::string SUM_MAP_VALUE_TAG("c"); //! \brief Manages persistence of bucket sums. struct SSumSerializer { - typedef std::vector TSampleVec; + using TSampleVec = std::vector; void operator()(const TSampleVec &sample, core::CStatePersistInserter &inserter) const { @@ -70,11 +70,11 @@ struct SSumSerializer //! \brief Manages persistence of influence bucket sums. struct SInfluencerSumSerializer { - typedef boost::unordered_map TStoredStringPtrDoubleUMap; - typedef TStoredStringPtrDoubleUMap::const_iterator TStoredStringPtrDoubleUMapCItr; - typedef boost::reference_wrapper TStrCRef; - typedef std::pair TStrCRefDoublePr; - typedef std::vector TStrCRefDoublePrVec; + using TStoredStringPtrDoubleUMap = boost::unordered_map; + using TStoredStringPtrDoubleUMapCItr = TStoredStringPtrDoubleUMap::const_iterator; + using TStrCRef = boost::reference_wrapper; + using TStrCRefDoublePr = std::pair; + using TStrCRefDoublePrVec = std::vector; void operator()(const TStoredStringPtrDoubleUMap &map, core::CStatePersistInserter &inserter) const { @@ -209,11 +209,11 @@ std::size_t CGathererTools::CSumGatherer::dimension(void) const SMetricFeatureData CGathererTools::CSumGatherer::featureData(core_t::TTime time, core_t::TTime /*bucketLength*/, const TSampleVec &emptySample) const { - typedef boost::reference_wrapper TStrCRef; - typedef std::pair TDouble1VecDoublePr; - typedef std::pair TStrCRefDouble1VecDoublePrPr; - typedef std::vector TStrCRefDouble1VecDoublePrPrVec; - typedef std::vector TStrCRefDouble1VecDoublePrPrVecVec; + using TStrCRef = boost::reference_wrapper; + using TDouble1VecDoublePr = std::pair; + using TStrCRefDouble1VecDoublePrPr = std::pair; + using TStrCRefDouble1VecDoublePrPrVec = std::vector; + using TStrCRefDouble1VecDoublePrPrVecVec = std::vector; const TSampleVec *sum = &m_BucketSums.get(time); if (sum->empty()) diff --git a/lib/model/CHierarchicalResults.cc b/lib/model/CHierarchicalResults.cc index f1f353bcc3..8a6772782d 100644 --- a/lib/model/CHierarchicalResults.cc +++ b/lib/model/CHierarchicalResults.cc @@ -35,7 +35,7 @@ namespace hierarchical_results_detail namespace { -typedef SNode::TNodeCPtr TNodeCPtr; +using TNodeCPtr = SNode::TNodeCPtr; //! CHierarchicalResults tags const std::string NODES_1_TAG("a"); @@ -189,8 +189,8 @@ void aggregateLayer(ITR beginLayer, FACTORY newNode, std::vector &newLayer) { - typedef std::vector TNodePtrVec; - typedef std::map TNodeCPtrNodePtrVecMap; + using TNodePtrVec = std::vector; + using TNodeCPtrNodePtrVecMap = std::map; newLayer.clear(); @@ -673,7 +673,7 @@ void CHierarchicalResults::addInfluencer(const std::string &name) void CHierarchicalResults::buildHierarchy(void) { - typedef std::vector TNodePtrVec; + using TNodePtrVec = std::vector; m_Nodes.erase(std::remove_if(m_Nodes.begin(), m_Nodes.end(), isAggregate), m_Nodes.end()); @@ -778,7 +778,7 @@ void CHierarchicalResults::createPivots(void) } } - for (auto &&pivot : m_PivotNodes) + for (auto &pivot : m_PivotNodes) { TNode &root = this->newPivotRoot(pivot.second.s_Spec.s_PersonFieldName); root.s_Children.push_back(&pivot.second); @@ -889,10 +889,10 @@ model_t::CResultType CHierarchicalResults::resultType(void) const void CHierarchicalResults::acceptPersistInserter(core::CStatePersistInserter &inserter) const { - typedef TStoredStringPtrNodeMap::const_iterator TStoredStringPtrNodeMapCItr; - typedef std::vector TStoredStringPtrNodeMapCItrVec; - typedef TStoredStringPtrStoredStringPtrPrNodeMap::const_iterator TStoredStringPtrStoredStringPtrPrNodeMapCItr; - typedef std::vector TStoredStringPtrStoredStringPtrPrNodeMapCItrVec; + using TStoredStringPtrNodeMapCItr = TStoredStringPtrNodeMap::const_iterator; + using TStoredStringPtrNodeMapCItrVec = std::vector; + using TStoredStringPtrStoredStringPtrPrNodeMapCItr = TStoredStringPtrStoredStringPtrPrNodeMap::const_iterator; + using TStoredStringPtrStoredStringPtrPrNodeMapCItrVec = std::vector; TNodePtrSizeUMap nodePointers; diff --git a/lib/model/CHierarchicalResultsAggregator.cc b/lib/model/CHierarchicalResultsAggregator.cc index 0cee80c669..e6fd049436 100644 --- a/lib/model/CHierarchicalResultsAggregator.cc +++ b/lib/model/CHierarchicalResultsAggregator.cc @@ -441,7 +441,7 @@ double CHierarchicalResultsAggregator::correctProbability(const TNode &node, boo TDetectorEqualizerPtrVec equalizers; this->elements(node, pivot, factory, equalizers); TMaxAccumulator corrected; - for (auto &&equalizer : equalizers) + for (auto &equalizer : equalizers) { switch (m_Job) { diff --git a/lib/model/CHierarchicalResultsNormalizer.cc b/lib/model/CHierarchicalResultsNormalizer.cc index c50b2d7cf3..f7c3e81bc6 100644 --- a/lib/model/CHierarchicalResultsNormalizer.cc +++ b/lib/model/CHierarchicalResultsNormalizer.cc @@ -34,7 +34,7 @@ namespace class CNormalizerFactory { public: - typedef CHierarchicalResultsNormalizer::TNormalizer TNormalizer; + using TNormalizer = CHierarchicalResultsNormalizer::TNormalizer; CNormalizerFactory(const CAnomalyDetectorModelConfig &modelConfig) : m_ModelConfig(modelConfig) {} diff --git a/lib/model/CIndividualModel.cc b/lib/model/CIndividualModel.cc index 48a5b23c3f..f8097a4de1 100644 --- a/lib/model/CIndividualModel.cc +++ b/lib/model/CIndividualModel.cc @@ -38,10 +38,10 @@ namespace model namespace { -typedef boost::reference_wrapper TStrCRef; -typedef std::map TStrCRefUInt64Map; -typedef std::pair TStrCRefStrCRefPr; -typedef std::map TStrCRefStrCRefPrUInt64Map; +using TStrCRef = boost::reference_wrapper; +using TStrCRefUInt64Map = std::map; +using TStrCRefStrCRefPr = std::pair; +using TStrCRefStrCRefPrUInt64Map = std::map; //! Update \p hashes with the hashes of the active people in \p values. template @@ -432,9 +432,9 @@ bool CIndividualModel::doAcceptRestoreTraverser(core::CStateRestoreTraverser &tr } while (traverser.next()); - for (auto &&feature : m_FeatureModels) + for (auto &feature : m_FeatureModels) { - for (auto &&model : feature.s_Models) + for (auto &model : feature.s_Models) { for (const auto &correlates : m_FeatureCorrelatesModels) { @@ -506,7 +506,7 @@ void CIndividualModel::createNewModels(std::size_t n, std::size_t m) std::size_t newN = m_FirstBucketTimes.size() + n; core::CAllocationStrategy::resize(m_FirstBucketTimes, newN, CAnomalyDetectorModel::TIME_UNSET); core::CAllocationStrategy::resize(m_LastBucketTimes, newN, CAnomalyDetectorModel::TIME_UNSET); - for (auto &&feature : m_FeatureModels) + for (auto &feature : m_FeatureModels) { core::CAllocationStrategy::reserve(feature.s_Models, newN); for (std::size_t pid = feature.s_Models.size(); pid < newN; ++pid) @@ -531,7 +531,7 @@ void CIndividualModel::updateRecycledModels(void) { m_FirstBucketTimes[pid] = CAnomalyDetectorModel::TIME_UNSET; m_LastBucketTimes[pid] = CAnomalyDetectorModel::TIME_UNSET; - for (auto &&feature : m_FeatureModels) + for (auto &feature : m_FeatureModels) { feature.s_Models[pid].reset(feature.s_NewModel->clone(pid)); for (const auto &correlates : m_FeatureCorrelatesModels) @@ -554,7 +554,7 @@ void CIndividualModel::refreshCorrelationModels(std::size_t resourceLimit, auto memoryUsage = boost::bind(&CAnomalyDetectorModel::estimateMemoryUsageOrComputeAndUpdate, this, n, 0, _1); CTimeSeriesCorrelateModelAllocator allocator(resourceMonitor, memoryUsage, resourceLimit, static_cast(maxNumberCorrelations)); - for (auto &&feature : m_FeatureCorrelatesModels) + for (auto &feature : m_FeatureCorrelatesModels) { allocator.prototypePrior(feature.s_ModelPrior); feature.s_Models->refresh(allocator); @@ -565,7 +565,7 @@ void CIndividualModel::clearPrunedResources(const TSizeVec &people, const TSizeV { for (auto pid : people) { - for (auto &&feature : m_FeatureModels) + for (auto &feature : m_FeatureModels) { feature.s_Models[pid].reset(this->tinyModel()); } @@ -699,7 +699,7 @@ void CIndividualModel::doSkipSampling(core_t::TTime startTime, core_t::TTime end { core_t::TTime gap = endTime - startTime; - for (auto &&time : m_LastBucketTimes) + for (auto &time : m_LastBucketTimes) { if (!CAnomalyDetectorModel::isTimeUnset(time)) { @@ -707,7 +707,7 @@ void CIndividualModel::doSkipSampling(core_t::TTime startTime, core_t::TTime end } } - for (auto &&feature : m_FeatureModels) + for (auto &feature : m_FeatureModels) { for (auto &model : feature.s_Models) { diff --git a/lib/model/CMemoryUsageEstimator.cc b/lib/model/CMemoryUsageEstimator.cc index cd039842e2..066648563b 100644 --- a/lib/model/CMemoryUsageEstimator.cc +++ b/lib/model/CMemoryUsageEstimator.cc @@ -40,7 +40,7 @@ CMemoryUsageEstimator::CMemoryUsageEstimator(void) CMemoryUsageEstimator::TOptionalSize CMemoryUsageEstimator::estimate(const TSizeArray &predictors) { - typedef boost::array TDoubleArray; + using TDoubleArray = boost::array; if (m_Values.size() < E_NumberPredictors) { diff --git a/lib/model/CMetricBucketGatherer.cc b/lib/model/CMetricBucketGatherer.cc index 321f1ea2bb..dc286bab85 100644 --- a/lib/model/CMetricBucketGatherer.cc +++ b/lib/model/CMetricBucketGatherer.cc @@ -117,18 +117,18 @@ const std::string &overField(bool population, const TStrVec &fieldNames) } template struct SDataType {}; -template<> struct SDataType { typedef TSizeSizeMeanGathererUMapUMap Type; }; -template<> struct SDataType { typedef TSizeSizeMedianGathererUMapUMap Type; }; -template<> struct SDataType { typedef TSizeSizeMinGathererUMapUMap Type; }; -template<> struct SDataType { typedef TSizeSizeMaxGathererUMapUMap Type; }; -template<> struct SDataType { typedef TSizeSizeSumGathererUMapUMap Type; }; -template<> struct SDataType { typedef TSizeSizeVarianceGathererUMapUMap Type; }; -template<> struct SDataType { typedef TSizeSizeMultivariateMeanGathererUMapUMap Type; }; -template<> struct SDataType { typedef TSizeSizeMultivariateMinGathererUMapUMap Type; }; -template<> struct SDataType { typedef TSizeSizeMultivariateMaxGathererUMapUMap Type; }; +template<> struct SDataType { using Type = TSizeSizeMeanGathererUMapUMap; }; +template<> struct SDataType { using Type = TSizeSizeMedianGathererUMapUMap; }; +template<> struct SDataType { using Type = TSizeSizeMinGathererUMapUMap; }; +template<> struct SDataType { using Type = TSizeSizeMaxGathererUMapUMap; }; +template<> struct SDataType { using Type = TSizeSizeSumGathererUMapUMap; }; +template<> struct SDataType { using Type = TSizeSizeVarianceGathererUMapUMap; }; +template<> struct SDataType { using Type = TSizeSizeMultivariateMeanGathererUMapUMap; }; +template<> struct SDataType { using Type = TSizeSizeMultivariateMinGathererUMapUMap; }; +template<> struct SDataType { using Type = TSizeSizeMultivariateMaxGathererUMapUMap; }; template struct SMaybeConst {}; -template struct SMaybeConst { typedef T Type; }; -template struct SMaybeConst { typedef const T Type; }; +template struct SMaybeConst { using Type = T;}; +template struct SMaybeConst { using Type = const T; }; //! Register the callbacks for computing the size of feature data gatherers //! with \p visitor. @@ -1656,7 +1656,7 @@ void CMetricBucketGatherer::startNewBucket(core_t::TTime time, bool skipUpdates) } double alpha = ::exp(-m_DataGatherer.params().s_DecayRate); - for (auto &&count : counts) + for (auto &count : counts) { std::sort(count.second.begin(), count.second.end()); std::size_t n = count.second.size() / 2; diff --git a/lib/model/CMetricModel.cc b/lib/model/CMetricModel.cc index 82e5bcc58e..316a52e5ab 100644 --- a/lib/model/CMetricModel.cc +++ b/lib/model/CMetricModel.cc @@ -255,7 +255,7 @@ void CMetricModel::sample(core_t::TTime startTime, maths::CModelAddSamplesParams::TDouble2Vec4VecVec trendWeights; maths::CModelAddSamplesParams::TDouble2Vec4VecVec priorWeights; - for (auto &&featureData : m_CurrentBucketStats.s_FeatureData) + for (auto &featureData : m_CurrentBucketStats.s_FeatureData) { model_t::EFeature feature = featureData.first; TSizeFeatureDataPrVec &data = featureData.second; diff --git a/lib/model/CMetricPopulationModel.cc b/lib/model/CMetricPopulationModel.cc index 136fca71f7..959fd382c6 100644 --- a/lib/model/CMetricPopulationModel.cc +++ b/lib/model/CMetricPopulationModel.cc @@ -216,9 +216,9 @@ bool CMetricPopulationModel::acceptRestoreTraverser(core::CStateRestoreTraverser } while (traverser.next()); - for (auto &&feature : m_FeatureModels) + for (auto &feature : m_FeatureModels) { - for (auto &&model : feature.s_Models) + for (auto &model : feature.s_Models) { for (const auto &correlates : m_FeatureCorrelatesModels) { @@ -317,7 +317,7 @@ void CMetricPopulationModel::sampleBucketStatistics(core_t::TTime startTime, TFeatureSizeSizePrFeatureDataPrVecPrVec featureData; gatherer.featureData(time, bucketLength, featureData); - for (auto &&featureData_ : featureData) + for (auto &featureData_ : featureData) { model_t::EFeature feature = featureData_.first; TSizeSizePrFeatureDataPrVec &data = m_CurrentBucketStats.s_FeatureData[feature]; @@ -496,7 +496,7 @@ void CMetricPopulationModel::sample(core_t::TTime startTime, } } - for (auto &&attribute : attributes) + for (auto &attribute : attributes) { std::size_t cid = attribute.first; core_t::TTime latest = boost::numeric::bounds::lowest(); @@ -560,7 +560,7 @@ void CMetricPopulationModel::prune(std::size_t maximumAge) { TFeatureSizeSizePrFeatureDataPrVecPrVec featureData; gatherer.featureData(m_CurrentBucketStats.s_StartTime, gatherer.bucketLength(), featureData); - for (auto &&feature : featureData) + for (auto &feature : featureData) { m_CurrentBucketStats.s_FeatureData[feature.first].swap(feature.second); } @@ -893,7 +893,7 @@ void CMetricPopulationModel::createNewModels(std::size_t n, std::size_t m) { if (m > 0) { - for (auto &&feature : m_FeatureModels) + for (auto &feature : m_FeatureModels) { std::size_t newM = feature.s_Models.size() + m; core::CAllocationStrategy::reserve(feature.s_Models, newM); @@ -918,7 +918,7 @@ void CMetricPopulationModel::updateRecycledModels(void) CDataGatherer &gatherer = this->dataGatherer(); for (auto cid : gatherer.recycledAttributeIds()) { - for (auto &&feature : m_FeatureModels) + for (auto &feature : m_FeatureModels) { feature.s_Models[cid].reset(feature.s_NewModel->clone(cid)); for (const auto &correlates : m_FeatureCorrelatesModels) @@ -941,7 +941,7 @@ void CMetricPopulationModel::refreshCorrelationModels(std::size_t resourceLimit, auto memoryUsage = boost::bind(&CAnomalyDetectorModel::estimateMemoryUsageOrComputeAndUpdate, this, n, 0, _1); CTimeSeriesCorrelateModelAllocator allocator(resourceMonitor, memoryUsage, resourceLimit, static_cast(maxNumberCorrelations + 0.5)); - for (auto &&feature : m_FeatureCorrelatesModels) + for (auto &feature : m_FeatureCorrelatesModels) { allocator.prototypePrior(feature.s_ModelPrior); feature.s_Models->refresh(allocator); @@ -954,7 +954,7 @@ void CMetricPopulationModel::clearPrunedResources(const TSizeVec &/*people*/, CDataGatherer &gatherer = this->dataGatherer(); for (auto cid : gatherer.recycledAttributeIds()) { - for (auto &&feature : m_FeatureModels) + for (auto &feature : m_FeatureModels) { feature.s_Models[cid].reset(feature.s_NewModel->clone(cid)); for (const auto &correlates : m_FeatureCorrelatesModels) @@ -971,7 +971,7 @@ void CMetricPopulationModel::clearPrunedResources(const TSizeVec &/*people*/, void CMetricPopulationModel::doSkipSampling(core_t::TTime startTime, core_t::TTime endTime) { core_t::TTime gap = endTime - startTime; - for (auto &&feature : m_FeatureModels) + for (auto &feature : m_FeatureModels) { for (auto &model : feature.s_Models) { diff --git a/lib/model/CModelTools.cc b/lib/model/CModelTools.cc index 2bace06124..1343237233 100644 --- a/lib/model/CModelTools.cc +++ b/lib/model/CModelTools.cc @@ -234,7 +234,7 @@ void CModelTools::CProbabilityAggregator::add(const TAggregator &aggregator, dou void CModelTools::CProbabilityAggregator::add(double probability, double weight) { m_TotalWeight += weight; - for (auto &&aggregator : m_Aggregators) + for (auto &aggregator : m_Aggregators) { boost::apply_visitor(boost::bind( SAddProbability(), probability, weight, _1), aggregator.first); diff --git a/lib/model/CPopulationModel.cc b/lib/model/CPopulationModel.cc index a61ba806d7..92b1b6c65c 100644 --- a/lib/model/CPopulationModel.cc +++ b/lib/model/CPopulationModel.cc @@ -38,7 +38,7 @@ namespace { using TStrCRef = boost::reference_wrapper; -using TStrCRefUInt64Map = std::map ; +using TStrCRefUInt64Map = std::map; enum EEntity { @@ -91,7 +91,7 @@ void hashActive(EEntity entity, template void hashActive(EEntity entity, const CDataGatherer &gatherer, - const std::vector > > &values, + const std::vector> > &values, TStrCRefUInt64Map &hashes) { for (const auto &value : values) diff --git a/lib/model/CProbabilityAndInfluenceCalculator.cc b/lib/model/CProbabilityAndInfluenceCalculator.cc index d8f70289ac..ccf5b8f895 100644 --- a/lib/model/CProbabilityAndInfluenceCalculator.cc +++ b/lib/model/CProbabilityAndInfluenceCalculator.cc @@ -26,30 +26,30 @@ namespace model namespace { -typedef CProbabilityAndInfluenceCalculator::TSize1Vec TSize1Vec; -typedef CProbabilityAndInfluenceCalculator::TSize2Vec TSize2Vec; -typedef CProbabilityAndInfluenceCalculator::TDouble1Vec TDouble1Vec; -typedef CProbabilityAndInfluenceCalculator::TDouble2Vec TDouble2Vec; -typedef CProbabilityAndInfluenceCalculator::TDouble4Vec TDouble4Vec; -typedef CProbabilityAndInfluenceCalculator::TDouble2Vec1Vec TDouble2Vec1Vec; -typedef CProbabilityAndInfluenceCalculator::TDouble4Vec1Vec TDouble4Vec1Vec; -typedef CProbabilityAndInfluenceCalculator::TDouble1VecDoublePr TDouble1VecDoublePr; -typedef CProbabilityAndInfluenceCalculator::TBool2Vec TBool2Vec; -typedef CProbabilityAndInfluenceCalculator::TTime2Vec TTime2Vec; -typedef CProbabilityAndInfluenceCalculator::TTime2Vec1Vec TTime2Vec1Vec; -typedef CProbabilityAndInfluenceCalculator::TStrCRefDouble1VecDoublePrPr TStrCRefDouble1VecDoublePrPr; -typedef CProbabilityAndInfluenceCalculator::TStrCRefDouble1VecDoublePrPrVec TStrCRefDouble1VecDoublePrPrVec; -typedef CProbabilityAndInfluenceCalculator::TStrCRefDouble1VecDouble1VecPrPr TStrCRefDouble1VecDouble1VecPrPr; -typedef CProbabilityAndInfluenceCalculator::TStrCRefDouble1VecDouble1VecPrPrVec TStrCRefDouble1VecDouble1VecPrPrVec; -typedef CProbabilityAndInfluenceCalculator::TStoredStringPtrStoredStringPtrPr TStoredStringPtrStoredStringPtrPr; -typedef CProbabilityAndInfluenceCalculator::TStoredStringPtrStoredStringPtrPrDoublePr TStoredStringPtrStoredStringPtrPrDoublePr; -typedef CProbabilityAndInfluenceCalculator::TStoredStringPtrStoredStringPtrPrDoublePrVec TStoredStringPtrStoredStringPtrPrDoublePrVec; -typedef core::CSmallVector TTail2Vec; -typedef core::CSmallVector TProbabilityCalculation2Vec; -typedef core::CSmallVector TDouble2Vec4Vec; -typedef core::CSmallVector TDouble2Vec4Vec1Vec; -typedef std::pair TSizeDoublePr; -typedef core::CSmallVector TSizeDoublePr1Vec; +using TSize1Vec = CProbabilityAndInfluenceCalculator::TSize1Vec; +using TSize2Vec = CProbabilityAndInfluenceCalculator::TSize2Vec; +using TDouble1Vec = CProbabilityAndInfluenceCalculator::TDouble1Vec; +using TDouble2Vec = CProbabilityAndInfluenceCalculator::TDouble2Vec; +using TDouble4Vec = CProbabilityAndInfluenceCalculator::TDouble4Vec; +using TDouble2Vec1Vec = CProbabilityAndInfluenceCalculator::TDouble2Vec1Vec; +using TDouble4Vec1Vec = CProbabilityAndInfluenceCalculator::TDouble4Vec1Vec; +using TDouble1VecDoublePr = CProbabilityAndInfluenceCalculator::TDouble1VecDoublePr; +using TBool2Vec = CProbabilityAndInfluenceCalculator::TBool2Vec; +using TTime2Vec = CProbabilityAndInfluenceCalculator::TTime2Vec; +using TTime2Vec1Vec = CProbabilityAndInfluenceCalculator::TTime2Vec1Vec; +using TStrCRefDouble1VecDoublePrPr = CProbabilityAndInfluenceCalculator::TStrCRefDouble1VecDoublePrPr; +using TStrCRefDouble1VecDoublePrPrVec = CProbabilityAndInfluenceCalculator::TStrCRefDouble1VecDoublePrPrVec; +using TStrCRefDouble1VecDouble1VecPrPr = CProbabilityAndInfluenceCalculator::TStrCRefDouble1VecDouble1VecPrPr; +using TStrCRefDouble1VecDouble1VecPrPrVec = CProbabilityAndInfluenceCalculator::TStrCRefDouble1VecDouble1VecPrPrVec; +using TStoredStringPtrStoredStringPtrPr = CProbabilityAndInfluenceCalculator::TStoredStringPtrStoredStringPtrPr; +using TStoredStringPtrStoredStringPtrPrDoublePr = CProbabilityAndInfluenceCalculator::TStoredStringPtrStoredStringPtrPrDoublePr; +using TStoredStringPtrStoredStringPtrPrDoublePrVec = CProbabilityAndInfluenceCalculator::TStoredStringPtrStoredStringPtrPrDoublePrVec; +using TTail2Vec = core::CSmallVector; +using TProbabilityCalculation2Vec = core::CSmallVector; +using TDouble2Vec4Vec = core::CSmallVector; +using TDouble2Vec4Vec1Vec = core::CSmallVector; +using TSizeDoublePr = std::pair; +using TSizeDoublePr1Vec = core::CSmallVector; //! Get the canonical influence string pointer. core::CStoredStringPtr canonical(const std::string &influence) @@ -79,7 +79,7 @@ class CDecreasingValueInfluence class CDecreasingMeanInfluence { public: - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; public: CDecreasingMeanInfluence(maths_t::ETail tail, const TDouble2Vec &value, double count) : @@ -112,7 +112,7 @@ class CDecreasingMeanInfluence class CDecreasingVarianceInfluence { public: - typedef maths::CBasicStatistics::SSampleMeanVar::TAccumulator TMeanVarAccumulator; + using TMeanVarAccumulator = maths::CBasicStatistics::SSampleMeanVar::TAccumulator; public: CDecreasingVarianceInfluence(maths_t::ETail tail, const TDouble2Vec &value, double count) : @@ -755,7 +755,7 @@ bool CProbabilityAndInfluenceCalculator::addProbability(model_t::EFeature featur void CProbabilityAndInfluenceCalculator::addProbability(double probability, double weight) { m_Probability.add(probability, weight); - for (auto &&aggregator : m_InfluencerProbabilities) + for (auto &aggregator : m_InfluencerProbabilities) { aggregator.second.add(probability, weight); } diff --git a/lib/model/CResourceMonitor.cc b/lib/model/CResourceMonitor.cc index 2774223662..11b25d3653 100644 --- a/lib/model/CResourceMonitor.cc +++ b/lib/model/CResourceMonitor.cc @@ -200,7 +200,7 @@ bool CResourceMonitor::pruneIfRequired(core_t::TTime endTime) // Do a prune and see how much we got back // These are the expensive operations std::size_t usageAfter = 0; - for (auto &&model : m_Models) + for (auto &model : m_Models) { model.first->prune(m_PruneWindow); model.second = model.first->memoryUsage(); diff --git a/lib/model/CSample.cc b/lib/model/CSample.cc index a31e2746c8..172970cea5 100644 --- a/lib/model/CSample.cc +++ b/lib/model/CSample.cc @@ -94,7 +94,7 @@ CSample::CSample(core_t::TTime time, CSample::TDouble1Vec CSample::value(std::size_t dimension) const { - typedef std::vector TSizeVec; + using TSizeVec = std::vector; TDouble1Vec result; const TSizeVec &indices = CFeatureDataIndexing::valueIndices(dimension); diff --git a/lib/model/CSearchKey.cc b/lib/model/CSearchKey.cc index f23611a439..9a39296fe2 100644 --- a/lib/model/CSearchKey.cc +++ b/lib/model/CSearchKey.cc @@ -204,7 +204,7 @@ void CSearchKey::swap(CSearchKey &other) bool CSearchKey::operator==(const CSearchKey &rhs) const { - typedef std::equal_to TStrEqualTo; + using TStrEqualTo = std::equal_to; return this->hash() == rhs.hash() && m_Identifier == rhs.m_Identifier diff --git a/lib/model/FunctionTypes.cc b/lib/model/FunctionTypes.cc index 60999b64f3..eac295cf13 100644 --- a/lib/model/FunctionTypes.cc +++ b/lib/model/FunctionTypes.cc @@ -21,7 +21,7 @@ namespace model namespace function_t { -typedef model_t::TFeatureVec TFeatureVec; +using TFeatureVec = model_t::TFeatureVec; bool isIndividual(EFunction function) { @@ -543,9 +543,9 @@ bool isForecastSupported(EFunction function) namespace { -typedef std::map TFeatureFunctionVecMap; -typedef TFeatureFunctionVecMap::iterator TFeatureFunctionVecMapItr; -typedef TFeatureFunctionVecMap::const_iterator TFeatureFunctionVecMapCItr; +using TFeatureFunctionVecMap = std::map; +using TFeatureFunctionVecMapItr = TFeatureFunctionVecMap::iterator; +using TFeatureFunctionVecMapCItr = TFeatureFunctionVecMap::const_iterator; namespace detail { diff --git a/lib/model/unittest/CAnnotatedProbabilityBuilderTest.cc b/lib/model/unittest/CAnnotatedProbabilityBuilderTest.cc index 189ae9ffe9..4202af0683 100644 --- a/lib/model/unittest/CAnnotatedProbabilityBuilderTest.cc +++ b/lib/model/unittest/CAnnotatedProbabilityBuilderTest.cc @@ -21,12 +21,12 @@ using namespace model; namespace { -typedef core::CSmallVector TDouble1Vec; -typedef core::CSmallVector TDouble4Vec; -typedef core::CSmallVector TDouble4Vec1Vec; -typedef std::pair TSizeDoublePr; -typedef core::CSmallVector TSizeDoublePr1Vec; -typedef core::CSmallVector TStoredStringPtr1Vec; +using TDouble1Vec = core::CSmallVector; +using TDouble4Vec = core::CSmallVector; +using TDouble4Vec1Vec = core::CSmallVector; +using TSizeDoublePr = std::pair; +using TSizeDoublePr1Vec = core::CSmallVector; +using TStoredStringPtr1Vec = core::CSmallVector; const std::string EMPTY_STRING; const core::CStoredStringPtr EMPTY_STRING_PTR(CStringStore::names().getEmpty()); diff --git a/lib/model/unittest/CAnomalyDetectorModelConfigTest.cc b/lib/model/unittest/CAnomalyDetectorModelConfigTest.cc index c938a84d73..c6b1da1b80 100644 --- a/lib/model/unittest/CAnomalyDetectorModelConfigTest.cc +++ b/lib/model/unittest/CAnomalyDetectorModelConfigTest.cc @@ -19,7 +19,7 @@ using namespace model; namespace { -typedef std::vector TDoubleVec; +using TDoubleVec = std::vector; const function_t::EFunction INDIVIDUAL_COUNT = function_t::E_IndividualCount; const function_t::EFunction INDIVIDUAL_METRIC = function_t::E_IndividualMetricMin; diff --git a/lib/model/unittest/CAnomalyScoreTest.cc b/lib/model/unittest/CAnomalyScoreTest.cc index 6ea19c7739..6a87ab4005 100644 --- a/lib/model/unittest/CAnomalyScoreTest.cc +++ b/lib/model/unittest/CAnomalyScoreTest.cc @@ -36,15 +36,15 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; } void CAnomalyScoreTest::testComputeScores(void) { - typedef model::CAnomalyScore TScores; - typedef maths::CJointProbabilityOfLessLikelySamples TJointProbabilityCalculator; - typedef maths::CLogProbabilityOfMFromNExtremeSamples TLogExtremeProbabilityCalculator; + using TScores = model::CAnomalyScore; + using TJointProbabilityCalculator = maths::CJointProbabilityOfLessLikelySamples; + using TLogExtremeProbabilityCalculator = maths::CLogProbabilityOfMFromNExtremeSamples; const double jointProbabilityWeight = 0.5; const double extremeProbabilityWeight = 0.5; @@ -265,8 +265,8 @@ void CAnomalyScoreTest::testComputeScores(void) void CAnomalyScoreTest::testNormalizeScoresQuantiles(void) { - typedef std::multiset TDoubleMSet; - typedef TDoubleMSet::iterator TDoubleMSetItr; + using TDoubleMSet = std::multiset; + using TDoubleMSetItr = TDoubleMSet::iterator; test::CRandomNumbers rng; @@ -322,8 +322,8 @@ void CAnomalyScoreTest::testNormalizeScoresQuantiles(void) void CAnomalyScoreTest::testNormalizeScoresNoisy(void) { - typedef std::multimap TDoubleSizeMap; - typedef TDoubleSizeMap::const_iterator TDoubleSizeMapCItr; + using TDoubleSizeMap = std::multimap; + using TDoubleSizeMapCItr = TDoubleSizeMap::const_iterator; test::CRandomNumbers rng; diff --git a/lib/model/unittest/CBucketQueueTest.cc b/lib/model/unittest/CBucketQueueTest.cc index af1c29ba15..10d5122a85 100644 --- a/lib/model/unittest/CBucketQueueTest.cc +++ b/lib/model/unittest/CBucketQueueTest.cc @@ -19,12 +19,12 @@ using namespace ml; using namespace model; -typedef std::pair TSizeSizePr; -typedef std::pair TSizeSizePrUInt64Pr; -typedef std::vector TSizeSizePrUInt64PrVec; -typedef boost::unordered_map TSizeSizePrUInt64UMap; -typedef model::CBucketQueue TSizeSizePrUInt64UMapQueue; -typedef TSizeSizePrUInt64UMapQueue::const_iterator TSizeSizePrUInt64UMapQueueCItr; +using TSizeSizePr = std::pair; +using TSizeSizePrUInt64Pr = std::pair; +using TSizeSizePrUInt64PrVec = std::vector; +using TSizeSizePrUInt64UMap = boost::unordered_map; +using TSizeSizePrUInt64UMapQueue = model::CBucketQueue; +using TSizeSizePrUInt64UMapQueueCItr = TSizeSizePrUInt64UMapQueue::const_iterator; void CBucketQueueTest::testConstructorFillsQueue(void) { @@ -96,7 +96,7 @@ void CBucketQueueTest::testClear(void) void CBucketQueueTest::testIterators(void) { - typedef CBucketQueue::iterator TStringQueueItr; + using TStringQueueItr = CBucketQueue::iterator; CBucketQueue queue(1, 5, 0); queue.push("a", 5); @@ -115,7 +115,7 @@ void CBucketQueueTest::testIterators(void) void CBucketQueueTest::testReverseIterators(void) { - typedef CBucketQueue::const_reverse_iterator TStringQueueCRItr; + using TStringQueueCRItr = CBucketQueue::const_reverse_iterator; CBucketQueue queue(1, 5, 0); queue.push("a", 5); diff --git a/lib/model/unittest/CDetectionRuleTest.cc b/lib/model/unittest/CDetectionRuleTest.cc index 5966160af7..84ecea01d6 100644 --- a/lib/model/unittest/CDetectionRuleTest.cc +++ b/lib/model/unittest/CDetectionRuleTest.cc @@ -27,8 +27,8 @@ using namespace model; namespace { -typedef std::vector TFeatureVec; -typedef std::vector TStrVec; +using TFeatureVec = std::vector; +using TStrVec = std::vector; const std::string EMPTY_STRING; } diff --git a/lib/model/unittest/CDetectorEqualizerTest.cc b/lib/model/unittest/CDetectorEqualizerTest.cc index cf4f50b5a3..edf2c886c1 100644 --- a/lib/model/unittest/CDetectorEqualizerTest.cc +++ b/lib/model/unittest/CDetectorEqualizerTest.cc @@ -21,12 +21,12 @@ using namespace ml; -typedef std::vector TDoubleVec; +using TDoubleVec = std::vector; namespace { -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; const double THRESHOLD = ::log(0.05); } diff --git a/lib/model/unittest/CEventRateAnomalyDetectorTest.cc b/lib/model/unittest/CEventRateAnomalyDetectorTest.cc index 52a42c96e7..e656c57ae3 100644 --- a/lib/model/unittest/CEventRateAnomalyDetectorTest.cc +++ b/lib/model/unittest/CEventRateAnomalyDetectorTest.cc @@ -32,12 +32,12 @@ namespace { -typedef std::vector TTimeVec; -typedef std::vector TStrVec; -typedef std::map TTimeDoubleMap; -typedef TTimeDoubleMap::const_iterator TTimeDoubleMapCItr; -typedef std::pair TTimeStrPr; -typedef std::set TTimeStrPrSet; +using TTimeVec = std::vector; +using TStrVec = std::vector; +using TTimeDoubleMap = std::map; +using TTimeDoubleMapCItr = TTimeDoubleMap::const_iterator; +using TTimeStrPr = std::pair; +using TTimeStrPrSet = std::set; const std::string EMPTY_STRING; @@ -146,9 +146,9 @@ void importData(ml::core_t::TTime firstTime, const TStrVec &fileNames, ml::model::CAnomalyDetector &detector) { - typedef boost::shared_ptr TifstreamPtr; - typedef std::vector TifstreamPtrVec; - typedef std::vector TTimeVec; + using TifstreamPtr = boost::shared_ptr; + using TifstreamPtrVec = std::vector; + using TTimeVec = std::vector; TifstreamPtrVec ifss; for (std::size_t i = 0u; i < fileNames.size(); ++i) diff --git a/lib/model/unittest/CEventRateDataGathererTest.cc b/lib/model/unittest/CEventRateDataGathererTest.cc index 06e4f56e29..5a38301f53 100644 --- a/lib/model/unittest/CEventRateDataGathererTest.cc +++ b/lib/model/unittest/CEventRateDataGathererTest.cc @@ -33,27 +33,27 @@ using namespace ml; using namespace model; -typedef std::vector TSizeVec; -typedef std::vector TFeatureVec; -typedef std::pair TSizeUInt64Pr; -typedef std::vector TSizeUInt64PrVec; -typedef std::vector TStrVec; -typedef TStrVec::const_iterator TStrVecCItr; -typedef std::vector TStrVecVec; -typedef SEventRateFeatureData TFeatureData; -typedef std::pair TSizeFeatureDataPr; -typedef std::vector TSizeFeatureDataPrVec; -typedef std::pair TFeatureSizeFeatureDataPrVecPr; -typedef std::vector TFeatureSizeFeatureDataPrVecPrVec; -typedef std::pair TSizeSizePr; -typedef std::pair TSizeSizePrFeatureDataPr; -typedef std::vector TSizeSizePrFeatureDataPrVec; -typedef std::pair TFeatureSizeSizePrFeatureDataPrVecPr; -typedef std::vector TFeatureSizeSizePrFeatureDataPrVecPrVec; -typedef CBucketGatherer::TSizeSizePrStoredStringPtrPr TSizeSizePrStoredStringPtrPr; -typedef CBucketGatherer::TSizeSizePrStoredStringPtrPrUInt64UMapVec TSizeSizePrStoredStringPtrPrUInt64UMapVec; -typedef std::vector TTimeVec; -typedef CBucketGatherer::TStrCPtrVec TStrCPtrVec; +using TSizeVec = std::vector; +using TFeatureVec = std::vector; +using TSizeUInt64Pr = std::pair; +using TSizeUInt64PrVec = std::vector; +using TStrVec = std::vector; +using TStrVecCItr = TStrVec::const_iterator; +using TStrVecVec = std::vector; +using TFeatureData = SEventRateFeatureData; +using TSizeFeatureDataPr = std::pair; +using TSizeFeatureDataPrVec = std::vector; +using TFeatureSizeFeatureDataPrVecPr = std::pair; +using TFeatureSizeFeatureDataPrVecPrVec = std::vector; +using TSizeSizePr = std::pair; +using TSizeSizePrFeatureDataPr = std::pair; +using TSizeSizePrFeatureDataPrVec = std::vector; +using TFeatureSizeSizePrFeatureDataPrVecPr = std::pair; +using TFeatureSizeSizePrFeatureDataPrVecPrVec = std::vector; +using TSizeSizePrStoredStringPtrPr = CBucketGatherer::TSizeSizePrStoredStringPtrPr; +using TSizeSizePrStoredStringPtrPrUInt64UMapVec = CBucketGatherer::TSizeSizePrStoredStringPtrPrUInt64UMapVec; +using TTimeVec = std::vector; +using TStrCPtrVec = CBucketGatherer::TStrCPtrVec; namespace { @@ -274,7 +274,7 @@ void importCsvData(CDataGatherer &gatherer, const std::string &filename, const TSizeVec &fields) { - typedef boost::shared_ptr TifstreamPtr; + using TifstreamPtr = boost::shared_ptr; TifstreamPtr ifs(new std::ifstream(filename.c_str())); CPPUNIT_ASSERT(ifs->is_open()); @@ -1620,7 +1620,7 @@ void CEventRateDataGathererTest::testInfluencerBucketStatistics(void) void CEventRateDataGathererTest::testDistinctStrings(void) { - typedef std::vector TStoredStringPtrVec; + using TStoredStringPtrVec = std::vector; TSizeSizePr pair(0, 0); // Test the SUniqueStringFeatureData struct diff --git a/lib/model/unittest/CEventRateModelTest.cc b/lib/model/unittest/CEventRateModelTest.cc index 20a5a79848..db8b6b1a4b 100644 --- a/lib/model/unittest/CEventRateModelTest.cc +++ b/lib/model/unittest/CEventRateModelTest.cc @@ -53,26 +53,26 @@ using namespace model; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleDoublePrVec; -typedef std::vector TUInt64Vec; -typedef std::vector TTimeVec; -typedef std::vector TSizeVec; -typedef std::vector TSizeVecVec; -typedef std::vector TSizeVecVecVec; -typedef std::vector TStrVec; -typedef core::CSmallVector TDouble1Vec; -typedef core::CSmallVector TDouble2Vec; -typedef std::pair TSizeDoublePr; -typedef core::CSmallVector TSizeDoublePr1Vec; -typedef boost::optional TOptionalStr; -typedef boost::optional TOptionalUInt64; -typedef boost::optional TOptionalDouble; -typedef std::vector TOptionalDoubleVec; -typedef boost::shared_ptr TMathsModelPtr; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; +using TDoubleDoublePr = std::pair; +using TDoubleDoublePrVec = std::vector; +using TUInt64Vec = std::vector; +using TTimeVec = std::vector; +using TSizeVec = std::vector; +using TSizeVecVec = std::vector; +using TSizeVecVecVec = std::vector; +using TStrVec = std::vector; +using TDouble1Vec = core::CSmallVector; +using TDouble2Vec = core::CSmallVector; +using TSizeDoublePr = std::pair; +using TSizeDoublePr1Vec = core::CSmallVector; +using TOptionalStr = boost::optional; +using TOptionalUInt64 = boost::optional; +using TOptionalDouble = boost::optional; +using TOptionalDoubleVec = std::vector; +using TMathsModelPtr = boost::shared_ptr; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; const std::string EMPTY_STRING; @@ -621,8 +621,8 @@ void CEventRateModelTest::testOnlineProbabilityCalculation(void) { LOG_DEBUG("*** testOnlineProbabilityCalculation ***"); - typedef std::pair TDoubleSizePr; - typedef maths::CBasicStatistics::COrderStatisticsHeap TMinAccumulator; + using TDoubleSizePr = std::pair; + using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsHeap; const core_t::TTime startTime = 1346968800; const core_t::TTime bucketLength = 3600; @@ -798,8 +798,8 @@ void CEventRateModelTest::testOnlineCorrelatedNoTrend(void) // Check we find the correct correlated variables, and identify // correlate and marginal anomalies. - typedef core::CTriple TDoubleSizeStrTr; - typedef maths::CBasicStatistics::COrderStatisticsHeap TMinAccumulator; + using TDoubleSizeStrTr = core::CTriple; + using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsHeap; const core_t::TTime startTime = 1346968800; const core_t::TTime bucketLength = 3600; @@ -1053,8 +1053,8 @@ void CEventRateModelTest::testOnlineCorrelatedTrend(void) // Check we find the correct correlated variables, and identify // correlate and marginal anomalies. - typedef core::CTriple TDoubleSizeStrTr; - typedef maths::CBasicStatistics::COrderStatisticsHeap TMinAccumulator; + using TDoubleSizeStrTr = core::CTriple; + using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsHeap; const core_t::TTime startTime = 1346968800; const core_t::TTime bucketLength = 600; @@ -1195,9 +1195,9 @@ void CEventRateModelTest::testPrune(void) { LOG_DEBUG("*** testPrune ***"); - typedef std::vector TUInt64VecVec; - typedef std::vector TEventDataVec; - typedef std::map TSizeSizeMap; + using TUInt64VecVec = std::vector; + using TEventDataVec = std::vector; + using TSizeSizeMap = std::map; const core_t::TTime startTime = 1346968800; const core_t::TTime bucketLength = 3600; diff --git a/lib/model/unittest/CEventRatePopulationDataGathererTest.cc b/lib/model/unittest/CEventRatePopulationDataGathererTest.cc index 12009313a4..204c3a16bd 100644 --- a/lib/model/unittest/CEventRatePopulationDataGathererTest.cc +++ b/lib/model/unittest/CEventRatePopulationDataGathererTest.cc @@ -57,25 +57,25 @@ struct SMessage std::string s_Person; }; -typedef std::vector TMessageVec; -typedef std::vector TSizeVec; -typedef std::vector TStrVec; -typedef boost::shared_ptr TEventRateDataGathererPtr; -typedef std::pair TSizeSizePr; -typedef std::map TSizeSizePrUInt64Map; -typedef TSizeSizePrUInt64Map::iterator TSizeSizePrUInt64MapCItr; -typedef std::set TSizeSet; -typedef std::map TSizeSizeSetMap; -typedef std::set TStrSet; -typedef std::map TSizeStrSetMap; -typedef std::map::iterator TSizeStrSetMapItr; -typedef SEventRateFeatureData TFeatureData; -typedef std::pair TStrFeatureDataPr; -typedef std::vector TStrFeatureDataPrVec; -typedef std::pair TSizeSizePrFeatureDataPr; -typedef std::vector TSizeSizePrFeatureDataPrVec; -typedef std::pair TFeatureSizeSizePrFeatureDataPrVecPr; -typedef std::vector TFeatureSizeSizePrFeatureDataPrVecPrVec; +using TMessageVec = std::vector; +using TSizeVec = std::vector; +using TStrVec = std::vector; +using TEventRateDataGathererPtr = boost::shared_ptr; +using TSizeSizePr = std::pair; +using TSizeSizePrUInt64Map = std::map; +using TSizeSizePrUInt64MapCItr = TSizeSizePrUInt64Map::iterator; +using TSizeSet = std::set; +using TSizeSizeSetMap = std::map; +using TStrSet = std::set; +using TSizeStrSetMap = std::map; +using TSizeStrSetMapItr = std::map::iterator; +using TFeatureData = SEventRateFeatureData; +using TStrFeatureDataPr = std::pair; +using TStrFeatureDataPrVec = std::vector; +using TSizeSizePrFeatureDataPr = std::pair; +using TSizeSizePrFeatureDataPrVec = std::vector; +using TFeatureSizeSizePrFeatureDataPrVecPr = std::pair; +using TFeatureSizeSizePrFeatureDataPrVecPrVec = std::vector; TStrVec allCategories(void) { @@ -104,8 +104,8 @@ void generateTestMessages(test::CRandomNumbers &rng, core_t::TTime bucketLength, TMessageVec &messages) { - typedef std::vector TUIntVec; - typedef std::vector TDoubleVec; + using TUIntVec = std::vector; + using TDoubleVec = std::vector; LOG_DEBUG("bucket = [" << time << ", " << time + bucketLength << ")"); @@ -253,7 +253,7 @@ void CEventRatePopulationDataGathererTest::testAttributeCounts(void) // We check that we correctly sample the unique people per // attribute and (attribute, person) pair counts. - typedef std::map TStrSizeMap; + using TStrSizeMap = std::map; const core_t::TTime startTime = 1367280000; const core_t::TTime bucketLength = 3600; @@ -649,9 +649,9 @@ void CEventRatePopulationDataGathererTest::testRemovePeople(void) { LOG_DEBUG("*** CEventRatePopulationDataGathererTest::testRemovePeople ***"); - typedef std::map TStrSizeMap; - typedef std::pair TSizeUInt64Pr; - typedef std::vector TSizeUInt64PrVec; + using TStrSizeMap = std::map; + using TSizeUInt64Pr = std::pair; + using TSizeUInt64PrVec = std::vector; const core_t::TTime startTime = 1367280000; const core_t::TTime bucketLength = 3600; diff --git a/lib/model/unittest/CEventRatePopulationModelTest.cc b/lib/model/unittest/CEventRatePopulationModelTest.cc index a9dd57b821..0e0e29ba7f 100644 --- a/lib/model/unittest/CEventRatePopulationModelTest.cc +++ b/lib/model/unittest/CEventRatePopulationModelTest.cc @@ -51,21 +51,21 @@ using namespace model; namespace { -typedef boost::optional TOptionalDouble; -typedef std::pair TSizeSizePr; -typedef std::vector TStrVec; -typedef std::vector TUIntVec; -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleDoublePrVec; -typedef std::vector TSizeVec; -typedef std::vector TSizeVecVec; -typedef std::pair TDoubleStrPr; -typedef std::vector TDoubleStrPrVec; -typedef core::CSmallVector TDouble1Vec; -typedef std::pair TSizeDoublePr; -typedef core::CSmallVector TSizeDoublePr1Vec; +using TOptionalDouble = boost::optional; +using TSizeSizePr = std::pair; +using TStrVec = std::vector; +using TUIntVec = std::vector; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; +using TDoubleDoublePr = std::pair; +using TDoubleDoublePrVec = std::vector; +using TSizeVec = std::vector; +using TSizeVecVec = std::vector; +using TDoubleStrPr = std::pair; +using TDoubleStrPrVec = std::vector; +using TDouble1Vec = core::CSmallVector; +using TSizeDoublePr = std::pair; +using TSizeDoublePr1Vec = core::CSmallVector; const std::string EMPTY_STRING; @@ -122,7 +122,7 @@ struct SAnomaly } }; -typedef std::vector TMessageVec; +using TMessageVec = std::vector; void generateTestMessages(core_t::TTime startTime, core_t::TTime bucketLength, @@ -142,7 +142,7 @@ void generateTestMessages(core_t::TTime startTime, // // There are 100 buckets. - typedef boost::tuple TSizeSizeSizeTr; + using TSizeSizeSizeTr = boost::tuple; const std::size_t numberBuckets = 100u; const std::size_t numberAttributes = 5u; @@ -246,12 +246,12 @@ void CEventRatePopulationModelTest::testBasicAccessors(void) // Check that the correct data is read retrieved by the // basic model accessors. - typedef boost::optional TOptionalUInt64; - typedef std::map TStrUInt64Map; - typedef TStrUInt64Map::const_iterator TStrUInt64MapCItr; - typedef std::pair TStrStrPr; - typedef std::map TStrStrPrDoubleMap; - typedef TStrStrPrDoubleMap::const_iterator TStrStrPrDoubleMapCItr; + using TOptionalUInt64 = boost::optional; + using TStrUInt64Map = std::map; + using TStrUInt64MapCItr = TStrUInt64Map::const_iterator; + using TStrStrPr = std::pair; + using TStrStrPrDoubleMap = std::map; + using TStrStrPrDoubleMapCItr = TStrStrPrDoubleMap::const_iterator; core_t::TTime startTime = 1367280000; const core_t::TTime bucketLength = 3600; @@ -364,22 +364,22 @@ void CEventRatePopulationModelTest::testFeatures(void) // We check that the correct data is read from the gatherer // into the model on sample. - typedef core::CSmallVector TDouble2Vec; - typedef std::vector TDouble2VecVec; - typedef core::CSmallVector TDouble2Vec4Vec; - typedef std::vector TDouble2Vec4VecVec; - typedef std::set TSizeSet; - typedef std::map TSizeSizeSetMap; - typedef std::pair TStrStrPr; - typedef std::map TStrStrPrUint64Map; - typedef SEventRateFeatureData TFeatureData; - typedef CEventRatePopulationModel::TSizeSizePrFeatureDataPr TSizeSizePrFeatureDataPr; - typedef std::vector TSizeSizePrFeatureDataPrVec; - typedef std::map TSizeSizePrUInt64Map; - typedef boost::shared_ptr TMathsModelPtr; - typedef std::map TSizeMathsModelPtrMap; - typedef std::pair TDouble2VecVecDouble2Vec4VecVecPr; - typedef std::map TSizeDouble2VecVecDouble2Vec4VecVecPrMap; + using TDouble2Vec = core::CSmallVector; + using TDouble2VecVec = std::vector; + using TDouble2Vec4Vec = core::CSmallVector; + using TDouble2Vec4VecVec = std::vector; + using TSizeSet = std::set; + using TSizeSizeSetMap = std::map; + using TStrStrPr = std::pair; + using TStrStrPrUint64Map = std::map; + using TFeatureData = SEventRateFeatureData; + using TSizeSizePrFeatureDataPr = CEventRatePopulationModel::TSizeSizePrFeatureDataPr; + using TSizeSizePrFeatureDataPrVec = std::vector; + using TSizeSizePrUInt64Map = std::map; + using TMathsModelPtr = boost::shared_ptr; + using TSizeMathsModelPtrMap = std::map; + using TDouble2VecVecDouble2Vec4VecVecPr = std::pair; + using TSizeDouble2VecVecDouble2Vec4VecVecPrMap = std::map; static const maths_t::TWeightStyleVec WEIGHT_STYLES{maths_t::E_SampleCountWeight, maths_t::E_SampleWinsorisationWeight}; @@ -526,10 +526,10 @@ void CEventRatePopulationModelTest::testComputeProbability(void) // Check that we get the probabilities we expect. - typedef std::vector TAnomalyVec; - typedef std::pair TDoubleAnomalyPr; - typedef maths::CBasicStatistics::COrderStatisticsHeap TAnomalyAccumulator; + using TAnomalyVec = std::vector; + using TDoubleAnomalyPr = std::pair; + using TAnomalyAccumulator = maths::CBasicStatistics::COrderStatisticsHeap< + TDoubleAnomalyPr, maths::COrderings::SFirstLess>; core_t::TTime startTime = 1367280000; const core_t::TTime bucketLength = 3600; @@ -622,9 +622,9 @@ void CEventRatePopulationModelTest::testPrune(void) // This test has four people and five attributes. We expect // person 2 and attributes 1, 2 and 5 to be deleted. - typedef std::pair TStrSizePr; - typedef std::vector TStrSizePrVec; - typedef std::vector TStrSizePrVecVec; + using TStrSizePr = std::pair; + using TStrSizePrVec = std::vector; + using TStrSizePrVecVec = std::vector; core_t::TTime startTime = 1367280000; const core_t::TTime bucketLength = 3600; @@ -880,7 +880,7 @@ void CEventRatePopulationModelTest::testFrequency(void) { LOG_DEBUG("*** CEventRatePopulationModelTest::testFrequency ***"); - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; // Test we correctly compute frequencies for people and attributes. @@ -1115,8 +1115,8 @@ void CEventRatePopulationModelTest::testPeriodicity(void) // Create a daily periodic population and check that the // periodicity is learned and compensated (approximately). - typedef std::map TStrDoubleMap; - typedef TStrDoubleMap::const_iterator TStrDoubleMapCItr; + using TStrDoubleMap = std::map; + using TStrDoubleMapCItr = TStrDoubleMap::const_iterator; static const core_t::TTime HOUR = 3600; static const core_t::TTime DAY = 86400; diff --git a/lib/model/unittest/CHierarchicalResultsTest.cc b/lib/model/unittest/CHierarchicalResultsTest.cc index 7262ec25f2..6cdf1ba3e9 100644 --- a/lib/model/unittest/CHierarchicalResultsTest.cc +++ b/lib/model/unittest/CHierarchicalResultsTest.cc @@ -46,12 +46,12 @@ using namespace ml; namespace { -typedef std::vector TDoubleVec; -typedef model::CHierarchicalResults::TAttributeProbabilityVec TAttributeProbabilityVec; -typedef model::CHierarchicalResults::TStoredStringPtrStoredStringPtrPr TStoredStringPtrStoredStringPtrPr; -typedef model::CHierarchicalResults::TStoredStringPtrStoredStringPtrPrDoublePr TStoredStringPtrStoredStringPtrPrDoublePr; -typedef model::CHierarchicalResults::TStoredStringPtrStoredStringPtrPrDoublePrVec TStoredStringPtrStoredStringPtrPrDoublePrVec; -typedef std::vector TStrVec; +using TDoubleVec = std::vector; +using TAttributeProbabilityVec = model::CHierarchicalResults::TAttributeProbabilityVec; +using TStoredStringPtrStoredStringPtrPr = model::CHierarchicalResults::TStoredStringPtrStoredStringPtrPr; +using TStoredStringPtrStoredStringPtrPrDoublePr = model::CHierarchicalResults::TStoredStringPtrStoredStringPtrPrDoublePr; +using TStoredStringPtrStoredStringPtrPrDoublePrVec = model::CHierarchicalResults::TStoredStringPtrStoredStringPtrPrDoublePrVec; +using TStrVec = std::vector; const std::string EMPTY_STRING; @@ -59,8 +59,8 @@ const std::string EMPTY_STRING; class CBreadthFirstCheck : public model::CHierarchicalResultsVisitor { public: - typedef std::set TNodeCPtrSet; - typedef std::vector TNodeCPtrSetVec; + using TNodeCPtrSet = std::set; + using TNodeCPtrSetVec = std::vector; public: CBreadthFirstCheck(void) : @@ -108,7 +108,7 @@ class CBreadthFirstCheck : public model::CHierarchicalResultsVisitor // Check we have the expected number of layers and that // all nodes are in a lower layer than their parents. - typedef TNodeCPtrSet::const_iterator TNodeCPtrSetCItr; + using TNodeCPtrSetCItr = TNodeCPtrSet::const_iterator; LOG_DEBUG("# layers = " << m_Layers.size()); CPPUNIT_ASSERT_EQUAL(expectedLayers, m_Layers.size()); @@ -159,7 +159,7 @@ class CBreadthFirstCheck : public model::CHierarchicalResultsVisitor class CDepthFirstCheck : public model::CHierarchicalResultsVisitor { public: - typedef std::vector TNodeCPtrVec; + using TNodeCPtrVec = std::vector; public: virtual void visit(const model::CHierarchicalResults &/*results*/, @@ -234,7 +234,7 @@ class CPrinter : public model::CHierarchicalResultsVisitor class CNodeExtractor : public model::CHierarchicalResultsVisitor { public: - typedef std::vector TNodeCPtrVec; + using TNodeCPtrVec = std::vector; public: virtual void visit(const model::CHierarchicalResults &/*results*/, @@ -348,8 +348,8 @@ class CWriteConsistencyChecker : public model::CHierarchicalResultsVisitor const model::CLimits &m_Limits; }; -typedef std::map TIntDoubleVecMap; -typedef TIntDoubleVecMap::const_iterator TIntDoubleVecMapCItr; +using TIntDoubleVecMap = std::map; +using TIntDoubleVecMapCItr = TIntDoubleVecMap::const_iterator; //! \brief Node probability container. struct SNodeProbabilities @@ -364,8 +364,8 @@ struct SNodeProbabilities class CProbabilityGatherer : public model::CHierarchicalResultsLevelSet { public: - typedef model::CHierarchicalResultsLevelSet TBase; - typedef TBase::TTypePtrVec TNodeProbabilitiesPtrVec; + using TBase = model::CHierarchicalResultsLevelSet; + using TNodeProbabilitiesPtrVec = TBase::TTypePtrVec; class CFactory { @@ -1047,7 +1047,7 @@ void CHierarchicalResultsTest::testAggregator(void) { LOG_DEBUG("*** testAggregator ***"); - typedef std::vector TAnnotatedProbabilityVec; + using TAnnotatedProbabilityVec = std::vector; model::CAnomalyDetectorModelConfig modelConfig = model::CAnomalyDetectorModelConfig::defaultConfig(); model::CHierarchicalResultsAggregator aggregator(modelConfig); @@ -1461,7 +1461,7 @@ void CHierarchicalResultsTest::testWriter(void) // Test complex. { - typedef model::CDataGatherer::TStrCPtrVec TStrCPtrVec; + using TStrCPtrVec = model::CDataGatherer::TStrCPtrVec; model::SModelParams params(modelConfig.bucketLength()); model::CSearchKey key; model::CAnomalyDetectorModel::TDataGathererPtr dataGatherer( @@ -1522,10 +1522,10 @@ void CHierarchicalResultsTest::testNormalizer(void) { LOG_DEBUG("*** testNormalizer ***"); - typedef boost::shared_ptr TNormalizerPtr; - typedef std::map TStrNormalizerPtrMap; - typedef TStrNormalizerPtrMap::iterator TStrNormalizerPtrMapItr; - typedef std::set TNodeCPtrSet; + using TNormalizerPtr = boost::shared_ptr; + using TStrNormalizerPtrMap = std::map; + using TStrNormalizerPtrMapItr = TStrNormalizerPtrMap::iterator; + using TNodeCPtrSet = std::set; model::CAnomalyDetectorModelConfig modelConfig = model::CAnomalyDetectorModelConfig::defaultConfig(); model::CHierarchicalResultsAggregator aggregator(modelConfig); @@ -1902,7 +1902,7 @@ void CHierarchicalResultsTest::testDetectorEqualizing(void) results.bottomUpBreadthFirst(aggregator); } - typedef std::pair TDoubleSizePr; + using TDoubleSizePr = std::pair; maths::CBasicStatistics::COrderStatisticsStack mostAnomalous; for (std::size_t i = 0u; i < 100; ++i) diff --git a/lib/model/unittest/CInterimBucketCorrectorTest.cc b/lib/model/unittest/CInterimBucketCorrectorTest.cc index 0fda2928a4..aeb2a85ae1 100644 --- a/lib/model/unittest/CInterimBucketCorrectorTest.cc +++ b/lib/model/unittest/CInterimBucketCorrectorTest.cc @@ -22,8 +22,8 @@ using namespace model; namespace { -typedef core::CSmallVector TDouble1Vec; -typedef core::CSmallVector TDouble10Vec; +using TDouble1Vec = core::CSmallVector; +using TDouble10Vec = core::CSmallVector; const double EPSILON = 1e-10; } diff --git a/lib/model/unittest/CMetricAnomalyDetectorTest.cc b/lib/model/unittest/CMetricAnomalyDetectorTest.cc index 483220eaba..187678017b 100644 --- a/lib/model/unittest/CMetricAnomalyDetectorTest.cc +++ b/lib/model/unittest/CMetricAnomalyDetectorTest.cc @@ -39,9 +39,9 @@ using namespace ml; namespace { -typedef std::pair TTimeTimePr; -typedef std::vector TTimeTimePrVec; -typedef std::vector TDoubleVec; +using TTimeTimePr = std::pair; +using TTimeTimePrVec = std::vector; +using TDoubleVec = std::vector; bool doIntersect(const TTimeTimePr &i1, const TTimeTimePr &i2) { @@ -212,7 +212,7 @@ void importCsvData(core_t::TTime firstTime, const std::string &fileName, model::CAnomalyDetector &detector) { - typedef boost::shared_ptr TifstreamPtr; + using TifstreamPtr = boost::shared_ptr; TifstreamPtr ifs(new std::ifstream(fileName.c_str())); CPPUNIT_ASSERT(ifs->is_open()); diff --git a/lib/model/unittest/CMetricDataGathererTest.cc b/lib/model/unittest/CMetricDataGathererTest.cc index a9380c1daa..145c5738c5 100644 --- a/lib/model/unittest/CMetricDataGathererTest.cc +++ b/lib/model/unittest/CMetricDataGathererTest.cc @@ -32,23 +32,23 @@ using namespace model; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; -typedef std::pair TSizeSizePr; -typedef std::vector TFeatureVec; -typedef std::pair TSizeUInt64Pr; -typedef std::vector TSizeUInt64PrVec; -typedef std::vector TStrVec; -typedef std::pair TSizeFeatureDataPr; -typedef std::vector TSizeFeatureDataPrVec; -typedef std::pair TFeatureSizeFeatureDataPrVecPr; -typedef std::vector TFeatureSizeFeatureDataPrVecPrVec; -typedef boost::optional TOptionalDouble; -typedef boost::optional TOptionalStr; -typedef std::pair TTimeDoublePr; -typedef std::vector TTimeDoublePrVec; -typedef std::vector TTimeDoublePrVecVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; +using TSizeSizePr = std::pair; +using TFeatureVec = std::vector; +using TSizeUInt64Pr = std::pair; +using TSizeUInt64PrVec = std::vector; +using TStrVec = std::vector; +using TSizeFeatureDataPr = std::pair; +using TSizeFeatureDataPrVec = std::vector; +using TFeatureSizeFeatureDataPrVecPr = std::pair; +using TFeatureSizeFeatureDataPrVecPrVec = std::vector; +using TOptionalDouble = boost::optional; +using TOptionalStr = boost::optional; +using TTimeDoublePr = std::pair; +using TTimeDoublePrVec = std::vector; +using TTimeDoublePrVecVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; std::size_t addPerson(const std::string &p, CDataGatherer &gatherer, @@ -1512,10 +1512,10 @@ void CMetricDataGathererTest::testInfluenceStatistics(void) { LOG_DEBUG("*** CMetricDataGathererTest::testInfluenceStatistics ***"); - typedef boost::tuple TTimeDoubleStrStrTuple; - typedef std::pair TDoubleDoublePr; - typedef std::pair TStrDoubleDoublePrPr; - typedef std::vector TStrDoubleDoublePrPrVec; + using TTimeDoubleStrStrTuple = boost::tuple; + using TDoubleDoublePr = std::pair; + using TStrDoubleDoublePrPr = std::pair; + using TStrDoubleDoublePrPrVec = std::vector; const core_t::TTime startTime = 0; const core_t::TTime bucketLength = 600; @@ -1657,9 +1657,9 @@ void CMetricDataGathererTest::testInfluenceStatistics(void) void CMetricDataGathererTest::testMultivariate(void) { - typedef boost::tuple TTimeDoubleDoubleTuple; - typedef std::vector TTimeDoubleDoubleTupleVec; - typedef std::vector TTimeDoubleDoubleTupleVecVec; + using TTimeDoubleDoubleTuple = boost::tuple; + using TTimeDoubleDoubleTupleVec = std::vector; + using TTimeDoubleDoubleTupleVecVec = std::vector; static const std::string DELIMITER("__"); diff --git a/lib/model/unittest/CMetricModelTest.cc b/lib/model/unittest/CMetricModelTest.cc index c8f3c153bd..cc50aa2508 100644 --- a/lib/model/unittest/CMetricModelTest.cc +++ b/lib/model/unittest/CMetricModelTest.cc @@ -54,36 +54,36 @@ using namespace model; namespace { -typedef std::pair TDoubleDoublePr; -typedef std::pair TSizeDoublePr; -typedef std::pair TDoubleSizePr; -typedef std::vector TDoubleVec; -typedef std::vector TDoubleVecVec; -typedef std::vector TDoubleDoublePrVec; -typedef std::vector TStrVec; -typedef std::vector TStrVecVec; -typedef boost::optional TOptionalUInt64; -typedef boost::optional TOptionalDouble; -typedef std::vector TOptionalDoubleVec; -typedef boost::optional TOptionalStr; -typedef std::pair TTimeDoublePr; -typedef boost::optional TOptionalTimeDoublePr; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef maths::CBasicStatistics::COrderStatisticsStack TMinAccumulator; -typedef maths::CBasicStatistics::COrderStatisticsStack > TMaxAccumulator; -typedef boost::shared_ptr TMathsModelPtr; -typedef boost::shared_ptr TPriorPtr; -typedef boost::shared_ptr TMultivariatePriorPtr; -typedef std::pair TDoubleStrPr; -typedef core::CSmallVector TDouble1Vec; -typedef core::CSmallVector TDouble2Vec; -typedef core::CSmallVector TDouble4Vec; -typedef core::CSmallVector TDouble4Vec1Vec; -typedef std::pair TSizeDoublePr; -typedef core::CSmallVector TSizeDoublePr1Vec; -typedef std::vector TStrVec; -typedef std::pair TTimeStrVecPr; -typedef std::vector TTimeStrVecPrVec; +using TDoubleDoublePr = std::pair; +using TSizeDoublePr = std::pair; +using TDoubleSizePr = std::pair; +using TDoubleVec = std::vector; +using TDoubleVecVec = std::vector; +using TDoubleDoublePrVec = std::vector; +using TStrVec = std::vector; +using TStrVecVec = std::vector; +using TOptionalUInt64 = boost::optional; +using TOptionalDouble = boost::optional; +using TOptionalDoubleVec = std::vector; +using TOptionalStr = boost::optional; +using TTimeDoublePr = std::pair; +using TOptionalTimeDoublePr = boost::optional; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsStack; +using TMaxAccumulator = maths::CBasicStatistics::COrderStatisticsStack>; +using TMathsModelPtr = boost::shared_ptr; +using TPriorPtr = boost::shared_ptr; +using TMultivariatePriorPtr = boost::shared_ptr; +using TDoubleStrPr = std::pair; +using TDouble1Vec = core::CSmallVector; +using TDouble2Vec = core::CSmallVector; +using TDouble4Vec = core::CSmallVector; +using TDouble4Vec1Vec = core::CSmallVector; +using TSizeDoublePr = std::pair; +using TSizeDoublePr1Vec = core::CSmallVector; +using TStrVec = std::vector; +using TTimeStrVecPr = std::pair; +using TTimeStrVecPrVec = std::vector; const std::string EMPTY_STRING; @@ -560,11 +560,11 @@ void CMetricModelTest::testMultivariateSample(void) { LOG_DEBUG("*** testMultivariateSample ***"); - typedef std::vector TDoubleVecVecVec; - typedef maths::CVectorNx1 TVector2; - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMean2Accumulator; - typedef std::pair > TTimeDouble2AryPr; - typedef std::vector TTimeDouble2AryPrVec; + using TDoubleVecVecVec = std::vector; + using TVector2 = maths::CVectorNx1; + using TMean2Accumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; + using TTimeDouble2AryPr = std::pair>; + using TTimeDouble2AryPrVec = std::vector; core_t::TTime startTime(45); core_t::TTime bucketLength(5); @@ -750,7 +750,7 @@ void CMetricModelTest::testProbabilityCalculationForMetric(void) { LOG_DEBUG("*** testProbabilityCalculationForMetric ***"); - typedef maths::CBasicStatistics::COrderStatisticsHeap TMinAccumulator; + using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsHeap; core_t::TTime startTime(0); core_t::TTime bucketLength(10); @@ -821,7 +821,7 @@ void CMetricModelTest::testProbabilityCalculationForMedian(void) { LOG_DEBUG("*** testProbabilityCalculationForMedian ***"); - typedef maths::CBasicStatistics::COrderStatisticsHeap TMinAccumulator; + using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsHeap; core_t::TTime startTime(0); core_t::TTime bucketLength(10); @@ -1444,10 +1444,10 @@ void CMetricModelTest::testPrune(void) maths::CSampling::CScopeMockRandomNumberGenerator scopeMockRng; - typedef std::vector TSizeVec; - typedef std::vector TSizeVecVec; - typedef std::vector TEventDataVec; - typedef std::map TSizeSizeMap; + using TSizeVec = std::vector; + using TSizeVecVec = std::vector; + using TEventDataVec = std::vector; + using TSizeSizeMap = std::map; const core_t::TTime startTime = 1346968800; const core_t::TTime bucketLength = 3600; @@ -2165,8 +2165,8 @@ void CMetricModelTest::testCorrelatePersist(void) { LOG_DEBUG("*** testCorrelatePersist ***"); - typedef maths::CVectorNx1 TVector2; - typedef maths::CSymmetricMatrixNxN TMatrix2; + using TVector2 = maths::CVectorNx1; + using TMatrix2 = maths::CSymmetricMatrixNxN; const core_t::TTime startTime = 0; const core_t::TTime bucketLength = 600; diff --git a/lib/model/unittest/CMetricPopulationDataGathererTest.cc b/lib/model/unittest/CMetricPopulationDataGathererTest.cc index 2e1338efc3..3ea0f68172 100644 --- a/lib/model/unittest/CMetricPopulationDataGathererTest.cc +++ b/lib/model/unittest/CMetricPopulationDataGathererTest.cc @@ -34,17 +34,17 @@ using namespace model; namespace { -typedef std::vector TDoubleVec; -typedef std::vector TFeatureVec; -typedef std::vector TStrVec; -typedef std::pair TStrStrPr; -typedef std::map TStrStrPrDoubleMap; -typedef boost::optional TOptionalStr; -typedef std::pair TSizeSizePr; -typedef std::pair TSizeSizePrFeatureDataPr; -typedef std::vector TSizeSizePrFeatureDataPrVec; -typedef std::pair TFeatureSizeSizePrFeatureDataPrVecPr; -typedef std::vector TFeatureSizeSizePrFeatureDataPrVecPrVec; +using TDoubleVec = std::vector; +using TFeatureVec = std::vector; +using TStrVec = std::vector; +using TStrStrPr = std::pair; +using TStrStrPrDoubleMap = std::map; +using TOptionalStr = boost::optional; +using TSizeSizePr = std::pair; +using TSizeSizePrFeatureDataPr = std::pair; +using TSizeSizePrFeatureDataPrVec = std::vector; +using TFeatureSizeSizePrFeatureDataPrVecPr = std::pair; +using TFeatureSizeSizePrFeatureDataPrVecPrVec = std::vector; struct SMessage { @@ -67,7 +67,7 @@ struct SMessage double s_Value; TStrVec s_Influences; }; -typedef std::vector TMessageVec; +using TMessageVec = std::vector; TStrVec vec(const std::string &s1, const std::string &s2) { @@ -153,9 +153,9 @@ void CMetricPopulationDataGathererTest::testMean(void) // Test that we correctly sample the bucket means. - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef std::map TStrStrPrMeanAccumulatorMap; - typedef TStrStrPrMeanAccumulatorMap::const_iterator TStrStrPrMeanAccumulatorMapCItr; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; + using TStrStrPrMeanAccumulatorMap = std::map; + using TStrStrPrMeanAccumulatorMapCItr = TStrStrPrMeanAccumulatorMap::const_iterator; const core_t::TTime startTime = 1373932800; const core_t::TTime bucketLength = 3600; @@ -226,9 +226,9 @@ void CMetricPopulationDataGathererTest::testMin(void) // Test that we correctly sample the bucket minimums. - typedef maths::CBasicStatistics::COrderStatisticsStack TMinAccumulator; - typedef std::map TStrStrPrMinAccumulatorMap; - typedef TStrStrPrMinAccumulatorMap::const_iterator TStrStrPrMinAccumulatorMapCItr; + using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsStack; + using TStrStrPrMinAccumulatorMap = std::map; + using TStrStrPrMinAccumulatorMapCItr = TStrStrPrMinAccumulatorMap::const_iterator; const core_t::TTime startTime = 1373932800; const core_t::TTime bucketLength = 3600; @@ -298,9 +298,9 @@ void CMetricPopulationDataGathererTest::testMax(void) // Test that we correctly sample the bucket maximums. - typedef maths::CBasicStatistics::COrderStatisticsStack > TMaxAccumulator; - typedef std::map TStrStrPrMaxAccumulatorMap; - typedef TStrStrPrMaxAccumulatorMap::const_iterator TStrStrPrMaxAccumulatorMapCItr; + using TMaxAccumulator = maths::CBasicStatistics::COrderStatisticsStack>; + using TStrStrPrMaxAccumulatorMap = std::map; + using TStrStrPrMaxAccumulatorMapCItr = TStrStrPrMaxAccumulatorMap::const_iterator; const core_t::TTime startTime = 1373932800; const core_t::TTime bucketLength = 3600; @@ -510,16 +510,16 @@ void CMetricPopulationDataGathererTest::testFeatureData(void) // Test we correctly sample the mean, minimum and maximum statistics. - typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; - typedef std::map TStrStrPrMeanAccumulatorMap; - typedef TStrStrPrMeanAccumulatorMap::const_iterator TStrStrPrMeanAccumulatorMapCItr; - typedef maths::CBasicStatistics::COrderStatisticsStack TMinAccumulator; - typedef std::map TStrStrPrMinAccumulatorMap; - typedef TStrStrPrMinAccumulatorMap::const_iterator TStrStrPrMinAccumulatorMapCItr; - typedef maths::CBasicStatistics::COrderStatisticsStack > TMaxAccumulator; - typedef std::map TStrStrPrMaxAccumulatorMap; - typedef TStrStrPrMaxAccumulatorMap::const_iterator TStrStrPrMaxAccumulatorMapCItr; - typedef std::map TStrStrPrDoubleVecMap; + using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; + using TStrStrPrMeanAccumulatorMap = std::map; + using TStrStrPrMeanAccumulatorMapCItr = TStrStrPrMeanAccumulatorMap::const_iterator; + using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsStack; + using TStrStrPrMinAccumulatorMap = std::map; + using TStrStrPrMinAccumulatorMapCItr = TStrStrPrMinAccumulatorMap::const_iterator; + using TMaxAccumulator = maths::CBasicStatistics::COrderStatisticsStack>; + using TStrStrPrMaxAccumulatorMap = std::map; + using TStrStrPrMaxAccumulatorMapCItr = TStrStrPrMaxAccumulatorMap::const_iterator; + using TStrStrPrDoubleVecMap = std::map; const core_t::TTime startTime = 1373932800; const core_t::TTime bucketLength = 3600; @@ -713,13 +713,13 @@ void CMetricPopulationDataGathererTest::testRemovePeople(void) // Check that all the state is correctly updated when some // people are removed. - typedef std::vector TSizeVec; - typedef std::vector TStrVec; - typedef std::pair TSizeUInt64Pr; - typedef std::vector TSizeUInt64PrVec; - typedef std::pair TStrFeatureDataPr; - typedef std::vector TStrFeatureDataPrVec; - typedef std::map TStrSizeMap; + using TSizeVec = std::vector; + using TStrVec = std::vector; + using TSizeUInt64Pr = std::pair; + using TSizeUInt64PrVec = std::vector; + using TStrFeatureDataPr = std::pair; + using TStrFeatureDataPrVec = std::vector; + using TStrSizeMap = std::map; const core_t::TTime startTime = 1367280000; const core_t::TTime bucketLength = 3600; @@ -875,10 +875,10 @@ void CMetricPopulationDataGathererTest::testRemoveAttributes(void) // Check that all the state is correctly updated when some // attributes are removed. - typedef std::vector TSizeVec; - typedef std::vector TStrVec; - typedef std::pair TStrFeatureDataPr; - typedef std::vector TStrFeatureDataPrVec; + using TSizeVec = std::vector; + using TStrVec = std::vector; + using TStrFeatureDataPr = std::pair; + using TStrFeatureDataPrVec = std::vector; const core_t::TTime startTime = 1367280000; const core_t::TTime bucketLength = 3600; @@ -1012,9 +1012,9 @@ void CMetricPopulationDataGathererTest::testInfluenceStatistics(void) { LOG_DEBUG("*** CMetricPopulationDataGathererTest::testInfluenceStatistics ***"); - typedef std::pair TDoubleDoublePr; - typedef std::pair TStrDoubleDoublePrPr; - typedef std::vector TStrDoubleDoublePrPrVec; + using TDoubleDoublePr = std::pair; + using TStrDoubleDoublePrPr = std::pair; + using TStrDoubleDoublePrPrVec = std::vector; const core_t::TTime startTime = 0; const core_t::TTime bucketLength = 600; diff --git a/lib/model/unittest/CMetricPopulationModelTest.cc b/lib/model/unittest/CMetricPopulationModelTest.cc index 2280648d3b..da44839c39 100644 --- a/lib/model/unittest/CMetricPopulationModelTest.cc +++ b/lib/model/unittest/CMetricPopulationModelTest.cc @@ -50,23 +50,23 @@ using namespace model; namespace { -typedef std::pair TSizeSizePr; -typedef std::vector TSizeSizePrVec; -typedef std::vector TSizeSizePrVecVec; -typedef std::pair TDoubleDoublePr; -typedef std::vector TDoubleDoublePrVec; -typedef std::pair TDoubleStrPr; -typedef std::vector TDoubleStrPrVec; -typedef std::vector TStrVec; -typedef std::vector TUIntVec; -typedef std::vector TDoubleVec; -typedef std::vector TSizeVec; -typedef std::vector TSizeVecVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef maths::CBasicStatistics::COrderStatisticsStack TMinAccumulator; -typedef maths::CBasicStatistics::COrderStatisticsStack > TMaxAccumulator; -typedef core::CSmallVector TDouble1Vec; -typedef core::CSmallVector TDouble2Vec; +using TSizeSizePr = std::pair; +using TSizeSizePrVec = std::vector; +using TSizeSizePrVecVec = std::vector; +using TDoubleDoublePr = std::pair; +using TDoubleDoublePrVec = std::vector; +using TDoubleStrPr = std::pair; +using TDoubleStrPrVec = std::vector; +using TStrVec = std::vector; +using TUIntVec = std::vector; +using TDoubleVec = std::vector; +using TSizeVec = std::vector; +using TSizeVecVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TMinAccumulator = maths::CBasicStatistics::COrderStatisticsStack; +using TMaxAccumulator = maths::CBasicStatistics::COrderStatisticsStack>; +using TDouble1Vec = core::CSmallVector; +using TDouble2Vec = core::CSmallVector; const std::string EMPTY_STRING; @@ -136,7 +136,7 @@ struct SMessage TDouble1Vec s_Value; }; -typedef std::vector TMessageVec; +using TMessageVec = std::vector; const std::size_t numberAttributes = 5u; const std::size_t numberPeople = 10u; @@ -342,11 +342,11 @@ void CMetricPopulationModelTest::testBasicAccessors(void) // Check that the correct data is read retrieved by the // basic model accessors. - typedef boost::optional TOptionalUInt64; - typedef std::map TStrUInt64Map; - typedef std::vector TMeanAccumulatorVec; - typedef std::vector TMinAccumulatorVec; - typedef std::vector TMaxAccumulatorVec; + using TOptionalUInt64 = boost::optional; + using TStrUInt64Map = std::map; + using TMeanAccumulatorVec = std::vector; + using TMinAccumulatorVec = std::vector; + using TMaxAccumulatorVec = std::vector; core_t::TTime startTime = 1367280000; const core_t::TTime bucketLength = 3600; @@ -494,19 +494,19 @@ void CMetricPopulationModelTest::testMinMaxAndMean(void) // We check that the correct data is read from the gatherer // into the model on sample. - typedef core::CTriple TTimeDouble2VecSizeTr; - typedef std::vector TTimeDouble2VecSizeTrVec; - typedef core::CSmallVector TDouble2Vec4Vec; - typedef std::vector TDouble2Vec4VecVec; - typedef std::map TSizeSizePrDoubleVecMap; - typedef std::map TSizeSizePrMeanAccumulatorUMap; - typedef std::map TSizeSizePrMinAccumulatorMap; - typedef std::map TSizeSizePrMaxAccumulatorMap; - typedef boost::shared_ptr TMathsModelPtr; - typedef std::map TSizeMathsModelPtrMap; - typedef std::pair TTimeDouble2VecSizeTrVecDouble2Vec4VecVecPr; - typedef std::map TSizeTimeDouble2VecSizeTrVecDouble2Vec4VecVecPrMap; - typedef std::map TSizeSizeTimeDouble2VecSizeTrVecDouble2Vec4VecVecPrMapMap; + using TTimeDouble2VecSizeTr = core::CTriple; + using TTimeDouble2VecSizeTrVec = std::vector; + using TDouble2Vec4Vec = core::CSmallVector; + using TDouble2Vec4VecVec = std::vector; + using TSizeSizePrDoubleVecMap = std::map; + using TSizeSizePrMeanAccumulatorUMap = std::map; + using TSizeSizePrMinAccumulatorMap = std::map; + using TSizeSizePrMaxAccumulatorMap = std::map; + using TMathsModelPtr = boost::shared_ptr; + using TSizeMathsModelPtrMap = std::map; + using TTimeDouble2VecSizeTrVecDouble2Vec4VecVecPr = std::pair; + using TSizeTimeDouble2VecSizeTrVecDouble2Vec4VecVecPrMap = std::map; + using TSizeSizeTimeDouble2VecSizeTrVecDouble2Vec4VecVecPrMapMap = std::map; static const maths_t::TWeightStyleVec WEIGHT_STYLES{maths_t::E_SampleCountWeight, maths_t::E_SampleWinsorisationWeight}; @@ -758,10 +758,10 @@ void CMetricPopulationModelTest::testComputeProbability(void) // Test that we correctly pick out synthetic the anomalies, // their people and attributes. - typedef std::vector TAnomalyVec; - typedef std::pair TDoubleAnomalyPr; - typedef maths::CBasicStatistics::COrderStatisticsHeap TAnomalyAccumulator; + using TAnomalyVec = std::vector; + using TDoubleAnomalyPr = std::pair; + using TAnomalyAccumulator = maths::CBasicStatistics::COrderStatisticsHeap< + TDoubleAnomalyPr, maths::COrderings::SFirstLess>; core_t::TTime startTime = 1367280000; const core_t::TTime bucketLength = 3600; @@ -868,9 +868,9 @@ void CMetricPopulationModelTest::testPrune(void) // This test has four people and five attributes. We expect // person 2 and attributes 1, 2 and 5 to be deleted. - typedef std::pair TStrSizePr; - typedef std::vector TStrSizePrVec; - typedef std::vector TStrSizePrVecVec; + using TStrSizePr = std::pair; + using TStrSizePrVec = std::vector; + using TStrSizePrVecVec = std::vector; core_t::TTime startTime = 1367280000; const core_t::TTime bucketLength = 3600; @@ -1384,7 +1384,7 @@ void CMetricPopulationModelTest::testPeriodicity(void) // Create a daily periodic population and check that the // periodicity is learned and compensated (approximately). - typedef std::map TStrDoubleMap; + using TStrDoubleMap = std::map; static const core_t::TTime HOUR = 3600; static const core_t::TTime DAY = 86400; diff --git a/lib/model/unittest/CModelMemoryTest.cc b/lib/model/unittest/CModelMemoryTest.cc index d40fddc161..e52d957b45 100644 --- a/lib/model/unittest/CModelMemoryTest.cc +++ b/lib/model/unittest/CModelMemoryTest.cc @@ -28,7 +28,7 @@ using namespace model; namespace { -typedef std::vector TDoubleVec; +using TDoubleVec = std::vector; std::size_t addPerson(const std::string &p, const CModelFactory::TDataGathererPtr &gatherer) diff --git a/lib/model/unittest/CProbabilityAndInfluenceCalculatorTest.cc b/lib/model/unittest/CProbabilityAndInfluenceCalculatorTest.cc index 4e873d0f54..251dbc06b6 100644 --- a/lib/model/unittest/CProbabilityAndInfluenceCalculatorTest.cc +++ b/lib/model/unittest/CProbabilityAndInfluenceCalculatorTest.cc @@ -206,7 +206,7 @@ void computeInfluences(CALCULATOR &calculator, params.s_Values.push_back(values_); params.s_Counts.push_back(counts_); params.s_ComputeProbabilityParams.weightStyles(weightStyles); - //for (auto &&weight : weights) + //for (auto &weight : weights) //{ // weight.resize(weightStyles.size(), TDouble2Vec(2, 1.0)); // params.s_ComputeProbabilityParams.addWeights(weight); @@ -457,7 +457,7 @@ void CProbabilityAndInfluenceCalculatorTest::testLogProbabilityComplementInfluen { rng.generateNormalSamples(0.0, 100.0, 10 * 86400 / 600, samples); core_t::TTime time{0}; - for (auto &&sample : samples) + for (auto &sample : samples) { sample += 100.0 + 100.0 * ::sin(2.0 * 3.1416 * static_cast(time) / 86400.0); time += bucketLength; @@ -1129,7 +1129,7 @@ void CProbabilityAndInfluenceCalculatorTest::testLogProbabilityInfluenceCalculat { rng.generateNormalSamples(0.0, 100.0, 10 * 86400 / 600, samples); core_t::TTime time{0}; - for (auto &&sample : samples) + for (auto &sample : samples) { sample += 100.0 + 100.0 * ::sin(2.0 * 3.1416 * static_cast(time) / 86400.0); time += bucketLength; diff --git a/lib/model/unittest/CResourceLimitTest.cc b/lib/model/unittest/CResourceLimitTest.cc index 8647ece1f1..a938ece960 100644 --- a/lib/model/unittest/CResourceLimitTest.cc +++ b/lib/model/unittest/CResourceLimitTest.cc @@ -33,17 +33,17 @@ using namespace ml; using namespace model; -typedef std::vector TStrVec; +using TStrVec = std::vector; class CResultWriter : public ml::model::CHierarchicalResultsVisitor { public: - typedef boost::tuple TResultsTp; - typedef std::vector TResultsVec; + using TResultsTp = boost::tuple; + using TResultsVec = std::vector; public: CResultWriter(const CAnomalyDetectorModelConfig &modelConfig, @@ -616,7 +616,7 @@ void CResourceLimitTest::importCsvDataWithLimiter(core_t::TTime firstTime, CResourceMonitor &resourceMonitor) { - typedef boost::shared_ptr TifstreamPtr; + using TifstreamPtr = boost::shared_ptr; TifstreamPtr ifs(new std::ifstream(fileName.c_str())); CPPUNIT_ASSERT(ifs->is_open()); diff --git a/lib/model/unittest/CRuleConditionTest.cc b/lib/model/unittest/CRuleConditionTest.cc index e9cea41d14..080d5fa05a 100644 --- a/lib/model/unittest/CRuleConditionTest.cc +++ b/lib/model/unittest/CRuleConditionTest.cc @@ -26,7 +26,7 @@ using namespace model; namespace { -typedef std::vector TStrVec; +using TStrVec = std::vector; const std::string EMPTY_STRING; diff --git a/lib/model/unittest/CSampleQueueTest.cc b/lib/model/unittest/CSampleQueueTest.cc index 08d139a044..596cfe2668 100644 --- a/lib/model/unittest/CSampleQueueTest.cc +++ b/lib/model/unittest/CSampleQueueTest.cc @@ -27,10 +27,10 @@ using namespace ml; using namespace model; -typedef std::vector TDoubleVec; -typedef std::vector TSampleVec; -typedef maths::CBasicStatistics::SSampleMean::TAccumulator TMeanAccumulator; -typedef CSampleQueue TTestSampleQueue; +using TDoubleVec = std::vector; +using TSampleVec = std::vector; +using TMeanAccumulator = maths::CBasicStatistics::SSampleMean::TAccumulator; +using TTestSampleQueue = CSampleQueue; void CSampleQueueTest::testSampleToString(void) { @@ -1065,7 +1065,7 @@ void CSampleQueueTest::testQualityOfSamplesGivenConstantRate(void) maths::CBasicStatistics::SSampleMeanVar::TAccumulator varianceStat; maths::CBasicStatistics::COrderStatisticsStack varianceMin; - maths::CBasicStatistics::COrderStatisticsStack > varianceMax; + maths::CBasicStatistics::COrderStatisticsStack> varianceMax; for (std::size_t i = 0; i < samples.size(); ++i) { varianceStat.add(samples[i].varianceScale()); @@ -1134,7 +1134,7 @@ void CSampleQueueTest::testQualityOfSamplesGivenVariableRate(void) maths::CBasicStatistics::SSampleMeanVar::TAccumulator varianceStat; maths::CBasicStatistics::COrderStatisticsStack varianceMin; - maths::CBasicStatistics::COrderStatisticsStack > varianceMax; + maths::CBasicStatistics::COrderStatisticsStack> varianceMax; for (std::size_t i = 0; i < samples.size(); ++i) { varianceStat.add(samples[i].varianceScale()); @@ -1190,7 +1190,7 @@ void CSampleQueueTest::testQualityOfSamplesGivenHighLatencyAndDataInReverseOrder maths::CBasicStatistics::SSampleMeanVar::TAccumulator varianceStat; maths::CBasicStatistics::COrderStatisticsStack varianceMin; - maths::CBasicStatistics::COrderStatisticsStack > varianceMax; + maths::CBasicStatistics::COrderStatisticsStack> varianceMax; for (std::size_t i = 0; i < samples.size(); ++i) { varianceStat.add(samples[i].varianceScale()); diff --git a/lib/model/unittest/CStringStoreTest.cc b/lib/model/unittest/CStringStoreTest.cc index a6d00e0427..066cf33a6a 100644 --- a/lib/model/unittest/CStringStoreTest.cc +++ b/lib/model/unittest/CStringStoreTest.cc @@ -21,15 +21,15 @@ using namespace model; namespace { -typedef std::vector TSizeVec; -typedef std::vector TStrVec; -typedef std::vector TStoredStringPtrVec; -typedef boost::unordered_set TStrCPtrUSet; +using TSizeVec = std::vector; +using TStrVec = std::vector; +using TStoredStringPtrVec = std::vector; +using TStrCPtrUSet = boost::unordered_set; class CStringThread : public core::CThread { public: - typedef boost::shared_ptr TCppUnitExceptionP; + using TCppUnitExceptionP = boost::shared_ptr; public: CStringThread(std::size_t i, const TStrVec &strings) @@ -149,8 +149,8 @@ void CStringStoreTest::testStringStore(void) { LOG_DEBUG("Testing multi-threaded"); - typedef boost::shared_ptr TThreadPtr; - typedef std::vector TThreadVec; + using TThreadPtr = boost::shared_ptr; + using TThreadVec = std::vector; TThreadVec threads; for (std::size_t i = 0; i < 20; ++i) { @@ -196,8 +196,8 @@ void CStringStoreTest::testStringStore(void) lotsOfStrings.push_back(core::CStringUtils::typeToString(i)); } - typedef boost::shared_ptr TThreadPtr; - typedef std::vector TThreadVec; + using TThreadPtr = boost::shared_ptr; + using TThreadVec = std::vector; TThreadVec threads; for (std::size_t i = 0; i < 20; ++i) { diff --git a/lib/test/CTimeSeriesTestData.cc b/lib/test/CTimeSeriesTestData.cc index 2769c04d95..0fd23e9035 100644 --- a/lib/test/CTimeSeriesTestData.cc +++ b/lib/test/CTimeSeriesTestData.cc @@ -79,7 +79,7 @@ bool CTimeSeriesTestData::parseCounter(const std::string &fileName, TTimeDoubleP double last(0); bool started(false); - for (auto &&result : results) + for (auto &result : results) { double value = result.second; if (started == false) @@ -158,7 +158,7 @@ bool CTimeSeriesTestData::pad(const TTimeDoublePrVec &data, results.reserve(static_cast(maxTime - minTime + 1)); // Inefficient but easy and safe - typedef std::map TTimeDoubleMap; + using TTimeDoubleMap = std::map; TTimeDoubleMap dataMap; @@ -206,7 +206,7 @@ template bool CTimeSeriesTestData::parse(const std::string &fileName, const std::string ®ex, const std::string &dateFormat, - std::vector > &results, + std::vector> &results, core_t::TTime &minTime, core_t::TTime &maxTime) { @@ -255,7 +255,7 @@ template bool CTimeSeriesTestData::parseLine(const core::CRegex &tokenRegex, const std::string &dateFormat, const std::string &line, - std::vector > &results) + std::vector> &results) { if (line.empty() || line.find_first_not_of(core::CStringUtils::WHITESPACE_CHARS) == std::string::npos)