diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 18f3c45..edd2aa9 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -261,16 +261,20 @@ IF (STAR_COMPILER_GNU) SET (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Ofast") ELSEIF (STAR_COMPILER_CLANG) - SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-export_dynamic -Wall -Wextra -Wuninitialized -Wno-parentheses-equality -Wno-deprecated-declarations") - SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wl,-export_dynamic -Wall -Wextra -Wuninitialized -Wno-parentheses-equality -Wno-deprecated-declarations") + SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wuninitialized -Wno-parentheses-equality -Wno-deprecated-declarations") + SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wextra -Wuninitialized -Wno-parentheses-equality -Wno-deprecated-declarations") IF (STAR_SYSTEM_MACOS) SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-export_dynamic") + SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-export_dynamic") SET (CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++17") SET (CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") ELSEIF () SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -D_REENTRANT") SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -D_REENTRANT") + SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export_dynamic") + SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export_dynamic") ENDIF () SET (CMAKE_C_FLAGS_DEBUG "-g") diff --git a/source/application/StarApplication.cpp b/source/application/StarApplication.cpp index e894673..319b669 100644 --- a/source/application/StarApplication.cpp +++ b/source/application/StarApplication.cpp @@ -7,11 +7,11 @@ namespace Star { void Application::startup(StringList const&) {} void Application::applicationInit(ApplicationControllerPtr appController) { - m_appController = move(appController); + m_appController = std::move(appController); } void Application::renderInit(RendererPtr renderer) { - m_renderer = move(renderer); + m_renderer = std::move(renderer); } void Application::windowChanged(WindowMode, Vec2U) {} diff --git a/source/application/StarMainApplication_sdl.cpp b/source/application/StarMainApplication_sdl.cpp index 48b7fa5..08d3813 100644 --- a/source/application/StarMainApplication_sdl.cpp +++ b/source/application/StarMainApplication_sdl.cpp @@ -206,7 +206,7 @@ ControllerButton controllerButtonFromSdlControllerButton(uint8_t button) { class SdlPlatform { public: SdlPlatform(ApplicationUPtr application, StringList cmdLineArgs) { - m_application = move(application); + m_application = std::move(application); // extract application path from command line args String applicationPath = cmdLineArgs.first(); @@ -215,7 +215,7 @@ public: StringList platformArguments; eraseWhere(cmdLineArgs, [&platformArguments](String& argument) { if (argument.beginsWith("+platform")) { - platformArguments.append(move(argument)); + platformArguments.append(std::move(argument)); return true; } return false; @@ -461,7 +461,7 @@ private: Maybe string; if (SDL_HasClipboardText()) { if (auto text = SDL_GetClipboardText()) { - if (*text != NULL) + if (*text != '\0') string.emplace(text); SDL_free(text); } @@ -482,7 +482,7 @@ private: } void setApplicationTitle(String title) override { - parent->m_windowTitle = move(title); + parent->m_windowTitle = std::move(title); if (parent->m_sdlWindow) SDL_SetWindowTitle(parent->m_sdlWindow, parent->m_windowTitle.utf8Ptr()); } @@ -817,10 +817,10 @@ private: else operations = { FlipImageOperation{ FlipImageOperation::Mode::FlipY } }; - auto newImage = std::make_shared(move(processImageOperations(operations, *image))); + auto newImage = std::make_shared(processImageOperations(operations, *image)); // Fix fully transparent pixels inverting the underlying display pixel on Windows (allowing this could be made configurable per cursor later!) newImage->forEachPixel([](unsigned x, unsigned y, Vec4B& pixel) { if (!pixel[3]) pixel[0] = pixel[1] = pixel[2] = 0; }); - entry->image = move(newImage); + entry->image = std::move(newImage); auto size = entry->image->size(); @@ -907,7 +907,7 @@ private: int runMainApplication(ApplicationUPtr application, StringList cmdLineArgs) { try { { - SdlPlatform platform(move(application), move(cmdLineArgs)); + SdlPlatform platform(std::move(application), std::move(cmdLineArgs)); platform.run(); } Logger::info("Application: stopped gracefully"); diff --git a/source/application/StarP2PNetworkingService_pc.cpp b/source/application/StarP2PNetworkingService_pc.cpp index 0170eb0..f13bb62 100644 --- a/source/application/StarP2PNetworkingService_pc.cpp +++ b/source/application/StarP2PNetworkingService_pc.cpp @@ -19,9 +19,9 @@ PcP2PNetworkingService::PcP2PNetworkingService(PcPlatformServicesStatePtr state) : m_callbackConnectionFailure(this, &PcP2PNetworkingService::steamOnConnectionFailure), m_callbackJoinRequested(this, &PcP2PNetworkingService::steamOnJoinRequested), m_callbackSessionRequest(this, &PcP2PNetworkingService::steamOnSessionRequest), - m_state(move(state)) { + m_state(std::move(state)) { #else - : m_state(move(state)) { + : m_state(std::move(state)) { #endif #ifdef STAR_ENABLE_DISCORD_INTEGRATION @@ -224,7 +224,7 @@ Either PcP2PNetworkingService::connectToPeer(P2PNetworkin if (type == "discord") { auto remoteUserId = lexicalCast(peerId.extract("_")); auto lobbyId = lexicalCast(peerId.extract("_")); - String lobbySecret = move(peerId); + String lobbySecret = std::move(peerId); return makeRight(discordConnectRemote(remoteUserId, lobbyId, lobbySecret)); } } @@ -242,7 +242,7 @@ void PcP2PNetworkingService::addPendingJoin(String connectionString) { if (connectionString.extract(":") != "connect") throw ApplicationException::format("malformed connection string '{}'", connectionString); - String target = move(connectionString); + String target = std::move(connectionString); String targetType = target.extract("_"); if (targetType == "address") @@ -357,7 +357,7 @@ void PcP2PNetworkingService::steamReceiveAll() { SteamNetworking()->ReadP2PPacket(data.ptr(), messageSize, &messageSize, &messageRemoteUser); if (auto openSocket = m_steamOpenSockets.value(messageRemoteUser.ConvertToUint64())) { MutexLocker socketLocker(openSocket->mutex); - openSocket->incoming.append(move(data)); + openSocket->incoming.append(std::move(data)); } } } @@ -474,7 +474,7 @@ P2PSocketUPtr PcP2PNetworkingService::discordConnectRemote(discord::UserId remot } }); - return unique_ptr(move(socket)); + return unique_ptr(std::move(socket)); } void PcP2PNetworkingService::discordOnReceiveMessage(discord::LobbyId lobbyId, discord::UserId userId, discord::NetworkChannelId channel, uint8_t* data, uint32_t size) { @@ -507,7 +507,7 @@ void PcP2PNetworkingService::discordOnLobbyMemberConnect(discord::LobbyId lobbyI socket->mode = DiscordSocketMode::Connected; m_discordOpenSockets[userId] = socket.get(); - m_pendingIncomingConnections.append(move(socket)); + m_pendingIncomingConnections.append(std::move(socket)); Logger::info("Accepted new discord connection from remote user {}", userId); } } diff --git a/source/application/StarPlatformServices_pc.cpp b/source/application/StarPlatformServices_pc.cpp index 7023129..8f940b3 100644 --- a/source/application/StarPlatformServices_pc.cpp +++ b/source/application/StarPlatformServices_pc.cpp @@ -118,7 +118,7 @@ PcPlatformServicesUPtr PcPlatformServices::create(String const& path, StringList for (auto& argument : platformArguments) { if (argument.beginsWith("+platform:connect:")) { Logger::info("PC platform services joining from command line argument '{}'", argument); - p2pNetworkingService->addPendingJoin(move(argument)); + p2pNetworkingService->addPendingJoin(std::move(argument)); } else { throw ApplicationException::format("Unrecognized PC platform services command line argument '{}'", argument); } diff --git a/source/application/StarRenderer.cpp b/source/application/StarRenderer.cpp index f4aa4fe..764dd4a 100644 --- a/source/application/StarRenderer.cpp +++ b/source/application/StarRenderer.cpp @@ -19,7 +19,7 @@ RenderQuad::RenderQuad(Vec2F posA, Vec2F posB, Vec2F posC, Vec2F posD, Vec4B col d = { posD, { 0, 0 }, color, param1 }; } -RenderQuad::RenderQuad(TexturePtr tex, Vec2F minPosition, float textureScale, Vec4B color, float param1) : texture(move(tex)) { +RenderQuad::RenderQuad(TexturePtr tex, Vec2F minPosition, float textureScale, Vec4B color, float param1) : texture(std::move(tex)) { Vec2F size = Vec2F(texture->size()); a = { minPosition, { 0, 0 }, color, param1}; b = { { (minPosition[0] + size[0] * textureScale), minPosition[1] }, { size[0], 0 }, color, param1 }; @@ -27,7 +27,7 @@ RenderQuad::RenderQuad(TexturePtr tex, Vec2F minPosition, float textureScale, Ve d = { { minPosition[0], (minPosition[1] + size[1] * textureScale) }, { 0, size[1] }, color, param1 }; } -RenderQuad::RenderQuad(TexturePtr tex, RectF const& screenCoords, Vec4B color, float param1) : texture(move(tex)) { +RenderQuad::RenderQuad(TexturePtr tex, RectF const& screenCoords, Vec4B color, float param1) : texture(std::move(tex)) { Vec2F size = Vec2F(texture->size()); a = { screenCoords.min(), { 0, 0 }, color, param1 }; b = { { screenCoords.xMax(), screenCoords.yMin(), }, { size[0], 0.f }, color, param1 }; @@ -35,7 +35,7 @@ RenderQuad::RenderQuad(TexturePtr tex, RectF const& screenCoords, Vec4B color, f d = { { screenCoords.xMin(), screenCoords.yMax(), }, { 0.f, size[1] }, color, param1 }; } -RenderQuad::RenderQuad(TexturePtr tex, Vec2F posA, Vec2F uvA, Vec2F posB, Vec2F uvB, Vec2F posC, Vec2F uvC, Vec2F posD, Vec2F uvD, Vec4B color, float param1) : texture(move(tex)) { +RenderQuad::RenderQuad(TexturePtr tex, Vec2F posA, Vec2F uvA, Vec2F posB, Vec2F uvB, Vec2F posC, Vec2F uvC, Vec2F posD, Vec2F uvD, Vec4B color, float param1) : texture(std::move(tex)) { a = { posA, uvA, color, param1 }; b = { posB, uvB, color, param1 }; c = { posC, uvC, color, param1 }; @@ -43,7 +43,7 @@ RenderQuad::RenderQuad(TexturePtr tex, Vec2F posA, Vec2F uvA, Vec2F posB, Vec2F } RenderQuad::RenderQuad(TexturePtr tex, RenderVertex vA, RenderVertex vB, RenderVertex vC, RenderVertex vD) - : texture(move(tex)), a(move(vA)), b(move(vB)), c(move(vC)), d(move(vD)) {} + : texture(std::move(tex)), a(std::move(vA)), b(std::move(vB)), c(std::move(vC)), d(std::move(vD)) {} RenderQuad::RenderQuad(RectF const& rect, Vec4B color, float param1) : a{ rect.min(), {}, color, param1 } @@ -64,18 +64,18 @@ RenderTriangle::RenderTriangle(Vec2F posA, Vec2F posB, Vec2F posC, Vec4B color, c = { posC, { 0, 0 }, color, param1 }; } -RenderTriangle::RenderTriangle(TexturePtr tex, Vec2F posA, Vec2F uvA, Vec2F posB, Vec2F uvB, Vec2F posC, Vec2F uvC, Vec4B color, float param1) : texture(move(tex)) { +RenderTriangle::RenderTriangle(TexturePtr tex, Vec2F posA, Vec2F uvA, Vec2F posB, Vec2F uvB, Vec2F posC, Vec2F uvC, Vec4B color, float param1) : texture(std::move(tex)) { a = { posA, uvA, color, param1 }; b = { posB, uvB, color, param1 }; c = { posC, uvC, color, param1 }; } RenderQuad renderTexturedRect(TexturePtr texture, Vec2F minPosition, float textureScale, Vec4B color, float param1) { - return RenderQuad(move(texture), minPosition, textureScale, color, param1); + return RenderQuad(std::move(texture), minPosition, textureScale, color, param1); } RenderQuad renderTexturedRect(TexturePtr texture, RectF const& screenCoords, Vec4B color, float param1) { - return RenderQuad(move(texture), screenCoords, color, param1); + return RenderQuad(std::move(texture), screenCoords, color, param1); } RenderQuad renderFlatRect(RectF const& rect, Vec4B color, float param1) { diff --git a/source/application/StarRenderer_opengl20.cpp b/source/application/StarRenderer_opengl20.cpp index f85f0e8..18f771b 100644 --- a/source/application/StarRenderer_opengl20.cpp +++ b/source/application/StarRenderer_opengl20.cpp @@ -416,7 +416,7 @@ List& OpenGl20Renderer::immediatePrimitives() { } void OpenGl20Renderer::render(RenderPrimitive primitive) { - m_immediatePrimitives.append(move(primitive)); + m_immediatePrimitives.append(std::move(primitive)); } void OpenGl20Renderer::renderBuffer(RenderBufferPtr const& renderBuffer, Mat3F const& transformation) { @@ -672,7 +672,7 @@ void OpenGl20Renderer::GlRenderBuffer::set(List& primitives) { glBufferData(GL_ARRAY_BUFFER, accumulationBuffer.size(), accumulationBuffer.ptr(), GL_STREAM_DRAW); } - vertexBuffers.emplace_back(move(vb)); + vertexBuffers.emplace_back(std::move(vb)); currentTextures.clear(); currentTextureSizes.clear(); @@ -701,7 +701,7 @@ void OpenGl20Renderer::GlRenderBuffer::set(List& primitives) { if (auto gt = as(texture.get())) gt->incrementBufferUseCount(); - usedTextures.add(move(texture)); + usedTextures.add(std::move(texture)); return {float(textureIndex), Vec2F(glTexture->glTextureCoordinateOffset())}; }; @@ -723,14 +723,14 @@ void OpenGl20Renderer::GlRenderBuffer::set(List& primitives) { Texture* lastTexture = nullptr; for (auto& primitive : primitives) { if (auto tri = primitive.ptr()) { - tie(textureIndex, textureOffset) = addCurrentTexture(move(tri->texture)); + tie(textureIndex, textureOffset) = addCurrentTexture(std::move(tri->texture)); appendBufferVertex(tri->a, textureIndex, textureOffset); appendBufferVertex(tri->b, textureIndex, textureOffset); appendBufferVertex(tri->c, textureIndex, textureOffset); } else if (auto quad = primitive.ptr()) { - tie(textureIndex, textureOffset) = addCurrentTexture(move(quad->texture)); + tie(textureIndex, textureOffset) = addCurrentTexture(std::move(quad->texture)); appendBufferVertex(quad->a, textureIndex, textureOffset); appendBufferVertex(quad->b, textureIndex, textureOffset); @@ -742,7 +742,7 @@ void OpenGl20Renderer::GlRenderBuffer::set(List& primitives) { } else if (auto poly = primitive.ptr()) { if (poly->vertexes.size() > 2) { - tie(textureIndex, textureOffset) = addCurrentTexture(move(poly->texture)); + tie(textureIndex, textureOffset) = addCurrentTexture(std::move(poly->texture)); for (size_t i = 1; i < poly->vertexes.size() - 1; ++i) { appendBufferVertex(poly->vertexes[0], textureIndex, textureOffset); diff --git a/source/application/StarTextureAtlas.hpp b/source/application/StarTextureAtlas.hpp index db5a163..595f6ba 100644 --- a/source/application/StarTextureAtlas.hpp +++ b/source/application/StarTextureAtlas.hpp @@ -33,6 +33,8 @@ public: TextureAtlasSet(unsigned cellSize, unsigned atlasNumCells); + virtual ~TextureAtlasSet() = default; + // The constant square size of all atlas textures Vec2U atlasTextureSize() const; @@ -88,6 +90,8 @@ private: }; struct TextureEntry : Texture { + virtual ~TextureEntry() = default; + Vec2U imageSize() const override; AtlasTextureHandle const& atlasTexture() const override; @@ -168,7 +172,7 @@ auto TextureAtlasSet::addTexture(Image const& image, bool bo return nullptr; auto textureEntry = make_shared(); - textureEntry->textureImage = move(finalImage); + textureEntry->textureImage = std::move(finalImage); textureEntry->atlasPlacement = *placement; m_textures.add(textureEntry); diff --git a/source/base/StarAnimatedPartSet.cpp b/source/base/StarAnimatedPartSet.cpp index 3f5d72a..9133921 100644 --- a/source/base/StarAnimatedPartSet.cpp +++ b/source/base/StarAnimatedPartSet.cpp @@ -27,7 +27,7 @@ AnimatedPartSet::AnimatedPartSet(Json config) { newState->transitionState = stateConfig.getString("transition", ""); newState->stateProperties = stateConfig.getObject("properties", {}); newState->stateFrameProperties = stateConfig.getObject("frameProperties", {}); - newStateType.states[stateName] = move(newState); + newStateType.states[stateName] = std::move(newState); } newStateType.states.sortByKey(); @@ -38,7 +38,7 @@ AnimatedPartSet::AnimatedPartSet(Json config) { if (newStateType.defaultState.empty() && !newStateType.states.empty()) newStateType.defaultState = newStateType.states.firstKey(); - m_stateTypes[stateTypeName] = move(newStateType); + m_stateTypes[stateTypeName] = std::move(newStateType); } // Sort state types by decreasing priority. @@ -61,13 +61,13 @@ AnimatedPartSet::AnimatedPartSet(Json config) { auto const& stateConfig = partStatePair.second; PartState partState = {stateConfig.getObject("properties", {}), stateConfig.getObject("frameProperties", {})}; - newPart.partStates[stateTypeName][stateName] = move(partState); + newPart.partStates[stateTypeName][stateName] = std::move(partState); } } newPart.activePart.partName = partPair.first; newPart.activePartDirty = true; - m_parts[partName] = move(newPart); + m_parts[partName] = std::move(newPart); } for (auto const& pair : m_stateTypes) diff --git a/source/base/StarAssets.cpp b/source/base/StarAssets.cpp index 8956ba9..135945c 100644 --- a/source/base/StarAssets.cpp +++ b/source/base/StarAssets.cpp @@ -71,17 +71,17 @@ Maybe FramesSpecification::getRect(String const& frame) const { Assets::Assets(Settings settings, StringList assetSources) { const char* const AssetsPatchSuffix = ".patch"; - m_settings = move(settings); + m_settings = std::move(settings); m_stopThreads = false; - m_assetSources = move(assetSources); + m_assetSources = std::move(assetSources); for (auto& sourcePath : m_assetSources) { Logger::info("Loading assets from: '{}'", sourcePath); AssetSourcePtr source; if (File::isDirectory(sourcePath)) - source = make_shared(sourcePath, m_settings.pathIgnore); + source = std::make_shared(sourcePath, m_settings.pathIgnore); else - source = make_shared(sourcePath); + source = std::make_shared(sourcePath); m_assetSourcePaths.add(sourcePath, source); @@ -225,7 +225,7 @@ Json Assets::json(String const& path) const { auto components = AssetPath::split(path); validatePath(components, true, false); - return as(getAsset(AssetId{AssetType::Json, move(components)}))->json; + return as(getAsset(AssetId{AssetType::Json, std::move(components)}))->json; } Json Assets::fetchJson(Json const& v, String const& dir) const { @@ -255,7 +255,7 @@ void Assets::queueImages(StringList const& paths) const { auto components = AssetPath::split(path); validatePath(components, true, true); - return AssetId{AssetType::Image, move(components)}; + return AssetId{AssetType::Image, std::move(components)}; })); } @@ -280,7 +280,7 @@ AudioConstPtr Assets::audio(String const& path) const { auto components = AssetPath::split(path); validatePath(components, false, false); - return as(getAsset(AssetId{AssetType::Audio, move(components)}))->audio; + return as(getAsset(AssetId{AssetType::Audio, std::move(components)}))->audio; } void Assets::queueAudios(StringList const& paths) const { @@ -288,7 +288,7 @@ void Assets::queueAudios(StringList const& paths) const { const auto components = AssetPath::split(path); validatePath(components, false, false); - return AssetId{AssetType::Audio, move(components)}; + return AssetId{AssetType::Audio, std::move(components)}; })); } @@ -296,7 +296,7 @@ AudioConstPtr Assets::tryAudio(String const& path) const { auto components = AssetPath::split(path); validatePath(components, false, false); - if (auto audioData = as(tryAsset(AssetId{AssetType::Audio, move(components)}))) + if (auto audioData = as(tryAsset(AssetId{AssetType::Audio, std::move(components)}))) return audioData->audio; else return {}; @@ -306,14 +306,14 @@ FontConstPtr Assets::font(String const& path) const { auto components = AssetPath::split(path); validatePath(components, false, false); - return as(getAsset(AssetId{AssetType::Font, move(components)}))->font; + return as(getAsset(AssetId{AssetType::Font, std::move(components)}))->font; } ByteArrayConstPtr Assets::bytes(String const& path) const { auto components = AssetPath::split(path); validatePath(components, false, false); - return as(getAsset(AssetId{AssetType::Bytes, move(components)}))->bytes; + return as(getAsset(AssetId{AssetType::Bytes, std::move(components)}))->bytes; } IODevicePtr Assets::openFile(String const& path) const { @@ -386,7 +386,7 @@ bool Assets::BytesData::shouldPersist() const { FramesSpecification Assets::parseFramesSpecification(Json const& frameConfig, String path) { FramesSpecification framesSpecification; - framesSpecification.framesFile = move(path); + framesSpecification.framesFile = std::move(path); if (frameConfig.contains("frameList")) { for (auto const& pair : frameConfig.get("frameList").toObject()) { @@ -469,7 +469,7 @@ FramesSpecification Assets::parseFramesSpecification(Json const& frameConfig, St if (!framesSpecification.frames.contains(value)) throw AssetException(strf("No such frame '{}' found for alias '{}'", value, key)); - framesSpecification.aliases[key] = move(value); + framesSpecification.aliases[key] = std::move(value); } } @@ -866,7 +866,7 @@ shared_ptr Assets::loadImage(AssetPath const& path) const { for (auto const& ref : referencePaths) { auto components = AssetPath::split(ref); validatePath(components, true, false); - auto refImage = as(loadAsset(AssetId{AssetType::Image, move(components)})); + auto refImage = as(loadAsset(AssetId{AssetType::Image, std::move(components)})); if (!refImage) return {}; references[ref] = refImage->image; @@ -881,7 +881,7 @@ shared_ptr Assets::loadImage(AssetPath const& path) const { else processImageOperation(entry.operation, newImage, [&](String const& ref) { return references.get(ref).get(); }); }); - newData->image = make_shared(move(newImage)); + newData->image = make_shared(std::move(newImage)); return newData; }); diff --git a/source/base/StarDirectoryAssetSource.cpp b/source/base/StarDirectoryAssetSource.cpp index 675c64c..f375e4a 100644 --- a/source/base/StarDirectoryAssetSource.cpp +++ b/source/base/StarDirectoryAssetSource.cpp @@ -62,7 +62,7 @@ void DirectoryAssetSource::setMetadata(JsonObject metadata) { if (!m_metadataFile) m_metadataFile = String("/_metadata"); - m_metadata = move(metadata); + m_metadata = std::move(metadata); if (m_metadata.empty()) File::remove(toFilesystem(*m_metadataFile)); @@ -88,7 +88,7 @@ void DirectoryAssetSource::scanAll(String const& assetDirectory, StringList& out scanAll(assetPath + "/", output); } else { if (!shouldIgnore(assetPath)) - output.append(move(assetPath)); + output.append(std::move(assetPath)); } } } diff --git a/source/base/StarMixer.cpp b/source/base/StarMixer.cpp index d3c7c5a..be0bea8 100644 --- a/source/base/StarMixer.cpp +++ b/source/base/StarMixer.cpp @@ -218,7 +218,7 @@ void Mixer::setVolume(float volume, float rampTime) { void Mixer::play(AudioInstancePtr sample) { MutexLocker locker(m_queueMutex); - m_audios.add(move(sample), AudioState{List(m_channels, 1.0f)}); + m_audios.add(std::move(sample), AudioState{List(m_channels, 1.0f)}); } void Mixer::stopAll(float rampTime) { diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp index 47e5596..d44bd6e 100644 --- a/source/client/StarClientApplication.cpp +++ b/source/client/StarClientApplication.cpp @@ -607,7 +607,7 @@ void ClientApplication::changeState(MainAppState newState) { setError(strf("Cannot join peer: {}", result.left())); return; } else { - packetSocket = P2PPacketSocket::open(move(result.right())); + packetSocket = P2PPacketSocket::open(std::move(result.right())); } } else { setError("Internal error, no p2p networking service when joining p2p networking peer"); @@ -616,7 +616,7 @@ void ClientApplication::changeState(MainAppState newState) { } bool allowAssetsMismatch = m_root->configuration()->get("allowAssetsMismatch").toBool(); - if (auto errorMessage = m_universeClient->connect(UniverseConnection(move(packetSocket)), allowAssetsMismatch, + if (auto errorMessage = m_universeClient->connect(UniverseConnection(std::move(packetSocket)), allowAssetsMismatch, multiPlayerConnection.account, multiPlayerConnection.password)) { setError(*errorMessage); return; @@ -951,7 +951,7 @@ void ClientApplication::updateRunning(float dt) { if (m_universeServer) { if (auto p2pNetworkingService = appController()->p2pNetworkingService()) { for (auto& p2pClient : p2pNetworkingService->acceptP2PConnections()) - m_universeServer->addClient(UniverseConnection(P2PPacketSocket::open(move(p2pClient)))); + m_universeServer->addClient(UniverseConnection(P2PPacketSocket::open(std::move(p2pClient)))); } m_universeServer->setPause(m_mainInterface->escapeDialogOpen()); diff --git a/source/core/StarAStar.hpp b/source/core/StarAStar.hpp index 52dc5d4..eedac8c 100644 --- a/source/core/StarAStar.hpp +++ b/source/core/StarAStar.hpp @@ -121,7 +121,7 @@ namespace AStar { template void Search::start(Node startNode, Node goalNode) { - m_goal = move(goalNode); + m_goal = std::move(goalNode); m_nodeMeta.clear(); m_openQueue = std::priority_queue(); m_openSet.clear(); @@ -137,7 +137,7 @@ namespace AStar { m_nodeMeta[startNode].score = startScore; m_openSet.insert(startNode); - m_openQueue.push(ScoredNode{startScore, move(startNode)}); + m_openQueue.push(ScoredNode{startScore, std::move(startNode)}); } template @@ -251,7 +251,7 @@ namespace AStar { template Maybe> const& Search::findPath(Node startNode, Node goalNode) { - start(move(startNode), move(goalNode)); + start(std::move(startNode), std::move(goalNode)); explore(); return result(); } diff --git a/source/core/StarAlgorithm.hpp b/source/core/StarAlgorithm.hpp index e26917a..ef82cc8 100644 --- a/source/core/StarAlgorithm.hpp +++ b/source/core/StarAlgorithm.hpp @@ -14,7 +14,7 @@ template struct construct { template ToType operator()(FromTypes&&... fromTypes) const { - return ToType(forward(fromTypes)...); + return ToType(std::forward(fromTypes)...); } }; @@ -29,7 +29,7 @@ template struct SwallowReturn { template void operator()(T&&... args) { - func(forward(args)...); + func(std::forward(args)...); } Func func; @@ -37,7 +37,7 @@ struct SwallowReturn { template SwallowReturn swallow(Func f) { - return SwallowReturn{move(f)}; + return SwallowReturn{std::move(f)}; } struct Empty { @@ -58,18 +58,18 @@ struct FunctionComposer { template decltype(auto) operator()(T&&... args) { - return f1(f2(forward(args)...)); + return f1(f2(std::forward(args)...)); } }; template decltype(auto) compose(FirstFunction&& firstFunction, SecondFunction&& secondFunction) { - return FunctionComposer{move(forward(firstFunction)), move(forward(secondFunction))}; + return FunctionComposer{std::move(std::forward(firstFunction)), std::move(std::forward(secondFunction))}; } template decltype(auto) compose(FirstFunction firstFunction, SecondFunction secondFunction, ThirdFunction thirdFunction, RestFunctions... restFunctions) { - return compose(forward(firstFunction), compose(forward(secondFunction), compose(forward(thirdFunction), forward(restFunctions)...))); + return compose(std::forward(firstFunction), compose(std::forward(secondFunction), compose(std::forward(thirdFunction), std::forward(restFunctions)...))); } template @@ -260,7 +260,7 @@ void sortByComputedValue(Container& container, Getter&& valueGetter, bool stable template void stableSortByComputedValue(Container& container, Getter&& valueGetter) { - return sortByComputedValue(container, forward(valueGetter), true); + return sortByComputedValue(container, std::forward(valueGetter), true); } template @@ -293,7 +293,7 @@ template void transformInto(OutContainer& outContainer, InContainer&& inContainer, Function&& function) { for (auto&& elem : inContainer) { if (std::is_rvalue_reference::value) - outContainer.insert(outContainer.end(), function(move(elem))); + outContainer.insert(outContainer.end(), function(std::move(elem))); else outContainer.insert(outContainer.end(), function(elem)); } @@ -302,7 +302,7 @@ void transformInto(OutContainer& outContainer, InContainer&& inContainer, Functi template OutContainer transform(InContainer&& container, Function&& function) { OutContainer res; - transformInto(res, forward(container), forward(function)); + transformInto(res, std::forward(container), std::forward(function)); return res; } @@ -326,7 +326,7 @@ OutputContainer zipWith(Function&& function, Container1 const& cont1, Container2 // default constructed state. template T take(T& t) { - T t2 = move(t); + T t2 = std::move(t); t = T(); return t2; } @@ -356,7 +356,7 @@ public: template OutputProxy& operator=(T&& value) { - m_function(forward(value)); + m_function(std::forward(value)); return *this; } @@ -365,7 +365,7 @@ public: }; explicit FunctionOutputIterator(UnaryFunction f = UnaryFunction()) - : m_function(move(f)) {} + : m_function(std::move(f)) {} OutputProxy operator*() { return OutputProxy(m_function); @@ -385,7 +385,7 @@ private: template FunctionOutputIterator makeFunctionOutputIterator(UnaryFunction f) { - return FunctionOutputIterator(move(f)); + return FunctionOutputIterator(std::move(f)); } // Wraps a nullary function to produce an input iterator @@ -401,7 +401,7 @@ public: typedef typename std::result_of::type FunctionReturnType; explicit FunctionInputIterator(NullaryFunction f = {}) - : m_function(move(f)) {} + : m_function(std::move(f)) {} FunctionReturnType operator*() { return m_function(); @@ -421,7 +421,7 @@ private: template FunctionInputIterator makeFunctionInputIterator(NullaryFunction f) { - return FunctionInputIterator(move(f)); + return FunctionInputIterator(std::move(f)); } template @@ -449,14 +449,14 @@ ReverseWrapper reverseIterate(Iterable& list) { template class FinallyGuard { public: - FinallyGuard(Functor functor) : functor(move(functor)), dismiss(false) {} + FinallyGuard(Functor functor) : functor(std::move(functor)), dismiss(false) {} - FinallyGuard(FinallyGuard&& o) : functor(move(o.functor)), dismiss(o.dismiss) { + FinallyGuard(FinallyGuard&& o) : functor(std::move(o.functor)), dismiss(o.dismiss) { o.cancel(); } FinallyGuard& operator=(FinallyGuard&& o) { - functor = move(o.functor); + functor = std::move(o.functor); dismiss = o.dismiss; o.cancel(); return *this; @@ -478,7 +478,7 @@ private: template FinallyGuard::type> finally(Functor&& f) { - return FinallyGuard(forward(f)); + return FinallyGuard(std::forward(f)); } // Generates compile time sequences of indexes from MinIndex to MaxIndex @@ -498,12 +498,12 @@ struct GenIndexSequence { template decltype(auto) tupleUnpackFunctionIndexes(Function&& function, Tuple&& args, IndexSequence const&) { - return function(get(forward(args))...); + return function(get(std::forward(args))...); } template decltype(auto) tupleUnpackFunction(Function&& function, Tuple&& args) { - return tupleUnpackFunctionIndexes(forward(function), forward(args), + return tupleUnpackFunctionIndexes(std::forward(function), std::forward(args), typename GenIndexSequence<0, std::tuple_size::type>::value>::type()); } @@ -512,12 +512,12 @@ decltype(auto) tupleUnpackFunction(Function&& function, Tuple&& args) { template decltype(auto) tupleApplyFunctionIndexes(Function&& function, Tuple&& args, IndexSequence const&) { - return make_tuple(function(get(forward(args)))...); + return make_tuple(function(get(std::forward(args)))...); } template decltype(auto) tupleApplyFunction(Function&& function, Tuple&& args) { - return tupleApplyFunctionIndexes(forward(function), forward(args), + return tupleApplyFunctionIndexes(std::forward(function), std::forward(args), typename GenIndexSequence<0, std::tuple_size::type>::value>::type()); } @@ -530,35 +530,35 @@ void tupleCallFunctionCaller(Function&&, Tuple&&) {} template void tupleCallFunctionCaller(Tuple&& t, Function&& function) { - tupleCallFunctionCaller(forward(t), forward(function)); - function(get(forward(t))); + tupleCallFunctionCaller(std::forward(t), std::forward(function)); + function(get(std::forward(t))); } template void tupleCallFunctionExpander(Tuple&& t, Function&& function, tuple const&) { - tupleCallFunctionCaller(forward(t), forward(function)); + tupleCallFunctionCaller(std::forward(t), std::forward(function)); } template void tupleCallFunction(Tuple&& t, Function&& function) { - tupleCallFunctionExpander(forward(t), forward(function), forward(t)); + tupleCallFunctionExpander(std::forward(t), std::forward(function), std::forward(t)); } // Get a subset of a tuple template decltype(auto) subTupleIndexes(Tuple&& t, IndexSequence const&) { - return make_tuple(get(forward(t))...); + return make_tuple(get(std::forward(t))...); } template decltype(auto) subTuple(Tuple&& t) { - return subTupleIndexes(forward(t), GenIndexSequence::type()); + return subTupleIndexes(std::forward(t), GenIndexSequence::type()); } template decltype(auto) trimTuple(Tuple&& t) { - return subTupleIndexes(forward(t), typename GenIndexSequence::type>::value>::type()); + return subTupleIndexes(std::forward(t), typename GenIndexSequence::type>::value>::type()); } // Unpack a parameter expansion into a container @@ -568,14 +568,14 @@ void unpackVariadicImpl(Container&) {} template void unpackVariadicImpl(Container& container, TFirst&& tfirst, TRest&&... trest) { - container.insert(container.end(), forward(tfirst)); - unpackVariadicImpl(container, forward(trest)...); + container.insert(container.end(), std::forward(tfirst)); + unpackVariadicImpl(container, std::forward(trest)...); } template Container unpackVariadic(T&&... t) { Container c; - unpackVariadicImpl(c, forward(t)...); + unpackVariadicImpl(c, std::forward(t)...); return c; } @@ -587,7 +587,7 @@ void callFunctionVariadic(Function&&) {} template void callFunctionVariadic(Function&& function, Arg1&& arg1, ArgRest&&... argRest) { function(arg1); - callFunctionVariadic(forward(function), forward(argRest)...); + callFunctionVariadic(std::forward(function), std::forward(argRest)...); } template diff --git a/source/core/StarAssetPath.cpp b/source/core/StarAssetPath.cpp index cb607fb..9a7833b 100644 --- a/source/core/StarAssetPath.cpp +++ b/source/core/StarAssetPath.cpp @@ -133,18 +133,18 @@ bool AssetPath::operator==(AssetPath const& rhs) const { } AssetPath::AssetPath(const char* path) { - *this = move(AssetPath::split(path)); + *this = AssetPath::split(path); } AssetPath::AssetPath(String const& path) { - *this = move(AssetPath::split(path)); + *this = AssetPath::split(path); } AssetPath::AssetPath(String&& basePath, Maybe&& subPath, DirectivesGroup&& directives) { - this->basePath = move(basePath); - this->subPath = move(subPath); - this->directives = move(directives); + this->basePath = std::move(basePath); + this->subPath = std::move(subPath); + this->directives = std::move(directives); } AssetPath::AssetPath(String const& basePath, Maybe const& subPath, DirectivesGroup const& directives) { @@ -176,7 +176,7 @@ DataStream& operator>>(DataStream& ds, AssetPath& path) { String string; ds.read(string); - path = move(string); + path = std::move(string); return ds; } diff --git a/source/core/StarAtomicSharedPtr.hpp b/source/core/StarAtomicSharedPtr.hpp index e85ffd5..306192f 100644 --- a/source/core/StarAtomicSharedPtr.hpp +++ b/source/core/StarAtomicSharedPtr.hpp @@ -47,11 +47,11 @@ AtomicSharedPtr::AtomicSharedPtr(AtomicSharedPtr const& p) template AtomicSharedPtr::AtomicSharedPtr(AtomicSharedPtr&& p) - : m_ptr(move(p.m_ptr)) {} + : m_ptr(std::move(p.m_ptr)) {} template AtomicSharedPtr::AtomicSharedPtr(SharedPtr p) - : m_ptr(move(p)) {} + : m_ptr(std::move(p)) {} template auto AtomicSharedPtr::load() const -> SharedPtr { @@ -68,7 +68,7 @@ auto AtomicSharedPtr::weak() const -> WeakPtr { template void AtomicSharedPtr::store(SharedPtr p) { SpinLocker locker(m_lock); - m_ptr = move(p); + m_ptr = std::move(p); } template @@ -105,14 +105,14 @@ AtomicSharedPtr& AtomicSharedPtr::operator=(AtomicSharedPtr const& p) { template AtomicSharedPtr& AtomicSharedPtr::operator=(AtomicSharedPtr&& p) { SpinLocker locker(m_lock); - m_ptr = move(p.m_ptr); + m_ptr = std::move(p.m_ptr); return *this; } template AtomicSharedPtr& AtomicSharedPtr::operator=(SharedPtr p) { SpinLocker locker(m_lock); - m_ptr = move(p); + m_ptr = std::move(p); return *this; } diff --git a/source/core/StarAudio.cpp b/source/core/StarAudio.cpp index 1718aa8..4f07d05 100644 --- a/source/core/StarAudio.cpp +++ b/source/core/StarAudio.cpp @@ -129,7 +129,7 @@ namespace { for (size_t i = 0; i < pcmData->size() / 2; ++i) fromByteOrder(ByteOrder::LittleEndian, pcmData->ptr() + i * 2, 2); - return WaveData{move(pcmData), wavChannels, wavSampleRate}; + return WaveData{std::move(pcmData), wavChannels, wavSampleRate}; } } @@ -276,7 +276,7 @@ public: UncompressedAudioImpl(ByteArrayConstPtr data, unsigned channels, unsigned sampleRate) { m_channels = channels; m_sampleRate = sampleRate; - m_audioData = move(data); + m_audioData = std::move(data); m_memoryFile.reset(m_audioData->ptr(), m_audioData->size()); } @@ -335,7 +335,7 @@ Audio::Audio(IODevicePtr device) { if (isUncompressed(device)) { WaveData data = parseWav(device); - m_uncompressed = make_shared(move(data.byteArray), data.channels, data.sampleRate); + m_uncompressed = make_shared(std::move(data.byteArray), data.channels, data.sampleRate); } else { m_compressed = make_shared(device); if (!m_compressed->open()) @@ -348,7 +348,7 @@ Audio::Audio(Audio const& audio) { } Audio::Audio(Audio&& audio) { - operator=(move(audio)); + operator=(std::move(audio)); } Audio& Audio::operator=(Audio const& audio) { @@ -365,8 +365,8 @@ Audio& Audio::operator=(Audio const& audio) { } Audio& Audio::operator=(Audio&& audio) { - m_compressed = move(audio.m_compressed); - m_uncompressed = move(audio.m_uncompressed); + m_compressed = std::move(audio.m_compressed); + m_uncompressed = std::move(audio.m_uncompressed); return *this; } diff --git a/source/core/StarBTree.hpp b/source/core/StarBTree.hpp index abd8d78..1ff53bd 100644 --- a/source/core/StarBTree.hpp +++ b/source/core/StarBTree.hpp @@ -284,18 +284,18 @@ template template void BTreeMixin::forEach(Key const& lower, Key const& upper, Visitor&& visitor) { if (Base::rootIsLeaf()) - forEach(Base::loadLeaf(Base::rootPointer()), lower, upper, forward(visitor)); + forEach(Base::loadLeaf(Base::rootPointer()), lower, upper, std::forward(visitor)); else - forEach(Base::loadIndex(Base::rootPointer()), lower, upper, forward(visitor)); + forEach(Base::loadIndex(Base::rootPointer()), lower, upper, std::forward(visitor)); } template template void BTreeMixin::forAll(Visitor&& visitor) { if (Base::rootIsLeaf()) - forAll(Base::loadLeaf(Base::rootPointer()), forward(visitor)); + forAll(Base::loadLeaf(Base::rootPointer()), std::forward(visitor)); else - forAll(Base::loadIndex(Base::rootPointer()), forward(visitor)); + forAll(Base::loadIndex(Base::rootPointer()), std::forward(visitor)); } template @@ -303,9 +303,9 @@ template void BTreeMixin::recoverAll(Visitor&& visitor, ErrorHandler&& error) { try { if (Base::rootIsLeaf()) - recoverAll(Base::loadLeaf(Base::rootPointer()), forward(visitor), forward(error)); + recoverAll(Base::loadLeaf(Base::rootPointer()), std::forward(visitor), std::forward(error)); else - recoverAll(Base::loadIndex(Base::rootPointer()), forward(visitor), forward(error)); + recoverAll(Base::loadIndex(Base::rootPointer()), std::forward(visitor), std::forward(error)); } catch (std::exception const& e) { error("Error loading root index or leaf node", e); } @@ -317,17 +317,17 @@ void BTreeMixin::forAllNodes(Visitor&& visitor) { if (Base::rootIsLeaf()) visitor(Base::loadLeaf(Base::rootPointer())); else - forAllNodes(Base::loadIndex(Base::rootPointer()), forward(visitor)); + forAllNodes(Base::loadIndex(Base::rootPointer()), std::forward(visitor)); } template bool BTreeMixin::insert(Key k, Data data) { - return modify(DataElement{move(k), move(data)}, InsertAction); + return modify(DataElement{std::move(k), std::move(data)}, InsertAction); } template bool BTreeMixin::remove(Key k) { - return modify(DataElement{move(k), Data()}, RemoveAction); + return modify(DataElement{std::move(k), Data()}, RemoveAction); } template @@ -422,7 +422,7 @@ bool BTreeMixin::LeafCounter::operator()(Leaf const&) { template BTreeMixin::ModifyInfo::ModifyInfo(ModifyAction a, DataElement e) - : targetElement(move(e)), action(a) { + : targetElement(std::move(e)), action(a) { found = false; state = Done; } @@ -466,9 +466,9 @@ auto BTreeMixin::forEach(Index const& index, Key const& lower, Key const& Key lastKey; if (Base::indexLevel(index) == 0) - lastKey = forEach(Base::loadLeaf(Base::indexPointer(index, i)), lower, upper, forward(o)); + lastKey = forEach(Base::loadLeaf(Base::indexPointer(index, i)), lower, upper, std::forward(o)); else - lastKey = forEach(Base::loadIndex(Base::indexPointer(index, i)), lower, upper, forward(o)); + lastKey = forEach(Base::loadIndex(Base::indexPointer(index, i)), lower, upper, std::forward(o)); if (!(lastKey < upper)) return lastKey; @@ -483,9 +483,9 @@ auto BTreeMixin::forEach(Index const& index, Key const& lower, Key const& continue; if (Base::indexLevel(index) == 0) - lastKey = forEach(Base::loadLeaf(Base::indexPointer(index, i)), lower, upper, forward(o)); + lastKey = forEach(Base::loadLeaf(Base::indexPointer(index, i)), lower, upper, std::forward(o)); else - lastKey = forEach(Base::loadIndex(Base::indexPointer(index, i)), lower, upper, forward(o)); + lastKey = forEach(Base::loadIndex(Base::indexPointer(index, i)), lower, upper, std::forward(o)); if (!(lastKey < upper)) break; @@ -530,9 +530,9 @@ auto BTreeMixin::forAll(Index const& index, Visitor&& o) -> Key { continue; if (Base::indexLevel(index) == 0) - lastKey = forAll(Base::loadLeaf(Base::indexPointer(index, i)), forward(o)); + lastKey = forAll(Base::loadLeaf(Base::indexPointer(index, i)), std::forward(o)); else - lastKey = forAll(Base::loadIndex(Base::indexPointer(index, i)), forward(o)); + lastKey = forAll(Base::loadIndex(Base::indexPointer(index, i)), std::forward(o)); } return lastKey; @@ -550,7 +550,7 @@ auto BTreeMixin::forAll(Leaf const& leaf, Visitor&& o) -> Key { } if (auto nextLeafPointer = Base::nextLeaf(leaf)) - return forAll(Base::loadLeaf(*nextLeafPointer), forward(o)); + return forAll(Base::loadLeaf(*nextLeafPointer), std::forward(o)); else return Base::leafKey(leaf, Base::leafElementCount(leaf) - 1); } @@ -562,13 +562,13 @@ void BTreeMixin::recoverAll(Index const& index, Visitor&& visitor, ErrorHa for (size_t i = 0; i < Base::indexPointerCount(index); ++i) { if (Base::indexLevel(index) == 0) { try { - recoverAll(Base::loadLeaf(Base::indexPointer(index, i)), forward(visitor), forward(error)); + recoverAll(Base::loadLeaf(Base::indexPointer(index, i)), std::forward(visitor), std::forward(error)); } catch (std::exception const& e) { error("Error loading leaf node", e); } } else { try { - recoverAll(Base::loadIndex(Base::indexPointer(index, i)), forward(visitor), forward(error)); + recoverAll(Base::loadIndex(Base::indexPointer(index, i)), std::forward(visitor), std::forward(error)); } catch (std::exception const& e) { error("Error loading index node", e); } @@ -608,7 +608,7 @@ void BTreeMixin::modify(Leaf& leafNode, ModifyInfo& info) { return; if (info.action == InsertAction) - Base::leafInsert(leafNode, i, info.targetElement.key, move(info.targetElement.data)); + Base::leafInsert(leafNode, i, info.targetElement.key, std::move(info.targetElement.data)); auto splitResult = Base::leafSplit(leafNode); if (splitResult) { @@ -677,26 +677,26 @@ void BTreeMixin::modify(Index& indexNode, ModifyInfo& info) { } else if (Base::leafElementCount(rightLeaf) == 0) { // Leaves merged. Base::setNextLeaf(leftLeaf, Base::nextLeaf(rightLeaf)); - Base::deleteLeaf(move(rightLeaf)); + Base::deleteLeaf(std::move(rightLeaf)); // Replace two sibling pointer elements with one pointing to merged // leaf. if (left != 0) Base::indexUpdateKeyBefore(indexNode, left, Base::leafKey(leftLeaf, 0)); - Base::indexUpdatePointer(indexNode, left, Base::storeLeaf(move(leftLeaf))); + Base::indexUpdatePointer(indexNode, left, Base::storeLeaf(std::move(leftLeaf))); Base::indexRemoveBefore(indexNode, right); selfUpdated = true; } else { // Leaves shifted. - Base::indexUpdatePointer(indexNode, left, Base::storeLeaf(move(leftLeaf))); + Base::indexUpdatePointer(indexNode, left, Base::storeLeaf(std::move(leftLeaf))); // Right leaf first key changes on shift, so always need to update // left index node. Base::indexUpdateKeyBefore(indexNode, right, Base::leafKey(rightLeaf, 0)); - Base::indexUpdatePointer(indexNode, right, Base::storeLeaf(move(rightLeaf))); + Base::indexUpdatePointer(indexNode, right, Base::storeLeaf(std::move(rightLeaf))); selfUpdated = true; } @@ -725,25 +725,25 @@ void BTreeMixin::modify(Index& indexNode, ModifyInfo& info) { } else if (Base::indexPointerCount(rightIndex) == 0) { // Indexes merged. - Base::deleteIndex(move(rightIndex)); + Base::deleteIndex(std::move(rightIndex)); // Replace two sibling pointer elements with one pointing to merged // index. if (left != 0) Base::indexUpdateKeyBefore(indexNode, left, getLeftKey(leftIndex)); - Base::indexUpdatePointer(indexNode, left, Base::storeIndex(move(leftIndex))); + Base::indexUpdatePointer(indexNode, left, Base::storeIndex(std::move(leftIndex))); Base::indexRemoveBefore(indexNode, right); selfUpdated = true; } else { // Indexes shifted. - Base::indexUpdatePointer(indexNode, left, Base::storeIndex(move(leftIndex))); + Base::indexUpdatePointer(indexNode, left, Base::storeIndex(std::move(leftIndex))); // Right index first key changes on shift, so always need to update // right index node. Key keyForRight = getLeftKey(rightIndex); - Base::indexUpdatePointer(indexNode, right, Base::storeIndex(move(rightIndex))); + Base::indexUpdatePointer(indexNode, right, Base::storeIndex(std::move(rightIndex))); Base::indexUpdateKeyBefore(indexNode, right, keyForRight); selfUpdated = true; @@ -752,19 +752,19 @@ void BTreeMixin::modify(Index& indexNode, ModifyInfo& info) { } if (info.state == LeafSplit) { - Base::indexUpdatePointer(indexNode, i, Base::storeLeaf(move(lowerLeaf))); + Base::indexUpdatePointer(indexNode, i, Base::storeLeaf(std::move(lowerLeaf))); Base::indexInsertAfter(indexNode, i, info.newKey, info.newPointer); selfUpdated = true; } if (info.state == IndexSplit) { - Base::indexUpdatePointer(indexNode, i, Base::storeIndex(move(lowerIndex))); + Base::indexUpdatePointer(indexNode, i, Base::storeIndex(std::move(lowerIndex))); Base::indexInsertAfter(indexNode, i, info.newKey, info.newPointer); selfUpdated = true; } if (info.state == LeafNeedsUpdate) { - Pointer lowerLeafPointer = Base::storeLeaf(move(lowerLeaf)); + Pointer lowerLeafPointer = Base::storeLeaf(std::move(lowerLeaf)); if (lowerLeafPointer != Base::indexPointer(indexNode, i)) { Base::indexUpdatePointer(indexNode, i, lowerLeafPointer); selfUpdated = true; @@ -772,7 +772,7 @@ void BTreeMixin::modify(Index& indexNode, ModifyInfo& info) { } if (info.state == IndexNeedsUpdate) { - Pointer lowerIndexPointer = Base::storeIndex(move(lowerIndex)); + Pointer lowerIndexPointer = Base::storeIndex(std::move(lowerIndex)); if (lowerIndexPointer != Base::indexPointer(indexNode, i)) { Base::indexUpdatePointer(indexNode, i, lowerIndexPointer); selfUpdated = true; @@ -796,7 +796,7 @@ void BTreeMixin::modify(Index& indexNode, ModifyInfo& info) { template bool BTreeMixin::modify(DataElement e, ModifyAction action) { - ModifyInfo info(action, move(e)); + ModifyInfo info(action, std::move(e)); Leaf lowerLeaf; Index lowerIndex; @@ -816,7 +816,7 @@ bool BTreeMixin::modify(DataElement e, ModifyAction action) { // removes until setNewRoot) Pointer pointer = Base::indexPointer(lowerIndex, 0); size_t level = Base::indexLevel(lowerIndex); - Base::deleteIndex(move(lowerIndex)); + Base::deleteIndex(std::move(lowerIndex)); Base::setNewRoot(pointer, level == 0); } else { // Else just update. @@ -833,24 +833,24 @@ bool BTreeMixin::modify(DataElement e, ModifyAction action) { Index newRoot; if (info.state == IndexSplit) { auto rootIndexLevel = Base::indexLevel(lowerIndex) + 1; - newRoot = Base::createIndex(Base::storeIndex(move(lowerIndex))); + newRoot = Base::createIndex(Base::storeIndex(std::move(lowerIndex))); Base::setIndexLevel(newRoot, rootIndexLevel); } else { - newRoot = Base::createIndex(Base::storeLeaf(move(lowerLeaf))); + newRoot = Base::createIndex(Base::storeLeaf(std::move(lowerLeaf))); Base::setIndexLevel(newRoot, 0); } Base::indexInsertAfter(newRoot, 0, info.newKey, info.newPointer); - Base::setNewRoot(Base::storeIndex(move(newRoot)), false); + Base::setNewRoot(Base::storeIndex(std::move(newRoot)), false); } if (info.state == IndexNeedsUpdate) { - Pointer newRootPointer = Base::storeIndex(move(lowerIndex)); + Pointer newRootPointer = Base::storeIndex(std::move(lowerIndex)); if (newRootPointer != Base::rootPointer()) Base::setNewRoot(newRootPointer, false); } if (info.state == LeafNeedsUpdate) { - Pointer newRootPointer = Base::storeLeaf(move(lowerLeaf)); + Pointer newRootPointer = Base::storeLeaf(std::move(lowerLeaf)); if (newRootPointer != Base::rootPointer()) Base::setNewRoot(newRootPointer, true); } @@ -876,7 +876,7 @@ void BTreeMixin::forAllNodes(Index const& index, Visitor&& visitor) { for (size_t i = 0; i < Base::indexPointerCount(index); ++i) { if (Base::indexLevel(index) != 0) { - forAllNodes(Base::loadIndex(Base::indexPointer(index, i)), forward(visitor)); + forAllNodes(Base::loadIndex(Base::indexPointer(index, i)), std::forward(visitor)); } else { if (!visitor(Base::loadLeaf(Base::indexPointer(index, i)))) return; diff --git a/source/core/StarBTreeDatabase.cpp b/source/core/StarBTreeDatabase.cpp index 4ac321f..b188f20 100644 --- a/source/core/StarBTreeDatabase.cpp +++ b/source/core/StarBTreeDatabase.cpp @@ -58,7 +58,7 @@ String BTreeDatabase::contentIdentifier() const { void BTreeDatabase::setContentIdentifier(String contentIdentifier) { WriteLocker writeLocker(m_lock); checkIfOpen("setContentIdentifier", false); - m_contentIdentifier = move(contentIdentifier); + m_contentIdentifier = std::move(contentIdentifier); } uint32_t BTreeDatabase::indexCacheSize() const { @@ -91,7 +91,7 @@ IODevicePtr BTreeDatabase::ioDevice() const { void BTreeDatabase::setIODevice(IODevicePtr device) { WriteLocker writeLocker(m_lock); checkIfOpen("setIODevice", false); - m_device = move(device); + m_device = std::move(device); } bool BTreeDatabase::isOpen() const { @@ -188,12 +188,12 @@ void BTreeDatabase::forEach(ByteArray const& lower, ByteArray const& upper, func ReadLocker readLocker(m_lock); checkKeySize(lower); checkKeySize(upper); - m_impl.forEach(lower, upper, move(v)); + m_impl.forEach(lower, upper, std::move(v)); } void BTreeDatabase::forAll(function v) { ReadLocker readLocker(m_lock); - m_impl.forAll(move(v)); + m_impl.forAll(std::move(v)); } bool BTreeDatabase::insert(ByteArray const& k, ByteArray const& data) { @@ -445,7 +445,7 @@ ByteArray const& BTreeDatabase::LeafNode::data(size_t i) const { } void BTreeDatabase::LeafNode::insert(size_t i, ByteArray k, ByteArray d) { - elements.insertAt(i, Element{move(k), move(d)}); + elements.insertAt(i, Element{std::move(k), std::move(d)}); } void BTreeDatabase::LeafNode::remove(size_t i) { @@ -855,7 +855,7 @@ auto BTreeDatabase::BTreeImpl::leafData(Leaf const& leaf, size_t i) -> Data { } void BTreeDatabase::BTreeImpl::leafInsert(Leaf& leaf, size_t i, Key k, Data d) { - leaf->insert(i, move(k), move(d)); + leaf->insert(i, std::move(k), std::move(d)); } void BTreeDatabase::BTreeImpl::leafRemove(Leaf& leaf, size_t i) { diff --git a/source/core/StarBlockAllocator.hpp b/source/core/StarBlockAllocator.hpp index 5051e66..23e0201 100644 --- a/source/core/StarBlockAllocator.hpp +++ b/source/core/StarBlockAllocator.hpp @@ -142,7 +142,7 @@ T* BlockAllocator::allocate(size_t n) { auto sortedPosition = std::lower_bound(m_data->blocks.begin(), m_data->blocks.end(), block.get(), [](std::unique_ptr const& a, Block* b) { return a.get() < b; }); - m_data->blocks.insert(sortedPosition, move(block)); + m_data->blocks.insert(sortedPosition, std::move(block)); } } @@ -183,7 +183,7 @@ void BlockAllocator::deallocate(T* p, size_t n) { template template void BlockAllocator::construct(pointer p, Args&&... args) const { - new (p) T(forward(args)...); + new (p) T(std::forward(args)...); } template diff --git a/source/core/StarBuffer.cpp b/source/core/StarBuffer.cpp index 3212e0a..0d998af 100644 --- a/source/core/StarBuffer.cpp +++ b/source/core/StarBuffer.cpp @@ -17,7 +17,7 @@ Buffer::Buffer(size_t initialSize) Buffer::Buffer(ByteArray b) : Buffer() { - reset(move(b)); + reset(std::move(b)); } Buffer::Buffer(Buffer const& buffer) @@ -27,7 +27,7 @@ Buffer::Buffer(Buffer const& buffer) Buffer::Buffer(Buffer&& buffer) : Buffer() { - operator=(move(buffer)); + operator=(std::move(buffer)); } StreamOffset Buffer::pos() { @@ -106,7 +106,7 @@ ByteArray const& Buffer::data() const { } ByteArray Buffer::takeData() { - ByteArray ret = move(m_bytes); + ByteArray ret = std::move(m_bytes); reset(0); return ret; } @@ -143,7 +143,7 @@ void Buffer::reset(size_t newSize) { void Buffer::reset(ByteArray b) { m_pos = 0; - m_bytes = move(b); + m_bytes = std::move(b); } Buffer& Buffer::operator=(Buffer const& buffer) { @@ -156,7 +156,7 @@ Buffer& Buffer::operator=(Buffer const& buffer) { Buffer& Buffer::operator=(Buffer&& buffer) { IODevice::operator=(buffer); m_pos = buffer.m_pos; - m_bytes = move(buffer.m_bytes); + m_bytes = std::move(buffer.m_bytes); buffer.m_pos = 0; buffer.m_bytes = ByteArray(); diff --git a/source/core/StarByteArray.cpp b/source/core/StarByteArray.cpp index 6414c46..c764bce 100644 --- a/source/core/StarByteArray.cpp +++ b/source/core/StarByteArray.cpp @@ -43,7 +43,7 @@ ByteArray::ByteArray(ByteArray const& b) ByteArray::ByteArray(ByteArray&& b) noexcept : ByteArray() { - operator=(move(b)); + operator=(std::move(b)); } ByteArray::~ByteArray() { diff --git a/source/core/StarColor.cpp b/source/core/StarColor.cpp index 0c10b9d..2137a36 100644 --- a/source/core/StarColor.cpp +++ b/source/core/StarColor.cpp @@ -625,7 +625,7 @@ Vec4B Color::hexToVec4B(StringView s) { throw ColorException(strf("Improper size {} for hex string '{}' in Color::hexToVec4B", s.utf8Size(), s), false); } - return Vec4B(move(cbytes)); + return Vec4B(std::move(cbytes)); } } diff --git a/source/core/StarCompression.cpp b/source/core/StarCompression.cpp index 2aaf17f..2aa59b2 100644 --- a/source/core/StarCompression.cpp +++ b/source/core/StarCompression.cpp @@ -108,7 +108,7 @@ CompressedFile::CompressedFile() CompressedFile::CompressedFile(String filename) : IODevice(IOMode::Closed), m_file(0), m_compression(MediumCompression) { - setFilename(move(filename)); + setFilename(std::move(filename)); } CompressedFile::~CompressedFile() { @@ -172,7 +172,7 @@ size_t CompressedFile::write(const char* data, size_t len) { void CompressedFile::setFilename(String filename) { if (isOpen()) throw IOException("Cannot call setFilename while CompressedFile is open"); - m_filename = move(filename); + m_filename = std::move(filename); } void CompressedFile::setCompression(CompressionLevel compression) { diff --git a/source/core/StarDataStream.cpp b/source/core/StarDataStream.cpp index 834f4de..18456b6 100644 --- a/source/core/StarDataStream.cpp +++ b/source/core/StarDataStream.cpp @@ -294,7 +294,7 @@ DataStream& DataStream::operator>>(ByteArray& d) { DataStream& DataStream::operator>>(String& s) { std::string string; operator>>(string); - s = move(string); + s = std::move(string); return *this; } diff --git a/source/core/StarDataStream.hpp b/source/core/StarDataStream.hpp index 2508a00..c8cd805 100644 --- a/source/core/StarDataStream.hpp +++ b/source/core/StarDataStream.hpp @@ -358,7 +358,7 @@ void DataStream::readMapContainer(Container& map, ReadFunction function) { typename Container::key_type key; typename Container::mapped_type mapped; function(*this, key, mapped); - map.insert(make_pair(move(key), move(mapped))); + map.insert(make_pair(std::move(key), std::move(mapped))); } } diff --git a/source/core/StarDataStreamDevices.cpp b/source/core/StarDataStreamDevices.cpp index 85e6d3f..58ec920 100644 --- a/source/core/StarDataStreamDevices.cpp +++ b/source/core/StarDataStreamDevices.cpp @@ -3,7 +3,7 @@ namespace Star { DataStreamFunctions::DataStreamFunctions(function reader, function writer) - : m_reader(move(reader)), m_writer(move(writer)) {} + : m_reader(std::move(reader)), m_writer(std::move(writer)) {} void DataStreamFunctions::readData(char* data, size_t len) { if (!m_reader) @@ -18,7 +18,7 @@ void DataStreamFunctions::writeData(char const* data, size_t len) { } DataStreamIODevice::DataStreamIODevice(IODevicePtr device) - : m_device(move(device)) {} + : m_device(std::move(device)) {} IODevicePtr const& DataStreamIODevice::device() const { return m_device; @@ -119,7 +119,7 @@ void DataStreamBuffer::reset(size_t newSize) { } void DataStreamBuffer::reset(ByteArray b) { - m_buffer->reset(move(b)); + m_buffer->reset(std::move(b)); } void DataStreamBuffer::readData(char* data, size_t len) { diff --git a/source/core/StarDataStreamDevices.hpp b/source/core/StarDataStreamDevices.hpp index 4a12d24..cec315e 100644 --- a/source/core/StarDataStreamDevices.hpp +++ b/source/core/StarDataStreamDevices.hpp @@ -184,66 +184,66 @@ ByteArray DataStreamBuffer::serializeMapContainer(T const& t, WriteFunction writ template void DataStreamBuffer::deserialize(T& t, ByteArray data) { - DataStreamBuffer ds(move(data)); + DataStreamBuffer ds(std::move(data)); ds.read(t); } template void DataStreamBuffer::deserializeContainer(T& t, ByteArray data) { - DataStreamBuffer ds(move(data)); + DataStreamBuffer ds(std::move(data)); ds.readContainer(t); } template void DataStreamBuffer::deserializeContainer(T& t, ByteArray data, ReadFunction readFunction) { - DataStreamBuffer ds(move(data)); + DataStreamBuffer ds(std::move(data)); ds.readContainer(t, readFunction); } template void DataStreamBuffer::deserializeMapContainer(T& t, ByteArray data) { - DataStreamBuffer ds(move(data)); + DataStreamBuffer ds(std::move(data)); ds.readMapContainer(t); } template void DataStreamBuffer::deserializeMapContainer(T& t, ByteArray data, ReadFunction readFunction) { - DataStreamBuffer ds(move(data)); + DataStreamBuffer ds(std::move(data)); ds.readMapContainer(t, readFunction); } template T DataStreamBuffer::deserialize(ByteArray data) { T t; - deserialize(t, move(data)); + deserialize(t, std::move(data)); return t; } template T DataStreamBuffer::deserializeContainer(ByteArray data) { T t; - deserializeContainer(t, move(data)); + deserializeContainer(t, std::move(data)); return t; } template T DataStreamBuffer::deserializeContainer(ByteArray data, ReadFunction readFunction) { T t; - deserializeContainer(t, move(data), readFunction); + deserializeContainer(t, std::move(data), readFunction); return t; } template T DataStreamBuffer::deserializeMapContainer(ByteArray data) { T t; - deserializeMapContainer(t, move(data)); + deserializeMapContainer(t, std::move(data)); return t; } template T DataStreamBuffer::deserializeMapContainer(ByteArray data, ReadFunction readFunction) { T t; - deserializeMapContainer(t, move(data), readFunction); + deserializeMapContainer(t, std::move(data), readFunction); return t; } diff --git a/source/core/StarDataStreamExtra.hpp b/source/core/StarDataStreamExtra.hpp index c0965a9..3c8565a 100644 --- a/source/core/StarDataStreamExtra.hpp +++ b/source/core/StarDataStreamExtra.hpp @@ -293,7 +293,7 @@ void readMaybe(DataStream& ds, Maybe& maybe, ReadFunction&& readFunction) { if (set) { T t; readFunction(ds, t); - maybe = move(t); + maybe = std::move(t); } else { maybe.reset(); } diff --git a/source/core/StarDirectives.cpp b/source/core/StarDirectives.cpp index 6c335a5..5d5266f 100644 --- a/source/core/StarDirectives.cpp +++ b/source/core/StarDirectives.cpp @@ -7,7 +7,7 @@ namespace Star { Directives::Entry::Entry(ImageOperation&& newOperation, size_t strBegin, size_t strLength) { - operation = move(newOperation); + operation = std::move(newOperation); begin = strBegin; length = strLength; } @@ -43,8 +43,8 @@ bool Directives::Shared::empty() const { } Directives::Shared::Shared(List&& givenEntries, String&& givenString, StringView givenPrefix) { - entries = move(givenEntries); - string = move(givenString); + entries = std::move(givenEntries); + string = std::move(givenString); prefix = givenPrefix; hash = XXH3_64bits(string.utf8Ptr(), string.utf8Size()); } @@ -56,7 +56,7 @@ Directives::Directives(String const& directives) { } Directives::Directives(String&& directives) { - parse(move(directives)); + parse(std::move(directives)); } Directives::Directives(const char* directives) { @@ -64,7 +64,7 @@ Directives::Directives(const char* directives) { } Directives::Directives(Directives&& directives) { - *this = move(directives); + *this = std::move(directives); } Directives::Directives(Directives const& directives) { @@ -87,7 +87,7 @@ Directives& Directives::operator=(String&& s) { return *this; } - parse(move(s)); + parse(std::move(s)); return *this; } @@ -100,7 +100,7 @@ Directives& Directives::operator=(const char* s) { } Directives& Directives::operator=(Directives&& other) { - shared = move(other.shared); + shared = std::move(other.shared); return *this; } @@ -132,7 +132,7 @@ void Directives::parse(String&& directives) { if (beg == 0) { try { ImageOperation operation = imageOperationFromString(split); - newList.emplace_back(move(operation), beg, end); + newList.emplace_back(std::move(operation), beg, end); } catch (StarException const& e) { prefix = split; @@ -141,7 +141,7 @@ void Directives::parse(String&& directives) { } else { ImageOperation operation = NullImageOperation(); - newList.emplace_back(move(operation), beg, end); + newList.emplace_back(std::move(operation), beg, end); } } }); @@ -151,7 +151,7 @@ void Directives::parse(String&& directives) { return; } - shared = std::make_shared(move(newList), move(directives), prefix); + shared = std::make_shared(std::move(newList), std::move(directives), prefix); if (view.size() < 1000) { // Pre-load short enough directives for (auto& entry : shared->entries) entry.loadOperation(*shared); @@ -219,7 +219,7 @@ DataStream& operator>>(DataStream& ds, Directives& directives) { String string; ds.read(string); - directives.parse(move(string)); + directives.parse(std::move(string)); return ds; } @@ -240,7 +240,7 @@ DirectivesGroup::DirectivesGroup(String const& directives) : m_count(0) { Directives parsed(directives); if (parsed) { - m_directives.emplace_back(move(parsed)); + m_directives.emplace_back(std::move(parsed)); m_count = m_directives.back().size(); } } @@ -250,9 +250,9 @@ DirectivesGroup::DirectivesGroup(String&& directives) : m_count(0) { return; } - Directives parsed(move(directives)); + Directives parsed(std::move(directives)); if (parsed) { - m_directives.emplace_back(move(parsed)); + m_directives.emplace_back(std::move(parsed)); m_count = m_directives.back().size(); } } @@ -372,7 +372,7 @@ DataStream& operator>>(DataStream& ds, DirectivesGroup& directivesGroup) { String string; ds.read(string); - directivesGroup = DirectivesGroup(move(string)); + directivesGroup = DirectivesGroup(std::move(string)); return ds; } diff --git a/source/core/StarEither.hpp b/source/core/StarEither.hpp index 287e4bc..bed6fd7 100644 --- a/source/core/StarEither.hpp +++ b/source/core/StarEither.hpp @@ -85,12 +85,12 @@ private: template EitherLeftValue makeLeft(Value value) { - return {move(value)}; + return {std::move(value)}; } template EitherRightValue makeRight(Value value) { - return {move(value)}; + return {std::move(value)}; } template @@ -98,21 +98,21 @@ Either::Either() {} template Either::Either(EitherLeftValue left) - : m_value(move(left)) {} + : m_value(std::move(left)) {} template Either::Either(EitherRightValue right) - : m_value(move(right)) {} + : m_value(std::move(right)) {} template template Either::Either(EitherLeftValue left) - : Either(LeftType{move(left.value)}) {} + : Either(LeftType{std::move(left.value)}) {} template template Either::Either(EitherRightValue right) - : Either(RightType{move(right.value)}) {} + : Either(RightType{std::move(right.value)}) {} template Either::Either(Either const& rhs) @@ -120,7 +120,7 @@ Either::Either(Either const& rhs) template Either::Either(Either&& rhs) - : m_value(move(rhs.m_value)) {} + : m_value(std::move(rhs.m_value)) {} template Either& Either::operator=(Either const& rhs) { @@ -130,21 +130,21 @@ Either& Either::operator=(Either const& rhs) { template Either& Either::operator=(Either&& rhs) { - m_value = move(rhs.m_value); + m_value = std::move(rhs.m_value); return *this; } template template Either& Either::operator=(EitherLeftValue left) { - m_value = LeftType{move(left.value)}; + m_value = LeftType{std::move(left.value)}; return *this; } template template Either& Either::operator=(EitherRightValue right) { - m_value = RightType{move(right.value)}; + m_value = RightType{std::move(right.value)}; return *this; } @@ -160,12 +160,12 @@ bool Either::isRight() const { template void Either::setLeft(Left left) { - m_value = LeftType{move(left)}; + m_value = LeftType{std::move(left)}; } template void Either::setRight(Right right) { - m_value = RightType{move(right)}; + m_value = RightType{std::move(right)}; } template diff --git a/source/core/StarException.hpp b/source/core/StarException.hpp index 87f0571..2805c9d 100644 --- a/source/core/StarException.hpp +++ b/source/core/StarException.hpp @@ -79,18 +79,18 @@ void fatalException(std::exception const& e, bool showStackTrace); class ClassName : public BaseName { \ public: \ template \ - static ClassName format(fmt::format_string fmt, Args const&... args) { \ + static ClassName format(fmt::format_string fmt, Args const&... args) { \ return ClassName(strf(fmt, args...)); \ } \ ClassName() : BaseName(#ClassName, std::string()) {} \ - explicit ClassName(std::string message, bool genStackTrace = true) : BaseName(#ClassName, move(message), genStackTrace) {} \ + explicit ClassName(std::string message, bool genStackTrace = true) : BaseName(#ClassName, std::move(message), genStackTrace) {} \ explicit ClassName(std::exception const& cause) : BaseName(#ClassName, std::string(), cause) {} \ - ClassName(std::string message, std::exception const& cause) : BaseName(#ClassName, move(message), cause) {} \ + ClassName(std::string message, std::exception const& cause) : BaseName(#ClassName, std::move(message), cause) {} \ \ protected: \ - ClassName(char const* type, std::string message, bool genStackTrace = true) : BaseName(type, move(message), genStackTrace) {} \ + ClassName(char const* type, std::string message, bool genStackTrace = true) : BaseName(type, std::move(message), genStackTrace) {} \ ClassName(char const* type, std::string message, std::exception const& cause) \ - : BaseName(type, move(message), cause) {} \ + : BaseName(type, std::move(message), cause) {} \ } STAR_EXCEPTION(OutOfRangeException, StarException); diff --git a/source/core/StarException_unix.cpp b/source/core/StarException_unix.cpp index 71ffd2b..02b3cbc 100644 --- a/source/core/StarException_unix.cpp +++ b/source/core/StarException_unix.cpp @@ -18,7 +18,7 @@ inline StackCapture captureStack() { } OutputProxy outputStack(StackCapture stack) { - return OutputProxy([stack = move(stack)](std::ostream & os) { + return OutputProxy([stack = std::move(stack)](std::ostream & os) { char** symbols = backtrace_symbols(stack.first.ptr(), stack.second); for (size_t i = 0; i < stack.second; ++i) { os << symbols[i]; @@ -39,13 +39,13 @@ StarException::StarException() noexcept StarException::~StarException() noexcept {} StarException::StarException(std::string message, bool genStackTrace) noexcept - : StarException("StarException", move(message), genStackTrace) {} + : StarException("StarException", std::move(message), genStackTrace) {} StarException::StarException(std::exception const& cause) noexcept : StarException("StarException", std::string(), cause) {} StarException::StarException(std::string message, std::exception const& cause) noexcept - : StarException("StarException", move(message), cause) {} + : StarException("StarException", std::move(message), cause) {} const char* StarException::what() const throw() { if (m_whatBuffer.empty()) { @@ -68,11 +68,11 @@ StarException::StarException(char const* type, std::string message, bool genStac } }; - m_printException = bind(printException, _1, _2, type, move(message), genStackTrace ? captureStack() : Maybe()); + m_printException = bind(printException, _1, _2, type, std::move(message), genStackTrace ? captureStack() : Maybe()); } StarException::StarException(char const* type, std::string message, std::exception const& cause) noexcept - : StarException(type, move(message)) { + : StarException(type, std::move(message)) { auto printException = [](std::ostream& os, bool fullStacktrace, function self, function cause) { self(os, fullStacktrace); os << std::endl << "Caused by: "; @@ -88,7 +88,7 @@ StarException::StarException(char const* type, std::string message, std::excepti }, _1, _2, std::string(cause.what())); } - m_printException = bind(printException, _1, _2, m_printException, move(printCause)); + m_printException = bind(printException, _1, _2, m_printException, std::move(printCause)); } std::string printException(std::exception const& e, bool fullStacktrace) { diff --git a/source/core/StarException_windows.cpp b/source/core/StarException_windows.cpp index b40df12..159cf3d 100644 --- a/source/core/StarException_windows.cpp +++ b/source/core/StarException_windows.cpp @@ -117,7 +117,7 @@ inline StackCapture captureStack() { } OutputProxy outputStack(StackCapture stack) { - return OutputProxy([stack = move(stack)](std::ostream & os) { + return OutputProxy([stack = std::move(stack)](std::ostream & os) { HANDLE process = GetCurrentProcess(); g_dbgHelpLock.lock(); for (size_t i = 0; i < stack.second; ++i) { @@ -146,13 +146,13 @@ StarException::StarException() noexcept : StarException(std::string("StarExcepti StarException::~StarException() noexcept {} -StarException::StarException(std::string message, bool genStackTrace) noexcept : StarException("StarException", move(message), genStackTrace) {} +StarException::StarException(std::string message, bool genStackTrace) noexcept : StarException("StarException", std::move(message), genStackTrace) {} StarException::StarException(std::exception const& cause) noexcept : StarException("StarException", std::string(), cause) {} StarException::StarException(std::string message, std::exception const& cause) noexcept - : StarException("StarException", move(message), cause) {} + : StarException("StarException", std::move(message), cause) {} const char* StarException::what() const throw() { if (m_whatBuffer.empty()) { @@ -176,11 +176,11 @@ StarException::StarException(char const* type, std::string message, bool genStac } }; - m_printException = bind(printException, _1, _2, type, move(message), genStackTrace ? captureStack() : Maybe()); + m_printException = bind(printException, _1, _2, type, std::move(message), genStackTrace ? captureStack() : Maybe()); } StarException::StarException(char const* type, std::string message, std::exception const& cause) noexcept - : StarException(type, move(message)) { + : StarException(type, std::move(message)) { auto printException = [](std::ostream& os, bool fullStacktrace, function self, @@ -199,7 +199,7 @@ StarException::StarException(char const* type, std::string message, std::excepti }, _1, _2, std::string(cause.what())); } - m_printException = bind(printException, _1, _2, m_printException, move(printCause)); + m_printException = bind(printException, _1, _2, m_printException, std::move(printCause)); } std::string printException(std::exception const& e, bool fullStacktrace) { diff --git a/source/core/StarFile.cpp b/source/core/StarFile.cpp index 873a10e..9153960 100644 --- a/source/core/StarFile.cpp +++ b/source/core/StarFile.cpp @@ -124,7 +124,7 @@ File::File() } File::File(String filename) - : IODevice(IOMode::Closed), m_filename(move(filename)), m_file(0) {} + : IODevice(IOMode::Closed), m_filename(std::move(filename)), m_file(0) {} File::~File() { close(); @@ -190,7 +190,7 @@ String File::fileName() const { void File::setFilename(String filename) { if (isOpen()) throw IOException("Cannot call setFilename while File is open"); - m_filename = move(filename); + m_filename = std::move(filename); } void File::remove() { diff --git a/source/core/StarFlatHashMap.hpp b/source/core/StarFlatHashMap.hpp index 6a8c739..111aa6b 100644 --- a/source/core/StarFlatHashMap.hpp +++ b/source/core/StarFlatHashMap.hpp @@ -290,12 +290,12 @@ FlatHashMap::FlatHashMap(FlatHashMap const template FlatHashMap::FlatHashMap(FlatHashMap&& other) - : FlatHashMap(move(other), other.m_table.getAllocator()) {} + : FlatHashMap(std::move(other), other.m_table.getAllocator()) {} template FlatHashMap::FlatHashMap(FlatHashMap&& other, allocator_type const& alloc) : FlatHashMap(alloc) { - operator=(move(other)); + operator=(std::move(other)); } template @@ -326,7 +326,7 @@ auto FlatHashMap::operator=(FlatHashMap co template auto FlatHashMap::operator=(FlatHashMap&& other) -> FlatHashMap& { - m_table = move(other.m_table); + m_table = std::move(other.m_table); return *this; } @@ -391,7 +391,7 @@ auto FlatHashMap::insert(value_type const& template template auto FlatHashMap::insert(T&& value) -> pair { - auto res = m_table.insert(TableValue(forward(value))); + auto res = m_table.insert(TableValue(std::forward(value))); return {iterator{res.first}, res.second}; } @@ -403,7 +403,7 @@ auto FlatHashMap::insert(const_iterator hi template template auto FlatHashMap::insert(const_iterator, T&& value) -> iterator { - return insert(forward(value)).first; + return insert(std::forward(value)).first; } template @@ -422,13 +422,13 @@ void FlatHashMap::insert(initializer_list< template template auto FlatHashMap::emplace(Args&&... args) -> pair { - return insert(TableValue(forward(args)...)); + return insert(TableValue(std::forward(args)...)); } template template auto FlatHashMap::emplace_hint(const_iterator hint, Args&&... args) -> iterator { - return insert(hint, TableValue(forward(args)...)); + return insert(hint, TableValue(std::forward(args)...)); } template @@ -480,7 +480,7 @@ auto FlatHashMap::operator[](key_type&& ke auto i = m_table.find(key); if (i != m_table.end()) return i->second; - return m_table.insert({move(key), mapped_type()}).first->second; + return m_table.insert({std::move(key), mapped_type()}).first->second; } template diff --git a/source/core/StarFlatHashSet.hpp b/source/core/StarFlatHashSet.hpp index 5502a1f..51d01f7 100644 --- a/source/core/StarFlatHashSet.hpp +++ b/source/core/StarFlatHashSet.hpp @@ -277,12 +277,12 @@ FlatHashSet::FlatHashSet(FlatHashSet const& other, template FlatHashSet::FlatHashSet(FlatHashSet&& other) - : FlatHashSet(move(other), other.m_table.getAllocator()) {} + : FlatHashSet(std::move(other), other.m_table.getAllocator()) {} template FlatHashSet::FlatHashSet(FlatHashSet&& other, allocator_type const& alloc) : FlatHashSet(alloc) { - operator=(move(other)); + operator=(std::move(other)); } template @@ -312,7 +312,7 @@ FlatHashSet& FlatHashSet FlatHashSet& FlatHashSet::operator=(FlatHashSet&& other) { - m_table = move(other.m_table); + m_table = std::move(other.m_table); return *this; } @@ -376,7 +376,7 @@ auto FlatHashSet::insert(value_type const& value) template auto FlatHashSet::insert(value_type&& value) -> pair { - auto res = m_table.insert(move(value)); + auto res = m_table.insert(std::move(value)); return {iterator{res.first}, res.second}; } @@ -387,7 +387,7 @@ auto FlatHashSet::insert(const_iterator i, value_t template auto FlatHashSet::insert(const_iterator, value_type&& value) -> iterator { - return insert(move(value)).first; + return insert(std::move(value)).first; } template diff --git a/source/core/StarFlatHashTable.hpp b/source/core/StarFlatHashTable.hpp index a13e08a..e9a8680 100644 --- a/source/core/StarFlatHashTable.hpp +++ b/source/core/StarFlatHashTable.hpp @@ -138,7 +138,7 @@ template ::Bucket::Bucket(Bucket&& rhs) { this->hash = rhs.hash; if (auto o = rhs.valuePtr()) - new (&this->value) Value(move(*o)); + new (&this->value) Value(std::move(*o)); } template @@ -160,9 +160,9 @@ template ::Bucket::operator=(Bucket&& rhs) -> Bucket& { if (auto o = rhs.valuePtr()) { if (auto s = valuePtr()) - *s = move(*o); + *s = std::move(*o); else - new (&this->value) Value(move(*o)); + new (&this->value) Value(std::move(*o)); } else { if (auto s = valuePtr()) s->~Value(); @@ -174,9 +174,9 @@ auto FlatHashTable::Bucket::operato template void FlatHashTable::Bucket::setFilled(size_t hash, Value value) { if (auto s = valuePtr()) - *s = move(value); + *s = std::move(value); else - new (&this->value) Value(move(value)); + new (&this->value) Value(std::move(value)); this->hash = hash | FilledHashBit; } @@ -370,7 +370,7 @@ auto FlatHashTable::insert(Value va currentBucket = hashBucket(currentBucket + 1); } else { - target.setFilled(hash, move(value)); + target.setFilled(hash, std::move(value)); ++m_filledCount; if (insertedBucket == NPos) insertedBucket = currentBucket; @@ -392,7 +392,7 @@ auto FlatHashTable::erase(const_ite if (auto nextPtr = nextBucket->valuePtr()) { if (bucketError(nextBucketIndex, nextBucket->hash) > 0) { currentBucket->hash = nextBucket->hash; - *currentBucket->valuePtr() = move(*nextPtr); + *currentBucket->valuePtr() = std::move(*nextPtr); currentBucketIndex = nextBucketIndex; currentBucket = nextBucket; } else { @@ -548,7 +548,7 @@ void FlatHashTable::checkCapacity(s for (auto& entry : oldBuckets) { if (auto ptr = entry.valuePtr()) - insert(move(*ptr)); + insert(std::move(*ptr)); } } diff --git a/source/core/StarFont.cpp b/source/core/StarFont.cpp index 89503ed..8113cf9 100644 --- a/source/core/StarFont.cpp +++ b/source/core/StarFont.cpp @@ -130,7 +130,7 @@ std::pair Font::render(String::Char c) { } } - return { move(image), {slot->bitmap_left - 1, (slot->bitmap_top - height) + (m_pixelSize / 4) - 1} }; + return { std::move(image), {slot->bitmap_left - 1, (slot->bitmap_top - height) + (m_pixelSize / 4) - 1} }; } } diff --git a/source/core/StarHostAddress.cpp b/source/core/StarHostAddress.cpp index 5459a7e..0457620 100644 --- a/source/core/StarHostAddress.cpp +++ b/source/core/StarHostAddress.cpp @@ -20,7 +20,7 @@ Either HostAddress::lookup(String const& address) { try { HostAddress ha; ha.set(address); - return makeRight(move(ha)); + return makeRight(std::move(ha)); } catch (NetworkException const& e) { return makeLeft(String(e.what())); } @@ -35,7 +35,7 @@ HostAddress::HostAddress(String const& address) { if (a.isLeft()) throw NetworkException(a.left().takeUtf8()); else - *this = move(a.right()); + *this = std::move(a.right()); } NetworkMode HostAddress::mode() const { @@ -211,9 +211,9 @@ size_t hash::operator()(HostAddress const& address) const { Either HostAddressWithPort::lookup(String const& address, uint16_t port) { auto hostAddress = HostAddress::lookup(address); if (hostAddress.isLeft()) - return makeLeft(move(hostAddress.left())); + return makeLeft(std::move(hostAddress.left())); else - return makeRight(HostAddressWithPort(move(hostAddress.right()), port)); + return makeRight(HostAddressWithPort(std::move(hostAddress.right()), port)); } Either HostAddressWithPort::lookupWithPort(String const& address) { @@ -228,9 +228,9 @@ Either HostAddressWithPort::lookupWithPort(String c auto hostAddress = HostAddress::lookup(host); if (hostAddress.isLeft()) - return makeLeft(move(hostAddress.left())); + return makeLeft(std::move(hostAddress.left())); - return makeRight(HostAddressWithPort(move(hostAddress.right()), *portNum)); + return makeRight(HostAddressWithPort(std::move(hostAddress.right()), *portNum)); } HostAddressWithPort::HostAddressWithPort() : m_port(0) {} @@ -247,14 +247,14 @@ HostAddressWithPort::HostAddressWithPort(String const& address, uint16_t port) { auto a = lookup(address, port); if (a.isLeft()) throw NetworkException(a.left().takeUtf8()); - *this = move(a.right()); + *this = std::move(a.right()); } HostAddressWithPort::HostAddressWithPort(String const& address) { auto a = lookupWithPort(address); if (a.isLeft()) throw NetworkException(a.left().takeUtf8()); - *this = move(a.right()); + *this = std::move(a.right()); } HostAddress HostAddressWithPort::address() const { diff --git a/source/core/StarIdMap.hpp b/source/core/StarIdMap.hpp index 1f97c55..964b899 100644 --- a/source/core/StarIdMap.hpp +++ b/source/core/StarIdMap.hpp @@ -101,7 +101,7 @@ auto IdMapWrapper::nextId() -> IdType { template void IdMapWrapper::add(IdType id, MappedType mappedType) { - if (!BaseMap::insert(make_pair(move(id), move(mappedType))).second) + if (!BaseMap::insert(make_pair(std::move(id), std::move(mappedType))).second) throw IdMapException::format("IdMapWrapper::add(id, value) called with pre-existing id '{}'", outputAny(id)); } diff --git a/source/core/StarImage.cpp b/source/core/StarImage.cpp index 183b00a..f41e034 100644 --- a/source/core/StarImage.cpp +++ b/source/core/StarImage.cpp @@ -217,7 +217,7 @@ Image::Image(Image const& image) : Image() { } Image::Image(Image&& image) : Image() { - operator=(move(image)); + operator=(std::move(image)); } Image& Image::operator=(Image const& image) { diff --git a/source/core/StarImageProcessing.cpp b/source/core/StarImageProcessing.cpp index bf4d01a..27519bb 100644 --- a/source/core/StarImageProcessing.cpp +++ b/source/core/StarImageProcessing.cpp @@ -201,7 +201,7 @@ ImageOperation imageOperationFromString(StringView string) { else if (!which || (ptr != end && ++ptr != end)) throw ImageOperationException(strf("Improper size for hex string '{}' in imageOperationFromString", StringView(hexPtr, hexLen)), false); else // we're in A of A=B. In vanilla only A=B pairs are evaluated, so only throw an exception if B is also there. - return move(operation); + return std::move(operation); which = !which; diff --git a/source/core/StarInterpolation.hpp b/source/core/StarInterpolation.hpp index 1797495..426f37d 100644 --- a/source/core/StarInterpolation.hpp +++ b/source/core/StarInterpolation.hpp @@ -369,7 +369,7 @@ Pos inverseLinearInterpolateLower(Iterator begin, Iterator end, Pos t, Comp&& co if (begin == end || std::next(begin) == end) return Pos(); - Iterator i = std::lower_bound(std::next(begin), std::prev(end), t, forward(comp)); + Iterator i = std::lower_bound(std::next(begin), std::prev(end), t, std::forward(comp)); --i; Pos min = posGetter(*i); @@ -396,7 +396,7 @@ Pos inverseLinearInterpolateUpper(Iterator begin, Iterator end, Pos t, Comp&& co if (begin == end || std::next(begin) == end) return Pos(); - Iterator i = std::upper_bound(std::next(begin), std::prev(end), t, forward(comp)); + Iterator i = std::upper_bound(std::next(begin), std::prev(end), t, std::forward(comp)); --i; Pos min = posGetter(*i); diff --git a/source/core/StarIterator.hpp b/source/core/StarIterator.hpp index 7770d84..389740a 100644 --- a/source/core/StarIterator.hpp +++ b/source/core/StarIterator.hpp @@ -137,7 +137,7 @@ public: } void insert(value_type v) { - curr = ++cont.insert(curr, move(v)); + curr = ++cont.insert(curr, std::move(v)); direction = -1; } @@ -178,7 +178,7 @@ public: } void setValue(value_type v) const { - value() = move(v); + value() = std::move(v); } value_ref next() { diff --git a/source/core/StarJson.cpp b/source/core/StarJson.cpp index 2892e1c..3feaf37 100644 --- a/source/core/StarJson.cpp +++ b/source/core/StarJson.cpp @@ -745,7 +745,7 @@ Maybe Json::optQueryObject(String const& path) const { Json Json::set(String key, Json value) const { auto map = toObject(); - map[move(key)] = move(value); + map[std::move(key)] = std::move(value); return map; } @@ -760,31 +760,31 @@ Json Json::erasePath(String path) const { Json Json::setAll(JsonObject values) const { auto map = toObject(); for (auto& p : values) - map[move(p.first)] = move(p.second); + map[std::move(p.first)] = std::move(p.second); return map; } Json Json::eraseKey(String key) const { auto map = toObject(); - map.erase(move(key)); + map.erase(std::move(key)); return map; } Json Json::set(size_t index, Json value) const { auto array = toArray(); - array[index] = move(value); + array[index] = std::move(value); return array; } Json Json::insert(size_t index, Json value) const { auto array = toArray(); - array.insertAt(index, move(value)); + array.insertAt(index, std::move(value)); return array; } Json Json::append(Json value) const { auto array = toArray(); - array.append(move(value)); + array.append(std::move(value)); return array; } @@ -927,7 +927,7 @@ DataStream& operator>>(DataStream& os, Json& v) { for (size_t i = 0; i < s; ++i) l.append(os.read()); - v = move(l); + v = std::move(l); } else if (type == Json::Type::Object) { JsonObject m; size_t s = os.readVlqU(); @@ -936,7 +936,7 @@ DataStream& operator>>(DataStream& os, Json& v) { m[k] = os.read(); } - v = move(m); + v = std::move(m); } return os; diff --git a/source/core/StarJsonBuilder.cpp b/source/core/StarJsonBuilder.cpp index 6355666..14b45a1 100644 --- a/source/core/StarJsonBuilder.cpp +++ b/source/core/StarJsonBuilder.cpp @@ -15,12 +15,12 @@ void JsonBuilderStream::endObject() { JsonObject object; while (true) { if (isSentry()) { - set(Json(move(object))); + set(Json(std::move(object))); return; } else { Json v = pop(); String k = pop().toString(); - if (!object.insert(k, move(v)).second) + if (!object.insert(k, std::move(v)).second) throw JsonParsingException(strf("Json object contains a duplicate entry for key '{}'", k)); } } @@ -35,7 +35,7 @@ void JsonBuilderStream::endArray() { while (true) { if (isSentry()) { array.reverse(); - set(Json(move(array))); + set(Json(std::move(array))); return; } else { array.append(pop()); @@ -81,7 +81,7 @@ Json JsonBuilderStream::takeTop() { } void JsonBuilderStream::push(Json v) { - m_stack.append(move(v)); + m_stack.append(std::move(v)); } Json JsonBuilderStream::pop() { @@ -89,7 +89,7 @@ Json JsonBuilderStream::pop() { } void JsonBuilderStream::set(Json v) { - m_stack.last() = move(v); + m_stack.last() = std::move(v); } void JsonBuilderStream::pushSentry() { diff --git a/source/core/StarJsonExtra.cpp b/source/core/StarJsonExtra.cpp index ec6fe90..dcf2bf6 100644 --- a/source/core/StarJsonExtra.cpp +++ b/source/core/StarJsonExtra.cpp @@ -372,7 +372,7 @@ List jsonToColorList(Json const& v) { List jsonToDirectivesList(Json const& v) { List result; for (auto const& entry : v.iterateArray()) - result.append(move(entry.toString())); + result.append(entry.toString()); return result; } diff --git a/source/core/StarJsonExtra.hpp b/source/core/StarJsonExtra.hpp index 66d89d6..98de98b 100644 --- a/source/core/StarJsonExtra.hpp +++ b/source/core/StarJsonExtra.hpp @@ -262,7 +262,7 @@ MapType jsonToMapK(Json const& v, KeyConverter&& keyConvert) { template MapType jsonToMapV(Json const& v, ValueConverter&& valueConvert) { - return jsonToMapKV(v, construct(), forward(valueConvert)); + return jsonToMapKV(v, construct(), std::forward(valueConvert)); } template @@ -281,12 +281,12 @@ Json jsonFromMapKV(MapType const& map, KeyConverter&& keyConvert, ValueConverter template Json jsonFromMapK(MapType const& map, KeyConverter&& keyConvert) { - return jsonFromMapKV(map, forward(keyConvert), construct()); + return jsonFromMapKV(map, std::forward(keyConvert), construct()); } template Json jsonFromMapV(MapType const& map, ValueConverter&& valueConvert) { - return jsonFromMapKV(map, construct(), forward(valueConvert)); + return jsonFromMapKV(map, construct(), std::forward(valueConvert)); } template diff --git a/source/core/StarJsonParser.hpp b/source/core/StarJsonParser.hpp index fc14d84..522f434 100644 --- a/source/core/StarJsonParser.hpp +++ b/source/core/StarJsonParser.hpp @@ -462,7 +462,7 @@ private: } void error(std::string msg) { - m_error = move(msg); + m_error = std::move(msg); throw ParsingException(); } diff --git a/source/core/StarJsonRpc.cpp b/source/core/StarJsonRpc.cpp index f6def8f..c8b59a5 100644 --- a/source/core/StarJsonRpc.cpp +++ b/source/core/StarJsonRpc.cpp @@ -13,7 +13,7 @@ JsonRpc::JsonRpc() { void JsonRpc::registerHandler(String const& handler, JsonRpcRemoteFunction func) { if (m_handlers.contains(handler)) throw JsonRpcException(strf("Handler by that name already exists '{}'", handler)); - m_handlers.add(handler, move(func)); + m_handlers.add(handler, std::move(func)); } void JsonRpc::registerHandlers(JsonRpcHandlers const& handlers) { diff --git a/source/core/StarLexicalCast.hpp b/source/core/StarLexicalCast.hpp index abda912..9e5a4a2 100644 --- a/source/core/StarLexicalCast.hpp +++ b/source/core/StarLexicalCast.hpp @@ -30,7 +30,7 @@ Maybe maybeLexicalCast(StringView s, std::ios_base::fmtflags flags = std:: if (stream >> ch) return {}; - return move(result); + return std::move(result); } template diff --git a/source/core/StarList.hpp b/source/core/StarList.hpp index 49d2f84..cf7c6a6 100644 --- a/source/core/StarList.hpp +++ b/source/core/StarList.hpp @@ -451,7 +451,7 @@ void ListMixin::appendAll(Container&& list) { template template auto ListMixin::emplaceAppend(Args&&... args) -> reference { - Base::emplace_back(forward(args)...); + Base::emplace_back(std::forward(args)...); return *prev(Base::end()); } @@ -558,13 +558,13 @@ size_t ListMixin::remove(const_reference e) { template template void ListMixin::filter(Filter&& filter) { - Star::filter(*this, forward(filter)); + Star::filter(*this, std::forward(filter)); } template template void ListMixin::insertSorted(value_type e, Comparator&& comparator) { - auto i = std::upper_bound(Base::begin(), Base::end(), e, forward(comparator)); + auto i = std::upper_bound(Base::begin(), Base::end(), e, std::forward(comparator)); Base::insert(i, std::move(e)); } @@ -577,7 +577,7 @@ void ListMixin::insertSorted(value_type e) { template template bool ListMixin::containsSorted(value_type const& e, Comparator&& comparator) { - auto range = std::equal_range(Base::begin(), Base::end(), e, forward(comparator)); + auto range = std::equal_range(Base::begin(), Base::end(), e, std::forward(comparator)); return range.first != range.second; } @@ -611,7 +611,7 @@ void ListMixin::transform(Function&& function) { template template bool ListMixin::any(Function&& function) const { - return Star::any(*this, forward(function)); + return Star::any(*this, std::forward(function)); } template @@ -622,7 +622,7 @@ bool ListMixin::any() const { template template bool ListMixin::all(Function&& function) const { - return Star::all(*this, forward(function)); + return Star::all(*this, std::forward(function)); } template @@ -633,7 +633,7 @@ bool ListMixin::all() const { template template void RandomAccessListMixin::sort(Comparator&& comparator) { - Star::sort(*this, forward(comparator)); + Star::sort(*this, std::forward(comparator)); } template @@ -790,7 +790,7 @@ void FrontModifyingListMixin::prependAll(Container&& list) { template template auto FrontModifyingListMixin::emplacePrepend(Args&&... args) -> reference { - Base::emplace_front(forward(args)...); + Base::emplace_front(std::forward(args)...); return *Base::begin(); } @@ -839,7 +839,7 @@ template template auto List::filtered(Filter&& filter) const -> List { List list(*this); - list.filter(forward(filter)); + list.filter(std::forward(filter)); return list; } @@ -847,7 +847,7 @@ template template auto List::sorted(Comparator&& comparator) const -> List { List list(*this); - list.sort(forward(comparator)); + list.sort(std::forward(comparator)); return list; } @@ -863,7 +863,7 @@ template auto List::transformed(Function&& function) { List()(std::declval()))>::type> res; res.reserve(Base::size()); - transformInto(res, *this, forward(function)); + transformInto(res, *this, std::forward(function)); return res; } @@ -872,7 +872,7 @@ template auto List::transformed(Function&& function) const { List()(std::declval()))>::type> res; res.reserve(Base::size()); - transformInto(res, *this, forward(function)); + transformInto(res, *this, std::forward(function)); return res; } @@ -899,7 +899,7 @@ template template auto StaticList::sorted(Comparator&& comparator) const -> StaticList { StaticList list(*this); - list.sort(forward(comparator)); + list.sort(std::forward(comparator)); return list; } @@ -914,7 +914,7 @@ template template auto StaticList::transformed(Function&& function) { StaticList()(std::declval()))>::type, MaxSize> res; - transformInto(res, *this, forward(function)); + transformInto(res, *this, std::forward(function)); return res; } @@ -922,7 +922,7 @@ template template auto StaticList::transformed(Function&& function) const { StaticList()(std::declval()))>::type, MaxSize> res; - transformInto(res, *this, forward(function)); + transformInto(res, *this, std::forward(function)); return res; } @@ -941,7 +941,7 @@ template template auto SmallList::filtered(Filter&& filter) const -> SmallList { SmallList list(*this); - list.filter(forward(filter)); + list.filter(std::forward(filter)); return list; } @@ -949,7 +949,7 @@ template template auto SmallList::sorted(Comparator&& comparator) const -> SmallList { SmallList list(*this); - list.sort(forward(comparator)); + list.sort(std::forward(comparator)); return list; } @@ -964,7 +964,7 @@ template template auto SmallList::transformed(Function&& function) { SmallList()(std::declval()))>::type, MaxStackSize> res; - transformInto(res, *this, forward(function)); + transformInto(res, *this, std::forward(function)); return res; } @@ -972,7 +972,7 @@ template template auto SmallList::transformed(Function&& function) const { SmallList()(std::declval()))>::type, MaxStackSize> res; - transformInto(res, *this, forward(function)); + transformInto(res, *this, std::forward(function)); return res; } @@ -991,7 +991,7 @@ template template Deque Deque::filtered(Filter&& filter) const { Deque l(*this); - l.filter(forward(filter)); + l.filter(std::forward(filter)); return l; } @@ -999,7 +999,7 @@ template template Deque Deque::sorted(Comparator&& comparator) const { Deque l(*this); - l.sort(forward(comparator)); + l.sort(std::forward(comparator)); return l; } @@ -1013,13 +1013,13 @@ Deque Deque::sorted() const { template template auto Deque::transformed(Function&& function) { - return Star::transform()(std::declval()))>>(*this, forward(function)); + return Star::transform()(std::declval()))>>(*this, std::forward(function)); } template template auto Deque::transformed(Function&& function) const { - return Star::transform()(std::declval()))>>(*this, forward(function)); + return Star::transform()(std::declval()))>>(*this, std::forward(function)); } template @@ -1064,7 +1064,7 @@ template template LinkedList LinkedList::filtered(Filter&& filter) const { LinkedList list(*this); - list.filter(forward(filter)); + list.filter(std::forward(filter)); return list; } @@ -1072,7 +1072,7 @@ template template LinkedList LinkedList::sorted(Comparator&& comparator) const { LinkedList l(*this); - l.sort(forward(comparator)); + l.sort(std::forward(comparator)); return l; } @@ -1086,13 +1086,13 @@ LinkedList LinkedList::sorted() const { template template auto LinkedList::transformed(Function&& function) { - return Star::transform()(std::declval()))>>(*this, forward(function)); + return Star::transform()(std::declval()))>>(*this, std::forward(function)); } template template auto LinkedList::transformed(Function&& function) const { - return Star::transform()(std::declval()))>>(*this, forward(function)); + return Star::transform()(std::declval()))>>(*this, std::forward(function)); } template diff --git a/source/core/StarListener.cpp b/source/core/StarListener.cpp index 642f2a2..394d55d 100644 --- a/source/core/StarListener.cpp +++ b/source/core/StarListener.cpp @@ -5,7 +5,7 @@ namespace Star { Listener::~Listener() {} CallbackListener::CallbackListener(function callback) - : callback(move(callback)) {} + : callback(std::move(callback)) {} void CallbackListener::trigger() { if (callback) @@ -16,12 +16,12 @@ TrackerListener::TrackerListener() : triggered(false) {} void ListenerGroup::addListener(ListenerWeakPtr listener) { MutexLocker locker(m_mutex); - m_listeners.insert(move(listener)); + m_listeners.insert(std::move(listener)); } void ListenerGroup::removeListener(ListenerWeakPtr listener) { MutexLocker locker(m_mutex); - m_listeners.erase(move(listener)); + m_listeners.erase(std::move(listener)); } void ListenerGroup::clearExpiredListeners() { diff --git a/source/core/StarLockFile_unix.cpp b/source/core/StarLockFile_unix.cpp index 298c636..ab43d93 100644 --- a/source/core/StarLockFile_unix.cpp +++ b/source/core/StarLockFile_unix.cpp @@ -12,16 +12,16 @@ namespace Star { int64_t const LockFile::MaximumSleepMillis; Maybe LockFile::acquireLock(String const& filename, int64_t lockTimeout) { - LockFile lock(move(filename)); + LockFile lock(std::move(filename)); if (lock.lock(lockTimeout)) return lock; return {}; } -LockFile::LockFile(String const& filename) : m_filename(move(filename)) {} +LockFile::LockFile(String const& filename) : m_filename(std::move(filename)) {} LockFile::LockFile(LockFile&& lockFile) { - operator=(move(lockFile)); + operator=(std::move(lockFile)); } LockFile::~LockFile() { @@ -29,8 +29,8 @@ LockFile::~LockFile() { } LockFile& LockFile::operator=(LockFile&& lockFile) { - m_filename = move(lockFile.m_filename); - m_handle = move(lockFile.m_handle); + m_filename = std::move(lockFile.m_filename); + m_handle = std::move(lockFile.m_handle); return *this; } diff --git a/source/core/StarLockFile_windows.cpp b/source/core/StarLockFile_windows.cpp index 33692fb..c6d7295 100644 --- a/source/core/StarLockFile_windows.cpp +++ b/source/core/StarLockFile_windows.cpp @@ -11,16 +11,16 @@ namespace Star { int64_t const LockFile::MaximumSleepMillis; Maybe LockFile::acquireLock(String const& filename, int64_t lockTimeout) { - LockFile lock(move(filename)); + LockFile lock(std::move(filename)); if (lock.lock(lockTimeout)) - return move(lock); + return std::move(lock); return {}; } -LockFile::LockFile(String const& filename) : m_filename(move(filename)) {} +LockFile::LockFile(String const& filename) : m_filename(std::move(filename)) {} LockFile::LockFile(LockFile&& lockFile) { - operator=(move(lockFile)); + operator=(std::move(lockFile)); } LockFile::~LockFile() { @@ -28,8 +28,8 @@ LockFile::~LockFile() { } LockFile& LockFile::operator=(LockFile&& lockFile) { - m_filename = move(lockFile.m_filename); - m_handle = move(lockFile.m_handle); + m_filename = std::move(lockFile.m_filename); + m_handle = std::move(lockFile.m_handle); return *this; } diff --git a/source/core/StarLogging.cpp b/source/core/StarLogging.cpp index 19094f8..062facf 100644 --- a/source/core/StarLogging.cpp +++ b/source/core/StarLogging.cpp @@ -212,9 +212,9 @@ void SpatialLogger::clear() { decltype(s_logText) logText; { MutexLocker locker(s_mutex); - lines = move(s_lines); - points = move(s_points); - logText = move(s_logText); + lines = std::move(s_lines); + points = std::move(s_points); + logText = std::move(s_logText); } // Move while locked to deallocate contents while unlocked. } diff --git a/source/core/StarLruCache.hpp b/source/core/StarLruCache.hpp index d047a37..a59ed03 100644 --- a/source/core/StarLruCache.hpp +++ b/source/core/StarLruCache.hpp @@ -105,9 +105,9 @@ template void LruCacheBase::set(Key const& key, Value value) { auto i = m_map.find(key); if (i == m_map.end()) { - m_map.add(key, move(value)); + m_map.add(key, std::move(value)); } else { - i->second = move(value); + i->second = std::move(value); m_map.toBack(i); } } diff --git a/source/core/StarLua.cpp b/source/core/StarLua.cpp index 49d54f3..84e6c82 100644 --- a/source/core/StarLua.cpp +++ b/source/core/StarLua.cpp @@ -76,7 +76,7 @@ StringMap const& LuaCallbacks::callbacks() const } bool LuaContext::containsPath(String path) const { - return engine().contextGetPath(handleIndex(), move(path)) != LuaNil; + return engine().contextGetPath(handleIndex(), std::move(path)) != LuaNil; } void LuaContext::load(char const* contents, size_t size, char const* name) { @@ -92,7 +92,7 @@ void LuaContext::load(ByteArray const& contents, String const& name) { } void LuaContext::setRequireFunction(RequireFunction requireFunction) { - engine().setContextRequire(handleIndex(), move(requireFunction)); + engine().setContextRequire(handleIndex(), std::move(requireFunction)); } void LuaContext::setCallbacks(String const& tableName, LuaCallbacks const& callbacks) const { @@ -162,11 +162,11 @@ Maybe LuaConverter::to(LuaEngine&, LuaValue const& v) { } LuaValue LuaConverter::from(LuaEngine& engine, JsonObject v) { - return engine.luaFrom(Json(move(v))); + return engine.luaFrom(Json(std::move(v))); } Maybe LuaConverter::to(LuaEngine& engine, LuaValue v) { - auto j = engine.luaTo(move(v)); + auto j = engine.luaTo(std::move(v)); if (j.type() == Json::Type::Object) { return j.toObject(); } else if (j.type() == Json::Type::Array) { @@ -179,11 +179,11 @@ Maybe LuaConverter::to(LuaEngine& engine, LuaValue v) { } LuaValue LuaConverter::from(LuaEngine& engine, JsonArray v) { - return engine.luaFrom(Json(move(v))); + return engine.luaFrom(Json(std::move(v))); } Maybe LuaConverter::to(LuaEngine& engine, LuaValue v) { - auto j = engine.luaTo(move(v)); + auto j = engine.luaTo(std::move(v)); if (j.type() == Json::Type::Array) { return j.toArray(); } else if (j.type() == Json::Type::Object) { @@ -839,7 +839,7 @@ void LuaEngine::tableIterate(int handleIndex, function LuaDetail::tableToJsonContainer(LuaTable const& table) { if (auto i = asInteger(key)) { intEntries[*i] = jsonValue.take(); } else { - auto stringKey = table.engine().luaMaybeTo(move(key)); + auto stringKey = table.engine().luaMaybeTo(std::move(key)); if (!stringKey) { failedConversion = true; return false; @@ -1420,12 +1420,12 @@ Maybe LuaDetail::tableToJsonContainer(LuaTable const& table) { if (interpretAsList) { JsonArray list; for (auto& p : intEntries) - list.set(p.first - 1, move(p.second)); - return Json(move(list)); + list.set(p.first - 1, std::move(p.second)); + return Json(std::move(list)); } else { for (auto& p : intEntries) - stringEntries[toString(p.first)] = move(p.second); - return Json(move(stringEntries)); + stringEntries[toString(p.first)] = std::move(p.second); + return Json(std::move(stringEntries)); } } diff --git a/source/core/StarLua.hpp b/source/core/StarLua.hpp index affee9a..d138c8b 100644 --- a/source/core/StarLua.hpp +++ b/source/core/StarLua.hpp @@ -856,7 +856,7 @@ struct LuaConverter { } static Maybe to(LuaEngine& engine, LuaValue v) { - return engine.luaTo(move(v)).takeUtf8(); + return engine.luaTo(std::move(v)).takeUtf8(); } }; @@ -887,12 +887,12 @@ struct LuaConverter { template <> struct LuaConverter { static LuaValue from(LuaEngine&, LuaString v) { - return LuaValue(move(v)); + return LuaValue(std::move(v)); } static Maybe to(LuaEngine& engine, LuaValue v) { if (v.is()) - return LuaString(move(v.get())); + return LuaString(std::move(v.get())); if (v.is()) return engine.createString(toString(v.get())); if (v.is()) @@ -909,7 +909,7 @@ struct LuaValueConverter { static Maybe to(LuaEngine&, LuaValue v) { if (auto p = v.ptr()) { - return move(*p); + return std::move(*p); } return {}; } @@ -967,7 +967,7 @@ struct LuaConverter> { static Maybe> to(LuaEngine& engine, LuaValue&& v) { if (v != LuaNil) { - if (auto conv = engine.luaMaybeTo(move(v))) + if (auto conv = engine.luaMaybeTo(std::move(v))) return conv; else return {}; @@ -991,8 +991,8 @@ struct LuaMapConverter { T result; bool failed = false; table->iterate([&result, &failed, &engine](LuaValue key, LuaValue value) { - auto contKey = engine.luaMaybeTo(move(key)); - auto contValue = engine.luaMaybeTo(move(value)); + auto contKey = engine.luaMaybeTo(std::move(key)); + auto contValue = engine.luaMaybeTo(std::move(value)); if (!contKey || !contValue) { failed = true; return false; @@ -1026,7 +1026,7 @@ struct LuaContainerConverter { failed = true; return false; } - auto contVal = engine.luaMaybeTo(move(value)); + auto contVal = engine.luaMaybeTo(std::move(value)); if (!contVal) { failed = true; return false; @@ -1086,7 +1086,7 @@ struct LuaConverter { namespace LuaDetail { inline LuaHandle::LuaHandle(LuaEnginePtr engine, int handleIndex) - : engine(move(engine)), handleIndex(handleIndex) {} + : engine(std::move(engine)), handleIndex(handleIndex) {} inline LuaHandle::~LuaHandle() { if (engine) @@ -1213,7 +1213,7 @@ namespace LuaDetail { struct ArgGet { static T get(LuaEngine& engine, size_t argc, LuaValue* argv, size_t index) { if (index < argc) - return engine.luaTo(move(argv[index])); + return engine.luaTo(std::move(argv[index])); return engine.luaTo(LuaNil); } }; @@ -1226,7 +1226,7 @@ namespace LuaDetail { LuaVariadic subargs(argc - index); for (size_t i = index; i < argc; ++i) - subargs[i - index] = engine.luaTo(move(argv[i])); + subargs[i - index] = engine.luaTo(std::move(argv[i])); return subargs; } }; @@ -1235,14 +1235,14 @@ namespace LuaDetail { struct FunctionWrapper { template static LuaWrappedFunction wrapIndexes(Function func, IndexSequence const&) { - return [func = move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) { + return [func = std::move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) { return toWrappedReturn(engine, (Return const&)func(ArgGet::get(engine, argc, argv, Indexes)...)); }; } template static LuaWrappedFunction wrap(Function func) { - return wrapIndexes(forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); + return wrapIndexes(std::forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); } }; @@ -1250,7 +1250,7 @@ namespace LuaDetail { struct FunctionWrapper { template static LuaWrappedFunction wrapIndexes(Function func, IndexSequence const&) { - return [func = move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) { + return [func = std::move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) { func(ArgGet::get(engine, argc, argv, Indexes)...); return LuaFunctionReturn(); }; @@ -1258,7 +1258,7 @@ namespace LuaDetail { template static LuaWrappedFunction wrap(Function func) { - return wrapIndexes(forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); + return wrapIndexes(std::forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); } }; @@ -1266,14 +1266,14 @@ namespace LuaDetail { struct FunctionWrapper { template static LuaWrappedFunction wrapIndexes(Function func, IndexSequence const&) { - return [func = move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) { + return [func = std::move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) { return toWrappedReturn(engine, (Return const&)func(engine, ArgGet::get(engine, argc, argv, Indexes)...)); }; } template static LuaWrappedFunction wrap(Function func) { - return wrapIndexes(forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); + return wrapIndexes(std::forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); } }; @@ -1281,7 +1281,7 @@ namespace LuaDetail { struct FunctionWrapper { template static LuaWrappedFunction wrapIndexes(Function func, IndexSequence const&) { - return [func = move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) { + return [func = std::move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) { func(engine, ArgGet::get(engine, argc, argv, Indexes)...); return LuaFunctionReturn(); }; @@ -1289,31 +1289,31 @@ namespace LuaDetail { template static LuaWrappedFunction wrap(Function func) { - return wrapIndexes(forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); + return wrapIndexes(std::forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); } }; template LuaWrappedFunction wrapFunctionWithSignature(Function&& func) { - return FunctionWrapper::type...>::wrap(forward(func)); + return FunctionWrapper::type...>::wrap(std::forward(func)); } template LuaWrappedFunction wrapFunctionArgs(Function&& func, VariadicTypedef const&) { - return wrapFunctionWithSignature(forward(func)); + return wrapFunctionWithSignature(std::forward(func)); } template LuaWrappedFunction wrapFunction(Function&& func) { return wrapFunctionArgs::Return>( - forward(func), typename FunctionTraits::Args()); + std::forward(func), typename FunctionTraits::Args()); } template struct MethodWrapper { template static LuaWrappedFunction wrapIndexes(Function func, IndexSequence const&) { - return [func = move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) mutable { + return [func = std::move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) mutable { if (argc == 0) throw LuaException("No object argument passed to wrapped method"); return toWrappedReturn(engine, @@ -1323,7 +1323,7 @@ namespace LuaDetail { template static LuaWrappedFunction wrap(Function&& func) { - return wrapIndexes(forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); + return wrapIndexes(std::forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); } }; @@ -1331,7 +1331,7 @@ namespace LuaDetail { struct MethodWrapper { template static LuaWrappedFunction wrapIndexes(Function func, IndexSequence const&) { - return [func = move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) { + return [func = std::move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) { if (argc == 0) throw LuaException("No object argument passed to wrapped method"); func(argv[0].get().get(), ArgGet::get(engine, argc - 1, argv + 1, Indexes)...); @@ -1341,7 +1341,7 @@ namespace LuaDetail { template static LuaWrappedFunction wrap(Function func) { - return wrapIndexes(forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); + return wrapIndexes(std::forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); } }; @@ -1349,7 +1349,7 @@ namespace LuaDetail { struct MethodWrapper { template static LuaWrappedFunction wrapIndexes(Function func, IndexSequence const&) { - return [func = move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) { + return [func = std::move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) { if (argc == 0) throw LuaException("No object argument passed to wrapped method"); return toWrappedReturn( @@ -1360,7 +1360,7 @@ namespace LuaDetail { template static LuaWrappedFunction wrap(Function func) { - return wrapIndexes(forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); + return wrapIndexes(std::forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); } }; @@ -1368,7 +1368,7 @@ namespace LuaDetail { struct MethodWrapper { template static LuaWrappedFunction wrapIndexes(Function func, IndexSequence const&) { - return [func = move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) { + return [func = std::move(func)](LuaEngine& engine, size_t argc, LuaValue* argv) { if (argc == 0) throw LuaException("No object argument passed to wrapped method"); func(argv[0].get().get(), engine, ArgGet::get(engine, argc - 1, argv + 1, Indexes)...); @@ -1378,24 +1378,24 @@ namespace LuaDetail { template static LuaWrappedFunction wrap(Function func) { - return wrapIndexes(forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); + return wrapIndexes(std::forward(func), typename GenIndexSequence<0, sizeof...(Args)>::type()); } }; template LuaWrappedFunction wrapMethodWithSignature(Function&& func) { - return MethodWrapper::type...>::wrap(forward(func)); + return MethodWrapper::type...>::wrap(std::forward(func)); } template LuaWrappedFunction wrapMethodArgs(Function&& func, VariadicTypedef const&) { - return wrapMethodWithSignature(forward(func)); + return wrapMethodWithSignature(std::forward(func)); } template LuaWrappedFunction wrapMethod(Function&& func) { return wrapMethodArgs::Return>( - forward(func), typename FunctionTraits::Args()); + std::forward(func), typename FunctionTraits::Args()); } template @@ -1405,8 +1405,8 @@ namespace LuaDetail { struct TableIteratorWrapper { template static function wrap(LuaEngine& engine, Function&& func) { - return [&engine, func = move(func)](LuaValue key, LuaValue value) -> bool { - return func(engine, engine.luaTo(move(key)), engine.luaTo(move(value))); + return [&engine, func = std::move(func)](LuaValue key, LuaValue value) -> bool { + return func(engine, engine.luaTo(std::move(key)), engine.luaTo(std::move(value))); }; } }; @@ -1415,8 +1415,8 @@ namespace LuaDetail { struct TableIteratorWrapper { template static function wrap(LuaEngine& engine, Function&& func) { - return [&engine, func = move(func)](LuaValue key, LuaValue value) -> bool { - func(engine, engine.luaTo(move(key)), engine.luaTo(move(value))); + return [&engine, func = std::move(func)](LuaValue key, LuaValue value) -> bool { + func(engine, engine.luaTo(std::move(key)), engine.luaTo(std::move(value))); return true; }; } @@ -1426,8 +1426,8 @@ namespace LuaDetail { struct TableIteratorWrapper { template static function wrap(LuaEngine& engine, Function&& func) { - return [&engine, func = move(func)](LuaValue key, LuaValue value) -> bool { - return func(engine.luaTo(move(key)), engine.luaTo(move(value))); + return [&engine, func = std::move(func)](LuaValue key, LuaValue value) -> bool { + return func(engine.luaTo(std::move(key)), engine.luaTo(std::move(value))); }; } }; @@ -1436,8 +1436,8 @@ namespace LuaDetail { struct TableIteratorWrapper { template static function wrap(LuaEngine& engine, Function&& func) { - return [&engine, func = move(func)](LuaValue key, LuaValue value) -> bool { - func(engine.luaTo(move(key)), engine.luaTo(move(value))); + return [&engine, func = std::move(func)](LuaValue key, LuaValue value) -> bool { + func(engine.luaTo(std::move(key)), engine.luaTo(std::move(value))); return true; }; } @@ -1445,19 +1445,19 @@ namespace LuaDetail { template function wrapTableIteratorWithSignature(LuaEngine& engine, Function&& func) { - return TableIteratorWrapper::type...>::wrap(engine, forward(func)); + return TableIteratorWrapper::type...>::wrap(engine, std::forward(func)); } template function wrapTableIteratorArgs( LuaEngine& engine, Function&& func, VariadicTypedef const&) { - return wrapTableIteratorWithSignature(engine, forward(func)); + return wrapTableIteratorWithSignature(engine, std::forward(func)); } template function wrapTableIterator(LuaEngine& engine, Function&& func) { return wrapTableIteratorArgs::Return>( - engine, forward(func), typename FunctionTraits::Args()); + engine, std::forward(func), typename FunctionTraits::Args()); } // Like lua_setfield / lua_getfield but raw. @@ -1520,7 +1520,7 @@ LuaVariadic::type::value_type> luaUnpack(Containe LuaVariadic::type::value_type> ret; if (std::is_rvalue_reference::value) { for (auto& e : c) - ret.append(move(e)); + ret.append(std::move(e)); } else { for (auto const& e : c) ret.append(e); @@ -1535,7 +1535,7 @@ LuaTupleReturn::LuaTupleReturn(Types const&... args) template template LuaTupleReturn::LuaTupleReturn(UTypes&&... args) - : Base(move(args)...) {} + : Base(std::move(args)...) {} template template @@ -1548,7 +1548,7 @@ LuaTupleReturn::LuaTupleReturn(LuaTupleReturn const& rhs) template LuaTupleReturn::LuaTupleReturn(LuaTupleReturn&& rhs) - : Base(move(rhs)) {} + : Base(std::move(rhs)) {} template template @@ -1558,7 +1558,7 @@ LuaTupleReturn::LuaTupleReturn(LuaTupleReturn const& rhs) template template LuaTupleReturn::LuaTupleReturn(LuaTupleReturn&& rhs) - : Base(move(rhs)) {} + : Base(std::move(rhs)) {} template LuaTupleReturn& LuaTupleReturn::operator=(LuaTupleReturn const& rhs) { @@ -1568,7 +1568,7 @@ LuaTupleReturn& LuaTupleReturn::operator=(LuaTupleReturn con template LuaTupleReturn& LuaTupleReturn::operator=(LuaTupleReturn&& rhs) { - Base::operator=(move(rhs)); + Base::operator=(std::move(rhs)); return *this; } @@ -1582,7 +1582,7 @@ LuaTupleReturn& LuaTupleReturn::operator=(LuaTupleReturn template LuaTupleReturn& LuaTupleReturn::operator=(LuaTupleReturn&& rhs) { - Base::operator=((tuple && )move(rhs)); + Base::operator=((tuple && )std::move(rhs)); return *this; } @@ -1593,10 +1593,10 @@ LuaTupleReturn luaTie(Types&... args) { template LuaTupleReturn::type...> luaTupleReturn(Types&&... args) { - return LuaTupleReturn::type...>(forward(args)...); + return LuaTupleReturn::type...>(std::forward(args)...); } -inline LuaReference::LuaReference(LuaDetail::LuaHandle handle) : m_handle(move(handle)) {} +inline LuaReference::LuaReference(LuaDetail::LuaHandle handle) : m_handle(std::move(handle)) {} inline bool LuaReference::operator==(LuaReference const& rhs) const { return tie(m_handle.engine, m_handle.handleIndex) == tie(rhs.m_handle.engine, rhs.m_handle.handleIndex); @@ -1688,7 +1688,7 @@ inline bool operator!=(String const& s1, LuaString const& s2) { template T LuaTable::get(K key) const { - return engine().luaTo(engine().tableGet(false, handleIndex(), engine().luaFrom(move(key)))); + return engine().luaTo(engine().tableGet(false, handleIndex(), engine().luaFrom(std::move(key)))); } template @@ -1698,17 +1698,17 @@ T LuaTable::get(char const* key) const { template void LuaTable::set(K key, T value) const { - engine().tableSet(false, handleIndex(), engine().luaFrom(move(key)), engine().luaFrom(move(value))); + engine().tableSet(false, handleIndex(), engine().luaFrom(std::move(key)), engine().luaFrom(std::move(value))); } template void LuaTable::set(char const* key, T value) const { - engine().tableSet(false, handleIndex(), key, engine().luaFrom(move(value))); + engine().tableSet(false, handleIndex(), key, engine().luaFrom(std::move(value))); } template bool LuaTable::contains(K key) const { - return engine().tableGet(false, handleIndex(), engine().luaFrom(move(key))) != LuaNil; + return engine().tableGet(false, handleIndex(), engine().luaFrom(std::move(key))) != LuaNil; } template @@ -1718,12 +1718,12 @@ void LuaTable::remove(K key) const { template void LuaTable::iterate(Function&& function) const { - return engine().tableIterate(handleIndex(), LuaDetail::wrapTableIterator(engine(), forward(function))); + return engine().tableIterate(handleIndex(), LuaDetail::wrapTableIterator(engine(), std::forward(function))); } template void LuaTable::iterateWithSignature(Function&& func) const { - return engine().tableIterate(handleIndex(), LuaDetail::wrapTableIteratorWithSignature(engine(), forward(func))); + return engine().tableIterate(handleIndex(), LuaDetail::wrapTableIteratorWithSignature(engine(), std::forward(func))); } template @@ -1779,27 +1779,27 @@ T& LuaUserData::get() const { template void LuaCallbacks::registerCallback(String name, Function&& func) { - if (!m_callbacks.insert(name, LuaDetail::wrapFunction(forward(func))).second) + if (!m_callbacks.insert(name, LuaDetail::wrapFunction(std::forward(func))).second) throw LuaException::format("Lua callback '{}' was registered twice", name); } template void LuaCallbacks::registerCallbackWithSignature(String name, Function&& func) { - if (!m_callbacks.insert(name, LuaDetail::wrapFunctionWithSignature(forward(func))).second) + if (!m_callbacks.insert(name, LuaDetail::wrapFunctionWithSignature(std::forward(func))).second) throw LuaException::format("Lua callback '{}' was registered twice", name); } template template void LuaMethods::registerMethod(String name, Function&& func) { - if (!m_methods.insert(name, LuaDetail::wrapMethod(forward(move(func)))).second) + if (!m_methods.insert(name, LuaDetail::wrapMethod(std::forward(std::move(func)))).second) throw LuaException::format("Lua method '{}' was registered twice", name); } template template void LuaMethods::registerMethodWithSignature(String name, Function&& func) { - if (!m_methods.insert(name, LuaDetail::wrapMethodWithSignature(forward(move(func)))) + if (!m_methods.insert(name, LuaDetail::wrapMethodWithSignature(std::forward(std::move(func)))) .second) throw LuaException::format("Lua method '{}' was registered twice", name); } @@ -1811,12 +1811,12 @@ StringMap const& LuaMethods::methods() const { template T LuaContext::getPath(String path) const { - return engine().luaTo(engine().contextGetPath(handleIndex(), move(path))); + return engine().luaTo(engine().contextGetPath(handleIndex(), std::move(path))); } template void LuaContext::setPath(String key, T value) { - engine().contextSetPath(handleIndex(), move(key), engine().luaFrom(move(value))); + engine().contextSetPath(handleIndex(), std::move(key), engine().luaFrom(std::move(value))); } template @@ -1834,7 +1834,7 @@ Ret LuaContext::invokePath(String const& key, Args const&... args) const { template LuaValue LuaContext::luaFrom(T&& t) { - return engine().luaFrom(forward(t)); + return engine().luaFrom(std::forward(t)); } template @@ -1844,7 +1844,7 @@ LuaValue LuaContext::luaFrom(T const& t) { template Maybe LuaContext::luaMaybeTo(LuaValue&& v) { - return engine().luaFrom(move(v)); + return engine().luaFrom(std::move(v)); } template @@ -1854,7 +1854,7 @@ Maybe LuaContext::luaMaybeTo(LuaValue const& v) { template T LuaContext::luaTo(LuaValue&& v) { - return engine().luaTo(move(v)); + return engine().luaTo(std::move(v)); } template @@ -1874,17 +1874,17 @@ LuaTable LuaContext::createArrayTable(Container const& array) { template LuaFunction LuaContext::createFunction(Function&& func) { - return engine().createFunction(forward(func)); + return engine().createFunction(std::forward(func)); } template LuaFunction LuaContext::createFunctionWithSignature(Function&& func) { - return engine().createFunctionWithSignature(forward(func)); + return engine().createFunctionWithSignature(std::forward(func)); } template LuaUserData LuaContext::createUserData(T t) { - return engine().createUserData(move(t)); + return engine().createUserData(std::move(t)); } template @@ -1894,7 +1894,7 @@ LuaMethods LuaUserDataMethods::make() { template LuaValue LuaUserDataConverter::from(LuaEngine& engine, T t) { - return engine.createUserData(move(t)); + return engine.createUserData(std::move(t)); } template @@ -1908,7 +1908,7 @@ Maybe LuaUserDataConverter::to(LuaEngine&, LuaValue const& v) { template LuaValue LuaEngine::luaFrom(T&& t) { - return LuaConverter::type>::from(*this, forward(t)); + return LuaConverter::type>::from(*this, std::forward(t)); } template @@ -1918,7 +1918,7 @@ LuaValue LuaEngine::luaFrom(T const& t) { template Maybe LuaEngine::luaMaybeTo(LuaValue&& v) { - return LuaConverter::to(*this, move(v)); + return LuaConverter::to(*this, std::move(v)); } template @@ -1928,7 +1928,7 @@ Maybe LuaEngine::luaMaybeTo(LuaValue const& v) { template T LuaEngine::luaTo(LuaValue&& v) { - if (auto res = luaMaybeTo(move(v))) + if (auto res = luaMaybeTo(std::move(v))) return res.take(); throw LuaConversionException::format("Error converting LuaValue to type '{}'", typeid(T).name()); } @@ -1961,12 +1961,12 @@ LuaTable LuaEngine::createArrayTable(Container const& array) { template LuaFunction LuaEngine::createFunction(Function&& func) { - return createWrappedFunction(LuaDetail::wrapFunction(forward(func))); + return createWrappedFunction(LuaDetail::wrapFunction(std::forward(func))); } template LuaFunction LuaEngine::createFunctionWithSignature(Function&& func) { - return createWrappedFunction(LuaDetail::wrapFunctionWithSignature(forward(func))); + return createWrappedFunction(LuaDetail::wrapFunctionWithSignature(std::forward(func))); } template @@ -2026,7 +2026,7 @@ Maybe LuaEngine::resumeThread(int handleIndex, Arg LuaVariadic ret(returnValues); for (int i = returnValues - 1; i >= 0; --i) ret[i] = popLuaValue(threadState); - return LuaDetail::LuaFunctionReturn(move(ret)); + return LuaDetail::LuaFunctionReturn(std::move(ret)); } } @@ -2071,7 +2071,7 @@ LuaUserData LuaEngine::createUserData(T t) { lua_checkstack(m_state, 2); - new (lua_newuserdata(m_state, sizeof(T))) T(move(t)); + new (lua_newuserdata(m_state, sizeof(T))) T(std::move(t)); lua_rawgeti(m_state, LUA_REGISTRYINDEX, typeMetatable); lua_setmetatable(m_state, -2); @@ -2083,7 +2083,7 @@ template T LuaEngine::getGlobal(K key) { lua_checkstack(m_state, 1); lua_rawgeti(m_state, LUA_REGISTRYINDEX, m_scriptDefaultEnvRegistryId); - pushLuaValue(m_state, luaFrom(move(key))); + pushLuaValue(m_state, luaFrom(std::move(key))); lua_rawget(m_state, -2); LuaValue v = popLuaValue(m_state); @@ -2109,8 +2109,8 @@ void LuaEngine::setGlobal(K key, T value) { lua_checkstack(m_state, 1); lua_rawgeti(m_state, LUA_REGISTRYINDEX, m_scriptDefaultEnvRegistryId); - pushLuaValue(m_state, luaFrom(move(key))); - pushLuaValue(m_state, luaFrom(move(value))); + pushLuaValue(m_state, luaFrom(std::move(key))); + pushLuaValue(m_state, luaFrom(std::move(value))); lua_rawset(m_state, -3); lua_pop(m_state, 1); diff --git a/source/core/StarLuaConverters.hpp b/source/core/StarLuaConverters.hpp index f476d2e..277f691 100644 --- a/source/core/StarLuaConverters.hpp +++ b/source/core/StarLuaConverters.hpp @@ -33,8 +33,8 @@ template struct LuaConverter> { static LuaValue from(LuaEngine& engine, pair&& v) { auto t = engine.createTable(); - t.set(1, move(v.first)); - t.set(2, move(v.second)); + t.set(1, std::move(v.first)); + t.set(2, std::move(v.second)); return t; } @@ -46,7 +46,7 @@ struct LuaConverter> { } static Maybe> to(LuaEngine& engine, LuaValue const& v) { - if (auto table = engine.luaMaybeTo(move(v))) { + if (auto table = engine.luaMaybeTo(std::move(v))) { auto p1 = engine.luaMaybeTo(table->get(1)); auto p2 = engine.luaMaybeTo(table->get(2)); if (p1 && p2) @@ -173,7 +173,7 @@ struct LuaConverter> { } static LuaValue from(LuaEngine& engine, Variant&& variant) { - return variant.call([&engine](auto& a) { return luaFrom(engine, move(a)); }); + return variant.call([&engine](auto& a) { return luaFrom(engine, std::move(a)); }); } static Maybe> to(LuaEngine& engine, LuaValue const& v) { @@ -194,7 +194,7 @@ struct LuaConverter> { } static Maybe> to(LuaEngine& engine, LuaValue&& v) { - return checkTypeTo(engine, move(v)); + return checkTypeTo(engine, std::move(v)); } template @@ -202,12 +202,12 @@ struct LuaConverter> { if (auto t1 = engine.luaMaybeTo(v)) return t1; else - return checkTypeTo(engine, move(v)); + return checkTypeTo(engine, std::move(v)); } template static Maybe> checkTypeTo(LuaEngine& engine, LuaValue&& v) { - return engine.luaMaybeTo(move(v)); + return engine.luaMaybeTo(std::move(v)); } }; @@ -226,7 +226,7 @@ struct LuaConverter> { static LuaValue from(LuaEngine& engine, MVariant&& variant) { LuaValue value; variant.call([&value, &engine](auto& a) { - value = luaFrom(engine, move(a)); + value = luaFrom(engine, std::move(a)); }); return value; } @@ -253,7 +253,7 @@ struct LuaConverter> { static Maybe> to(LuaEngine& engine, LuaValue&& v) { if (v == LuaNil) return MVariant(); - return checkTypeTo(engine, move(v)); + return checkTypeTo(engine, std::move(v)); } template @@ -261,12 +261,12 @@ struct LuaConverter> { if (auto t1 = engine.luaMaybeTo(v)) return t1; else - return checkTypeTo(engine, move(v)); + return checkTypeTo(engine, std::move(v)); } template static Maybe> checkTypeTo(LuaEngine& engine, LuaValue&& v) { - return engine.luaMaybeTo(move(v)); + return engine.luaMaybeTo(std::move(v)); } }; diff --git a/source/core/StarMap.hpp b/source/core/StarMap.hpp index cf9c260..e3f9d67 100644 --- a/source/core/StarMap.hpp +++ b/source/core/StarMap.hpp @@ -172,7 +172,7 @@ auto MapMixin::maybeTake(key_type const& k) -> Maybe { if (i != Base::end()) { mapped_type v = std::move(i->second); Base::erase(i); - return move(v); + return std::move(v); } return {}; @@ -260,12 +260,12 @@ auto MapMixin::hasValue(mapped_type const& v) const -> bool { template auto MapMixin::insert(key_type k, mapped_type v) -> pair { - return Base::insert(value_type(move(k), move(v))); + return Base::insert(value_type(std::move(k), std::move(v))); } template auto MapMixin::add(key_type k, mapped_type v) -> mapped_type& { - auto pair = Base::insert(value_type(move(k), move(v))); + auto pair = Base::insert(value_type(std::move(k), std::move(v))); if (!pair.second) throw MapException(strf("Entry with key '{}' already present.", outputAny(k))); else @@ -276,10 +276,10 @@ template auto MapMixin::set(key_type k, mapped_type v) -> mapped_type& { auto i = Base::find(k); if (i != Base::end()) { - i->second = move(v); + i->second = std::move(v); return i->second; } else { - return Base::insert(value_type(move(k), move(v))).first->second; + return Base::insert(value_type(std::move(k), std::move(v))).first->second; } } diff --git a/source/core/StarMaybe.hpp b/source/core/StarMaybe.hpp index 2b2b70d..2c53bcb 100644 --- a/source/core/StarMaybe.hpp +++ b/source/core/StarMaybe.hpp @@ -118,7 +118,7 @@ Maybe::Maybe(T const& t) template Maybe::Maybe(T&& t) : Maybe() { - new (&m_data) T(forward(t)); + new (&m_data) T(std::forward(t)); m_initialized = true; } @@ -135,7 +135,7 @@ template Maybe::Maybe(Maybe&& rhs) : Maybe() { if (rhs.m_initialized) { - new (&m_data) T(move(rhs.m_data)); + new (&m_data) T(std::move(rhs.m_data)); m_initialized = true; rhs.reset(); } @@ -308,7 +308,7 @@ T Maybe::take() { if (!m_initialized) throw InvalidMaybeAccessException(); - T val(move(m_data)); + T val(std::move(m_data)); reset(); @@ -318,7 +318,7 @@ T Maybe::take() { template bool Maybe::put(T& t) { if (m_initialized) { - t = move(m_data); + t = std::move(m_data); reset(); @@ -335,7 +335,7 @@ void Maybe::set(T const& t) { template void Maybe::set(T&& t) { - emplace(forward(t)); + emplace(std::forward(t)); } template @@ -343,7 +343,7 @@ template void Maybe::emplace(Args&&... t) { reset(); - new (&m_data) T(forward(t)...); + new (&m_data) T(std::forward(t)...); m_initialized = true; } diff --git a/source/core/StarMultiArray.hpp b/source/core/StarMultiArray.hpp index 3668c8a..bb33490 100644 --- a/source/core/StarMultiArray.hpp +++ b/source/core/StarMultiArray.hpp @@ -326,14 +326,14 @@ void MultiArray::set(IndexArray const& index, Element element) { throw MultiArrayException(strf("Out of bounds on MultiArray::set({})", index)); } - m_data[storageIndex(index)] = move(element); + m_data[storageIndex(index)] = std::move(element); } template Element MultiArray::get(IndexArray const& index, Element def) { for (size_t i = Rank; i != 0; --i) { if (index[i - 1] >= m_shape[i - 1]) - return move(def); + return std::move(def); } return m_data[storageIndex(index)]; @@ -346,7 +346,7 @@ void MultiArray::setResize(IndexArray const& index, Element eleme newShape[i] = std::max(m_shape[i], index[i] + 1); resize(newShape); - m_data[storageIndex(index)] = move(element); + m_data[storageIndex(index)] = std::move(element); } template @@ -369,26 +369,26 @@ template template void MultiArray::forEach(IndexArray const& min, SizeArray const& size, OpType&& op) { IndexArray index; - subForEach(min, size, forward(op), index, 0, 0); + subForEach(min, size, std::forward(op), index, 0, 0); } template template void MultiArray::forEach(IndexArray const& min, SizeArray const& size, OpType&& op) const { IndexArray index; - subForEach(min, size, forward(op), index, 0, 0); + subForEach(min, size, std::forward(op), index, 0, 0); } template template void MultiArray::forEach(OpType&& op) { - forEach(IndexArray::filled(0), size(), forward(op)); + forEach(IndexArray::filled(0), size(), std::forward(op)); } template template void MultiArray::forEach(OpType&& op) const { - forEach(IndexArray::filled(0), size(), forward(op)); + forEach(IndexArray::filled(0), size(), std::forward(op)); } template @@ -461,7 +461,7 @@ void MultiArray::subForEach(IndexArray const& min, SizeArray cons if (dim == Rank - 1) op(index, m_data[offset + i]); else - subForEach(min, size, forward(op), index, (offset + i) * m_shape[dim + 1], dim + 1); + subForEach(min, size, std::forward(op), index, (offset + i) * m_shape[dim + 1], dim + 1); } } @@ -475,7 +475,7 @@ void MultiArray::subForEach(IndexArray const& min, SizeArray cons if (dim == Rank - 1) op(index, m_data[offset + i]); else - subForEach(min, size, forward(op), index, (offset + i) * m_shape[dim + 1], dim + 1); + subForEach(min, size, std::forward(op), index, (offset + i) * m_shape[dim + 1], dim + 1); } } diff --git a/source/core/StarNetElementBasicFields.hpp b/source/core/StarNetElementBasicFields.hpp index f0939a7..2d9f8e5 100644 --- a/source/core/StarNetElementBasicFields.hpp +++ b/source/core/StarNetElementBasicFields.hpp @@ -155,7 +155,7 @@ void NetElementBasicField::set(T const& value) { template void NetElementBasicField::push(T value) { - m_value = move(value); + m_value = std::move(value); updated(); m_latestUpdateVersion = m_netVersion ? m_netVersion->current() : 0; if (m_pendingInterpolatedValues) @@ -251,14 +251,14 @@ void NetElementBasicField::readNetDelta(DataStream& ds, float interpolationTi // case, this is an error or the step tracking is wildly off, so just clear // any other incoming values. if (interpolationTime > 0.0f && (m_pendingInterpolatedValues->empty() || interpolationTime >= m_pendingInterpolatedValues->last().first)) { - m_pendingInterpolatedValues->append({interpolationTime, move(t)}); + m_pendingInterpolatedValues->append({interpolationTime, std::move(t)}); } else { - m_value = move(t); + m_value = std::move(t); m_pendingInterpolatedValues->clear(); updated(); } } else { - m_value = move(t); + m_value = std::move(t); updated(); } } @@ -314,7 +314,7 @@ NetElementData::NetElementData() template NetElementData::NetElementData(function reader, function writer) - : m_reader(move(reader)), m_writer(move(writer)) {} + : m_reader(std::move(reader)), m_writer(std::move(writer)) {} template void NetElementData::readData(DataStream& ds, T& v) const { diff --git a/source/core/StarNetElementContainers.hpp b/source/core/StarNetElementContainers.hpp index 2127076..b48755d 100644 --- a/source/core/StarNetElementContainers.hpp +++ b/source/core/StarNetElementContainers.hpp @@ -124,7 +124,7 @@ void NetElementMapWrapper::initNetVersion(NetElementVersion const* vers m_changeDataLastVersion = 0; for (auto& change : Star::take(m_pendingChangeData)) - applyChange(move(change.second)); + applyChange(std::move(change.second)); addChangeData(ClearChange()); for (auto const& p : *this) @@ -140,7 +140,7 @@ template void NetElementMapWrapper::disableNetInterpolation() { m_interpolationEnabled = false; for (auto& change : Star::take(m_pendingChangeData)) - applyChange(move(change.second)); + applyChange(std::move(change.second)); } template @@ -175,7 +175,7 @@ void NetElementMapWrapper::netLoad(DataStream& ds) { for (uint64_t i = 0; i < count; ++i) { auto change = readChange(ds); addChangeData(change); - applyChange(move(change)); + applyChange(std::move(change)); } m_updated = true; @@ -219,9 +219,9 @@ void NetElementMapWrapper::readNetDelta(DataStream& ds, float interpola addChangeData(change); if (m_interpolationEnabled && interpolationTime > 0.0f) - addPendingChangeData(move(change), interpolationTime); + addPendingChangeData(std::move(change), interpolationTime); else - applyChange(move(change)); + applyChange(std::move(change)); } else { throw IOException("Improper delta code received in NetElementMapWrapper::readNetDelta"); } @@ -252,7 +252,7 @@ template auto NetElementMapWrapper::insert(value_type v) -> pair { auto res = BaseMap::insert(v); if (res.second) { - addChangeData(SetChange{move(v.first), move(v.second)}); + addChangeData(SetChange{std::move(v.first), std::move(v.second)}); m_updated = true; } return res; @@ -260,12 +260,12 @@ auto NetElementMapWrapper::insert(value_type v) -> pair auto NetElementMapWrapper::insert(key_type k, mapped_type v) -> pair { - return insert(value_type(move(k), move(v))); + return insert(value_type(std::move(k), std::move(v))); } template void NetElementMapWrapper::add(key_type k, mapped_type v) { - if (!insert(value_type(move(k), move(v))).second) + if (!insert(value_type(std::move(k), std::move(v))).second) throw MapException::format("Entry with key '{}' already present.", outputAny(k)); } @@ -274,13 +274,13 @@ void NetElementMapWrapper::set(key_type k, mapped_type v) { auto i = BaseMap::find(k); if (i != BaseMap::end()) { if (!(i->second == v)) { - addChangeData(SetChange{move(k), v}); - i->second = move(v); + addChangeData(SetChange{std::move(k), v}); + i->second = std::move(v); m_updated = true; } } else { addChangeData(SetChange{k, v}); - BaseMap::insert(value_type(move(k), move(v))); + BaseMap::insert(value_type(std::move(k), std::move(v))); m_updated = true; } } @@ -289,11 +289,11 @@ template void NetElementMapWrapper::push(key_type k, mapped_type v) { auto i = BaseMap::find(k); if (i != BaseMap::end()) { - addChangeData(SetChange(move(k), v)); - i->second = move(v); + addChangeData(SetChange(std::move(k), v)); + i->second = std::move(v); } else { addChangeData(SetChange(k, v)); - BaseMap::insert(value_type(move(k), move(v))); + BaseMap::insert(value_type(std::move(k), std::move(v))); } m_updated = true; } @@ -322,7 +322,7 @@ auto NetElementMapWrapper::take(key_type const& k) -> mapped_type { auto i = BaseMap::find(k); if (i == BaseMap::end()) throw MapException::format("Key '{}' not found in Map::take()", outputAny(k)); - auto m = move(i->second); + auto m = std::move(i->second); erase(i); return m; } @@ -332,9 +332,9 @@ auto NetElementMapWrapper::maybeTake(key_type const& k) -> Maybesecond); + auto m = std::move(i->second); erase(i); - return Maybe(move(m)); + return Maybe(std::move(m)); } template @@ -368,7 +368,7 @@ void NetElementMapWrapper::reset(BaseMap values) { } } - BaseMap::operator=(move(values)); + BaseMap::operator=(std::move(values)); } template @@ -420,7 +420,7 @@ void NetElementMapWrapper::addChangeData(ElementChange change) { uint64_t currentVersion = m_netVersion ? m_netVersion->current() : 0; starAssert(m_changeData.empty() || m_changeData.last().first <= currentVersion); - m_changeData.append({currentVersion, move(change)}); + m_changeData.append({currentVersion, std::move(change)}); m_changeDataLastVersion = max((int64_t)currentVersion - MaxChangeDataVersions, 0); while (!m_changeData.empty() && m_changeData.first().first < m_changeDataLastVersion) @@ -431,17 +431,17 @@ template void NetElementMapWrapper::addPendingChangeData(ElementChange change, float interpolationTime) { if (!m_pendingChangeData.empty() && interpolationTime < m_pendingChangeData.last().first) { for (auto& change : Star::take(m_pendingChangeData)) - applyChange(move(change.second)); + applyChange(std::move(change.second)); } - m_pendingChangeData.append({interpolationTime, move(change)}); + m_pendingChangeData.append({interpolationTime, std::move(change)}); } template void NetElementMapWrapper::applyChange(ElementChange change) { if (auto set = change.template ptr()) - BaseMap::set(move(set->key), move(set->value)); + BaseMap::set(std::move(set->key), std::move(set->value)); else if (auto remove = change.template ptr()) - BaseMap::remove(move(remove->key)); + BaseMap::remove(std::move(remove->key)); else BaseMap::clear(); m_updated = true; diff --git a/source/core/StarNetElementDynamicGroup.hpp b/source/core/StarNetElementDynamicGroup.hpp index 5d34c8d..75d11c8 100644 --- a/source/core/StarNetElementDynamicGroup.hpp +++ b/source/core/StarNetElementDynamicGroup.hpp @@ -91,7 +91,7 @@ auto NetElementDynamicGroup::addNetElement(ElementPtr element) -> Eleme readyElement(element); DataStreamBuffer storeBuffer; element->netStore(storeBuffer); - auto id = m_idMap.add(move(element)); + auto id = m_idMap.add(std::move(element)); addChangeData(ElementAddition(id, storeBuffer.takeData())); @@ -192,7 +192,7 @@ void NetElementDynamicGroup::netLoad(DataStream& ds) { element->netLoad(storeBuffer); readyElement(element); - m_idMap.add(id, move(element)); + m_idMap.add(id, std::move(element)); addChangeData(ElementAddition(id, storeBuffer.takeData())); } } @@ -256,10 +256,10 @@ void NetElementDynamicGroup::readNetDelta(DataStream& ds, float interpo m_idMap.clear(); } else if (auto addition = changeUpdate.template ptr()) { ElementPtr element = make_shared(); - DataStreamBuffer storeBuffer(move(get<1>(*addition))); + DataStreamBuffer storeBuffer(std::move(get<1>(*addition))); element->netLoad(storeBuffer); readyElement(element); - m_idMap.add(get<0>(*addition), move(element)); + m_idMap.add(get<0>(*addition), std::move(element)); } else if (auto removal = changeUpdate.template ptr()) { m_idMap.remove(*removal); } @@ -296,7 +296,7 @@ void NetElementDynamicGroup::addChangeData(ElementChange change) { uint64_t currentVersion = m_netVersion ? m_netVersion->current() : 0; starAssert(m_changeData.empty() || m_changeData.last().first <= currentVersion); - m_changeData.append({currentVersion, move(change)}); + m_changeData.append({currentVersion, std::move(change)}); m_changeDataLastVersion = max((int64_t)currentVersion - MaxChangeDataVersions, 0); while (!m_changeData.empty() && m_changeData.first().first < m_changeDataLastVersion) diff --git a/source/core/StarNetElementFloatFields.hpp b/source/core/StarNetElementFloatFields.hpp index 835b3ec..20895cd 100644 --- a/source/core/StarNetElementFloatFields.hpp +++ b/source/core/StarNetElementFloatFields.hpp @@ -92,7 +92,7 @@ void NetElementFloating::setFixedPointBase(Maybe fixedPointBase) { template void NetElementFloating::setInterpolator(function interpolator) { - m_interpolator = move(interpolator); + m_interpolator = std::move(interpolator); } template diff --git a/source/core/StarNetElementSignal.hpp b/source/core/StarNetElementSignal.hpp index c1a89ac..03a2586 100644 --- a/source/core/StarNetElementSignal.hpp +++ b/source/core/StarNetElementSignal.hpp @@ -71,7 +71,7 @@ template void NetElementSignal::disableNetInterpolation() { m_netInterpolationEnabled = false; for (auto& p : take(m_pendingSignals)) - send(move(p.second)); + send(std::move(p.second)); } template @@ -112,11 +112,11 @@ void NetElementSignal::readNetDelta(DataStream& ds, float interpolationT if (m_netInterpolationEnabled && interpolationTime > 0.0f) { if (!m_pendingSignals.empty() && m_pendingSignals.last().first > interpolationTime) { for (auto& p : take(m_pendingSignals)) - send(move(p.second)); + send(std::move(p.second)); } - m_pendingSignals.append({interpolationTime, move(s)}); + m_pendingSignals.append({interpolationTime, std::move(s)}); } else { - send(move(s)); + send(std::move(s)); } } } diff --git a/source/core/StarNetElementSyncGroup.cpp b/source/core/StarNetElementSyncGroup.cpp index 4ead00f..ac8da92 100644 --- a/source/core/StarNetElementSyncGroup.cpp +++ b/source/core/StarNetElementSyncGroup.cpp @@ -68,11 +68,11 @@ void NetElementSyncGroup::netElementsNeedLoad(bool) {} void NetElementSyncGroup::netElementsNeedStore() {} void NetElementCallbackGroup::setNeedsLoadCallback(function needsLoadCallback) { - m_netElementsNeedLoad = move(needsLoadCallback); + m_netElementsNeedLoad = std::move(needsLoadCallback); } void NetElementCallbackGroup::setNeedsStoreCallback(function needsStoreCallback) { - m_netElementsNeedStore = move(needsStoreCallback); + m_netElementsNeedStore = std::move(needsStoreCallback); } void NetElementCallbackGroup::netElementsNeedLoad(bool load) { diff --git a/source/core/StarNetElementTop.hpp b/source/core/StarNetElementTop.hpp index fa85688..454b34f 100644 --- a/source/core/StarNetElementTop.hpp +++ b/source/core/StarNetElementTop.hpp @@ -68,7 +68,7 @@ void NetElementTop::readNetState(ByteArray data, float interpola BaseNetElement::blankNetDelta(interpolationTime); } else { - DataStreamBuffer ds(move(data)); + DataStreamBuffer ds(std::move(data)); if (ds.read()) BaseNetElement::netLoad(ds); diff --git a/source/core/StarObserverStream.hpp b/source/core/StarObserverStream.hpp index c97376c..61c4f91 100644 --- a/source/core/StarObserverStream.hpp +++ b/source/core/StarObserverStream.hpp @@ -61,7 +61,7 @@ void ObserverStream::setHistoryLimit(uint64_t historyLimit) { template void ObserverStream::add(T value) { - m_values.append({m_nextStep, move(value)}); + m_values.append({m_nextStep, std::move(value)}); tick(1); } diff --git a/source/core/StarOptionParser.cpp b/source/core/StarOptionParser.cpp index f849f43..3cd32cc 100644 --- a/source/core/StarOptionParser.cpp +++ b/source/core/StarOptionParser.cpp @@ -4,29 +4,29 @@ namespace Star { void OptionParser::setCommandName(String commandName) { - m_commandName = move(commandName); + m_commandName = std::move(commandName); } void OptionParser::setSummary(String summary) { - m_summary = move(summary); + m_summary = std::move(summary); } void OptionParser::setAdditionalHelp(String help) { - m_additionalHelp = move(help); + m_additionalHelp = std::move(help); } void OptionParser::addSwitch(String const& flag, String description) { - if (!m_options.insert(flag, Switch{flag, move(description)}).second) + if (!m_options.insert(flag, Switch{flag, std::move(description)}).second) throw OptionParserException::format("Duplicate switch '-{}' added", flag); } void OptionParser::addParameter(String const& flag, String argument, RequirementMode requirementMode, String description) { - if (!m_options.insert(flag, Parameter{flag, move(argument), requirementMode, move(description)}).second) + if (!m_options.insert(flag, Parameter{flag, std::move(argument), requirementMode, std::move(description)}).second) throw OptionParserException::format("Duplicate flag '-{}' added", flag); } void OptionParser::addArgument(String argument, RequirementMode requirementMode, String description) { - m_arguments.append(Argument{move(argument), requirementMode, move(description)}); + m_arguments.append(Argument{std::move(argument), requirementMode, std::move(description)}); } pair OptionParser::parseOptions(StringList const& arguments) const { @@ -51,7 +51,7 @@ pair OptionParser::parseOptions(StringList co } if (option->is()) { - result.switches.add(move(flag)); + result.switches.add(std::move(flag)); } else { auto const& parameter = option->get(); if (!it.hasNext()) { @@ -63,7 +63,7 @@ pair OptionParser::parseOptions(StringList co errors.append(strf("Option with argument '-{}' specified multiple times", flag)); continue; } - result.parameters[move(flag)].append(move(val)); + result.parameters[std::move(flag)].append(std::move(val)); } } else { @@ -96,7 +96,7 @@ pair OptionParser::parseOptions(StringList co errors.append(strf( "Too many positional arguments given, expected at most {} got {}", maximumArguments, result.arguments.size())); - return {move(result), move(errors)}; + return {std::move(result), std::move(errors)}; } void OptionParser::printHelp(std::ostream& os) const { diff --git a/source/core/StarOrderedMap.hpp b/source/core/StarOrderedMap.hpp index 4f2dc22..8c787e0 100644 --- a/source/core/StarOrderedMap.hpp +++ b/source/core/StarOrderedMap.hpp @@ -192,7 +192,7 @@ OrderedMapWrapper::OrderedMapWrapper(Inp template