diff options
author | Artur Ryt <artur.ryt@gmail.com> | 2019-02-04 21:56:42 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-02-06 15:43:16 (GMT) |
commit | f3534386b504430aec926e46a413b044ff64d769 (patch) | |
tree | cb29c859cee6cdc69c0d8b25d719b4096be53ff8 | |
parent | 062cfd991faac000d484c74e5af7d65726c655dc (diff) | |
download | CMake-f3534386b504430aec926e46a413b044ff64d769.zip CMake-f3534386b504430aec926e46a413b044ff64d769.tar.gz CMake-f3534386b504430aec926e46a413b044ff64d769.tar.bz2 |
Prefer front/back/data over dereferencing begin/rbegin iter
Changed for sequenced containers: vector, list, string and array
-rw-r--r-- | Source/CPack/OSXScriptLauncher.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 21 | ||||
-rw-r--r-- | Source/CTest/cmProcess.cxx | 4 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 14 | ||||
-rw-r--r-- | Source/cmConditionEvaluator.cxx | 4 | ||||
-rw-r--r-- | Source/cmExecuteProcessCommand.cxx | 6 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 6 | ||||
-rw-r--r-- | Source/cmFilePathChecksum.cxx | 2 | ||||
-rw-r--r-- | Source/cmFindCommon.cxx | 2 | ||||
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 32 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionParser.cxx | 6 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 2 | ||||
-rw-r--r-- | Source/cmQtAutoGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmSearchPath.cxx | 4 | ||||
-rw-r--r-- | Source/cmStringCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 2 | ||||
-rw-r--r-- | Source/cmakexbuild.cxx | 2 |
22 files changed, 64 insertions, 65 deletions
diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx index 4966d09..00d272c 100644 --- a/Source/CPack/OSXScriptLauncher.cxx +++ b/Source/CPack/OSXScriptLauncher.cxx @@ -73,7 +73,7 @@ int main(int argc, char* argv[]) args.push_back(nullptr); cmsysProcess* cp = cmsysProcess_New(); - cmsysProcess_SetCommand(cp, &*args.begin()); + cmsysProcess_SetCommand(cp, args.data()); cmsysProcess_SetWorkingDirectory(cp, scriptDirectory.c_str()); cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); cmsysProcess_SetTimeout(cp, 0); diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index d934c00..af664ba 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -800,7 +800,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, // Now create process object cmsysProcess* cp = cmsysProcess_New(); - cmsysProcess_SetCommand(cp, &*argv.begin()); + cmsysProcess_SetCommand(cp, argv.data()); cmsysProcess_SetWorkingDirectory(cp, dir); cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); cmsysProcess_SetTimeout(cp, timeout); @@ -978,7 +978,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length, this->CurrentProcessingLine.insert(this->CurrentProcessingLine.end(), queue->begin(), it); this->CurrentProcessingLine.push_back(0); - const char* line = &*this->CurrentProcessingLine.begin(); + const char* line = this->CurrentProcessingLine.data(); // Process the line int lineType = this->ProcessSingleLine(line); diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 225383c..3b93422 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -72,7 +72,7 @@ public: args.push_back(cl.c_str()); } args.push_back(nullptr); // null terminate - cmsysProcess_SetCommand(this->Process, &*args.begin()); + cmsysProcess_SetCommand(this->Process, args.data()); if (!this->WorkingDirectory.empty()) { cmsysProcess_SetWorkingDirectory(this->Process, this->WorkingDirectory.c_str()); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 33b8b4a..6b57c43 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -199,7 +199,7 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) // Now create process object cmsysProcess* cp = cmsysProcess_New(); - cmsysProcess_SetCommand(cp, &*argv.begin()); + cmsysProcess_SetCommand(cp, argv.data()); // cmsysProcess_SetWorkingDirectory(cp, dir); cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); // cmsysProcess_SetTimeout(cp, timeout); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 87112da..1539635 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -343,7 +343,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( if (!chunk.empty()) { cmCTestOptionalLog(this->CTest, DEBUG, "CURL output: [" - << cmCTestLogWrite(&*chunk.begin(), chunk.size()) + << cmCTestLogWrite(chunk.data(), chunk.size()) << "]" << std::endl, this->Quiet); this->ParseResponse(chunk); @@ -352,7 +352,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( cmCTestOptionalLog( this->CTest, DEBUG, "CURL debug output: [" - << cmCTestLogWrite(&*chunkDebug.begin(), chunkDebug.size()) << "]" + << cmCTestLogWrite(chunkDebug.data(), chunkDebug.size()) << "]" << std::endl, this->Quiet); } @@ -404,12 +404,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( res = ::curl_easy_perform(curl); if (!chunk.empty()) { - cmCTestOptionalLog( - this->CTest, DEBUG, - "CURL output: [" - << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" - << std::endl, - this->Quiet); + cmCTestOptionalLog(this->CTest, DEBUG, + "CURL output: [" + << cmCTestLogWrite(chunk.data(), chunk.size()) + << "]" << std::endl, + this->Quiet); this->ParseResponse(chunk); } @@ -433,11 +432,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( // avoid deref of begin for zero size array if (!chunk.empty()) { *this->LogFile << " Curl output was: " - << cmCTestLogWrite(&*chunk.begin(), chunk.size()) + << cmCTestLogWrite(chunk.data(), chunk.size()) << std::endl; cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: [" - << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" + << cmCTestLogWrite(chunk.data(), chunk.size()) << "]" << std::endl); } ::curl_easy_cleanup(curl); @@ -486,7 +485,7 @@ void cmCTestSubmitHandler::ParseResponse( if (this->HasWarnings || this->HasErrors) { cmCTestLog(this->CTest, HANDLER_OUTPUT, " Server Response:\n" - << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "\n"); + << cmCTestLogWrite(chunk.data(), chunk.size()) << "\n"); } } diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 70ef8df..c03d004 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -199,7 +199,7 @@ bool cmProcess::Buffer::GetLine(std::string& line) for (size_type sz = this->size(); this->Last != sz; ++this->Last) { if ((*this)[this->Last] == '\n' || (*this)[this->Last] == '\0') { // Extract the range first..last as a line. - const char* text = &*this->begin() + this->First; + const char* text = this->data() + this->First; size_type length = this->Last - this->First; while (length && text[length - 1] == '\r') { length--; @@ -229,7 +229,7 @@ bool cmProcess::Buffer::GetLast(std::string& line) { // Return the partial last line, if any. if (!this->empty()) { - line.assign(&*this->begin(), this->size()); + line.assign(this->data(), this->size()); this->First = this->Last = 0; this->clear(); return true; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 989c7ee..ba2fe6c 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1039,7 +1039,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output, // Now create process object cmsysProcess* cp = cmsysProcess_New(); - cmsysProcess_SetCommand(cp, &*argv.begin()); + cmsysProcess_SetCommand(cp, argv.data()); cmsysProcess_SetWorkingDirectory(cp, dir); cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); cmsysProcess_SetTimeout(cp, timeout.count()); @@ -1222,7 +1222,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output, } cmsysProcess* cp = cmsysProcess_New(); - cmsysProcess_SetCommand(cp, &*argv.begin()); + cmsysProcess_SetCommand(cp, argv.data()); cmCTestLog(this, DEBUG, "Command is: " << argv[0] << std::endl); if (cmSystemTools::GetRunCommandHideConsole()) { cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); @@ -1258,7 +1258,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output, cmsysProcess_WaitForExit(cp, nullptr); processOutput.DecodeText(tempOutput, tempOutput); if (output && tempOutput.begin() != tempOutput.end()) { - output->append(&*tempOutput.begin(), tempOutput.size()); + output->append(tempOutput.data(), tempOutput.size()); } cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "-- Process completed" << std::endl); @@ -2776,7 +2776,7 @@ bool cmCTest::RunCommand(std::vector<std::string> const& args, stdErr->clear(); cmsysProcess* cp = cmsysProcess_New(); - cmsysProcess_SetCommand(cp, &*argv.begin()); + cmsysProcess_SetCommand(cp, argv.data()); cmsysProcess_SetWorkingDirectory(cp, dir); if (cmSystemTools::GetRunCommandHideConsole()) { cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); @@ -2820,11 +2820,11 @@ bool cmCTest::RunCommand(std::vector<std::string> const& args, cmsysProcess_WaitForExit(cp, nullptr); if (!tempOutput.empty()) { processOutput.DecodeText(tempOutput, tempOutput); - stdOut->append(&*tempOutput.begin(), tempOutput.size()); + stdOut->append(tempOutput.data(), tempOutput.size()); } if (!tempError.empty()) { processOutput.DecodeText(tempError, tempError); - stdErr->append(&*tempError.begin(), tempError.size()); + stdErr->append(tempError.data(), tempError.size()); } bool result = true; @@ -3048,7 +3048,7 @@ void cmCTest::OutputTestErrors(std::vector<char> const& process_output) { std::string test_outputs("\n*** Test Failed:\n"); if (!process_output.empty()) { - test_outputs.append(&*process_output.begin(), process_output.size()); + test_outputs.append(process_output.data(), process_output.size()); } cmCTestLog(this, HANDLER_OUTPUT, test_outputs << std::endl << std::flush); } diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 94ea529..303b147 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -130,8 +130,8 @@ bool cmConditionEvaluator::IsTrue( return false; } - return this->GetBooleanValueWithAutoDereference(*(newArgs.begin()), - errorString, status, true); + return this->GetBooleanValueWithAutoDereference(newArgs.front(), errorString, + status, true); } //========================================================================= diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index 8c67cdb..03eac5b 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -193,7 +193,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args, // Set the command sequence. for (auto const& cmd : cmds) { - cmsysProcess_AddCommand(cp, &*cmd.begin()); + cmsysProcess_AddCommand(cp, cmd.data()); } // Set the process working directory. @@ -286,10 +286,10 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args, // Store the output obtained. if (!output_variable.empty() && !tempOutput.empty()) { - this->Makefile->AddDefinition(output_variable, &*tempOutput.begin()); + this->Makefile->AddDefinition(output_variable, tempOutput.data()); } if (!merge_output && !error_variable.empty() && !tempError.empty()) { - this->Makefile->AddDefinition(error_variable, &*tempError.begin()); + this->Makefile->AddDefinition(error_variable, tempError.data()); } // Store the result of running the process. diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 0f911c1..2fe0d63 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3067,7 +3067,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) if (!logVar.empty()) { chunkDebug.push_back(0); - this->Makefile->AddDefinition(logVar, &*chunkDebug.begin()); + this->Makefile->AddDefinition(logVar, chunkDebug.data()); } return true; @@ -3326,14 +3326,14 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) if (!chunkResponse.empty()) { chunkResponse.push_back(0); log += "Response:\n"; - log += &*chunkResponse.begin(); + log += chunkResponse.data(); log += "\n"; } if (!chunkDebug.empty()) { chunkDebug.push_back(0); log += "Debug:\n"; - log += &*chunkDebug.begin(); + log += chunkDebug.data(); log += "\n"; } diff --git a/Source/cmFilePathChecksum.cxx b/Source/cmFilePathChecksum.cxx index 2cffa7c..47a223a 100644 --- a/Source/cmFilePathChecksum.cxx +++ b/Source/cmFilePathChecksum.cxx @@ -74,7 +74,7 @@ std::string cmFilePathChecksum::get(std::string const& filePath) const cmCryptoHash(cmCryptoHash::AlgoSHA256).ByteHashString(relSeed + relPath); // Convert binary checksum to string - return cmBase32Encoder().encodeString(&hashBytes.front(), hashBytes.size(), + return cmBase32Encoder().encodeString(hashBytes.data(), hashBytes.size(), false); } diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index 78be64e..9aaa000 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -310,7 +310,7 @@ void cmFindCommon::AddPathSuffix(std::string const& arg) void AddTrailingSlash(std::string& s) { - if (!s.empty() && *s.rbegin() != '/') { + if (!s.empty() && s.back() != '/') { s += '/'; } } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index c2e0712..93c71a1 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -466,7 +466,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args, // Allocate a PACKAGE_ROOT_PATH for the current find_package call. this->Makefile->FindPackageRootPathStack.emplace_back(); std::vector<std::string>& rootPaths = - *this->Makefile->FindPackageRootPathStack.rbegin(); + this->Makefile->FindPackageRootPathStack.back(); // Add root paths from <PackageName>_ROOT CMake and environment variables, // subject to CMP0074. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index aac188e..e8cb151 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -135,13 +135,13 @@ static const struct NotNode : public cmGeneratorExpressionNode const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { - if (*parameters.begin() != "0" && *parameters.begin() != "1") { + if (parameters.front() != "0" && parameters.front() != "1") { reportError( context, content->GetOriginalExpression(), "$<NOT> parameter must resolve to exactly one '0' or '1' value."); return std::string(); } - return *parameters.begin() == "0" ? "1" : "0"; + return parameters.front() == "0" ? "1" : "0"; } } notNode; @@ -157,7 +157,7 @@ static const struct BoolNode : public cmGeneratorExpressionNode const GeneratorExpressionContent* /*content*/, cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { - return !cmSystemTools::IsOff(*parameters.begin()) ? "1" : "0"; + return !cmSystemTools::IsOff(parameters.front()) ? "1" : "0"; } } boolNode; @@ -194,7 +194,7 @@ static const struct StrEqualNode : public cmGeneratorExpressionNode const GeneratorExpressionContent* /*content*/, cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { - return *parameters.begin() == parameters[1] ? "1" : "0"; + return parameters.front() == parameters[1] ? "1" : "0"; } } strEqualNode; @@ -613,7 +613,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode return compilerId; } static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$"); - if (!compilerIdValidator.find(*parameters.begin())) { + if (!compilerIdValidator.find(parameters.front())) { reportError(context, content->GetOriginalExpression(), "Expression syntax not recognized."); return std::string(); @@ -622,11 +622,11 @@ struct CompilerIdNode : public cmGeneratorExpressionNode return parameters.front().empty() ? "1" : "0"; } - if (strcmp(parameters.begin()->c_str(), compilerId.c_str()) == 0) { + if (strcmp(parameters.front().c_str(), compilerId.c_str()) == 0) { return "1"; } - if (cmsysString_strcasecmp(parameters.begin()->c_str(), + if (cmsysString_strcasecmp(parameters.front().c_str(), compilerId.c_str()) == 0) { switch (context->LG->GetPolicyStatus(cmPolicies::CMP0044)) { case cmPolicies::WARN: { @@ -734,7 +734,7 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode } static cmsys::RegularExpression compilerIdValidator("^[0-9\\.]*$"); - if (!compilerIdValidator.find(*parameters.begin())) { + if (!compilerIdValidator.find(parameters.front())) { reportError(context, content->GetOriginalExpression(), "Expression syntax not recognized."); return std::string(); @@ -744,7 +744,7 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode } return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, - parameters.begin()->c_str(), + parameters.front().c_str(), compilerVersion.c_str()) ? "1" : "0"; @@ -839,7 +839,7 @@ struct PlatformIdNode : public cmGeneratorExpressionNode return parameters.front().empty() ? "1" : "0"; } - if (*parameters.begin() == platformId) { + if (parameters.front() == platformId) { return "1"; } return "0"; @@ -1001,7 +1001,7 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode return configurationNode.Evaluate(parameters, context, content, nullptr); } static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$"); - if (!configValidator.find(*parameters.begin())) { + if (!configValidator.find(parameters.front())) { reportError(context, content->GetOriginalExpression(), "Expression syntax not recognized."); return std::string(); @@ -1011,7 +1011,7 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode return parameters.front().empty() ? "1" : "0"; } - if (cmsysString_strcasecmp(parameters.begin()->c_str(), + if (cmsysString_strcasecmp(parameters.front().c_str(), context->Config.c_str()) == 0) { return "1"; } @@ -1166,7 +1166,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$"); cmGeneratorTarget const* target = context->HeadTarget; - std::string propertyName = *parameters.begin(); + std::string propertyName = parameters.front(); if (parameters.size() == 1) { context->HadHeadSensitiveCondition = true; @@ -1182,14 +1182,14 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode } if (parameters.size() == 2) { - if (parameters.begin()->empty() && parameters[1].empty()) { + if (parameters.front().empty() && parameters[1].empty()) { reportError( context, content->GetOriginalExpression(), "$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty " "target name and property name."); return std::string(); } - if (parameters.begin()->empty()) { + if (parameters.front().empty()) { reportError( context, content->GetOriginalExpression(), "$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty " @@ -1964,7 +1964,7 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode cmGeneratorExpressionDAGChecker* dagChecker) const override { // Lookup the referenced target. - std::string name = *parameters.begin(); + std::string name = parameters.front(); if (!cmGeneratorExpression::IsValidTargetName(name)) { ::reportError(context, content->GetOriginalExpression(), diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx index 949a86d..7aa3314 100644 --- a/Source/cmGeneratorExpressionParser.cxx +++ b/Source/cmGeneratorExpressionParser.cxx @@ -47,11 +47,11 @@ static void extendResult( if (!result.empty() && (*(result.end() - 1))->GetType() == cmGeneratorExpressionEvaluator::Text && - (*contents.begin())->GetType() == cmGeneratorExpressionEvaluator::Text) { + contents.front()->GetType() == cmGeneratorExpressionEvaluator::Text) { TextContent* textContent = static_cast<TextContent*>(*(result.end() - 1)); textContent->Extend( - static_cast<TextContent*>(*contents.begin())->GetLength()); - delete *contents.begin(); + static_cast<TextContent*>(contents.front())->GetLength()); + delete contents.front(); result.insert(result.end(), contents.begin() + 1, contents.end()); } else { result.insert(result.end(), contents.begin(), contents.end()); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 78040c3..54cfd3a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -2389,7 +2389,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc) std::set<cmGeneratorTarget*> targets; for (cmCustomCommandLine const& cCmdLine : cc.GetCommandLines()) { - std::string const& command = *cCmdLine.begin(); + std::string const& command = cCmdLine.front(); // Check for a target with this name. if (cmGeneratorTarget* t = this->LocalGenerator->FindGeneratorTargetToUse(command)) { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ab139c0..cc61318 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2193,7 +2193,7 @@ cmSourceGroup* cmMakefile::FindSourceGroup( } // Shouldn't get here, but just in case, return the default group. - return &groups.front(); + return groups.data(); } #endif diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index e2d7deb..fbb9df3 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -447,7 +447,7 @@ void cmQtAutoGenerator::ReadOnlyProcessT::PipeT::UVAlloc(uv_handle_t* handle, { auto& pipe = *reinterpret_cast<PipeT*>(handle->data); pipe.Buffer_.resize(suggestedSize); - buf->base = &pipe.Buffer_.front(); + buf->base = pipe.Buffer_.data(); buf->len = pipe.Buffer_.size(); } @@ -555,11 +555,11 @@ bool cmQtAutoGenerator::ReadOnlyProcessT::start( std::fill_n(reinterpret_cast<char*>(&UVOptions_), sizeof(UVOptions_), 0); UVOptions_.exit_cb = &ReadOnlyProcessT::UVExit; UVOptions_.file = CommandPtr_[0]; - UVOptions_.args = const_cast<char**>(&CommandPtr_.front()); + UVOptions_.args = const_cast<char**>(CommandPtr_.data()); UVOptions_.cwd = Setup_.WorkingDirectory.c_str(); UVOptions_.flags = UV_PROCESS_WINDOWS_HIDE; UVOptions_.stdio_count = static_cast<int>(UVOptionsStdIO_.size()); - UVOptions_.stdio = &UVOptionsStdIO_.front(); + UVOptions_.stdio = UVOptionsStdIO_.data(); // -- Spawn process if (UVProcess_.spawn(*uv_loop, UVOptions_, this) != 0) { diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index 0f51e0e..f98984e 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -144,7 +144,7 @@ void cmSearchPath::AddSuffixes(const std::vector<std::string>& suffixes) // this will get incorrectly considered a network // path on windows and cause huge delays. std::string p = inPath; - if (!p.empty() && *p.rbegin() != '/') { + if (!p.empty() && p.back() != '/') { p += "/"; } @@ -176,7 +176,7 @@ void cmSearchPath::AddPrefixPaths(const std::vector<std::string>& paths, for (std::string const& path : paths) { std::string dir = path; - if (!subdir.empty() && !dir.empty() && *dir.rbegin() != '/') { + if (!subdir.empty() && !dir.empty() && dir.back() != '/') { dir += "/"; } if (subdir == "include" || subdir == "lib") { diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 91d6190..44ba82a 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -771,7 +771,7 @@ bool cmStringCommand::HandleRandomCommand(std::vector<std::string> const& args) } result.push_back(0); - this->Makefile->AddDefinition(variableName, &*result.begin()); + this->Makefile->AddDefinition(variableName, result.data()); return true; } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 1d20e2f..ba40ce1 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -740,7 +740,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command, argv.push_back(nullptr); cmsysProcess* cp = cmsysProcess_New(); - cmsysProcess_SetCommand(cp, &*argv.begin()); + cmsysProcess_SetCommand(cp, argv.data()); cmsysProcess_SetWorkingDirectory(cp, dir); if (cmSystemTools::GetRunCommandHideConsole()) { cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); diff --git a/Source/cmakexbuild.cxx b/Source/cmakexbuild.cxx index 2951945..f5c8f07 100644 --- a/Source/cmakexbuild.cxx +++ b/Source/cmakexbuild.cxx @@ -22,7 +22,7 @@ int RunXCode(std::vector<const char*>& argv, bool& hitbug) { hitbug = false; cmsysProcess* cp = cmsysProcess_New(); - cmsysProcess_SetCommand(cp, &*argv.begin()); + cmsysProcess_SetCommand(cp, argv.data()); cmsysProcess_SetTimeout(cp, 0); cmsysProcess_Execute(cp); std::vector<char> out; |