Merge pull request #19 from kblaschke/fix-compiler-warnings
Fixed a huge amount of Clang warnings
This commit is contained in:
commit
1c89042016
@ -261,16 +261,20 @@ IF (STAR_COMPILER_GNU)
|
|||||||
SET (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Ofast")
|
SET (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Ofast")
|
||||||
|
|
||||||
ELSEIF (STAR_COMPILER_CLANG)
|
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_C_FLAGS "${CMAKE_C_FLAGS} -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_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wextra -Wuninitialized -Wno-parentheses-equality -Wno-deprecated-declarations")
|
||||||
|
|
||||||
IF (STAR_SYSTEM_MACOS)
|
IF (STAR_SYSTEM_MACOS)
|
||||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
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_LANGUAGE_STANDARD "c++17")
|
||||||
SET (CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
SET (CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
||||||
ELSEIF ()
|
ELSEIF ()
|
||||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -D_REENTRANT")
|
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -D_REENTRANT")
|
||||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_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 ()
|
ENDIF ()
|
||||||
|
|
||||||
SET (CMAKE_C_FLAGS_DEBUG "-g")
|
SET (CMAKE_C_FLAGS_DEBUG "-g")
|
||||||
|
@ -7,11 +7,11 @@ namespace Star {
|
|||||||
void Application::startup(StringList const&) {}
|
void Application::startup(StringList const&) {}
|
||||||
|
|
||||||
void Application::applicationInit(ApplicationControllerPtr appController) {
|
void Application::applicationInit(ApplicationControllerPtr appController) {
|
||||||
m_appController = move(appController);
|
m_appController = std::move(appController);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::renderInit(RendererPtr renderer) {
|
void Application::renderInit(RendererPtr renderer) {
|
||||||
m_renderer = move(renderer);
|
m_renderer = std::move(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::windowChanged(WindowMode, Vec2U) {}
|
void Application::windowChanged(WindowMode, Vec2U) {}
|
||||||
|
@ -206,7 +206,7 @@ ControllerButton controllerButtonFromSdlControllerButton(uint8_t button) {
|
|||||||
class SdlPlatform {
|
class SdlPlatform {
|
||||||
public:
|
public:
|
||||||
SdlPlatform(ApplicationUPtr application, StringList cmdLineArgs) {
|
SdlPlatform(ApplicationUPtr application, StringList cmdLineArgs) {
|
||||||
m_application = move(application);
|
m_application = std::move(application);
|
||||||
|
|
||||||
// extract application path from command line args
|
// extract application path from command line args
|
||||||
String applicationPath = cmdLineArgs.first();
|
String applicationPath = cmdLineArgs.first();
|
||||||
@ -215,7 +215,7 @@ public:
|
|||||||
StringList platformArguments;
|
StringList platformArguments;
|
||||||
eraseWhere(cmdLineArgs, [&platformArguments](String& argument) {
|
eraseWhere(cmdLineArgs, [&platformArguments](String& argument) {
|
||||||
if (argument.beginsWith("+platform")) {
|
if (argument.beginsWith("+platform")) {
|
||||||
platformArguments.append(move(argument));
|
platformArguments.append(std::move(argument));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -461,7 +461,7 @@ private:
|
|||||||
Maybe<String> string;
|
Maybe<String> string;
|
||||||
if (SDL_HasClipboardText()) {
|
if (SDL_HasClipboardText()) {
|
||||||
if (auto text = SDL_GetClipboardText()) {
|
if (auto text = SDL_GetClipboardText()) {
|
||||||
if (*text != NULL)
|
if (*text != '\0')
|
||||||
string.emplace(text);
|
string.emplace(text);
|
||||||
SDL_free(text);
|
SDL_free(text);
|
||||||
}
|
}
|
||||||
@ -482,7 +482,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setApplicationTitle(String title) override {
|
void setApplicationTitle(String title) override {
|
||||||
parent->m_windowTitle = move(title);
|
parent->m_windowTitle = std::move(title);
|
||||||
if (parent->m_sdlWindow)
|
if (parent->m_sdlWindow)
|
||||||
SDL_SetWindowTitle(parent->m_sdlWindow, parent->m_windowTitle.utf8Ptr());
|
SDL_SetWindowTitle(parent->m_sdlWindow, parent->m_windowTitle.utf8Ptr());
|
||||||
}
|
}
|
||||||
@ -817,10 +817,10 @@ private:
|
|||||||
else
|
else
|
||||||
operations = { FlipImageOperation{ FlipImageOperation::Mode::FlipY } };
|
operations = { FlipImageOperation{ FlipImageOperation::Mode::FlipY } };
|
||||||
|
|
||||||
auto newImage = std::make_shared<Image>(move(processImageOperations(operations, *image)));
|
auto newImage = std::make_shared<Image>(processImageOperations(operations, *image));
|
||||||
// Fix fully transparent pixels inverting the underlying display pixel on Windows (allowing this could be made configurable per cursor later!)
|
// 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; });
|
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();
|
auto size = entry->image->size();
|
||||||
@ -907,7 +907,7 @@ private:
|
|||||||
int runMainApplication(ApplicationUPtr application, StringList cmdLineArgs) {
|
int runMainApplication(ApplicationUPtr application, StringList cmdLineArgs) {
|
||||||
try {
|
try {
|
||||||
{
|
{
|
||||||
SdlPlatform platform(move(application), move(cmdLineArgs));
|
SdlPlatform platform(std::move(application), std::move(cmdLineArgs));
|
||||||
platform.run();
|
platform.run();
|
||||||
}
|
}
|
||||||
Logger::info("Application: stopped gracefully");
|
Logger::info("Application: stopped gracefully");
|
||||||
|
@ -19,9 +19,9 @@ PcP2PNetworkingService::PcP2PNetworkingService(PcPlatformServicesStatePtr state)
|
|||||||
: m_callbackConnectionFailure(this, &PcP2PNetworkingService::steamOnConnectionFailure),
|
: m_callbackConnectionFailure(this, &PcP2PNetworkingService::steamOnConnectionFailure),
|
||||||
m_callbackJoinRequested(this, &PcP2PNetworkingService::steamOnJoinRequested),
|
m_callbackJoinRequested(this, &PcP2PNetworkingService::steamOnJoinRequested),
|
||||||
m_callbackSessionRequest(this, &PcP2PNetworkingService::steamOnSessionRequest),
|
m_callbackSessionRequest(this, &PcP2PNetworkingService::steamOnSessionRequest),
|
||||||
m_state(move(state)) {
|
m_state(std::move(state)) {
|
||||||
#else
|
#else
|
||||||
: m_state(move(state)) {
|
: m_state(std::move(state)) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef STAR_ENABLE_DISCORD_INTEGRATION
|
#ifdef STAR_ENABLE_DISCORD_INTEGRATION
|
||||||
@ -224,7 +224,7 @@ Either<String, P2PSocketUPtr> PcP2PNetworkingService::connectToPeer(P2PNetworkin
|
|||||||
if (type == "discord") {
|
if (type == "discord") {
|
||||||
auto remoteUserId = lexicalCast<discord::UserId>(peerId.extract("_"));
|
auto remoteUserId = lexicalCast<discord::UserId>(peerId.extract("_"));
|
||||||
auto lobbyId = lexicalCast<discord::LobbyId>(peerId.extract("_"));
|
auto lobbyId = lexicalCast<discord::LobbyId>(peerId.extract("_"));
|
||||||
String lobbySecret = move(peerId);
|
String lobbySecret = std::move(peerId);
|
||||||
return makeRight(discordConnectRemote(remoteUserId, lobbyId, lobbySecret));
|
return makeRight(discordConnectRemote(remoteUserId, lobbyId, lobbySecret));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -242,7 +242,7 @@ void PcP2PNetworkingService::addPendingJoin(String connectionString) {
|
|||||||
if (connectionString.extract(":") != "connect")
|
if (connectionString.extract(":") != "connect")
|
||||||
throw ApplicationException::format("malformed connection string '{}'", connectionString);
|
throw ApplicationException::format("malformed connection string '{}'", connectionString);
|
||||||
|
|
||||||
String target = move(connectionString);
|
String target = std::move(connectionString);
|
||||||
String targetType = target.extract("_");
|
String targetType = target.extract("_");
|
||||||
|
|
||||||
if (targetType == "address")
|
if (targetType == "address")
|
||||||
@ -357,7 +357,7 @@ void PcP2PNetworkingService::steamReceiveAll() {
|
|||||||
SteamNetworking()->ReadP2PPacket(data.ptr(), messageSize, &messageSize, &messageRemoteUser);
|
SteamNetworking()->ReadP2PPacket(data.ptr(), messageSize, &messageSize, &messageRemoteUser);
|
||||||
if (auto openSocket = m_steamOpenSockets.value(messageRemoteUser.ConvertToUint64())) {
|
if (auto openSocket = m_steamOpenSockets.value(messageRemoteUser.ConvertToUint64())) {
|
||||||
MutexLocker socketLocker(openSocket->mutex);
|
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<P2PSocket>(move(socket));
|
return unique_ptr<P2PSocket>(std::move(socket));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PcP2PNetworkingService::discordOnReceiveMessage(discord::LobbyId lobbyId, discord::UserId userId, discord::NetworkChannelId channel, uint8_t* data, uint32_t size) {
|
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;
|
socket->mode = DiscordSocketMode::Connected;
|
||||||
|
|
||||||
m_discordOpenSockets[userId] = socket.get();
|
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);
|
Logger::info("Accepted new discord connection from remote user {}", userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ PcPlatformServicesUPtr PcPlatformServices::create(String const& path, StringList
|
|||||||
for (auto& argument : platformArguments) {
|
for (auto& argument : platformArguments) {
|
||||||
if (argument.beginsWith("+platform:connect:")) {
|
if (argument.beginsWith("+platform:connect:")) {
|
||||||
Logger::info("PC platform services joining from command line argument '{}'", argument);
|
Logger::info("PC platform services joining from command line argument '{}'", argument);
|
||||||
p2pNetworkingService->addPendingJoin(move(argument));
|
p2pNetworkingService->addPendingJoin(std::move(argument));
|
||||||
} else {
|
} else {
|
||||||
throw ApplicationException::format("Unrecognized PC platform services command line argument '{}'", argument);
|
throw ApplicationException::format("Unrecognized PC platform services command line argument '{}'", argument);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ RenderQuad::RenderQuad(Vec2F posA, Vec2F posB, Vec2F posC, Vec2F posD, Vec4B col
|
|||||||
d = { posD, { 0, 0 }, color, param1 };
|
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());
|
Vec2F size = Vec2F(texture->size());
|
||||||
a = { minPosition, { 0, 0 }, color, param1};
|
a = { minPosition, { 0, 0 }, color, param1};
|
||||||
b = { { (minPosition[0] + size[0] * textureScale), minPosition[1] }, { size[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 };
|
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());
|
Vec2F size = Vec2F(texture->size());
|
||||||
a = { screenCoords.min(), { 0, 0 }, color, param1 };
|
a = { screenCoords.min(), { 0, 0 }, color, param1 };
|
||||||
b = { { screenCoords.xMax(), screenCoords.yMin(), }, { size[0], 0.f }, 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 };
|
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 };
|
a = { posA, uvA, color, param1 };
|
||||||
b = { posB, uvB, color, param1 };
|
b = { posB, uvB, color, param1 };
|
||||||
c = { posC, uvC, 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)
|
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)
|
RenderQuad::RenderQuad(RectF const& rect, Vec4B color, float param1)
|
||||||
: a{ rect.min(), {}, color, 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 };
|
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 };
|
a = { posA, uvA, color, param1 };
|
||||||
b = { posB, uvB, color, param1 };
|
b = { posB, uvB, color, param1 };
|
||||||
c = { posC, uvC, color, param1 };
|
c = { posC, uvC, color, param1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderQuad renderTexturedRect(TexturePtr texture, Vec2F minPosition, float textureScale, Vec4B color, float 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) {
|
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) {
|
RenderQuad renderFlatRect(RectF const& rect, Vec4B color, float param1) {
|
||||||
|
@ -416,7 +416,7 @@ List<RenderPrimitive>& OpenGl20Renderer::immediatePrimitives() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OpenGl20Renderer::render(RenderPrimitive primitive) {
|
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) {
|
void OpenGl20Renderer::renderBuffer(RenderBufferPtr const& renderBuffer, Mat3F const& transformation) {
|
||||||
@ -672,7 +672,7 @@ void OpenGl20Renderer::GlRenderBuffer::set(List<RenderPrimitive>& primitives) {
|
|||||||
glBufferData(GL_ARRAY_BUFFER, accumulationBuffer.size(), accumulationBuffer.ptr(), GL_STREAM_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, accumulationBuffer.size(), accumulationBuffer.ptr(), GL_STREAM_DRAW);
|
||||||
}
|
}
|
||||||
|
|
||||||
vertexBuffers.emplace_back(move(vb));
|
vertexBuffers.emplace_back(std::move(vb));
|
||||||
|
|
||||||
currentTextures.clear();
|
currentTextures.clear();
|
||||||
currentTextureSizes.clear();
|
currentTextureSizes.clear();
|
||||||
@ -701,7 +701,7 @@ void OpenGl20Renderer::GlRenderBuffer::set(List<RenderPrimitive>& primitives) {
|
|||||||
|
|
||||||
if (auto gt = as<GlGroupedTexture>(texture.get()))
|
if (auto gt = as<GlGroupedTexture>(texture.get()))
|
||||||
gt->incrementBufferUseCount();
|
gt->incrementBufferUseCount();
|
||||||
usedTextures.add(move(texture));
|
usedTextures.add(std::move(texture));
|
||||||
|
|
||||||
return {float(textureIndex), Vec2F(glTexture->glTextureCoordinateOffset())};
|
return {float(textureIndex), Vec2F(glTexture->glTextureCoordinateOffset())};
|
||||||
};
|
};
|
||||||
@ -723,14 +723,14 @@ void OpenGl20Renderer::GlRenderBuffer::set(List<RenderPrimitive>& primitives) {
|
|||||||
Texture* lastTexture = nullptr;
|
Texture* lastTexture = nullptr;
|
||||||
for (auto& primitive : primitives) {
|
for (auto& primitive : primitives) {
|
||||||
if (auto tri = primitive.ptr<RenderTriangle>()) {
|
if (auto tri = primitive.ptr<RenderTriangle>()) {
|
||||||
tie(textureIndex, textureOffset) = addCurrentTexture(move(tri->texture));
|
tie(textureIndex, textureOffset) = addCurrentTexture(std::move(tri->texture));
|
||||||
|
|
||||||
appendBufferVertex(tri->a, textureIndex, textureOffset);
|
appendBufferVertex(tri->a, textureIndex, textureOffset);
|
||||||
appendBufferVertex(tri->b, textureIndex, textureOffset);
|
appendBufferVertex(tri->b, textureIndex, textureOffset);
|
||||||
appendBufferVertex(tri->c, textureIndex, textureOffset);
|
appendBufferVertex(tri->c, textureIndex, textureOffset);
|
||||||
|
|
||||||
} else if (auto quad = primitive.ptr<RenderQuad>()) {
|
} else if (auto quad = primitive.ptr<RenderQuad>()) {
|
||||||
tie(textureIndex, textureOffset) = addCurrentTexture(move(quad->texture));
|
tie(textureIndex, textureOffset) = addCurrentTexture(std::move(quad->texture));
|
||||||
|
|
||||||
appendBufferVertex(quad->a, textureIndex, textureOffset);
|
appendBufferVertex(quad->a, textureIndex, textureOffset);
|
||||||
appendBufferVertex(quad->b, textureIndex, textureOffset);
|
appendBufferVertex(quad->b, textureIndex, textureOffset);
|
||||||
@ -742,7 +742,7 @@ void OpenGl20Renderer::GlRenderBuffer::set(List<RenderPrimitive>& primitives) {
|
|||||||
|
|
||||||
} else if (auto poly = primitive.ptr<RenderPoly>()) {
|
} else if (auto poly = primitive.ptr<RenderPoly>()) {
|
||||||
if (poly->vertexes.size() > 2) {
|
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) {
|
for (size_t i = 1; i < poly->vertexes.size() - 1; ++i) {
|
||||||
appendBufferVertex(poly->vertexes[0], textureIndex, textureOffset);
|
appendBufferVertex(poly->vertexes[0], textureIndex, textureOffset);
|
||||||
|
@ -33,6 +33,8 @@ public:
|
|||||||
|
|
||||||
TextureAtlasSet(unsigned cellSize, unsigned atlasNumCells);
|
TextureAtlasSet(unsigned cellSize, unsigned atlasNumCells);
|
||||||
|
|
||||||
|
virtual ~TextureAtlasSet() = default;
|
||||||
|
|
||||||
// The constant square size of all atlas textures
|
// The constant square size of all atlas textures
|
||||||
Vec2U atlasTextureSize() const;
|
Vec2U atlasTextureSize() const;
|
||||||
|
|
||||||
@ -88,6 +90,8 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct TextureEntry : Texture {
|
struct TextureEntry : Texture {
|
||||||
|
virtual ~TextureEntry() = default;
|
||||||
|
|
||||||
Vec2U imageSize() const override;
|
Vec2U imageSize() const override;
|
||||||
|
|
||||||
AtlasTextureHandle const& atlasTexture() const override;
|
AtlasTextureHandle const& atlasTexture() const override;
|
||||||
@ -168,7 +172,7 @@ auto TextureAtlasSet<AtlasTextureHandle>::addTexture(Image const& image, bool bo
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto textureEntry = make_shared<TextureEntry>();
|
auto textureEntry = make_shared<TextureEntry>();
|
||||||
textureEntry->textureImage = move(finalImage);
|
textureEntry->textureImage = std::move(finalImage);
|
||||||
textureEntry->atlasPlacement = *placement;
|
textureEntry->atlasPlacement = *placement;
|
||||||
|
|
||||||
m_textures.add(textureEntry);
|
m_textures.add(textureEntry);
|
||||||
|
@ -27,7 +27,7 @@ AnimatedPartSet::AnimatedPartSet(Json config) {
|
|||||||
newState->transitionState = stateConfig.getString("transition", "");
|
newState->transitionState = stateConfig.getString("transition", "");
|
||||||
newState->stateProperties = stateConfig.getObject("properties", {});
|
newState->stateProperties = stateConfig.getObject("properties", {});
|
||||||
newState->stateFrameProperties = stateConfig.getObject("frameProperties", {});
|
newState->stateFrameProperties = stateConfig.getObject("frameProperties", {});
|
||||||
newStateType.states[stateName] = move(newState);
|
newStateType.states[stateName] = std::move(newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
newStateType.states.sortByKey();
|
newStateType.states.sortByKey();
|
||||||
@ -38,7 +38,7 @@ AnimatedPartSet::AnimatedPartSet(Json config) {
|
|||||||
if (newStateType.defaultState.empty() && !newStateType.states.empty())
|
if (newStateType.defaultState.empty() && !newStateType.states.empty())
|
||||||
newStateType.defaultState = newStateType.states.firstKey();
|
newStateType.defaultState = newStateType.states.firstKey();
|
||||||
|
|
||||||
m_stateTypes[stateTypeName] = move(newStateType);
|
m_stateTypes[stateTypeName] = std::move(newStateType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort state types by decreasing priority.
|
// Sort state types by decreasing priority.
|
||||||
@ -61,13 +61,13 @@ AnimatedPartSet::AnimatedPartSet(Json config) {
|
|||||||
auto const& stateConfig = partStatePair.second;
|
auto const& stateConfig = partStatePair.second;
|
||||||
|
|
||||||
PartState partState = {stateConfig.getObject("properties", {}), stateConfig.getObject("frameProperties", {})};
|
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.activePart.partName = partPair.first;
|
||||||
newPart.activePartDirty = true;
|
newPart.activePartDirty = true;
|
||||||
|
|
||||||
m_parts[partName] = move(newPart);
|
m_parts[partName] = std::move(newPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& pair : m_stateTypes)
|
for (auto const& pair : m_stateTypes)
|
||||||
|
@ -71,17 +71,17 @@ Maybe<RectU> FramesSpecification::getRect(String const& frame) const {
|
|||||||
Assets::Assets(Settings settings, StringList assetSources) {
|
Assets::Assets(Settings settings, StringList assetSources) {
|
||||||
const char* const AssetsPatchSuffix = ".patch";
|
const char* const AssetsPatchSuffix = ".patch";
|
||||||
|
|
||||||
m_settings = move(settings);
|
m_settings = std::move(settings);
|
||||||
m_stopThreads = false;
|
m_stopThreads = false;
|
||||||
m_assetSources = move(assetSources);
|
m_assetSources = std::move(assetSources);
|
||||||
|
|
||||||
for (auto& sourcePath : m_assetSources) {
|
for (auto& sourcePath : m_assetSources) {
|
||||||
Logger::info("Loading assets from: '{}'", sourcePath);
|
Logger::info("Loading assets from: '{}'", sourcePath);
|
||||||
AssetSourcePtr source;
|
AssetSourcePtr source;
|
||||||
if (File::isDirectory(sourcePath))
|
if (File::isDirectory(sourcePath))
|
||||||
source = make_shared<DirectoryAssetSource>(sourcePath, m_settings.pathIgnore);
|
source = std::make_shared<DirectoryAssetSource>(sourcePath, m_settings.pathIgnore);
|
||||||
else
|
else
|
||||||
source = make_shared<PackedAssetSource>(sourcePath);
|
source = std::make_shared<PackedAssetSource>(sourcePath);
|
||||||
|
|
||||||
m_assetSourcePaths.add(sourcePath, source);
|
m_assetSourcePaths.add(sourcePath, source);
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ Json Assets::json(String const& path) const {
|
|||||||
auto components = AssetPath::split(path);
|
auto components = AssetPath::split(path);
|
||||||
validatePath(components, true, false);
|
validatePath(components, true, false);
|
||||||
|
|
||||||
return as<JsonData>(getAsset(AssetId{AssetType::Json, move(components)}))->json;
|
return as<JsonData>(getAsset(AssetId{AssetType::Json, std::move(components)}))->json;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json Assets::fetchJson(Json const& v, String const& dir) const {
|
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);
|
auto components = AssetPath::split(path);
|
||||||
validatePath(components, true, true);
|
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);
|
auto components = AssetPath::split(path);
|
||||||
validatePath(components, false, false);
|
validatePath(components, false, false);
|
||||||
|
|
||||||
return as<AudioData>(getAsset(AssetId{AssetType::Audio, move(components)}))->audio;
|
return as<AudioData>(getAsset(AssetId{AssetType::Audio, std::move(components)}))->audio;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Assets::queueAudios(StringList const& paths) const {
|
void Assets::queueAudios(StringList const& paths) const {
|
||||||
@ -288,7 +288,7 @@ void Assets::queueAudios(StringList const& paths) const {
|
|||||||
const auto components = AssetPath::split(path);
|
const auto components = AssetPath::split(path);
|
||||||
validatePath(components, false, false);
|
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);
|
auto components = AssetPath::split(path);
|
||||||
validatePath(components, false, false);
|
validatePath(components, false, false);
|
||||||
|
|
||||||
if (auto audioData = as<AudioData>(tryAsset(AssetId{AssetType::Audio, move(components)})))
|
if (auto audioData = as<AudioData>(tryAsset(AssetId{AssetType::Audio, std::move(components)})))
|
||||||
return audioData->audio;
|
return audioData->audio;
|
||||||
else
|
else
|
||||||
return {};
|
return {};
|
||||||
@ -306,14 +306,14 @@ FontConstPtr Assets::font(String const& path) const {
|
|||||||
auto components = AssetPath::split(path);
|
auto components = AssetPath::split(path);
|
||||||
validatePath(components, false, false);
|
validatePath(components, false, false);
|
||||||
|
|
||||||
return as<FontData>(getAsset(AssetId{AssetType::Font, move(components)}))->font;
|
return as<FontData>(getAsset(AssetId{AssetType::Font, std::move(components)}))->font;
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArrayConstPtr Assets::bytes(String const& path) const {
|
ByteArrayConstPtr Assets::bytes(String const& path) const {
|
||||||
auto components = AssetPath::split(path);
|
auto components = AssetPath::split(path);
|
||||||
validatePath(components, false, false);
|
validatePath(components, false, false);
|
||||||
|
|
||||||
return as<BytesData>(getAsset(AssetId{AssetType::Bytes, move(components)}))->bytes;
|
return as<BytesData>(getAsset(AssetId{AssetType::Bytes, std::move(components)}))->bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
IODevicePtr Assets::openFile(String const& path) const {
|
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 Assets::parseFramesSpecification(Json const& frameConfig, String path) {
|
||||||
FramesSpecification framesSpecification;
|
FramesSpecification framesSpecification;
|
||||||
|
|
||||||
framesSpecification.framesFile = move(path);
|
framesSpecification.framesFile = std::move(path);
|
||||||
|
|
||||||
if (frameConfig.contains("frameList")) {
|
if (frameConfig.contains("frameList")) {
|
||||||
for (auto const& pair : frameConfig.get("frameList").toObject()) {
|
for (auto const& pair : frameConfig.get("frameList").toObject()) {
|
||||||
@ -469,7 +469,7 @@ FramesSpecification Assets::parseFramesSpecification(Json const& frameConfig, St
|
|||||||
|
|
||||||
if (!framesSpecification.frames.contains(value))
|
if (!framesSpecification.frames.contains(value))
|
||||||
throw AssetException(strf("No such frame '{}' found for alias '{}'", value, key));
|
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::AssetData> Assets::loadImage(AssetPath const& path) const {
|
|||||||
for (auto const& ref : referencePaths) {
|
for (auto const& ref : referencePaths) {
|
||||||
auto components = AssetPath::split(ref);
|
auto components = AssetPath::split(ref);
|
||||||
validatePath(components, true, false);
|
validatePath(components, true, false);
|
||||||
auto refImage = as<ImageData>(loadAsset(AssetId{AssetType::Image, move(components)}));
|
auto refImage = as<ImageData>(loadAsset(AssetId{AssetType::Image, std::move(components)}));
|
||||||
if (!refImage)
|
if (!refImage)
|
||||||
return {};
|
return {};
|
||||||
references[ref] = refImage->image;
|
references[ref] = refImage->image;
|
||||||
@ -881,7 +881,7 @@ shared_ptr<Assets::AssetData> Assets::loadImage(AssetPath const& path) const {
|
|||||||
else
|
else
|
||||||
processImageOperation(entry.operation, newImage, [&](String const& ref) { return references.get(ref).get(); });
|
processImageOperation(entry.operation, newImage, [&](String const& ref) { return references.get(ref).get(); });
|
||||||
});
|
});
|
||||||
newData->image = make_shared<Image>(move(newImage));
|
newData->image = make_shared<Image>(std::move(newImage));
|
||||||
return newData;
|
return newData;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ void DirectoryAssetSource::setMetadata(JsonObject metadata) {
|
|||||||
if (!m_metadataFile)
|
if (!m_metadataFile)
|
||||||
m_metadataFile = String("/_metadata");
|
m_metadataFile = String("/_metadata");
|
||||||
|
|
||||||
m_metadata = move(metadata);
|
m_metadata = std::move(metadata);
|
||||||
|
|
||||||
if (m_metadata.empty())
|
if (m_metadata.empty())
|
||||||
File::remove(toFilesystem(*m_metadataFile));
|
File::remove(toFilesystem(*m_metadataFile));
|
||||||
@ -88,7 +88,7 @@ void DirectoryAssetSource::scanAll(String const& assetDirectory, StringList& out
|
|||||||
scanAll(assetPath + "/", output);
|
scanAll(assetPath + "/", output);
|
||||||
} else {
|
} else {
|
||||||
if (!shouldIgnore(assetPath))
|
if (!shouldIgnore(assetPath))
|
||||||
output.append(move(assetPath));
|
output.append(std::move(assetPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ void Mixer::setVolume(float volume, float rampTime) {
|
|||||||
|
|
||||||
void Mixer::play(AudioInstancePtr sample) {
|
void Mixer::play(AudioInstancePtr sample) {
|
||||||
MutexLocker locker(m_queueMutex);
|
MutexLocker locker(m_queueMutex);
|
||||||
m_audios.add(move(sample), AudioState{List<float>(m_channels, 1.0f)});
|
m_audios.add(std::move(sample), AudioState{List<float>(m_channels, 1.0f)});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mixer::stopAll(float rampTime) {
|
void Mixer::stopAll(float rampTime) {
|
||||||
|
@ -607,7 +607,7 @@ void ClientApplication::changeState(MainAppState newState) {
|
|||||||
setError(strf("Cannot join peer: {}", result.left()));
|
setError(strf("Cannot join peer: {}", result.left()));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
packetSocket = P2PPacketSocket::open(move(result.right()));
|
packetSocket = P2PPacketSocket::open(std::move(result.right()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setError("Internal error, no p2p networking service when joining p2p networking peer");
|
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();
|
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)) {
|
multiPlayerConnection.account, multiPlayerConnection.password)) {
|
||||||
setError(*errorMessage);
|
setError(*errorMessage);
|
||||||
return;
|
return;
|
||||||
@ -951,7 +951,7 @@ void ClientApplication::updateRunning(float dt) {
|
|||||||
if (m_universeServer) {
|
if (m_universeServer) {
|
||||||
if (auto p2pNetworkingService = appController()->p2pNetworkingService()) {
|
if (auto p2pNetworkingService = appController()->p2pNetworkingService()) {
|
||||||
for (auto& p2pClient : p2pNetworkingService->acceptP2PConnections())
|
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());
|
m_universeServer->setPause(m_mainInterface->escapeDialogOpen());
|
||||||
|
@ -121,7 +121,7 @@ namespace AStar {
|
|||||||
|
|
||||||
template <class Edge, class Node>
|
template <class Edge, class Node>
|
||||||
void Search<Edge, Node>::start(Node startNode, Node goalNode) {
|
void Search<Edge, Node>::start(Node startNode, Node goalNode) {
|
||||||
m_goal = move(goalNode);
|
m_goal = std::move(goalNode);
|
||||||
m_nodeMeta.clear();
|
m_nodeMeta.clear();
|
||||||
m_openQueue = std::priority_queue<ScoredNode>();
|
m_openQueue = std::priority_queue<ScoredNode>();
|
||||||
m_openSet.clear();
|
m_openSet.clear();
|
||||||
@ -137,7 +137,7 @@ namespace AStar {
|
|||||||
m_nodeMeta[startNode].score = startScore;
|
m_nodeMeta[startNode].score = startScore;
|
||||||
|
|
||||||
m_openSet.insert(startNode);
|
m_openSet.insert(startNode);
|
||||||
m_openQueue.push(ScoredNode{startScore, move(startNode)});
|
m_openQueue.push(ScoredNode{startScore, std::move(startNode)});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Edge, class Node>
|
template <class Edge, class Node>
|
||||||
@ -251,7 +251,7 @@ namespace AStar {
|
|||||||
|
|
||||||
template <class Edge, class Node>
|
template <class Edge, class Node>
|
||||||
Maybe<Path<Edge>> const& Search<Edge, Node>::findPath(Node startNode, Node goalNode) {
|
Maybe<Path<Edge>> const& Search<Edge, Node>::findPath(Node startNode, Node goalNode) {
|
||||||
start(move(startNode), move(goalNode));
|
start(std::move(startNode), std::move(goalNode));
|
||||||
explore();
|
explore();
|
||||||
return result();
|
return result();
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ template <typename ToType>
|
|||||||
struct construct {
|
struct construct {
|
||||||
template <typename... FromTypes>
|
template <typename... FromTypes>
|
||||||
ToType operator()(FromTypes&&... fromTypes) const {
|
ToType operator()(FromTypes&&... fromTypes) const {
|
||||||
return ToType(forward<FromTypes>(fromTypes)...);
|
return ToType(std::forward<FromTypes>(fromTypes)...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ template <typename Func>
|
|||||||
struct SwallowReturn {
|
struct SwallowReturn {
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
void operator()(T&&... args) {
|
void operator()(T&&... args) {
|
||||||
func(forward<T>(args)...);
|
func(std::forward<T>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
Func func;
|
Func func;
|
||||||
@ -37,7 +37,7 @@ struct SwallowReturn {
|
|||||||
|
|
||||||
template <typename Func>
|
template <typename Func>
|
||||||
SwallowReturn<Func> swallow(Func f) {
|
SwallowReturn<Func> swallow(Func f) {
|
||||||
return SwallowReturn<Func>{move(f)};
|
return SwallowReturn<Func>{std::move(f)};
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Empty {
|
struct Empty {
|
||||||
@ -58,18 +58,18 @@ struct FunctionComposer {
|
|||||||
|
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
decltype(auto) operator()(T&&... args) {
|
decltype(auto) operator()(T&&... args) {
|
||||||
return f1(f2(forward<T>(args)...));
|
return f1(f2(std::forward<T>(args)...));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename FirstFunction, typename SecondFunction>
|
template <typename FirstFunction, typename SecondFunction>
|
||||||
decltype(auto) compose(FirstFunction&& firstFunction, SecondFunction&& secondFunction) {
|
decltype(auto) compose(FirstFunction&& firstFunction, SecondFunction&& secondFunction) {
|
||||||
return FunctionComposer<FirstFunction, SecondFunction>{move(forward<FirstFunction>(firstFunction)), move(forward<SecondFunction>(secondFunction))};
|
return FunctionComposer<FirstFunction, SecondFunction>{std::move(std::forward<FirstFunction>(firstFunction)), std::move(std::forward<SecondFunction>(secondFunction))};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FirstFunction, typename SecondFunction, typename ThirdFunction, typename... RestFunctions>
|
template <typename FirstFunction, typename SecondFunction, typename ThirdFunction, typename... RestFunctions>
|
||||||
decltype(auto) compose(FirstFunction firstFunction, SecondFunction secondFunction, ThirdFunction thirdFunction, RestFunctions... restFunctions) {
|
decltype(auto) compose(FirstFunction firstFunction, SecondFunction secondFunction, ThirdFunction thirdFunction, RestFunctions... restFunctions) {
|
||||||
return compose(forward<FirstFunction>(firstFunction), compose(forward<SecondFunction>(secondFunction), compose(forward<ThirdFunction>(thirdFunction), forward<RestFunctions>(restFunctions)...)));
|
return compose(std::forward<FirstFunction>(firstFunction), compose(std::forward<SecondFunction>(secondFunction), compose(std::forward<ThirdFunction>(thirdFunction), std::forward<RestFunctions>(restFunctions)...)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Container, typename Value, typename Function>
|
template <typename Container, typename Value, typename Function>
|
||||||
@ -260,7 +260,7 @@ void sortByComputedValue(Container& container, Getter&& valueGetter, bool stable
|
|||||||
|
|
||||||
template <typename Container, typename Getter>
|
template <typename Container, typename Getter>
|
||||||
void stableSortByComputedValue(Container& container, Getter&& valueGetter) {
|
void stableSortByComputedValue(Container& container, Getter&& valueGetter) {
|
||||||
return sortByComputedValue(container, forward<Getter>(valueGetter), true);
|
return sortByComputedValue(container, std::forward<Getter>(valueGetter), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Container>
|
template <typename Container>
|
||||||
@ -293,7 +293,7 @@ template <typename OutContainer, typename InContainer, typename Function>
|
|||||||
void transformInto(OutContainer& outContainer, InContainer&& inContainer, Function&& function) {
|
void transformInto(OutContainer& outContainer, InContainer&& inContainer, Function&& function) {
|
||||||
for (auto&& elem : inContainer) {
|
for (auto&& elem : inContainer) {
|
||||||
if (std::is_rvalue_reference<InContainer&&>::value)
|
if (std::is_rvalue_reference<InContainer&&>::value)
|
||||||
outContainer.insert(outContainer.end(), function(move(elem)));
|
outContainer.insert(outContainer.end(), function(std::move(elem)));
|
||||||
else
|
else
|
||||||
outContainer.insert(outContainer.end(), function(elem));
|
outContainer.insert(outContainer.end(), function(elem));
|
||||||
}
|
}
|
||||||
@ -302,7 +302,7 @@ void transformInto(OutContainer& outContainer, InContainer&& inContainer, Functi
|
|||||||
template <typename OutContainer, typename InContainer, typename Function>
|
template <typename OutContainer, typename InContainer, typename Function>
|
||||||
OutContainer transform(InContainer&& container, Function&& function) {
|
OutContainer transform(InContainer&& container, Function&& function) {
|
||||||
OutContainer res;
|
OutContainer res;
|
||||||
transformInto(res, forward<InContainer>(container), forward<Function>(function));
|
transformInto(res, std::forward<InContainer>(container), std::forward<Function>(function));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ OutputContainer zipWith(Function&& function, Container1 const& cont1, Container2
|
|||||||
// default constructed state.
|
// default constructed state.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T take(T& t) {
|
T take(T& t) {
|
||||||
T t2 = move(t);
|
T t2 = std::move(t);
|
||||||
t = T();
|
t = T();
|
||||||
return t2;
|
return t2;
|
||||||
}
|
}
|
||||||
@ -356,7 +356,7 @@ public:
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
OutputProxy& operator=(T&& value) {
|
OutputProxy& operator=(T&& value) {
|
||||||
m_function(forward<T>(value));
|
m_function(std::forward<T>(value));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
explicit FunctionOutputIterator(UnaryFunction f = UnaryFunction())
|
explicit FunctionOutputIterator(UnaryFunction f = UnaryFunction())
|
||||||
: m_function(move(f)) {}
|
: m_function(std::move(f)) {}
|
||||||
|
|
||||||
OutputProxy operator*() {
|
OutputProxy operator*() {
|
||||||
return OutputProxy(m_function);
|
return OutputProxy(m_function);
|
||||||
@ -385,7 +385,7 @@ private:
|
|||||||
|
|
||||||
template <typename UnaryFunction>
|
template <typename UnaryFunction>
|
||||||
FunctionOutputIterator<UnaryFunction> makeFunctionOutputIterator(UnaryFunction f) {
|
FunctionOutputIterator<UnaryFunction> makeFunctionOutputIterator(UnaryFunction f) {
|
||||||
return FunctionOutputIterator<UnaryFunction>(move(f));
|
return FunctionOutputIterator<UnaryFunction>(std::move(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wraps a nullary function to produce an input iterator
|
// Wraps a nullary function to produce an input iterator
|
||||||
@ -401,7 +401,7 @@ public:
|
|||||||
typedef typename std::result_of<NullaryFunction()>::type FunctionReturnType;
|
typedef typename std::result_of<NullaryFunction()>::type FunctionReturnType;
|
||||||
|
|
||||||
explicit FunctionInputIterator(NullaryFunction f = {})
|
explicit FunctionInputIterator(NullaryFunction f = {})
|
||||||
: m_function(move(f)) {}
|
: m_function(std::move(f)) {}
|
||||||
|
|
||||||
FunctionReturnType operator*() {
|
FunctionReturnType operator*() {
|
||||||
return m_function();
|
return m_function();
|
||||||
@ -421,7 +421,7 @@ private:
|
|||||||
|
|
||||||
template <typename NullaryFunction>
|
template <typename NullaryFunction>
|
||||||
FunctionInputIterator<NullaryFunction> makeFunctionInputIterator(NullaryFunction f) {
|
FunctionInputIterator<NullaryFunction> makeFunctionInputIterator(NullaryFunction f) {
|
||||||
return FunctionInputIterator<NullaryFunction>(move(f));
|
return FunctionInputIterator<NullaryFunction>(std::move(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Iterable>
|
template <typename Iterable>
|
||||||
@ -449,14 +449,14 @@ ReverseWrapper<Iterable> reverseIterate(Iterable& list) {
|
|||||||
template <typename Functor>
|
template <typename Functor>
|
||||||
class FinallyGuard {
|
class FinallyGuard {
|
||||||
public:
|
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();
|
o.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
FinallyGuard& operator=(FinallyGuard&& o) {
|
FinallyGuard& operator=(FinallyGuard&& o) {
|
||||||
functor = move(o.functor);
|
functor = std::move(o.functor);
|
||||||
dismiss = o.dismiss;
|
dismiss = o.dismiss;
|
||||||
o.cancel();
|
o.cancel();
|
||||||
return *this;
|
return *this;
|
||||||
@ -478,7 +478,7 @@ private:
|
|||||||
|
|
||||||
template <typename Functor>
|
template <typename Functor>
|
||||||
FinallyGuard<typename std::decay<Functor>::type> finally(Functor&& f) {
|
FinallyGuard<typename std::decay<Functor>::type> finally(Functor&& f) {
|
||||||
return FinallyGuard<Functor>(forward<Functor>(f));
|
return FinallyGuard<Functor>(std::forward<Functor>(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generates compile time sequences of indexes from MinIndex to MaxIndex
|
// Generates compile time sequences of indexes from MinIndex to MaxIndex
|
||||||
@ -498,12 +498,12 @@ struct GenIndexSequence<Min, Min, S...> {
|
|||||||
|
|
||||||
template <typename Function, typename Tuple, size_t... Indexes>
|
template <typename Function, typename Tuple, size_t... Indexes>
|
||||||
decltype(auto) tupleUnpackFunctionIndexes(Function&& function, Tuple&& args, IndexSequence<Indexes...> const&) {
|
decltype(auto) tupleUnpackFunctionIndexes(Function&& function, Tuple&& args, IndexSequence<Indexes...> const&) {
|
||||||
return function(get<Indexes>(forward<Tuple>(args))...);
|
return function(get<Indexes>(std::forward<Tuple>(args))...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Function, typename Tuple>
|
template <typename Function, typename Tuple>
|
||||||
decltype(auto) tupleUnpackFunction(Function&& function, Tuple&& args) {
|
decltype(auto) tupleUnpackFunction(Function&& function, Tuple&& args) {
|
||||||
return tupleUnpackFunctionIndexes<Function, Tuple>(forward<Function>(function), forward<Tuple>(args),
|
return tupleUnpackFunctionIndexes<Function, Tuple>(std::forward<Function>(function), std::forward<Tuple>(args),
|
||||||
typename GenIndexSequence<0, std::tuple_size<typename std::decay<Tuple>::type>::value>::type());
|
typename GenIndexSequence<0, std::tuple_size<typename std::decay<Tuple>::type>::value>::type());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -512,12 +512,12 @@ decltype(auto) tupleUnpackFunction(Function&& function, Tuple&& args) {
|
|||||||
|
|
||||||
template <typename Function, typename Tuple, size_t... Indexes>
|
template <typename Function, typename Tuple, size_t... Indexes>
|
||||||
decltype(auto) tupleApplyFunctionIndexes(Function&& function, Tuple&& args, IndexSequence<Indexes...> const&) {
|
decltype(auto) tupleApplyFunctionIndexes(Function&& function, Tuple&& args, IndexSequence<Indexes...> const&) {
|
||||||
return make_tuple(function(get<Indexes>(forward<Tuple>(args)))...);
|
return make_tuple(function(get<Indexes>(std::forward<Tuple>(args)))...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Function, typename Tuple>
|
template <typename Function, typename Tuple>
|
||||||
decltype(auto) tupleApplyFunction(Function&& function, Tuple&& args) {
|
decltype(auto) tupleApplyFunction(Function&& function, Tuple&& args) {
|
||||||
return tupleApplyFunctionIndexes<Function, Tuple>(forward<Function>(function), forward<Tuple>(args),
|
return tupleApplyFunctionIndexes<Function, Tuple>(std::forward<Function>(function), std::forward<Tuple>(args),
|
||||||
typename GenIndexSequence<0, std::tuple_size<typename std::decay<Tuple>::type>::value>::type());
|
typename GenIndexSequence<0, std::tuple_size<typename std::decay<Tuple>::type>::value>::type());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,35 +530,35 @@ void tupleCallFunctionCaller(Function&&, Tuple&&) {}
|
|||||||
|
|
||||||
template <typename Tuple, typename Function, typename First, typename... Rest>
|
template <typename Tuple, typename Function, typename First, typename... Rest>
|
||||||
void tupleCallFunctionCaller(Tuple&& t, Function&& function) {
|
void tupleCallFunctionCaller(Tuple&& t, Function&& function) {
|
||||||
tupleCallFunctionCaller<Tuple, Function, Rest...>(forward<Tuple>(t), forward<Function>(function));
|
tupleCallFunctionCaller<Tuple, Function, Rest...>(std::forward<Tuple>(t), std::forward<Function>(function));
|
||||||
function(get<sizeof...(Rest)>(forward<Tuple>(t)));
|
function(get<sizeof...(Rest)>(std::forward<Tuple>(t)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Tuple, typename Function, typename... T>
|
template <typename Tuple, typename Function, typename... T>
|
||||||
void tupleCallFunctionExpander(Tuple&& t, Function&& function, tuple<T...> const&) {
|
void tupleCallFunctionExpander(Tuple&& t, Function&& function, tuple<T...> const&) {
|
||||||
tupleCallFunctionCaller<Tuple, Function, T...>(forward<Tuple>(t), forward<Function>(function));
|
tupleCallFunctionCaller<Tuple, Function, T...>(std::forward<Tuple>(t), std::forward<Function>(function));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Tuple, typename Function>
|
template <typename Tuple, typename Function>
|
||||||
void tupleCallFunction(Tuple&& t, Function&& function) {
|
void tupleCallFunction(Tuple&& t, Function&& function) {
|
||||||
tupleCallFunctionExpander<Tuple, Function>(forward<Tuple>(t), forward<Function>(function), forward<Tuple>(t));
|
tupleCallFunctionExpander<Tuple, Function>(std::forward<Tuple>(t), std::forward<Function>(function), std::forward<Tuple>(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a subset of a tuple
|
// Get a subset of a tuple
|
||||||
|
|
||||||
template <typename Tuple, size_t... Indexes>
|
template <typename Tuple, size_t... Indexes>
|
||||||
decltype(auto) subTupleIndexes(Tuple&& t, IndexSequence<Indexes...> const&) {
|
decltype(auto) subTupleIndexes(Tuple&& t, IndexSequence<Indexes...> const&) {
|
||||||
return make_tuple(get<Indexes>(forward<Tuple>(t))...);
|
return make_tuple(get<Indexes>(std::forward<Tuple>(t))...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t Min, size_t Size, typename Tuple>
|
template <size_t Min, size_t Size, typename Tuple>
|
||||||
decltype(auto) subTuple(Tuple&& t) {
|
decltype(auto) subTuple(Tuple&& t) {
|
||||||
return subTupleIndexes(forward<Tuple>(t), GenIndexSequence<Min, Size>::type());
|
return subTupleIndexes(std::forward<Tuple>(t), GenIndexSequence<Min, Size>::type());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t Trim, typename Tuple>
|
template <size_t Trim, typename Tuple>
|
||||||
decltype(auto) trimTuple(Tuple&& t) {
|
decltype(auto) trimTuple(Tuple&& t) {
|
||||||
return subTupleIndexes(forward<Tuple>(t), typename GenIndexSequence<Trim, std::tuple_size<typename std::decay<Tuple>::type>::value>::type());
|
return subTupleIndexes(std::forward<Tuple>(t), typename GenIndexSequence<Trim, std::tuple_size<typename std::decay<Tuple>::type>::value>::type());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unpack a parameter expansion into a container
|
// Unpack a parameter expansion into a container
|
||||||
@ -568,14 +568,14 @@ void unpackVariadicImpl(Container&) {}
|
|||||||
|
|
||||||
template <typename Container, typename TFirst, typename... TRest>
|
template <typename Container, typename TFirst, typename... TRest>
|
||||||
void unpackVariadicImpl(Container& container, TFirst&& tfirst, TRest&&... trest) {
|
void unpackVariadicImpl(Container& container, TFirst&& tfirst, TRest&&... trest) {
|
||||||
container.insert(container.end(), forward<TFirst>(tfirst));
|
container.insert(container.end(), std::forward<TFirst>(tfirst));
|
||||||
unpackVariadicImpl(container, forward<TRest>(trest)...);
|
unpackVariadicImpl(container, std::forward<TRest>(trest)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Container, typename... T>
|
template <typename Container, typename... T>
|
||||||
Container unpackVariadic(T&&... t) {
|
Container unpackVariadic(T&&... t) {
|
||||||
Container c;
|
Container c;
|
||||||
unpackVariadicImpl(c, forward<T>(t)...);
|
unpackVariadicImpl(c, std::forward<T>(t)...);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,7 +587,7 @@ void callFunctionVariadic(Function&&) {}
|
|||||||
template <typename Function, typename Arg1, typename... ArgRest>
|
template <typename Function, typename Arg1, typename... ArgRest>
|
||||||
void callFunctionVariadic(Function&& function, Arg1&& arg1, ArgRest&&... argRest) {
|
void callFunctionVariadic(Function&& function, Arg1&& arg1, ArgRest&&... argRest) {
|
||||||
function(arg1);
|
function(arg1);
|
||||||
callFunctionVariadic(forward<Function>(function), forward<ArgRest>(argRest)...);
|
callFunctionVariadic(std::forward<Function>(function), std::forward<ArgRest>(argRest)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Rest>
|
template <typename... Rest>
|
||||||
|
@ -133,18 +133,18 @@ bool AssetPath::operator==(AssetPath const& rhs) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AssetPath::AssetPath(const char* path) {
|
AssetPath::AssetPath(const char* path) {
|
||||||
*this = move(AssetPath::split(path));
|
*this = AssetPath::split(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AssetPath::AssetPath(String const& path) {
|
AssetPath::AssetPath(String const& path) {
|
||||||
*this = move(AssetPath::split(path));
|
*this = AssetPath::split(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetPath::AssetPath(String&& basePath, Maybe<String>&& subPath, DirectivesGroup&& directives) {
|
AssetPath::AssetPath(String&& basePath, Maybe<String>&& subPath, DirectivesGroup&& directives) {
|
||||||
this->basePath = move(basePath);
|
this->basePath = std::move(basePath);
|
||||||
this->subPath = move(subPath);
|
this->subPath = std::move(subPath);
|
||||||
this->directives = move(directives);
|
this->directives = std::move(directives);
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetPath::AssetPath(String const& basePath, Maybe<String> const& subPath, DirectivesGroup const& directives) {
|
AssetPath::AssetPath(String const& basePath, Maybe<String> const& subPath, DirectivesGroup const& directives) {
|
||||||
@ -176,7 +176,7 @@ DataStream& operator>>(DataStream& ds, AssetPath& path) {
|
|||||||
String string;
|
String string;
|
||||||
ds.read(string);
|
ds.read(string);
|
||||||
|
|
||||||
path = move(string);
|
path = std::move(string);
|
||||||
|
|
||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
|
@ -47,11 +47,11 @@ AtomicSharedPtr<T>::AtomicSharedPtr(AtomicSharedPtr const& p)
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
AtomicSharedPtr<T>::AtomicSharedPtr(AtomicSharedPtr&& p)
|
AtomicSharedPtr<T>::AtomicSharedPtr(AtomicSharedPtr&& p)
|
||||||
: m_ptr(move(p.m_ptr)) {}
|
: m_ptr(std::move(p.m_ptr)) {}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
AtomicSharedPtr<T>::AtomicSharedPtr(SharedPtr p)
|
AtomicSharedPtr<T>::AtomicSharedPtr(SharedPtr p)
|
||||||
: m_ptr(move(p)) {}
|
: m_ptr(std::move(p)) {}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
auto AtomicSharedPtr<T>::load() const -> SharedPtr {
|
auto AtomicSharedPtr<T>::load() const -> SharedPtr {
|
||||||
@ -68,7 +68,7 @@ auto AtomicSharedPtr<T>::weak() const -> WeakPtr {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void AtomicSharedPtr<T>::store(SharedPtr p) {
|
void AtomicSharedPtr<T>::store(SharedPtr p) {
|
||||||
SpinLocker locker(m_lock);
|
SpinLocker locker(m_lock);
|
||||||
m_ptr = move(p);
|
m_ptr = std::move(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -105,14 +105,14 @@ AtomicSharedPtr<T>& AtomicSharedPtr<T>::operator=(AtomicSharedPtr const& p) {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
AtomicSharedPtr<T>& AtomicSharedPtr<T>::operator=(AtomicSharedPtr&& p) {
|
AtomicSharedPtr<T>& AtomicSharedPtr<T>::operator=(AtomicSharedPtr&& p) {
|
||||||
SpinLocker locker(m_lock);
|
SpinLocker locker(m_lock);
|
||||||
m_ptr = move(p.m_ptr);
|
m_ptr = std::move(p.m_ptr);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
AtomicSharedPtr<T>& AtomicSharedPtr<T>::operator=(SharedPtr p) {
|
AtomicSharedPtr<T>& AtomicSharedPtr<T>::operator=(SharedPtr p) {
|
||||||
SpinLocker locker(m_lock);
|
SpinLocker locker(m_lock);
|
||||||
m_ptr = move(p);
|
m_ptr = std::move(p);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ namespace {
|
|||||||
for (size_t i = 0; i < pcmData->size() / 2; ++i)
|
for (size_t i = 0; i < pcmData->size() / 2; ++i)
|
||||||
fromByteOrder(ByteOrder::LittleEndian, pcmData->ptr() + i * 2, 2);
|
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) {
|
UncompressedAudioImpl(ByteArrayConstPtr data, unsigned channels, unsigned sampleRate) {
|
||||||
m_channels = channels;
|
m_channels = channels;
|
||||||
m_sampleRate = sampleRate;
|
m_sampleRate = sampleRate;
|
||||||
m_audioData = move(data);
|
m_audioData = std::move(data);
|
||||||
m_memoryFile.reset(m_audioData->ptr(), m_audioData->size());
|
m_memoryFile.reset(m_audioData->ptr(), m_audioData->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ Audio::Audio(IODevicePtr device) {
|
|||||||
|
|
||||||
if (isUncompressed(device)) {
|
if (isUncompressed(device)) {
|
||||||
WaveData data = parseWav(device);
|
WaveData data = parseWav(device);
|
||||||
m_uncompressed = make_shared<UncompressedAudioImpl>(move(data.byteArray), data.channels, data.sampleRate);
|
m_uncompressed = make_shared<UncompressedAudioImpl>(std::move(data.byteArray), data.channels, data.sampleRate);
|
||||||
} else {
|
} else {
|
||||||
m_compressed = make_shared<CompressedAudioImpl>(device);
|
m_compressed = make_shared<CompressedAudioImpl>(device);
|
||||||
if (!m_compressed->open())
|
if (!m_compressed->open())
|
||||||
@ -348,7 +348,7 @@ Audio::Audio(Audio const& audio) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Audio::Audio(Audio&& audio) {
|
Audio::Audio(Audio&& audio) {
|
||||||
operator=(move(audio));
|
operator=(std::move(audio));
|
||||||
}
|
}
|
||||||
|
|
||||||
Audio& Audio::operator=(Audio const& audio) {
|
Audio& Audio::operator=(Audio const& audio) {
|
||||||
@ -365,8 +365,8 @@ Audio& Audio::operator=(Audio const& audio) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Audio& Audio::operator=(Audio&& audio) {
|
Audio& Audio::operator=(Audio&& audio) {
|
||||||
m_compressed = move(audio.m_compressed);
|
m_compressed = std::move(audio.m_compressed);
|
||||||
m_uncompressed = move(audio.m_uncompressed);
|
m_uncompressed = std::move(audio.m_uncompressed);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,18 +284,18 @@ template <typename Base>
|
|||||||
template <typename Visitor>
|
template <typename Visitor>
|
||||||
void BTreeMixin<Base>::forEach(Key const& lower, Key const& upper, Visitor&& visitor) {
|
void BTreeMixin<Base>::forEach(Key const& lower, Key const& upper, Visitor&& visitor) {
|
||||||
if (Base::rootIsLeaf())
|
if (Base::rootIsLeaf())
|
||||||
forEach(Base::loadLeaf(Base::rootPointer()), lower, upper, forward<Visitor>(visitor));
|
forEach(Base::loadLeaf(Base::rootPointer()), lower, upper, std::forward<Visitor>(visitor));
|
||||||
else
|
else
|
||||||
forEach(Base::loadIndex(Base::rootPointer()), lower, upper, forward<Visitor>(visitor));
|
forEach(Base::loadIndex(Base::rootPointer()), lower, upper, std::forward<Visitor>(visitor));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
template <typename Visitor>
|
template <typename Visitor>
|
||||||
void BTreeMixin<Base>::forAll(Visitor&& visitor) {
|
void BTreeMixin<Base>::forAll(Visitor&& visitor) {
|
||||||
if (Base::rootIsLeaf())
|
if (Base::rootIsLeaf())
|
||||||
forAll(Base::loadLeaf(Base::rootPointer()), forward<Visitor>(visitor));
|
forAll(Base::loadLeaf(Base::rootPointer()), std::forward<Visitor>(visitor));
|
||||||
else
|
else
|
||||||
forAll(Base::loadIndex(Base::rootPointer()), forward<Visitor>(visitor));
|
forAll(Base::loadIndex(Base::rootPointer()), std::forward<Visitor>(visitor));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
@ -303,9 +303,9 @@ template <typename Visitor, typename ErrorHandler>
|
|||||||
void BTreeMixin<Base>::recoverAll(Visitor&& visitor, ErrorHandler&& error) {
|
void BTreeMixin<Base>::recoverAll(Visitor&& visitor, ErrorHandler&& error) {
|
||||||
try {
|
try {
|
||||||
if (Base::rootIsLeaf())
|
if (Base::rootIsLeaf())
|
||||||
recoverAll(Base::loadLeaf(Base::rootPointer()), forward<Visitor>(visitor), forward<ErrorHandler>(error));
|
recoverAll(Base::loadLeaf(Base::rootPointer()), std::forward<Visitor>(visitor), std::forward<ErrorHandler>(error));
|
||||||
else
|
else
|
||||||
recoverAll(Base::loadIndex(Base::rootPointer()), forward<Visitor>(visitor), forward<ErrorHandler>(error));
|
recoverAll(Base::loadIndex(Base::rootPointer()), std::forward<Visitor>(visitor), std::forward<ErrorHandler>(error));
|
||||||
} catch (std::exception const& e) {
|
} catch (std::exception const& e) {
|
||||||
error("Error loading root index or leaf node", e);
|
error("Error loading root index or leaf node", e);
|
||||||
}
|
}
|
||||||
@ -317,17 +317,17 @@ void BTreeMixin<Base>::forAllNodes(Visitor&& visitor) {
|
|||||||
if (Base::rootIsLeaf())
|
if (Base::rootIsLeaf())
|
||||||
visitor(Base::loadLeaf(Base::rootPointer()));
|
visitor(Base::loadLeaf(Base::rootPointer()));
|
||||||
else
|
else
|
||||||
forAllNodes(Base::loadIndex(Base::rootPointer()), forward<Visitor>(visitor));
|
forAllNodes(Base::loadIndex(Base::rootPointer()), std::forward<Visitor>(visitor));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
bool BTreeMixin<Base>::insert(Key k, Data data) {
|
bool BTreeMixin<Base>::insert(Key k, Data data) {
|
||||||
return modify(DataElement{move(k), move(data)}, InsertAction);
|
return modify(DataElement{std::move(k), std::move(data)}, InsertAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
bool BTreeMixin<Base>::remove(Key k) {
|
bool BTreeMixin<Base>::remove(Key k) {
|
||||||
return modify(DataElement{move(k), Data()}, RemoveAction);
|
return modify(DataElement{std::move(k), Data()}, RemoveAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
@ -422,7 +422,7 @@ bool BTreeMixin<Base>::LeafCounter::operator()(Leaf const&) {
|
|||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
BTreeMixin<Base>::ModifyInfo::ModifyInfo(ModifyAction a, DataElement e)
|
BTreeMixin<Base>::ModifyInfo::ModifyInfo(ModifyAction a, DataElement e)
|
||||||
: targetElement(move(e)), action(a) {
|
: targetElement(std::move(e)), action(a) {
|
||||||
found = false;
|
found = false;
|
||||||
state = Done;
|
state = Done;
|
||||||
}
|
}
|
||||||
@ -466,9 +466,9 @@ auto BTreeMixin<Base>::forEach(Index const& index, Key const& lower, Key const&
|
|||||||
Key lastKey;
|
Key lastKey;
|
||||||
|
|
||||||
if (Base::indexLevel(index) == 0)
|
if (Base::indexLevel(index) == 0)
|
||||||
lastKey = forEach(Base::loadLeaf(Base::indexPointer(index, i)), lower, upper, forward<Visitor>(o));
|
lastKey = forEach(Base::loadLeaf(Base::indexPointer(index, i)), lower, upper, std::forward<Visitor>(o));
|
||||||
else
|
else
|
||||||
lastKey = forEach(Base::loadIndex(Base::indexPointer(index, i)), lower, upper, forward<Visitor>(o));
|
lastKey = forEach(Base::loadIndex(Base::indexPointer(index, i)), lower, upper, std::forward<Visitor>(o));
|
||||||
|
|
||||||
if (!(lastKey < upper))
|
if (!(lastKey < upper))
|
||||||
return lastKey;
|
return lastKey;
|
||||||
@ -483,9 +483,9 @@ auto BTreeMixin<Base>::forEach(Index const& index, Key const& lower, Key const&
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Base::indexLevel(index) == 0)
|
if (Base::indexLevel(index) == 0)
|
||||||
lastKey = forEach(Base::loadLeaf(Base::indexPointer(index, i)), lower, upper, forward<Visitor>(o));
|
lastKey = forEach(Base::loadLeaf(Base::indexPointer(index, i)), lower, upper, std::forward<Visitor>(o));
|
||||||
else
|
else
|
||||||
lastKey = forEach(Base::loadIndex(Base::indexPointer(index, i)), lower, upper, forward<Visitor>(o));
|
lastKey = forEach(Base::loadIndex(Base::indexPointer(index, i)), lower, upper, std::forward<Visitor>(o));
|
||||||
|
|
||||||
if (!(lastKey < upper))
|
if (!(lastKey < upper))
|
||||||
break;
|
break;
|
||||||
@ -530,9 +530,9 @@ auto BTreeMixin<Base>::forAll(Index const& index, Visitor&& o) -> Key {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Base::indexLevel(index) == 0)
|
if (Base::indexLevel(index) == 0)
|
||||||
lastKey = forAll(Base::loadLeaf(Base::indexPointer(index, i)), forward<Visitor>(o));
|
lastKey = forAll(Base::loadLeaf(Base::indexPointer(index, i)), std::forward<Visitor>(o));
|
||||||
else
|
else
|
||||||
lastKey = forAll(Base::loadIndex(Base::indexPointer(index, i)), forward<Visitor>(o));
|
lastKey = forAll(Base::loadIndex(Base::indexPointer(index, i)), std::forward<Visitor>(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
return lastKey;
|
return lastKey;
|
||||||
@ -550,7 +550,7 @@ auto BTreeMixin<Base>::forAll(Leaf const& leaf, Visitor&& o) -> Key {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (auto nextLeafPointer = Base::nextLeaf(leaf))
|
if (auto nextLeafPointer = Base::nextLeaf(leaf))
|
||||||
return forAll(Base::loadLeaf(*nextLeafPointer), forward<Visitor>(o));
|
return forAll(Base::loadLeaf(*nextLeafPointer), std::forward<Visitor>(o));
|
||||||
else
|
else
|
||||||
return Base::leafKey(leaf, Base::leafElementCount(leaf) - 1);
|
return Base::leafKey(leaf, Base::leafElementCount(leaf) - 1);
|
||||||
}
|
}
|
||||||
@ -562,13 +562,13 @@ void BTreeMixin<Base>::recoverAll(Index const& index, Visitor&& visitor, ErrorHa
|
|||||||
for (size_t i = 0; i < Base::indexPointerCount(index); ++i) {
|
for (size_t i = 0; i < Base::indexPointerCount(index); ++i) {
|
||||||
if (Base::indexLevel(index) == 0) {
|
if (Base::indexLevel(index) == 0) {
|
||||||
try {
|
try {
|
||||||
recoverAll(Base::loadLeaf(Base::indexPointer(index, i)), forward<Visitor>(visitor), forward<ErrorHandler>(error));
|
recoverAll(Base::loadLeaf(Base::indexPointer(index, i)), std::forward<Visitor>(visitor), std::forward<ErrorHandler>(error));
|
||||||
} catch (std::exception const& e) {
|
} catch (std::exception const& e) {
|
||||||
error("Error loading leaf node", e);
|
error("Error loading leaf node", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
recoverAll(Base::loadIndex(Base::indexPointer(index, i)), forward<Visitor>(visitor), forward<ErrorHandler>(error));
|
recoverAll(Base::loadIndex(Base::indexPointer(index, i)), std::forward<Visitor>(visitor), std::forward<ErrorHandler>(error));
|
||||||
} catch (std::exception const& e) {
|
} catch (std::exception const& e) {
|
||||||
error("Error loading index node", e);
|
error("Error loading index node", e);
|
||||||
}
|
}
|
||||||
@ -608,7 +608,7 @@ void BTreeMixin<Base>::modify(Leaf& leafNode, ModifyInfo& info) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (info.action == InsertAction)
|
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);
|
auto splitResult = Base::leafSplit(leafNode);
|
||||||
if (splitResult) {
|
if (splitResult) {
|
||||||
@ -677,26 +677,26 @@ void BTreeMixin<Base>::modify(Index& indexNode, ModifyInfo& info) {
|
|||||||
} else if (Base::leafElementCount(rightLeaf) == 0) {
|
} else if (Base::leafElementCount(rightLeaf) == 0) {
|
||||||
// Leaves merged.
|
// Leaves merged.
|
||||||
Base::setNextLeaf(leftLeaf, Base::nextLeaf(rightLeaf));
|
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
|
// Replace two sibling pointer elements with one pointing to merged
|
||||||
// leaf.
|
// leaf.
|
||||||
if (left != 0)
|
if (left != 0)
|
||||||
Base::indexUpdateKeyBefore(indexNode, left, Base::leafKey(leftLeaf, 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);
|
Base::indexRemoveBefore(indexNode, right);
|
||||||
|
|
||||||
selfUpdated = true;
|
selfUpdated = true;
|
||||||
} else {
|
} else {
|
||||||
// Leaves shifted.
|
// 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
|
// Right leaf first key changes on shift, so always need to update
|
||||||
// left index node.
|
// left index node.
|
||||||
Base::indexUpdateKeyBefore(indexNode, right, Base::leafKey(rightLeaf, 0));
|
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;
|
selfUpdated = true;
|
||||||
}
|
}
|
||||||
@ -725,25 +725,25 @@ void BTreeMixin<Base>::modify(Index& indexNode, ModifyInfo& info) {
|
|||||||
|
|
||||||
} else if (Base::indexPointerCount(rightIndex) == 0) {
|
} else if (Base::indexPointerCount(rightIndex) == 0) {
|
||||||
// Indexes merged.
|
// Indexes merged.
|
||||||
Base::deleteIndex(move(rightIndex));
|
Base::deleteIndex(std::move(rightIndex));
|
||||||
|
|
||||||
// Replace two sibling pointer elements with one pointing to merged
|
// Replace two sibling pointer elements with one pointing to merged
|
||||||
// index.
|
// index.
|
||||||
if (left != 0)
|
if (left != 0)
|
||||||
Base::indexUpdateKeyBefore(indexNode, left, getLeftKey(leftIndex));
|
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);
|
Base::indexRemoveBefore(indexNode, right);
|
||||||
|
|
||||||
selfUpdated = true;
|
selfUpdated = true;
|
||||||
} else {
|
} else {
|
||||||
// Indexes shifted.
|
// 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 first key changes on shift, so always need to update
|
||||||
// right index node.
|
// right index node.
|
||||||
Key keyForRight = getLeftKey(rightIndex);
|
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);
|
Base::indexUpdateKeyBefore(indexNode, right, keyForRight);
|
||||||
|
|
||||||
selfUpdated = true;
|
selfUpdated = true;
|
||||||
@ -752,19 +752,19 @@ void BTreeMixin<Base>::modify(Index& indexNode, ModifyInfo& info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (info.state == LeafSplit) {
|
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);
|
Base::indexInsertAfter(indexNode, i, info.newKey, info.newPointer);
|
||||||
selfUpdated = true;
|
selfUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.state == IndexSplit) {
|
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);
|
Base::indexInsertAfter(indexNode, i, info.newKey, info.newPointer);
|
||||||
selfUpdated = true;
|
selfUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.state == LeafNeedsUpdate) {
|
if (info.state == LeafNeedsUpdate) {
|
||||||
Pointer lowerLeafPointer = Base::storeLeaf(move(lowerLeaf));
|
Pointer lowerLeafPointer = Base::storeLeaf(std::move(lowerLeaf));
|
||||||
if (lowerLeafPointer != Base::indexPointer(indexNode, i)) {
|
if (lowerLeafPointer != Base::indexPointer(indexNode, i)) {
|
||||||
Base::indexUpdatePointer(indexNode, i, lowerLeafPointer);
|
Base::indexUpdatePointer(indexNode, i, lowerLeafPointer);
|
||||||
selfUpdated = true;
|
selfUpdated = true;
|
||||||
@ -772,7 +772,7 @@ void BTreeMixin<Base>::modify(Index& indexNode, ModifyInfo& info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (info.state == IndexNeedsUpdate) {
|
if (info.state == IndexNeedsUpdate) {
|
||||||
Pointer lowerIndexPointer = Base::storeIndex(move(lowerIndex));
|
Pointer lowerIndexPointer = Base::storeIndex(std::move(lowerIndex));
|
||||||
if (lowerIndexPointer != Base::indexPointer(indexNode, i)) {
|
if (lowerIndexPointer != Base::indexPointer(indexNode, i)) {
|
||||||
Base::indexUpdatePointer(indexNode, i, lowerIndexPointer);
|
Base::indexUpdatePointer(indexNode, i, lowerIndexPointer);
|
||||||
selfUpdated = true;
|
selfUpdated = true;
|
||||||
@ -796,7 +796,7 @@ void BTreeMixin<Base>::modify(Index& indexNode, ModifyInfo& info) {
|
|||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
bool BTreeMixin<Base>::modify(DataElement e, ModifyAction action) {
|
bool BTreeMixin<Base>::modify(DataElement e, ModifyAction action) {
|
||||||
ModifyInfo info(action, move(e));
|
ModifyInfo info(action, std::move(e));
|
||||||
|
|
||||||
Leaf lowerLeaf;
|
Leaf lowerLeaf;
|
||||||
Index lowerIndex;
|
Index lowerIndex;
|
||||||
@ -816,7 +816,7 @@ bool BTreeMixin<Base>::modify(DataElement e, ModifyAction action) {
|
|||||||
// removes until setNewRoot)
|
// removes until setNewRoot)
|
||||||
Pointer pointer = Base::indexPointer(lowerIndex, 0);
|
Pointer pointer = Base::indexPointer(lowerIndex, 0);
|
||||||
size_t level = Base::indexLevel(lowerIndex);
|
size_t level = Base::indexLevel(lowerIndex);
|
||||||
Base::deleteIndex(move(lowerIndex));
|
Base::deleteIndex(std::move(lowerIndex));
|
||||||
Base::setNewRoot(pointer, level == 0);
|
Base::setNewRoot(pointer, level == 0);
|
||||||
} else {
|
} else {
|
||||||
// Else just update.
|
// Else just update.
|
||||||
@ -833,24 +833,24 @@ bool BTreeMixin<Base>::modify(DataElement e, ModifyAction action) {
|
|||||||
Index newRoot;
|
Index newRoot;
|
||||||
if (info.state == IndexSplit) {
|
if (info.state == IndexSplit) {
|
||||||
auto rootIndexLevel = Base::indexLevel(lowerIndex) + 1;
|
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);
|
Base::setIndexLevel(newRoot, rootIndexLevel);
|
||||||
} else {
|
} else {
|
||||||
newRoot = Base::createIndex(Base::storeLeaf(move(lowerLeaf)));
|
newRoot = Base::createIndex(Base::storeLeaf(std::move(lowerLeaf)));
|
||||||
Base::setIndexLevel(newRoot, 0);
|
Base::setIndexLevel(newRoot, 0);
|
||||||
}
|
}
|
||||||
Base::indexInsertAfter(newRoot, 0, info.newKey, info.newPointer);
|
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) {
|
if (info.state == IndexNeedsUpdate) {
|
||||||
Pointer newRootPointer = Base::storeIndex(move(lowerIndex));
|
Pointer newRootPointer = Base::storeIndex(std::move(lowerIndex));
|
||||||
if (newRootPointer != Base::rootPointer())
|
if (newRootPointer != Base::rootPointer())
|
||||||
Base::setNewRoot(newRootPointer, false);
|
Base::setNewRoot(newRootPointer, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.state == LeafNeedsUpdate) {
|
if (info.state == LeafNeedsUpdate) {
|
||||||
Pointer newRootPointer = Base::storeLeaf(move(lowerLeaf));
|
Pointer newRootPointer = Base::storeLeaf(std::move(lowerLeaf));
|
||||||
if (newRootPointer != Base::rootPointer())
|
if (newRootPointer != Base::rootPointer())
|
||||||
Base::setNewRoot(newRootPointer, true);
|
Base::setNewRoot(newRootPointer, true);
|
||||||
}
|
}
|
||||||
@ -876,7 +876,7 @@ void BTreeMixin<Base>::forAllNodes(Index const& index, Visitor&& visitor) {
|
|||||||
|
|
||||||
for (size_t i = 0; i < Base::indexPointerCount(index); ++i) {
|
for (size_t i = 0; i < Base::indexPointerCount(index); ++i) {
|
||||||
if (Base::indexLevel(index) != 0) {
|
if (Base::indexLevel(index) != 0) {
|
||||||
forAllNodes(Base::loadIndex(Base::indexPointer(index, i)), forward<Visitor>(visitor));
|
forAllNodes(Base::loadIndex(Base::indexPointer(index, i)), std::forward<Visitor>(visitor));
|
||||||
} else {
|
} else {
|
||||||
if (!visitor(Base::loadLeaf(Base::indexPointer(index, i))))
|
if (!visitor(Base::loadLeaf(Base::indexPointer(index, i))))
|
||||||
return;
|
return;
|
||||||
|
@ -58,7 +58,7 @@ String BTreeDatabase::contentIdentifier() const {
|
|||||||
void BTreeDatabase::setContentIdentifier(String contentIdentifier) {
|
void BTreeDatabase::setContentIdentifier(String contentIdentifier) {
|
||||||
WriteLocker writeLocker(m_lock);
|
WriteLocker writeLocker(m_lock);
|
||||||
checkIfOpen("setContentIdentifier", false);
|
checkIfOpen("setContentIdentifier", false);
|
||||||
m_contentIdentifier = move(contentIdentifier);
|
m_contentIdentifier = std::move(contentIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t BTreeDatabase::indexCacheSize() const {
|
uint32_t BTreeDatabase::indexCacheSize() const {
|
||||||
@ -91,7 +91,7 @@ IODevicePtr BTreeDatabase::ioDevice() const {
|
|||||||
void BTreeDatabase::setIODevice(IODevicePtr device) {
|
void BTreeDatabase::setIODevice(IODevicePtr device) {
|
||||||
WriteLocker writeLocker(m_lock);
|
WriteLocker writeLocker(m_lock);
|
||||||
checkIfOpen("setIODevice", false);
|
checkIfOpen("setIODevice", false);
|
||||||
m_device = move(device);
|
m_device = std::move(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BTreeDatabase::isOpen() const {
|
bool BTreeDatabase::isOpen() const {
|
||||||
@ -188,12 +188,12 @@ void BTreeDatabase::forEach(ByteArray const& lower, ByteArray const& upper, func
|
|||||||
ReadLocker readLocker(m_lock);
|
ReadLocker readLocker(m_lock);
|
||||||
checkKeySize(lower);
|
checkKeySize(lower);
|
||||||
checkKeySize(upper);
|
checkKeySize(upper);
|
||||||
m_impl.forEach(lower, upper, move(v));
|
m_impl.forEach(lower, upper, std::move(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BTreeDatabase::forAll(function<void(ByteArray, ByteArray)> v) {
|
void BTreeDatabase::forAll(function<void(ByteArray, ByteArray)> v) {
|
||||||
ReadLocker readLocker(m_lock);
|
ReadLocker readLocker(m_lock);
|
||||||
m_impl.forAll(move(v));
|
m_impl.forAll(std::move(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BTreeDatabase::insert(ByteArray const& k, ByteArray const& data) {
|
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) {
|
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) {
|
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) {
|
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) {
|
void BTreeDatabase::BTreeImpl::leafRemove(Leaf& leaf, size_t i) {
|
||||||
|
@ -142,7 +142,7 @@ T* BlockAllocator<T, BlockSize>::allocate(size_t n) {
|
|||||||
auto sortedPosition = std::lower_bound(m_data->blocks.begin(), m_data->blocks.end(), block.get(), [](std::unique_ptr<Block> const& a, Block* b) {
|
auto sortedPosition = std::lower_bound(m_data->blocks.begin(), m_data->blocks.end(), block.get(), [](std::unique_ptr<Block> const& a, Block* b) {
|
||||||
return a.get() < 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<T, BlockSize>::deallocate(T* p, size_t n) {
|
|||||||
template <typename T, size_t BlockSize>
|
template <typename T, size_t BlockSize>
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
void BlockAllocator<T, BlockSize>::construct(pointer p, Args&&... args) const {
|
void BlockAllocator<T, BlockSize>::construct(pointer p, Args&&... args) const {
|
||||||
new (p) T(forward<Args>(args)...);
|
new (p) T(std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, size_t BlockSize>
|
template <typename T, size_t BlockSize>
|
||||||
|
@ -17,7 +17,7 @@ Buffer::Buffer(size_t initialSize)
|
|||||||
|
|
||||||
Buffer::Buffer(ByteArray b)
|
Buffer::Buffer(ByteArray b)
|
||||||
: Buffer() {
|
: Buffer() {
|
||||||
reset(move(b));
|
reset(std::move(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer::Buffer(Buffer const& buffer)
|
Buffer::Buffer(Buffer const& buffer)
|
||||||
@ -27,7 +27,7 @@ Buffer::Buffer(Buffer const& buffer)
|
|||||||
|
|
||||||
Buffer::Buffer(Buffer&& buffer)
|
Buffer::Buffer(Buffer&& buffer)
|
||||||
: Buffer() {
|
: Buffer() {
|
||||||
operator=(move(buffer));
|
operator=(std::move(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamOffset Buffer::pos() {
|
StreamOffset Buffer::pos() {
|
||||||
@ -106,7 +106,7 @@ ByteArray const& Buffer::data() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ByteArray Buffer::takeData() {
|
ByteArray Buffer::takeData() {
|
||||||
ByteArray ret = move(m_bytes);
|
ByteArray ret = std::move(m_bytes);
|
||||||
reset(0);
|
reset(0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ void Buffer::reset(size_t newSize) {
|
|||||||
|
|
||||||
void Buffer::reset(ByteArray b) {
|
void Buffer::reset(ByteArray b) {
|
||||||
m_pos = 0;
|
m_pos = 0;
|
||||||
m_bytes = move(b);
|
m_bytes = std::move(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer& Buffer::operator=(Buffer const& buffer) {
|
Buffer& Buffer::operator=(Buffer const& buffer) {
|
||||||
@ -156,7 +156,7 @@ Buffer& Buffer::operator=(Buffer const& buffer) {
|
|||||||
Buffer& Buffer::operator=(Buffer&& buffer) {
|
Buffer& Buffer::operator=(Buffer&& buffer) {
|
||||||
IODevice::operator=(buffer);
|
IODevice::operator=(buffer);
|
||||||
m_pos = buffer.m_pos;
|
m_pos = buffer.m_pos;
|
||||||
m_bytes = move(buffer.m_bytes);
|
m_bytes = std::move(buffer.m_bytes);
|
||||||
|
|
||||||
buffer.m_pos = 0;
|
buffer.m_pos = 0;
|
||||||
buffer.m_bytes = ByteArray();
|
buffer.m_bytes = ByteArray();
|
||||||
|
@ -43,7 +43,7 @@ ByteArray::ByteArray(ByteArray const& b)
|
|||||||
|
|
||||||
ByteArray::ByteArray(ByteArray&& b) noexcept
|
ByteArray::ByteArray(ByteArray&& b) noexcept
|
||||||
: ByteArray() {
|
: ByteArray() {
|
||||||
operator=(move(b));
|
operator=(std::move(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArray::~ByteArray() {
|
ByteArray::~ByteArray() {
|
||||||
|
@ -625,7 +625,7 @@ Vec4B Color::hexToVec4B(StringView s) {
|
|||||||
throw ColorException(strf("Improper size {} for hex string '{}' in Color::hexToVec4B", s.utf8Size(), s), false);
|
throw ColorException(strf("Improper size {} for hex string '{}' in Color::hexToVec4B", s.utf8Size(), s), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Vec4B(move(cbytes));
|
return Vec4B(std::move(cbytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ CompressedFile::CompressedFile()
|
|||||||
|
|
||||||
CompressedFile::CompressedFile(String filename)
|
CompressedFile::CompressedFile(String filename)
|
||||||
: IODevice(IOMode::Closed), m_file(0), m_compression(MediumCompression) {
|
: IODevice(IOMode::Closed), m_file(0), m_compression(MediumCompression) {
|
||||||
setFilename(move(filename));
|
setFilename(std::move(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
CompressedFile::~CompressedFile() {
|
CompressedFile::~CompressedFile() {
|
||||||
@ -172,7 +172,7 @@ size_t CompressedFile::write(const char* data, size_t len) {
|
|||||||
void CompressedFile::setFilename(String filename) {
|
void CompressedFile::setFilename(String filename) {
|
||||||
if (isOpen())
|
if (isOpen())
|
||||||
throw IOException("Cannot call setFilename while CompressedFile is open");
|
throw IOException("Cannot call setFilename while CompressedFile is open");
|
||||||
m_filename = move(filename);
|
m_filename = std::move(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompressedFile::setCompression(CompressionLevel compression) {
|
void CompressedFile::setCompression(CompressionLevel compression) {
|
||||||
|
@ -294,7 +294,7 @@ DataStream& DataStream::operator>>(ByteArray& d) {
|
|||||||
DataStream& DataStream::operator>>(String& s) {
|
DataStream& DataStream::operator>>(String& s) {
|
||||||
std::string string;
|
std::string string;
|
||||||
operator>>(string);
|
operator>>(string);
|
||||||
s = move(string);
|
s = std::move(string);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ void DataStream::readMapContainer(Container& map, ReadFunction function) {
|
|||||||
typename Container::key_type key;
|
typename Container::key_type key;
|
||||||
typename Container::mapped_type mapped;
|
typename Container::mapped_type mapped;
|
||||||
function(*this, key, mapped);
|
function(*this, key, mapped);
|
||||||
map.insert(make_pair(move(key), move(mapped)));
|
map.insert(make_pair(std::move(key), std::move(mapped)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace Star {
|
namespace Star {
|
||||||
|
|
||||||
DataStreamFunctions::DataStreamFunctions(function<size_t(char*, size_t)> reader, function<size_t(char const*, size_t)> writer)
|
DataStreamFunctions::DataStreamFunctions(function<size_t(char*, size_t)> reader, function<size_t(char const*, size_t)> 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) {
|
void DataStreamFunctions::readData(char* data, size_t len) {
|
||||||
if (!m_reader)
|
if (!m_reader)
|
||||||
@ -18,7 +18,7 @@ void DataStreamFunctions::writeData(char const* data, size_t len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DataStreamIODevice::DataStreamIODevice(IODevicePtr device)
|
DataStreamIODevice::DataStreamIODevice(IODevicePtr device)
|
||||||
: m_device(move(device)) {}
|
: m_device(std::move(device)) {}
|
||||||
|
|
||||||
IODevicePtr const& DataStreamIODevice::device() const {
|
IODevicePtr const& DataStreamIODevice::device() const {
|
||||||
return m_device;
|
return m_device;
|
||||||
@ -119,7 +119,7 @@ void DataStreamBuffer::reset(size_t newSize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DataStreamBuffer::reset(ByteArray b) {
|
void DataStreamBuffer::reset(ByteArray b) {
|
||||||
m_buffer->reset(move(b));
|
m_buffer->reset(std::move(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataStreamBuffer::readData(char* data, size_t len) {
|
void DataStreamBuffer::readData(char* data, size_t len) {
|
||||||
|
@ -184,66 +184,66 @@ ByteArray DataStreamBuffer::serializeMapContainer(T const& t, WriteFunction writ
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void DataStreamBuffer::deserialize(T& t, ByteArray data) {
|
void DataStreamBuffer::deserialize(T& t, ByteArray data) {
|
||||||
DataStreamBuffer ds(move(data));
|
DataStreamBuffer ds(std::move(data));
|
||||||
ds.read(t);
|
ds.read(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void DataStreamBuffer::deserializeContainer(T& t, ByteArray data) {
|
void DataStreamBuffer::deserializeContainer(T& t, ByteArray data) {
|
||||||
DataStreamBuffer ds(move(data));
|
DataStreamBuffer ds(std::move(data));
|
||||||
ds.readContainer(t);
|
ds.readContainer(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename ReadFunction>
|
template <typename T, typename ReadFunction>
|
||||||
void DataStreamBuffer::deserializeContainer(T& t, ByteArray data, ReadFunction readFunction) {
|
void DataStreamBuffer::deserializeContainer(T& t, ByteArray data, ReadFunction readFunction) {
|
||||||
DataStreamBuffer ds(move(data));
|
DataStreamBuffer ds(std::move(data));
|
||||||
ds.readContainer(t, readFunction);
|
ds.readContainer(t, readFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void DataStreamBuffer::deserializeMapContainer(T& t, ByteArray data) {
|
void DataStreamBuffer::deserializeMapContainer(T& t, ByteArray data) {
|
||||||
DataStreamBuffer ds(move(data));
|
DataStreamBuffer ds(std::move(data));
|
||||||
ds.readMapContainer(t);
|
ds.readMapContainer(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename ReadFunction>
|
template <typename T, typename ReadFunction>
|
||||||
void DataStreamBuffer::deserializeMapContainer(T& t, ByteArray data, ReadFunction readFunction) {
|
void DataStreamBuffer::deserializeMapContainer(T& t, ByteArray data, ReadFunction readFunction) {
|
||||||
DataStreamBuffer ds(move(data));
|
DataStreamBuffer ds(std::move(data));
|
||||||
ds.readMapContainer(t, readFunction);
|
ds.readMapContainer(t, readFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T DataStreamBuffer::deserialize(ByteArray data) {
|
T DataStreamBuffer::deserialize(ByteArray data) {
|
||||||
T t;
|
T t;
|
||||||
deserialize(t, move(data));
|
deserialize(t, std::move(data));
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T DataStreamBuffer::deserializeContainer(ByteArray data) {
|
T DataStreamBuffer::deserializeContainer(ByteArray data) {
|
||||||
T t;
|
T t;
|
||||||
deserializeContainer(t, move(data));
|
deserializeContainer(t, std::move(data));
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename ReadFunction>
|
template <typename T, typename ReadFunction>
|
||||||
T DataStreamBuffer::deserializeContainer(ByteArray data, ReadFunction readFunction) {
|
T DataStreamBuffer::deserializeContainer(ByteArray data, ReadFunction readFunction) {
|
||||||
T t;
|
T t;
|
||||||
deserializeContainer(t, move(data), readFunction);
|
deserializeContainer(t, std::move(data), readFunction);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T DataStreamBuffer::deserializeMapContainer(ByteArray data) {
|
T DataStreamBuffer::deserializeMapContainer(ByteArray data) {
|
||||||
T t;
|
T t;
|
||||||
deserializeMapContainer(t, move(data));
|
deserializeMapContainer(t, std::move(data));
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename ReadFunction>
|
template <typename T, typename ReadFunction>
|
||||||
T DataStreamBuffer::deserializeMapContainer(ByteArray data, ReadFunction readFunction) {
|
T DataStreamBuffer::deserializeMapContainer(ByteArray data, ReadFunction readFunction) {
|
||||||
T t;
|
T t;
|
||||||
deserializeMapContainer(t, move(data), readFunction);
|
deserializeMapContainer(t, std::move(data), readFunction);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ void readMaybe(DataStream& ds, Maybe<T>& maybe, ReadFunction&& readFunction) {
|
|||||||
if (set) {
|
if (set) {
|
||||||
T t;
|
T t;
|
||||||
readFunction(ds, t);
|
readFunction(ds, t);
|
||||||
maybe = move(t);
|
maybe = std::move(t);
|
||||||
} else {
|
} else {
|
||||||
maybe.reset();
|
maybe.reset();
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
namespace Star {
|
namespace Star {
|
||||||
|
|
||||||
Directives::Entry::Entry(ImageOperation&& newOperation, size_t strBegin, size_t strLength) {
|
Directives::Entry::Entry(ImageOperation&& newOperation, size_t strBegin, size_t strLength) {
|
||||||
operation = move(newOperation);
|
operation = std::move(newOperation);
|
||||||
begin = strBegin;
|
begin = strBegin;
|
||||||
length = strLength;
|
length = strLength;
|
||||||
}
|
}
|
||||||
@ -43,8 +43,8 @@ bool Directives::Shared::empty() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Directives::Shared::Shared(List<Entry>&& givenEntries, String&& givenString, StringView givenPrefix) {
|
Directives::Shared::Shared(List<Entry>&& givenEntries, String&& givenString, StringView givenPrefix) {
|
||||||
entries = move(givenEntries);
|
entries = std::move(givenEntries);
|
||||||
string = move(givenString);
|
string = std::move(givenString);
|
||||||
prefix = givenPrefix;
|
prefix = givenPrefix;
|
||||||
hash = XXH3_64bits(string.utf8Ptr(), string.utf8Size());
|
hash = XXH3_64bits(string.utf8Ptr(), string.utf8Size());
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ Directives::Directives(String const& directives) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Directives::Directives(String&& directives) {
|
Directives::Directives(String&& directives) {
|
||||||
parse(move(directives));
|
parse(std::move(directives));
|
||||||
}
|
}
|
||||||
|
|
||||||
Directives::Directives(const char* directives) {
|
Directives::Directives(const char* directives) {
|
||||||
@ -64,7 +64,7 @@ Directives::Directives(const char* directives) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Directives::Directives(Directives&& directives) {
|
Directives::Directives(Directives&& directives) {
|
||||||
*this = move(directives);
|
*this = std::move(directives);
|
||||||
}
|
}
|
||||||
|
|
||||||
Directives::Directives(Directives const& directives) {
|
Directives::Directives(Directives const& directives) {
|
||||||
@ -87,7 +87,7 @@ Directives& Directives::operator=(String&& s) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
parse(move(s));
|
parse(std::move(s));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ Directives& Directives::operator=(const char* s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Directives& Directives::operator=(Directives&& other) {
|
Directives& Directives::operator=(Directives&& other) {
|
||||||
shared = move(other.shared);
|
shared = std::move(other.shared);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ void Directives::parse(String&& directives) {
|
|||||||
if (beg == 0) {
|
if (beg == 0) {
|
||||||
try {
|
try {
|
||||||
ImageOperation operation = imageOperationFromString(split);
|
ImageOperation operation = imageOperationFromString(split);
|
||||||
newList.emplace_back(move(operation), beg, end);
|
newList.emplace_back(std::move(operation), beg, end);
|
||||||
}
|
}
|
||||||
catch (StarException const& e) {
|
catch (StarException const& e) {
|
||||||
prefix = split;
|
prefix = split;
|
||||||
@ -141,7 +141,7 @@ void Directives::parse(String&& directives) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ImageOperation operation = NullImageOperation();
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
shared = std::make_shared<Shared const>(move(newList), move(directives), prefix);
|
shared = std::make_shared<Shared const>(std::move(newList), std::move(directives), prefix);
|
||||||
if (view.size() < 1000) { // Pre-load short enough directives
|
if (view.size() < 1000) { // Pre-load short enough directives
|
||||||
for (auto& entry : shared->entries)
|
for (auto& entry : shared->entries)
|
||||||
entry.loadOperation(*shared);
|
entry.loadOperation(*shared);
|
||||||
@ -219,7 +219,7 @@ DataStream& operator>>(DataStream& ds, Directives& directives) {
|
|||||||
String string;
|
String string;
|
||||||
ds.read(string);
|
ds.read(string);
|
||||||
|
|
||||||
directives.parse(move(string));
|
directives.parse(std::move(string));
|
||||||
|
|
||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
@ -240,7 +240,7 @@ DirectivesGroup::DirectivesGroup(String const& directives) : m_count(0) {
|
|||||||
|
|
||||||
Directives parsed(directives);
|
Directives parsed(directives);
|
||||||
if (parsed) {
|
if (parsed) {
|
||||||
m_directives.emplace_back(move(parsed));
|
m_directives.emplace_back(std::move(parsed));
|
||||||
m_count = m_directives.back().size();
|
m_count = m_directives.back().size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,9 +250,9 @@ DirectivesGroup::DirectivesGroup(String&& directives) : m_count(0) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Directives parsed(move(directives));
|
Directives parsed(std::move(directives));
|
||||||
if (parsed) {
|
if (parsed) {
|
||||||
m_directives.emplace_back(move(parsed));
|
m_directives.emplace_back(std::move(parsed));
|
||||||
m_count = m_directives.back().size();
|
m_count = m_directives.back().size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -372,7 +372,7 @@ DataStream& operator>>(DataStream& ds, DirectivesGroup& directivesGroup) {
|
|||||||
String string;
|
String string;
|
||||||
ds.read(string);
|
ds.read(string);
|
||||||
|
|
||||||
directivesGroup = DirectivesGroup(move(string));
|
directivesGroup = DirectivesGroup(std::move(string));
|
||||||
|
|
||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
|
@ -85,12 +85,12 @@ private:
|
|||||||
|
|
||||||
template <typename Value>
|
template <typename Value>
|
||||||
EitherLeftValue<Value> makeLeft(Value value) {
|
EitherLeftValue<Value> makeLeft(Value value) {
|
||||||
return {move(value)};
|
return {std::move(value)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Value>
|
template <typename Value>
|
||||||
EitherRightValue<Value> makeRight(Value value) {
|
EitherRightValue<Value> makeRight(Value value) {
|
||||||
return {move(value)};
|
return {std::move(value)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Left, typename Right>
|
template <typename Left, typename Right>
|
||||||
@ -98,21 +98,21 @@ Either<Left, Right>::Either() {}
|
|||||||
|
|
||||||
template <typename Left, typename Right>
|
template <typename Left, typename Right>
|
||||||
Either<Left, Right>::Either(EitherLeftValue<Left> left)
|
Either<Left, Right>::Either(EitherLeftValue<Left> left)
|
||||||
: m_value(move(left)) {}
|
: m_value(std::move(left)) {}
|
||||||
|
|
||||||
template <typename Left, typename Right>
|
template <typename Left, typename Right>
|
||||||
Either<Left, Right>::Either(EitherRightValue<Right> right)
|
Either<Left, Right>::Either(EitherRightValue<Right> right)
|
||||||
: m_value(move(right)) {}
|
: m_value(std::move(right)) {}
|
||||||
|
|
||||||
template <typename Left, typename Right>
|
template <typename Left, typename Right>
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Either<Left, Right>::Either(EitherLeftValue<T> left)
|
Either<Left, Right>::Either(EitherLeftValue<T> left)
|
||||||
: Either(LeftType{move(left.value)}) {}
|
: Either(LeftType{std::move(left.value)}) {}
|
||||||
|
|
||||||
template <typename Left, typename Right>
|
template <typename Left, typename Right>
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Either<Left, Right>::Either(EitherRightValue<T> right)
|
Either<Left, Right>::Either(EitherRightValue<T> right)
|
||||||
: Either(RightType{move(right.value)}) {}
|
: Either(RightType{std::move(right.value)}) {}
|
||||||
|
|
||||||
template <typename Left, typename Right>
|
template <typename Left, typename Right>
|
||||||
Either<Left, Right>::Either(Either const& rhs)
|
Either<Left, Right>::Either(Either const& rhs)
|
||||||
@ -120,7 +120,7 @@ Either<Left, Right>::Either(Either const& rhs)
|
|||||||
|
|
||||||
template <typename Left, typename Right>
|
template <typename Left, typename Right>
|
||||||
Either<Left, Right>::Either(Either&& rhs)
|
Either<Left, Right>::Either(Either&& rhs)
|
||||||
: m_value(move(rhs.m_value)) {}
|
: m_value(std::move(rhs.m_value)) {}
|
||||||
|
|
||||||
template <typename Left, typename Right>
|
template <typename Left, typename Right>
|
||||||
Either<Left, Right>& Either<Left, Right>::operator=(Either const& rhs) {
|
Either<Left, Right>& Either<Left, Right>::operator=(Either const& rhs) {
|
||||||
@ -130,21 +130,21 @@ Either<Left, Right>& Either<Left, Right>::operator=(Either const& rhs) {
|
|||||||
|
|
||||||
template <typename Left, typename Right>
|
template <typename Left, typename Right>
|
||||||
Either<Left, Right>& Either<Left, Right>::operator=(Either&& rhs) {
|
Either<Left, Right>& Either<Left, Right>::operator=(Either&& rhs) {
|
||||||
m_value = move(rhs.m_value);
|
m_value = std::move(rhs.m_value);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Left, typename Right>
|
template <typename Left, typename Right>
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Either<Left, Right>& Either<Left, Right>::operator=(EitherLeftValue<T> left) {
|
Either<Left, Right>& Either<Left, Right>::operator=(EitherLeftValue<T> left) {
|
||||||
m_value = LeftType{move(left.value)};
|
m_value = LeftType{std::move(left.value)};
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Left, typename Right>
|
template <typename Left, typename Right>
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Either<Left, Right>& Either<Left, Right>::operator=(EitherRightValue<T> right) {
|
Either<Left, Right>& Either<Left, Right>::operator=(EitherRightValue<T> right) {
|
||||||
m_value = RightType{move(right.value)};
|
m_value = RightType{std::move(right.value)};
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,12 +160,12 @@ bool Either<Left, Right>::isRight() const {
|
|||||||
|
|
||||||
template <typename Left, typename Right>
|
template <typename Left, typename Right>
|
||||||
void Either<Left, Right>::setLeft(Left left) {
|
void Either<Left, Right>::setLeft(Left left) {
|
||||||
m_value = LeftType{move(left)};
|
m_value = LeftType{std::move(left)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Left, typename Right>
|
template <typename Left, typename Right>
|
||||||
void Either<Left, Right>::setRight(Right right) {
|
void Either<Left, Right>::setRight(Right right) {
|
||||||
m_value = RightType{move(right)};
|
m_value = RightType{std::move(right)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Left, typename Right>
|
template <typename Left, typename Right>
|
||||||
|
@ -79,18 +79,18 @@ void fatalException(std::exception const& e, bool showStackTrace);
|
|||||||
class ClassName : public BaseName { \
|
class ClassName : public BaseName { \
|
||||||
public: \
|
public: \
|
||||||
template <typename... Args> \
|
template <typename... Args> \
|
||||||
static ClassName format(fmt::format_string<Args...> fmt, Args const&... args) { \
|
static ClassName format(fmt::format_string<Args...> fmt, Args const&... args) { \
|
||||||
return ClassName(strf(fmt, args...)); \
|
return ClassName(strf(fmt, args...)); \
|
||||||
} \
|
} \
|
||||||
ClassName() : BaseName(#ClassName, std::string()) {} \
|
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) {} \
|
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: \
|
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) \
|
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);
|
STAR_EXCEPTION(OutOfRangeException, StarException);
|
||||||
|
@ -18,7 +18,7 @@ inline StackCapture captureStack() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OutputProxy outputStack(StackCapture stack) {
|
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);
|
char** symbols = backtrace_symbols(stack.first.ptr(), stack.second);
|
||||||
for (size_t i = 0; i < stack.second; ++i) {
|
for (size_t i = 0; i < stack.second; ++i) {
|
||||||
os << symbols[i];
|
os << symbols[i];
|
||||||
@ -39,13 +39,13 @@ StarException::StarException() noexcept
|
|||||||
StarException::~StarException() noexcept {}
|
StarException::~StarException() noexcept {}
|
||||||
|
|
||||||
StarException::StarException(std::string message, bool genStackTrace) 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::exception const& cause) noexcept
|
||||||
: StarException("StarException", std::string(), cause) {}
|
: StarException("StarException", std::string(), cause) {}
|
||||||
|
|
||||||
StarException::StarException(std::string message, std::exception const& cause) noexcept
|
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() {
|
const char* StarException::what() const throw() {
|
||||||
if (m_whatBuffer.empty()) {
|
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<StackCapture>());
|
m_printException = bind(printException, _1, _2, type, std::move(message), genStackTrace ? captureStack() : Maybe<StackCapture>());
|
||||||
}
|
}
|
||||||
|
|
||||||
StarException::StarException(char const* type, std::string message, std::exception const& cause) noexcept
|
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<void(std::ostream&, bool)> self, function<void(std::ostream&, bool)> cause) {
|
auto printException = [](std::ostream& os, bool fullStacktrace, function<void(std::ostream&, bool)> self, function<void(std::ostream&, bool)> cause) {
|
||||||
self(os, fullStacktrace);
|
self(os, fullStacktrace);
|
||||||
os << std::endl << "Caused by: ";
|
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()));
|
}, _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) {
|
std::string printException(std::exception const& e, bool fullStacktrace) {
|
||||||
|
@ -117,7 +117,7 @@ inline StackCapture captureStack() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OutputProxy outputStack(StackCapture stack) {
|
OutputProxy outputStack(StackCapture stack) {
|
||||||
return OutputProxy([stack = move(stack)](std::ostream & os) {
|
return OutputProxy([stack = std::move(stack)](std::ostream & os) {
|
||||||
HANDLE process = GetCurrentProcess();
|
HANDLE process = GetCurrentProcess();
|
||||||
g_dbgHelpLock.lock();
|
g_dbgHelpLock.lock();
|
||||||
for (size_t i = 0; i < stack.second; ++i) {
|
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() 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::exception const& cause) noexcept
|
||||||
: StarException("StarException", std::string(), cause) {}
|
: StarException("StarException", std::string(), cause) {}
|
||||||
|
|
||||||
StarException::StarException(std::string message, std::exception const& cause) noexcept
|
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() {
|
const char* StarException::what() const throw() {
|
||||||
if (m_whatBuffer.empty()) {
|
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<StackCapture>());
|
m_printException = bind(printException, _1, _2, type, std::move(message), genStackTrace ? captureStack() : Maybe<StackCapture>());
|
||||||
}
|
}
|
||||||
|
|
||||||
StarException::StarException(char const* type, std::string message, std::exception const& cause) noexcept
|
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,
|
auto printException = [](std::ostream& os,
|
||||||
bool fullStacktrace,
|
bool fullStacktrace,
|
||||||
function<void(std::ostream&, bool)> self,
|
function<void(std::ostream&, bool)> self,
|
||||||
@ -199,7 +199,7 @@ StarException::StarException(char const* type, std::string message, std::excepti
|
|||||||
}, _1, _2, std::string(cause.what()));
|
}, _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) {
|
std::string printException(std::exception const& e, bool fullStacktrace) {
|
||||||
|
@ -124,7 +124,7 @@ File::File()
|
|||||||
}
|
}
|
||||||
|
|
||||||
File::File(String filename)
|
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() {
|
File::~File() {
|
||||||
close();
|
close();
|
||||||
@ -190,7 +190,7 @@ String File::fileName() const {
|
|||||||
void File::setFilename(String filename) {
|
void File::setFilename(String filename) {
|
||||||
if (isOpen())
|
if (isOpen())
|
||||||
throw IOException("Cannot call setFilename while File is open");
|
throw IOException("Cannot call setFilename while File is open");
|
||||||
m_filename = move(filename);
|
m_filename = std::move(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void File::remove() {
|
void File::remove() {
|
||||||
|
@ -290,12 +290,12 @@ FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::FlatHashMap(FlatHashMap const
|
|||||||
|
|
||||||
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
||||||
FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::FlatHashMap(FlatHashMap&& other)
|
FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::FlatHashMap(FlatHashMap&& other)
|
||||||
: FlatHashMap(move(other), other.m_table.getAllocator()) {}
|
: FlatHashMap(std::move(other), other.m_table.getAllocator()) {}
|
||||||
|
|
||||||
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
||||||
FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::FlatHashMap(FlatHashMap&& other, allocator_type const& alloc)
|
FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::FlatHashMap(FlatHashMap&& other, allocator_type const& alloc)
|
||||||
: FlatHashMap(alloc) {
|
: FlatHashMap(alloc) {
|
||||||
operator=(move(other));
|
operator=(std::move(other));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
||||||
@ -326,7 +326,7 @@ auto FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::operator=(FlatHashMap co
|
|||||||
|
|
||||||
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
||||||
auto FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::operator=(FlatHashMap&& other) -> FlatHashMap& {
|
auto FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::operator=(FlatHashMap&& other) -> FlatHashMap& {
|
||||||
m_table = move(other.m_table);
|
m_table = std::move(other.m_table);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ auto FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::insert(value_type const&
|
|||||||
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
||||||
template <typename T, typename>
|
template <typename T, typename>
|
||||||
auto FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::insert(T&& value) -> pair<iterator, bool> {
|
auto FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::insert(T&& value) -> pair<iterator, bool> {
|
||||||
auto res = m_table.insert(TableValue(forward<T&&>(value)));
|
auto res = m_table.insert(TableValue(std::forward<T&&>(value)));
|
||||||
return {iterator{res.first}, res.second};
|
return {iterator{res.first}, res.second};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +403,7 @@ auto FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::insert(const_iterator hi
|
|||||||
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
||||||
template <typename T, typename>
|
template <typename T, typename>
|
||||||
auto FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::insert(const_iterator, T&& value) -> iterator {
|
auto FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::insert(const_iterator, T&& value) -> iterator {
|
||||||
return insert(forward<T&&>(value)).first;
|
return insert(std::forward<T&&>(value)).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
||||||
@ -422,13 +422,13 @@ void FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::insert(initializer_list<
|
|||||||
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
auto FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::emplace(Args&&... args) -> pair<iterator, bool> {
|
auto FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::emplace(Args&&... args) -> pair<iterator, bool> {
|
||||||
return insert(TableValue(forward<Args>(args)...));
|
return insert(TableValue(std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
auto FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::emplace_hint(const_iterator hint, Args&&... args) -> iterator {
|
auto FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::emplace_hint(const_iterator hint, Args&&... args) -> iterator {
|
||||||
return insert(hint, TableValue(forward<Args>(args)...));
|
return insert(hint, TableValue(std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
||||||
@ -480,7 +480,7 @@ auto FlatHashMap<Key, Mapped, Hash, Equals, Allocator>::operator[](key_type&& ke
|
|||||||
auto i = m_table.find(key);
|
auto i = m_table.find(key);
|
||||||
if (i != m_table.end())
|
if (i != m_table.end())
|
||||||
return i->second;
|
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 <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Mapped, typename Hash, typename Equals, typename Allocator>
|
||||||
|
@ -277,12 +277,12 @@ FlatHashSet<Key, Hash, Equals, Allocator>::FlatHashSet(FlatHashSet const& other,
|
|||||||
|
|
||||||
template <typename Key, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Hash, typename Equals, typename Allocator>
|
||||||
FlatHashSet<Key, Hash, Equals, Allocator>::FlatHashSet(FlatHashSet&& other)
|
FlatHashSet<Key, Hash, Equals, Allocator>::FlatHashSet(FlatHashSet&& other)
|
||||||
: FlatHashSet(move(other), other.m_table.getAllocator()) {}
|
: FlatHashSet(std::move(other), other.m_table.getAllocator()) {}
|
||||||
|
|
||||||
template <typename Key, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Hash, typename Equals, typename Allocator>
|
||||||
FlatHashSet<Key, Hash, Equals, Allocator>::FlatHashSet(FlatHashSet&& other, allocator_type const& alloc)
|
FlatHashSet<Key, Hash, Equals, Allocator>::FlatHashSet(FlatHashSet&& other, allocator_type const& alloc)
|
||||||
: FlatHashSet(alloc) {
|
: FlatHashSet(alloc) {
|
||||||
operator=(move(other));
|
operator=(std::move(other));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Key, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Hash, typename Equals, typename Allocator>
|
||||||
@ -312,7 +312,7 @@ FlatHashSet<Key, Hash, Equals, Allocator>& FlatHashSet<Key, Hash, Equals, Alloca
|
|||||||
|
|
||||||
template <typename Key, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Hash, typename Equals, typename Allocator>
|
||||||
FlatHashSet<Key, Hash, Equals, Allocator>& FlatHashSet<Key, Hash, Equals, Allocator>::operator=(FlatHashSet&& other) {
|
FlatHashSet<Key, Hash, Equals, Allocator>& FlatHashSet<Key, Hash, Equals, Allocator>::operator=(FlatHashSet&& other) {
|
||||||
m_table = move(other.m_table);
|
m_table = std::move(other.m_table);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ auto FlatHashSet<Key, Hash, Equals, Allocator>::insert(value_type const& value)
|
|||||||
|
|
||||||
template <typename Key, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Hash, typename Equals, typename Allocator>
|
||||||
auto FlatHashSet<Key, Hash, Equals, Allocator>::insert(value_type&& value) -> pair<iterator, bool> {
|
auto FlatHashSet<Key, Hash, Equals, Allocator>::insert(value_type&& value) -> pair<iterator, bool> {
|
||||||
auto res = m_table.insert(move(value));
|
auto res = m_table.insert(std::move(value));
|
||||||
return {iterator{res.first}, res.second};
|
return {iterator{res.first}, res.second};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ auto FlatHashSet<Key, Hash, Equals, Allocator>::insert(const_iterator i, value_t
|
|||||||
|
|
||||||
template <typename Key, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Hash, typename Equals, typename Allocator>
|
||||||
auto FlatHashSet<Key, Hash, Equals, Allocator>::insert(const_iterator, value_type&& value) -> iterator {
|
auto FlatHashSet<Key, Hash, Equals, Allocator>::insert(const_iterator, value_type&& value) -> iterator {
|
||||||
return insert(move(value)).first;
|
return insert(std::move(value)).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Key, typename Hash, typename Equals, typename Allocator>
|
template <typename Key, typename Hash, typename Equals, typename Allocator>
|
||||||
|
@ -138,7 +138,7 @@ template <typename Value, typename Key, typename GetKey, typename Hash, typename
|
|||||||
FlatHashTable<Value, Key, GetKey, Hash, Equals, Allocator>::Bucket::Bucket(Bucket&& rhs) {
|
FlatHashTable<Value, Key, GetKey, Hash, Equals, Allocator>::Bucket::Bucket(Bucket&& rhs) {
|
||||||
this->hash = rhs.hash;
|
this->hash = rhs.hash;
|
||||||
if (auto o = rhs.valuePtr())
|
if (auto o = rhs.valuePtr())
|
||||||
new (&this->value) Value(move(*o));
|
new (&this->value) Value(std::move(*o));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Value, typename Key, typename GetKey, typename Hash, typename Equals, typename Allocator>
|
template <typename Value, typename Key, typename GetKey, typename Hash, typename Equals, typename Allocator>
|
||||||
@ -160,9 +160,9 @@ template <typename Value, typename Key, typename GetKey, typename Hash, typename
|
|||||||
auto FlatHashTable<Value, Key, GetKey, Hash, Equals, Allocator>::Bucket::operator=(Bucket&& rhs) -> Bucket& {
|
auto FlatHashTable<Value, Key, GetKey, Hash, Equals, Allocator>::Bucket::operator=(Bucket&& rhs) -> Bucket& {
|
||||||
if (auto o = rhs.valuePtr()) {
|
if (auto o = rhs.valuePtr()) {
|
||||||
if (auto s = valuePtr())
|
if (auto s = valuePtr())
|
||||||
*s = move(*o);
|
*s = std::move(*o);
|
||||||
else
|
else
|
||||||
new (&this->value) Value(move(*o));
|
new (&this->value) Value(std::move(*o));
|
||||||
} else {
|
} else {
|
||||||
if (auto s = valuePtr())
|
if (auto s = valuePtr())
|
||||||
s->~Value();
|
s->~Value();
|
||||||
@ -174,9 +174,9 @@ auto FlatHashTable<Value, Key, GetKey, Hash, Equals, Allocator>::Bucket::operato
|
|||||||
template <typename Value, typename Key, typename GetKey, typename Hash, typename Equals, typename Allocator>
|
template <typename Value, typename Key, typename GetKey, typename Hash, typename Equals, typename Allocator>
|
||||||
void FlatHashTable<Value, Key, GetKey, Hash, Equals, Allocator>::Bucket::setFilled(size_t hash, Value value) {
|
void FlatHashTable<Value, Key, GetKey, Hash, Equals, Allocator>::Bucket::setFilled(size_t hash, Value value) {
|
||||||
if (auto s = valuePtr())
|
if (auto s = valuePtr())
|
||||||
*s = move(value);
|
*s = std::move(value);
|
||||||
else
|
else
|
||||||
new (&this->value) Value(move(value));
|
new (&this->value) Value(std::move(value));
|
||||||
this->hash = hash | FilledHashBit;
|
this->hash = hash | FilledHashBit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,7 +370,7 @@ auto FlatHashTable<Value, Key, GetKey, Hash, Equals, Allocator>::insert(Value va
|
|||||||
currentBucket = hashBucket(currentBucket + 1);
|
currentBucket = hashBucket(currentBucket + 1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
target.setFilled(hash, move(value));
|
target.setFilled(hash, std::move(value));
|
||||||
++m_filledCount;
|
++m_filledCount;
|
||||||
if (insertedBucket == NPos)
|
if (insertedBucket == NPos)
|
||||||
insertedBucket = currentBucket;
|
insertedBucket = currentBucket;
|
||||||
@ -392,7 +392,7 @@ auto FlatHashTable<Value, Key, GetKey, Hash, Equals, Allocator>::erase(const_ite
|
|||||||
if (auto nextPtr = nextBucket->valuePtr()) {
|
if (auto nextPtr = nextBucket->valuePtr()) {
|
||||||
if (bucketError(nextBucketIndex, nextBucket->hash) > 0) {
|
if (bucketError(nextBucketIndex, nextBucket->hash) > 0) {
|
||||||
currentBucket->hash = nextBucket->hash;
|
currentBucket->hash = nextBucket->hash;
|
||||||
*currentBucket->valuePtr() = move(*nextPtr);
|
*currentBucket->valuePtr() = std::move(*nextPtr);
|
||||||
currentBucketIndex = nextBucketIndex;
|
currentBucketIndex = nextBucketIndex;
|
||||||
currentBucket = nextBucket;
|
currentBucket = nextBucket;
|
||||||
} else {
|
} else {
|
||||||
@ -548,7 +548,7 @@ void FlatHashTable<Value, Key, GetKey, Hash, Equals, Allocator>::checkCapacity(s
|
|||||||
|
|
||||||
for (auto& entry : oldBuckets) {
|
for (auto& entry : oldBuckets) {
|
||||||
if (auto ptr = entry.valuePtr())
|
if (auto ptr = entry.valuePtr())
|
||||||
insert(move(*ptr));
|
insert(std::move(*ptr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ std::pair<Image, Vec2I> 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} };
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ Either<String, HostAddress> HostAddress::lookup(String const& address) {
|
|||||||
try {
|
try {
|
||||||
HostAddress ha;
|
HostAddress ha;
|
||||||
ha.set(address);
|
ha.set(address);
|
||||||
return makeRight(move(ha));
|
return makeRight(std::move(ha));
|
||||||
} catch (NetworkException const& e) {
|
} catch (NetworkException const& e) {
|
||||||
return makeLeft(String(e.what()));
|
return makeLeft(String(e.what()));
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ HostAddress::HostAddress(String const& address) {
|
|||||||
if (a.isLeft())
|
if (a.isLeft())
|
||||||
throw NetworkException(a.left().takeUtf8());
|
throw NetworkException(a.left().takeUtf8());
|
||||||
else
|
else
|
||||||
*this = move(a.right());
|
*this = std::move(a.right());
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkMode HostAddress::mode() const {
|
NetworkMode HostAddress::mode() const {
|
||||||
@ -211,9 +211,9 @@ size_t hash<HostAddress>::operator()(HostAddress const& address) const {
|
|||||||
Either<String, HostAddressWithPort> HostAddressWithPort::lookup(String const& address, uint16_t port) {
|
Either<String, HostAddressWithPort> HostAddressWithPort::lookup(String const& address, uint16_t port) {
|
||||||
auto hostAddress = HostAddress::lookup(address);
|
auto hostAddress = HostAddress::lookup(address);
|
||||||
if (hostAddress.isLeft())
|
if (hostAddress.isLeft())
|
||||||
return makeLeft(move(hostAddress.left()));
|
return makeLeft(std::move(hostAddress.left()));
|
||||||
else
|
else
|
||||||
return makeRight(HostAddressWithPort(move(hostAddress.right()), port));
|
return makeRight(HostAddressWithPort(std::move(hostAddress.right()), port));
|
||||||
}
|
}
|
||||||
|
|
||||||
Either<String, HostAddressWithPort> HostAddressWithPort::lookupWithPort(String const& address) {
|
Either<String, HostAddressWithPort> HostAddressWithPort::lookupWithPort(String const& address) {
|
||||||
@ -228,9 +228,9 @@ Either<String, HostAddressWithPort> HostAddressWithPort::lookupWithPort(String c
|
|||||||
|
|
||||||
auto hostAddress = HostAddress::lookup(host);
|
auto hostAddress = HostAddress::lookup(host);
|
||||||
if (hostAddress.isLeft())
|
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) {}
|
HostAddressWithPort::HostAddressWithPort() : m_port(0) {}
|
||||||
@ -247,14 +247,14 @@ HostAddressWithPort::HostAddressWithPort(String const& address, uint16_t port) {
|
|||||||
auto a = lookup(address, port);
|
auto a = lookup(address, port);
|
||||||
if (a.isLeft())
|
if (a.isLeft())
|
||||||
throw NetworkException(a.left().takeUtf8());
|
throw NetworkException(a.left().takeUtf8());
|
||||||
*this = move(a.right());
|
*this = std::move(a.right());
|
||||||
}
|
}
|
||||||
|
|
||||||
HostAddressWithPort::HostAddressWithPort(String const& address) {
|
HostAddressWithPort::HostAddressWithPort(String const& address) {
|
||||||
auto a = lookupWithPort(address);
|
auto a = lookupWithPort(address);
|
||||||
if (a.isLeft())
|
if (a.isLeft())
|
||||||
throw NetworkException(a.left().takeUtf8());
|
throw NetworkException(a.left().takeUtf8());
|
||||||
*this = move(a.right());
|
*this = std::move(a.right());
|
||||||
}
|
}
|
||||||
|
|
||||||
HostAddress HostAddressWithPort::address() const {
|
HostAddress HostAddressWithPort::address() const {
|
||||||
|
@ -101,7 +101,7 @@ auto IdMapWrapper<BaseMap>::nextId() -> IdType {
|
|||||||
|
|
||||||
template <typename BaseMap>
|
template <typename BaseMap>
|
||||||
void IdMapWrapper<BaseMap>::add(IdType id, MappedType mappedType) {
|
void IdMapWrapper<BaseMap>::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));
|
throw IdMapException::format("IdMapWrapper::add(id, value) called with pre-existing id '{}'", outputAny(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ Image::Image(Image const& image) : Image() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Image::Image(Image&& image) : Image() {
|
Image::Image(Image&& image) : Image() {
|
||||||
operator=(move(image));
|
operator=(std::move(image));
|
||||||
}
|
}
|
||||||
|
|
||||||
Image& Image::operator=(Image const& image) {
|
Image& Image::operator=(Image const& image) {
|
||||||
|
@ -201,7 +201,7 @@ ImageOperation imageOperationFromString(StringView string) {
|
|||||||
else if (!which || (ptr != end && ++ptr != end))
|
else if (!which || (ptr != end && ++ptr != end))
|
||||||
throw ImageOperationException(strf("Improper size for hex string '{}' in imageOperationFromString", StringView(hexPtr, hexLen)), false);
|
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.
|
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 operation;
|
||||||
|
|
||||||
|
|
||||||
which = !which;
|
which = !which;
|
||||||
|
@ -369,7 +369,7 @@ Pos inverseLinearInterpolateLower(Iterator begin, Iterator end, Pos t, Comp&& co
|
|||||||
if (begin == end || std::next(begin) == end)
|
if (begin == end || std::next(begin) == end)
|
||||||
return Pos();
|
return Pos();
|
||||||
|
|
||||||
Iterator i = std::lower_bound(std::next(begin), std::prev(end), t, forward<Comp>(comp));
|
Iterator i = std::lower_bound(std::next(begin), std::prev(end), t, std::forward<Comp>(comp));
|
||||||
|
|
||||||
--i;
|
--i;
|
||||||
Pos min = posGetter(*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)
|
if (begin == end || std::next(begin) == end)
|
||||||
return Pos();
|
return Pos();
|
||||||
|
|
||||||
Iterator i = std::upper_bound(std::next(begin), std::prev(end), t, forward<Comp>(comp));
|
Iterator i = std::upper_bound(std::next(begin), std::prev(end), t, std::forward<Comp>(comp));
|
||||||
|
|
||||||
--i;
|
--i;
|
||||||
Pos min = posGetter(*i);
|
Pos min = posGetter(*i);
|
||||||
|
@ -137,7 +137,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void insert(value_type v) {
|
void insert(value_type v) {
|
||||||
curr = ++cont.insert(curr, move(v));
|
curr = ++cont.insert(curr, std::move(v));
|
||||||
direction = -1;
|
direction = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setValue(value_type v) const {
|
void setValue(value_type v) const {
|
||||||
value() = move(v);
|
value() = std::move(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
value_ref next() {
|
value_ref next() {
|
||||||
|
@ -745,7 +745,7 @@ Maybe<JsonObject> Json::optQueryObject(String const& path) const {
|
|||||||
|
|
||||||
Json Json::set(String key, Json value) const {
|
Json Json::set(String key, Json value) const {
|
||||||
auto map = toObject();
|
auto map = toObject();
|
||||||
map[move(key)] = move(value);
|
map[std::move(key)] = std::move(value);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -760,31 +760,31 @@ Json Json::erasePath(String path) const {
|
|||||||
Json Json::setAll(JsonObject values) const {
|
Json Json::setAll(JsonObject values) const {
|
||||||
auto map = toObject();
|
auto map = toObject();
|
||||||
for (auto& p : values)
|
for (auto& p : values)
|
||||||
map[move(p.first)] = move(p.second);
|
map[std::move(p.first)] = std::move(p.second);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json Json::eraseKey(String key) const {
|
Json Json::eraseKey(String key) const {
|
||||||
auto map = toObject();
|
auto map = toObject();
|
||||||
map.erase(move(key));
|
map.erase(std::move(key));
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json Json::set(size_t index, Json value) const {
|
Json Json::set(size_t index, Json value) const {
|
||||||
auto array = toArray();
|
auto array = toArray();
|
||||||
array[index] = move(value);
|
array[index] = std::move(value);
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json Json::insert(size_t index, Json value) const {
|
Json Json::insert(size_t index, Json value) const {
|
||||||
auto array = toArray();
|
auto array = toArray();
|
||||||
array.insertAt(index, move(value));
|
array.insertAt(index, std::move(value));
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json Json::append(Json value) const {
|
Json Json::append(Json value) const {
|
||||||
auto array = toArray();
|
auto array = toArray();
|
||||||
array.append(move(value));
|
array.append(std::move(value));
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -927,7 +927,7 @@ DataStream& operator>>(DataStream& os, Json& v) {
|
|||||||
for (size_t i = 0; i < s; ++i)
|
for (size_t i = 0; i < s; ++i)
|
||||||
l.append(os.read<Json>());
|
l.append(os.read<Json>());
|
||||||
|
|
||||||
v = move(l);
|
v = std::move(l);
|
||||||
} else if (type == Json::Type::Object) {
|
} else if (type == Json::Type::Object) {
|
||||||
JsonObject m;
|
JsonObject m;
|
||||||
size_t s = os.readVlqU();
|
size_t s = os.readVlqU();
|
||||||
@ -936,7 +936,7 @@ DataStream& operator>>(DataStream& os, Json& v) {
|
|||||||
m[k] = os.read<Json>();
|
m[k] = os.read<Json>();
|
||||||
}
|
}
|
||||||
|
|
||||||
v = move(m);
|
v = std::move(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
|
@ -15,12 +15,12 @@ void JsonBuilderStream::endObject() {
|
|||||||
JsonObject object;
|
JsonObject object;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (isSentry()) {
|
if (isSentry()) {
|
||||||
set(Json(move(object)));
|
set(Json(std::move(object)));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
Json v = pop();
|
Json v = pop();
|
||||||
String k = pop().toString();
|
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));
|
throw JsonParsingException(strf("Json object contains a duplicate entry for key '{}'", k));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ void JsonBuilderStream::endArray() {
|
|||||||
while (true) {
|
while (true) {
|
||||||
if (isSentry()) {
|
if (isSentry()) {
|
||||||
array.reverse();
|
array.reverse();
|
||||||
set(Json(move(array)));
|
set(Json(std::move(array)));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
array.append(pop());
|
array.append(pop());
|
||||||
@ -81,7 +81,7 @@ Json JsonBuilderStream::takeTop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void JsonBuilderStream::push(Json v) {
|
void JsonBuilderStream::push(Json v) {
|
||||||
m_stack.append(move(v));
|
m_stack.append(std::move(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
Json JsonBuilderStream::pop() {
|
Json JsonBuilderStream::pop() {
|
||||||
@ -89,7 +89,7 @@ Json JsonBuilderStream::pop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void JsonBuilderStream::set(Json v) {
|
void JsonBuilderStream::set(Json v) {
|
||||||
m_stack.last() = move(v);
|
m_stack.last() = std::move(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonBuilderStream::pushSentry() {
|
void JsonBuilderStream::pushSentry() {
|
||||||
|
@ -372,7 +372,7 @@ List<Color> jsonToColorList(Json const& v) {
|
|||||||
List<Directives> jsonToDirectivesList(Json const& v) {
|
List<Directives> jsonToDirectivesList(Json const& v) {
|
||||||
List<Directives> result;
|
List<Directives> result;
|
||||||
for (auto const& entry : v.iterateArray())
|
for (auto const& entry : v.iterateArray())
|
||||||
result.append(move(entry.toString()));
|
result.append(entry.toString());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ MapType jsonToMapK(Json const& v, KeyConverter&& keyConvert) {
|
|||||||
|
|
||||||
template <typename MapType, typename ValueConverter>
|
template <typename MapType, typename ValueConverter>
|
||||||
MapType jsonToMapV(Json const& v, ValueConverter&& valueConvert) {
|
MapType jsonToMapV(Json const& v, ValueConverter&& valueConvert) {
|
||||||
return jsonToMapKV<MapType>(v, construct<typename MapType::key_type>(), forward<ValueConverter>(valueConvert));
|
return jsonToMapKV<MapType>(v, construct<typename MapType::key_type>(), std::forward<ValueConverter>(valueConvert));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename MapType>
|
template <typename MapType>
|
||||||
@ -281,12 +281,12 @@ Json jsonFromMapKV(MapType const& map, KeyConverter&& keyConvert, ValueConverter
|
|||||||
|
|
||||||
template <typename MapType, typename KeyConverter>
|
template <typename MapType, typename KeyConverter>
|
||||||
Json jsonFromMapK(MapType const& map, KeyConverter&& keyConvert) {
|
Json jsonFromMapK(MapType const& map, KeyConverter&& keyConvert) {
|
||||||
return jsonFromMapKV<MapType>(map, forward<KeyConverter>(keyConvert), construct<Json>());
|
return jsonFromMapKV<MapType>(map, std::forward<KeyConverter>(keyConvert), construct<Json>());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename MapType, typename ValueConverter>
|
template <typename MapType, typename ValueConverter>
|
||||||
Json jsonFromMapV(MapType const& map, ValueConverter&& valueConvert) {
|
Json jsonFromMapV(MapType const& map, ValueConverter&& valueConvert) {
|
||||||
return jsonFromMapKV<MapType>(map, construct<String>(), forward<ValueConverter>(valueConvert));
|
return jsonFromMapKV<MapType>(map, construct<String>(), std::forward<ValueConverter>(valueConvert));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename MapType>
|
template <typename MapType>
|
||||||
|
@ -462,7 +462,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void error(std::string msg) {
|
void error(std::string msg) {
|
||||||
m_error = move(msg);
|
m_error = std::move(msg);
|
||||||
throw ParsingException();
|
throw ParsingException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ JsonRpc::JsonRpc() {
|
|||||||
void JsonRpc::registerHandler(String const& handler, JsonRpcRemoteFunction func) {
|
void JsonRpc::registerHandler(String const& handler, JsonRpcRemoteFunction func) {
|
||||||
if (m_handlers.contains(handler))
|
if (m_handlers.contains(handler))
|
||||||
throw JsonRpcException(strf("Handler by that name already exists '{}'", 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) {
|
void JsonRpc::registerHandlers(JsonRpcHandlers const& handlers) {
|
||||||
|
@ -30,7 +30,7 @@ Maybe<Type> maybeLexicalCast(StringView s, std::ios_base::fmtflags flags = std::
|
|||||||
if (stream >> ch)
|
if (stream >> ch)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
return move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
|
@ -451,7 +451,7 @@ void ListMixin<BaseList>::appendAll(Container&& list) {
|
|||||||
template <typename BaseList>
|
template <typename BaseList>
|
||||||
template <class... Args>
|
template <class... Args>
|
||||||
auto ListMixin<BaseList>::emplaceAppend(Args&&... args) -> reference {
|
auto ListMixin<BaseList>::emplaceAppend(Args&&... args) -> reference {
|
||||||
Base::emplace_back(forward<Args>(args)...);
|
Base::emplace_back(std::forward<Args>(args)...);
|
||||||
return *prev(Base::end());
|
return *prev(Base::end());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,13 +558,13 @@ size_t ListMixin<BaseList>::remove(const_reference e) {
|
|||||||
template <typename BaseList>
|
template <typename BaseList>
|
||||||
template <typename Filter>
|
template <typename Filter>
|
||||||
void ListMixin<BaseList>::filter(Filter&& filter) {
|
void ListMixin<BaseList>::filter(Filter&& filter) {
|
||||||
Star::filter(*this, forward<Filter>(filter));
|
Star::filter(*this, std::forward<Filter>(filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename BaseList>
|
template <typename BaseList>
|
||||||
template <typename Comparator>
|
template <typename Comparator>
|
||||||
void ListMixin<BaseList>::insertSorted(value_type e, Comparator&& comparator) {
|
void ListMixin<BaseList>::insertSorted(value_type e, Comparator&& comparator) {
|
||||||
auto i = std::upper_bound(Base::begin(), Base::end(), e, forward<Comparator>(comparator));
|
auto i = std::upper_bound(Base::begin(), Base::end(), e, std::forward<Comparator>(comparator));
|
||||||
Base::insert(i, std::move(e));
|
Base::insert(i, std::move(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,7 +577,7 @@ void ListMixin<BaseList>::insertSorted(value_type e) {
|
|||||||
template <typename BaseList>
|
template <typename BaseList>
|
||||||
template <typename Comparator>
|
template <typename Comparator>
|
||||||
bool ListMixin<BaseList>::containsSorted(value_type const& e, Comparator&& comparator) {
|
bool ListMixin<BaseList>::containsSorted(value_type const& e, Comparator&& comparator) {
|
||||||
auto range = std::equal_range(Base::begin(), Base::end(), e, forward<Comparator>(comparator));
|
auto range = std::equal_range(Base::begin(), Base::end(), e, std::forward<Comparator>(comparator));
|
||||||
return range.first != range.second;
|
return range.first != range.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,7 +611,7 @@ void ListMixin<BaseList>::transform(Function&& function) {
|
|||||||
template <typename BaseList>
|
template <typename BaseList>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
bool ListMixin<BaseList>::any(Function&& function) const {
|
bool ListMixin<BaseList>::any(Function&& function) const {
|
||||||
return Star::any(*this, forward<Function>(function));
|
return Star::any(*this, std::forward<Function>(function));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename BaseList>
|
template <typename BaseList>
|
||||||
@ -622,7 +622,7 @@ bool ListMixin<BaseList>::any() const {
|
|||||||
template <typename BaseList>
|
template <typename BaseList>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
bool ListMixin<BaseList>::all(Function&& function) const {
|
bool ListMixin<BaseList>::all(Function&& function) const {
|
||||||
return Star::all(*this, forward<Function>(function));
|
return Star::all(*this, std::forward<Function>(function));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename BaseList>
|
template <typename BaseList>
|
||||||
@ -633,7 +633,7 @@ bool ListMixin<BaseList>::all() const {
|
|||||||
template <typename BaseList>
|
template <typename BaseList>
|
||||||
template <typename Comparator>
|
template <typename Comparator>
|
||||||
void RandomAccessListMixin<BaseList>::sort(Comparator&& comparator) {
|
void RandomAccessListMixin<BaseList>::sort(Comparator&& comparator) {
|
||||||
Star::sort(*this, forward<Comparator>(comparator));
|
Star::sort(*this, std::forward<Comparator>(comparator));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename BaseList>
|
template <typename BaseList>
|
||||||
@ -790,7 +790,7 @@ void FrontModifyingListMixin<BaseList>::prependAll(Container&& list) {
|
|||||||
template <typename BaseList>
|
template <typename BaseList>
|
||||||
template <class... Args>
|
template <class... Args>
|
||||||
auto FrontModifyingListMixin<BaseList>::emplacePrepend(Args&&... args) -> reference {
|
auto FrontModifyingListMixin<BaseList>::emplacePrepend(Args&&... args) -> reference {
|
||||||
Base::emplace_front(forward<Args>(args)...);
|
Base::emplace_front(std::forward<Args>(args)...);
|
||||||
return *Base::begin();
|
return *Base::begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -839,7 +839,7 @@ template <typename Element, typename Allocator>
|
|||||||
template <typename Filter>
|
template <typename Filter>
|
||||||
auto List<Element, Allocator>::filtered(Filter&& filter) const -> List {
|
auto List<Element, Allocator>::filtered(Filter&& filter) const -> List {
|
||||||
List list(*this);
|
List list(*this);
|
||||||
list.filter(forward<Filter>(filter));
|
list.filter(std::forward<Filter>(filter));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -847,7 +847,7 @@ template <typename Element, typename Allocator>
|
|||||||
template <typename Comparator>
|
template <typename Comparator>
|
||||||
auto List<Element, Allocator>::sorted(Comparator&& comparator) const -> List {
|
auto List<Element, Allocator>::sorted(Comparator&& comparator) const -> List {
|
||||||
List list(*this);
|
List list(*this);
|
||||||
list.sort(forward<Comparator>(comparator));
|
list.sort(std::forward<Comparator>(comparator));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,7 +863,7 @@ template <typename Function>
|
|||||||
auto List<Element, Allocator>::transformed(Function&& function) {
|
auto List<Element, Allocator>::transformed(Function&& function) {
|
||||||
List<typename std::decay<decltype(std::declval<Function>()(std::declval<reference>()))>::type> res;
|
List<typename std::decay<decltype(std::declval<Function>()(std::declval<reference>()))>::type> res;
|
||||||
res.reserve(Base::size());
|
res.reserve(Base::size());
|
||||||
transformInto(res, *this, forward<Function>(function));
|
transformInto(res, *this, std::forward<Function>(function));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -872,7 +872,7 @@ template <typename Function>
|
|||||||
auto List<Element, Allocator>::transformed(Function&& function) const {
|
auto List<Element, Allocator>::transformed(Function&& function) const {
|
||||||
List<typename std::decay<decltype(std::declval<Function>()(std::declval<const_reference>()))>::type> res;
|
List<typename std::decay<decltype(std::declval<Function>()(std::declval<const_reference>()))>::type> res;
|
||||||
res.reserve(Base::size());
|
res.reserve(Base::size());
|
||||||
transformInto(res, *this, forward<Function>(function));
|
transformInto(res, *this, std::forward<Function>(function));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -899,7 +899,7 @@ template <typename Element, size_t MaxSize>
|
|||||||
template <typename Comparator>
|
template <typename Comparator>
|
||||||
auto StaticList<Element, MaxSize>::sorted(Comparator&& comparator) const -> StaticList {
|
auto StaticList<Element, MaxSize>::sorted(Comparator&& comparator) const -> StaticList {
|
||||||
StaticList list(*this);
|
StaticList list(*this);
|
||||||
list.sort(forward<Comparator>(comparator));
|
list.sort(std::forward<Comparator>(comparator));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -914,7 +914,7 @@ template <typename Element, size_t MaxSize>
|
|||||||
template <typename Function>
|
template <typename Function>
|
||||||
auto StaticList<Element, MaxSize>::transformed(Function&& function) {
|
auto StaticList<Element, MaxSize>::transformed(Function&& function) {
|
||||||
StaticList<typename std::decay<decltype(std::declval<Function>()(std::declval<reference>()))>::type, MaxSize> res;
|
StaticList<typename std::decay<decltype(std::declval<Function>()(std::declval<reference>()))>::type, MaxSize> res;
|
||||||
transformInto(res, *this, forward<Function>(function));
|
transformInto(res, *this, std::forward<Function>(function));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -922,7 +922,7 @@ template <typename Element, size_t MaxSize>
|
|||||||
template <typename Function>
|
template <typename Function>
|
||||||
auto StaticList<Element, MaxSize>::transformed(Function&& function) const {
|
auto StaticList<Element, MaxSize>::transformed(Function&& function) const {
|
||||||
StaticList<typename std::decay<decltype(std::declval<Function>()(std::declval<const_reference>()))>::type, MaxSize> res;
|
StaticList<typename std::decay<decltype(std::declval<Function>()(std::declval<const_reference>()))>::type, MaxSize> res;
|
||||||
transformInto(res, *this, forward<Function>(function));
|
transformInto(res, *this, std::forward<Function>(function));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -941,7 +941,7 @@ template <typename Element, size_t MaxStackSize>
|
|||||||
template <typename Filter>
|
template <typename Filter>
|
||||||
auto SmallList<Element, MaxStackSize>::filtered(Filter&& filter) const -> SmallList {
|
auto SmallList<Element, MaxStackSize>::filtered(Filter&& filter) const -> SmallList {
|
||||||
SmallList list(*this);
|
SmallList list(*this);
|
||||||
list.filter(forward<Filter>(filter));
|
list.filter(std::forward<Filter>(filter));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -949,7 +949,7 @@ template <typename Element, size_t MaxStackSize>
|
|||||||
template <typename Comparator>
|
template <typename Comparator>
|
||||||
auto SmallList<Element, MaxStackSize>::sorted(Comparator&& comparator) const -> SmallList {
|
auto SmallList<Element, MaxStackSize>::sorted(Comparator&& comparator) const -> SmallList {
|
||||||
SmallList list(*this);
|
SmallList list(*this);
|
||||||
list.sort(forward<Comparator>(comparator));
|
list.sort(std::forward<Comparator>(comparator));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -964,7 +964,7 @@ template <typename Element, size_t MaxStackSize>
|
|||||||
template <typename Function>
|
template <typename Function>
|
||||||
auto SmallList<Element, MaxStackSize>::transformed(Function&& function) {
|
auto SmallList<Element, MaxStackSize>::transformed(Function&& function) {
|
||||||
SmallList<typename std::decay<decltype(std::declval<Function>()(std::declval<reference>()))>::type, MaxStackSize> res;
|
SmallList<typename std::decay<decltype(std::declval<Function>()(std::declval<reference>()))>::type, MaxStackSize> res;
|
||||||
transformInto(res, *this, forward<Function>(function));
|
transformInto(res, *this, std::forward<Function>(function));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -972,7 +972,7 @@ template <typename Element, size_t MaxStackSize>
|
|||||||
template <typename Function>
|
template <typename Function>
|
||||||
auto SmallList<Element, MaxStackSize>::transformed(Function&& function) const {
|
auto SmallList<Element, MaxStackSize>::transformed(Function&& function) const {
|
||||||
SmallList<typename std::decay<decltype(std::declval<Function>()(std::declval<const_reference>()))>::type, MaxStackSize> res;
|
SmallList<typename std::decay<decltype(std::declval<Function>()(std::declval<const_reference>()))>::type, MaxStackSize> res;
|
||||||
transformInto(res, *this, forward<Function>(function));
|
transformInto(res, *this, std::forward<Function>(function));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -991,7 +991,7 @@ template <typename Element, typename Allocator>
|
|||||||
template <typename Filter>
|
template <typename Filter>
|
||||||
Deque<Element, Allocator> Deque<Element, Allocator>::filtered(Filter&& filter) const {
|
Deque<Element, Allocator> Deque<Element, Allocator>::filtered(Filter&& filter) const {
|
||||||
Deque l(*this);
|
Deque l(*this);
|
||||||
l.filter(forward<Filter>(filter));
|
l.filter(std::forward<Filter>(filter));
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -999,7 +999,7 @@ template <typename Element, typename Allocator>
|
|||||||
template <typename Comparator>
|
template <typename Comparator>
|
||||||
Deque<Element, Allocator> Deque<Element, Allocator>::sorted(Comparator&& comparator) const {
|
Deque<Element, Allocator> Deque<Element, Allocator>::sorted(Comparator&& comparator) const {
|
||||||
Deque l(*this);
|
Deque l(*this);
|
||||||
l.sort(forward<Comparator>(comparator));
|
l.sort(std::forward<Comparator>(comparator));
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1013,13 +1013,13 @@ Deque<Element, Allocator> Deque<Element, Allocator>::sorted() const {
|
|||||||
template <typename Element, typename Allocator>
|
template <typename Element, typename Allocator>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
auto Deque<Element, Allocator>::transformed(Function&& function) {
|
auto Deque<Element, Allocator>::transformed(Function&& function) {
|
||||||
return Star::transform<Deque<decltype(std::declval<Function>()(std::declval<reference>()))>>(*this, forward<Function>(function));
|
return Star::transform<Deque<decltype(std::declval<Function>()(std::declval<reference>()))>>(*this, std::forward<Function>(function));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, typename Allocator>
|
template <typename Element, typename Allocator>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
auto Deque<Element, Allocator>::transformed(Function&& function) const {
|
auto Deque<Element, Allocator>::transformed(Function&& function) const {
|
||||||
return Star::transform<Deque<decltype(std::declval<Function>()(std::declval<const_reference>()))>>(*this, forward<Function>(function));
|
return Star::transform<Deque<decltype(std::declval<Function>()(std::declval<const_reference>()))>>(*this, std::forward<Function>(function));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, typename Allocator>
|
template <typename Element, typename Allocator>
|
||||||
@ -1064,7 +1064,7 @@ template <typename Element, typename Allocator>
|
|||||||
template <typename Filter>
|
template <typename Filter>
|
||||||
LinkedList<Element, Allocator> LinkedList<Element, Allocator>::filtered(Filter&& filter) const {
|
LinkedList<Element, Allocator> LinkedList<Element, Allocator>::filtered(Filter&& filter) const {
|
||||||
LinkedList list(*this);
|
LinkedList list(*this);
|
||||||
list.filter(forward<Filter>(filter));
|
list.filter(std::forward<Filter>(filter));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1072,7 +1072,7 @@ template <typename Element, typename Allocator>
|
|||||||
template <typename Comparator>
|
template <typename Comparator>
|
||||||
LinkedList<Element, Allocator> LinkedList<Element, Allocator>::sorted(Comparator&& comparator) const {
|
LinkedList<Element, Allocator> LinkedList<Element, Allocator>::sorted(Comparator&& comparator) const {
|
||||||
LinkedList l(*this);
|
LinkedList l(*this);
|
||||||
l.sort(forward<Comparator>(comparator));
|
l.sort(std::forward<Comparator>(comparator));
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1086,13 +1086,13 @@ LinkedList<Element, Allocator> LinkedList<Element, Allocator>::sorted() const {
|
|||||||
template <typename Element, typename Allocator>
|
template <typename Element, typename Allocator>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
auto LinkedList<Element, Allocator>::transformed(Function&& function) {
|
auto LinkedList<Element, Allocator>::transformed(Function&& function) {
|
||||||
return Star::transform<LinkedList<decltype(std::declval<Function>()(std::declval<reference>()))>>(*this, forward<Function>(function));
|
return Star::transform<LinkedList<decltype(std::declval<Function>()(std::declval<reference>()))>>(*this, std::forward<Function>(function));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, typename Allocator>
|
template <typename Element, typename Allocator>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
auto LinkedList<Element, Allocator>::transformed(Function&& function) const {
|
auto LinkedList<Element, Allocator>::transformed(Function&& function) const {
|
||||||
return Star::transform<LinkedList<decltype(std::declval<Function>()(std::declval<const_reference>()))>>(*this, forward<Function>(function));
|
return Star::transform<LinkedList<decltype(std::declval<Function>()(std::declval<const_reference>()))>>(*this, std::forward<Function>(function));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename BaseList>
|
template <typename BaseList>
|
||||||
|
@ -5,7 +5,7 @@ namespace Star {
|
|||||||
Listener::~Listener() {}
|
Listener::~Listener() {}
|
||||||
|
|
||||||
CallbackListener::CallbackListener(function<void()> callback)
|
CallbackListener::CallbackListener(function<void()> callback)
|
||||||
: callback(move(callback)) {}
|
: callback(std::move(callback)) {}
|
||||||
|
|
||||||
void CallbackListener::trigger() {
|
void CallbackListener::trigger() {
|
||||||
if (callback)
|
if (callback)
|
||||||
@ -16,12 +16,12 @@ TrackerListener::TrackerListener() : triggered(false) {}
|
|||||||
|
|
||||||
void ListenerGroup::addListener(ListenerWeakPtr listener) {
|
void ListenerGroup::addListener(ListenerWeakPtr listener) {
|
||||||
MutexLocker locker(m_mutex);
|
MutexLocker locker(m_mutex);
|
||||||
m_listeners.insert(move(listener));
|
m_listeners.insert(std::move(listener));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListenerGroup::removeListener(ListenerWeakPtr listener) {
|
void ListenerGroup::removeListener(ListenerWeakPtr listener) {
|
||||||
MutexLocker locker(m_mutex);
|
MutexLocker locker(m_mutex);
|
||||||
m_listeners.erase(move(listener));
|
m_listeners.erase(std::move(listener));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListenerGroup::clearExpiredListeners() {
|
void ListenerGroup::clearExpiredListeners() {
|
||||||
|
@ -12,16 +12,16 @@ namespace Star {
|
|||||||
int64_t const LockFile::MaximumSleepMillis;
|
int64_t const LockFile::MaximumSleepMillis;
|
||||||
|
|
||||||
Maybe<LockFile> LockFile::acquireLock(String const& filename, int64_t lockTimeout) {
|
Maybe<LockFile> LockFile::acquireLock(String const& filename, int64_t lockTimeout) {
|
||||||
LockFile lock(move(filename));
|
LockFile lock(std::move(filename));
|
||||||
if (lock.lock(lockTimeout))
|
if (lock.lock(lockTimeout))
|
||||||
return lock;
|
return lock;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
LockFile::LockFile(String const& filename) : m_filename(move(filename)) {}
|
LockFile::LockFile(String const& filename) : m_filename(std::move(filename)) {}
|
||||||
|
|
||||||
LockFile::LockFile(LockFile&& lockFile) {
|
LockFile::LockFile(LockFile&& lockFile) {
|
||||||
operator=(move(lockFile));
|
operator=(std::move(lockFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
LockFile::~LockFile() {
|
LockFile::~LockFile() {
|
||||||
@ -29,8 +29,8 @@ LockFile::~LockFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LockFile& LockFile::operator=(LockFile&& lockFile) {
|
LockFile& LockFile::operator=(LockFile&& lockFile) {
|
||||||
m_filename = move(lockFile.m_filename);
|
m_filename = std::move(lockFile.m_filename);
|
||||||
m_handle = move(lockFile.m_handle);
|
m_handle = std::move(lockFile.m_handle);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -11,16 +11,16 @@ namespace Star {
|
|||||||
int64_t const LockFile::MaximumSleepMillis;
|
int64_t const LockFile::MaximumSleepMillis;
|
||||||
|
|
||||||
Maybe<LockFile> LockFile::acquireLock(String const& filename, int64_t lockTimeout) {
|
Maybe<LockFile> LockFile::acquireLock(String const& filename, int64_t lockTimeout) {
|
||||||
LockFile lock(move(filename));
|
LockFile lock(std::move(filename));
|
||||||
if (lock.lock(lockTimeout))
|
if (lock.lock(lockTimeout))
|
||||||
return move(lock);
|
return std::move(lock);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
LockFile::LockFile(String const& filename) : m_filename(move(filename)) {}
|
LockFile::LockFile(String const& filename) : m_filename(std::move(filename)) {}
|
||||||
|
|
||||||
LockFile::LockFile(LockFile&& lockFile) {
|
LockFile::LockFile(LockFile&& lockFile) {
|
||||||
operator=(move(lockFile));
|
operator=(std::move(lockFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
LockFile::~LockFile() {
|
LockFile::~LockFile() {
|
||||||
@ -28,8 +28,8 @@ LockFile::~LockFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LockFile& LockFile::operator=(LockFile&& lockFile) {
|
LockFile& LockFile::operator=(LockFile&& lockFile) {
|
||||||
m_filename = move(lockFile.m_filename);
|
m_filename = std::move(lockFile.m_filename);
|
||||||
m_handle = move(lockFile.m_handle);
|
m_handle = std::move(lockFile.m_handle);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -212,9 +212,9 @@ void SpatialLogger::clear() {
|
|||||||
decltype(s_logText) logText;
|
decltype(s_logText) logText;
|
||||||
{
|
{
|
||||||
MutexLocker locker(s_mutex);
|
MutexLocker locker(s_mutex);
|
||||||
lines = move(s_lines);
|
lines = std::move(s_lines);
|
||||||
points = move(s_points);
|
points = std::move(s_points);
|
||||||
logText = move(s_logText);
|
logText = std::move(s_logText);
|
||||||
} // Move while locked to deallocate contents while unlocked.
|
} // Move while locked to deallocate contents while unlocked.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,9 +105,9 @@ template <typename OrderedMapType>
|
|||||||
void LruCacheBase<OrderedMapType>::set(Key const& key, Value value) {
|
void LruCacheBase<OrderedMapType>::set(Key const& key, Value value) {
|
||||||
auto i = m_map.find(key);
|
auto i = m_map.find(key);
|
||||||
if (i == m_map.end()) {
|
if (i == m_map.end()) {
|
||||||
m_map.add(key, move(value));
|
m_map.add(key, std::move(value));
|
||||||
} else {
|
} else {
|
||||||
i->second = move(value);
|
i->second = std::move(value);
|
||||||
m_map.toBack(i);
|
m_map.toBack(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ StringMap<LuaDetail::LuaWrappedFunction> const& LuaCallbacks::callbacks() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool LuaContext::containsPath(String path) 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) {
|
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) {
|
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 {
|
void LuaContext::setCallbacks(String const& tableName, LuaCallbacks const& callbacks) const {
|
||||||
@ -162,11 +162,11 @@ Maybe<Json> LuaConverter<Json>::to(LuaEngine&, LuaValue const& v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LuaValue LuaConverter<JsonObject>::from(LuaEngine& engine, JsonObject v) {
|
LuaValue LuaConverter<JsonObject>::from(LuaEngine& engine, JsonObject v) {
|
||||||
return engine.luaFrom<Json>(Json(move(v)));
|
return engine.luaFrom<Json>(Json(std::move(v)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Maybe<JsonObject> LuaConverter<JsonObject>::to(LuaEngine& engine, LuaValue v) {
|
Maybe<JsonObject> LuaConverter<JsonObject>::to(LuaEngine& engine, LuaValue v) {
|
||||||
auto j = engine.luaTo<Json>(move(v));
|
auto j = engine.luaTo<Json>(std::move(v));
|
||||||
if (j.type() == Json::Type::Object) {
|
if (j.type() == Json::Type::Object) {
|
||||||
return j.toObject();
|
return j.toObject();
|
||||||
} else if (j.type() == Json::Type::Array) {
|
} else if (j.type() == Json::Type::Array) {
|
||||||
@ -179,11 +179,11 @@ Maybe<JsonObject> LuaConverter<JsonObject>::to(LuaEngine& engine, LuaValue v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LuaValue LuaConverter<JsonArray>::from(LuaEngine& engine, JsonArray v) {
|
LuaValue LuaConverter<JsonArray>::from(LuaEngine& engine, JsonArray v) {
|
||||||
return engine.luaFrom<Json>(Json(move(v)));
|
return engine.luaFrom<Json>(Json(std::move(v)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Maybe<JsonArray> LuaConverter<JsonArray>::to(LuaEngine& engine, LuaValue v) {
|
Maybe<JsonArray> LuaConverter<JsonArray>::to(LuaEngine& engine, LuaValue v) {
|
||||||
auto j = engine.luaTo<Json>(move(v));
|
auto j = engine.luaTo<Json>(std::move(v));
|
||||||
if (j.type() == Json::Type::Array) {
|
if (j.type() == Json::Type::Array) {
|
||||||
return j.toArray();
|
return j.toArray();
|
||||||
} else if (j.type() == Json::Type::Object) {
|
} else if (j.type() == Json::Type::Object) {
|
||||||
@ -839,7 +839,7 @@ void LuaEngine::tableIterate(int handleIndex, function<bool(LuaValue key, LuaVal
|
|||||||
LuaValue value = popLuaValue(m_state);
|
LuaValue value = popLuaValue(m_state);
|
||||||
bool cont = false;
|
bool cont = false;
|
||||||
try {
|
try {
|
||||||
cont = iterator(move(key), move(value));
|
cont = iterator(std::move(key), std::move(value));
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
lua_pop(m_state, 2);
|
lua_pop(m_state, 2);
|
||||||
throw;
|
throw;
|
||||||
@ -881,7 +881,7 @@ void LuaEngine::setContextRequire(int handleIndex, LuaContext::RequireFunction r
|
|||||||
pushHandle(m_state, handleIndex);
|
pushHandle(m_state, handleIndex);
|
||||||
|
|
||||||
auto funcUserdata = (LuaContext::RequireFunction*)lua_newuserdata(m_state, sizeof(LuaContext::RequireFunction));
|
auto funcUserdata = (LuaContext::RequireFunction*)lua_newuserdata(m_state, sizeof(LuaContext::RequireFunction));
|
||||||
new (funcUserdata) LuaContext::RequireFunction(move(requireFunction));
|
new (funcUserdata) LuaContext::RequireFunction(std::move(requireFunction));
|
||||||
lua_rawgeti(m_state, LUA_REGISTRYINDEX, m_requireFunctionMetatableRegistryId);
|
lua_rawgeti(m_state, LUA_REGISTRYINDEX, m_requireFunctionMetatableRegistryId);
|
||||||
lua_setmetatable(m_state, -2);
|
lua_setmetatable(m_state, -2);
|
||||||
|
|
||||||
@ -1076,7 +1076,7 @@ LuaFunction LuaEngine::createWrappedFunction(LuaDetail::LuaWrappedFunction funct
|
|||||||
lua_checkstack(m_state, 2);
|
lua_checkstack(m_state, 2);
|
||||||
|
|
||||||
auto funcUserdata = (LuaDetail::LuaWrappedFunction*)lua_newuserdata(m_state, sizeof(LuaDetail::LuaWrappedFunction));
|
auto funcUserdata = (LuaDetail::LuaWrappedFunction*)lua_newuserdata(m_state, sizeof(LuaDetail::LuaWrappedFunction));
|
||||||
new (funcUserdata) LuaDetail::LuaWrappedFunction(move(function));
|
new (funcUserdata) LuaDetail::LuaWrappedFunction(std::move(function));
|
||||||
|
|
||||||
lua_rawgeti(m_state, LUA_REGISTRYINDEX, m_wrappedFunctionMetatableRegistryId);
|
lua_rawgeti(m_state, LUA_REGISTRYINDEX, m_wrappedFunctionMetatableRegistryId);
|
||||||
lua_setmetatable(m_state, -2);
|
lua_setmetatable(m_state, -2);
|
||||||
@ -1400,7 +1400,7 @@ Maybe<Json> LuaDetail::tableToJsonContainer(LuaTable const& table) {
|
|||||||
if (auto i = asInteger(key)) {
|
if (auto i = asInteger(key)) {
|
||||||
intEntries[*i] = jsonValue.take();
|
intEntries[*i] = jsonValue.take();
|
||||||
} else {
|
} else {
|
||||||
auto stringKey = table.engine().luaMaybeTo<String>(move(key));
|
auto stringKey = table.engine().luaMaybeTo<String>(std::move(key));
|
||||||
if (!stringKey) {
|
if (!stringKey) {
|
||||||
failedConversion = true;
|
failedConversion = true;
|
||||||
return false;
|
return false;
|
||||||
@ -1420,12 +1420,12 @@ Maybe<Json> LuaDetail::tableToJsonContainer(LuaTable const& table) {
|
|||||||
if (interpretAsList) {
|
if (interpretAsList) {
|
||||||
JsonArray list;
|
JsonArray list;
|
||||||
for (auto& p : intEntries)
|
for (auto& p : intEntries)
|
||||||
list.set(p.first - 1, move(p.second));
|
list.set(p.first - 1, std::move(p.second));
|
||||||
return Json(move(list));
|
return Json(std::move(list));
|
||||||
} else {
|
} else {
|
||||||
for (auto& p : intEntries)
|
for (auto& p : intEntries)
|
||||||
stringEntries[toString(p.first)] = move(p.second);
|
stringEntries[toString(p.first)] = std::move(p.second);
|
||||||
return Json(move(stringEntries));
|
return Json(std::move(stringEntries));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -856,7 +856,7 @@ struct LuaConverter<std::string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Maybe<std::string> to(LuaEngine& engine, LuaValue v) {
|
static Maybe<std::string> to(LuaEngine& engine, LuaValue v) {
|
||||||
return engine.luaTo<String>(move(v)).takeUtf8();
|
return engine.luaTo<String>(std::move(v)).takeUtf8();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -887,12 +887,12 @@ struct LuaConverter<Directives> {
|
|||||||
template <>
|
template <>
|
||||||
struct LuaConverter<LuaString> {
|
struct LuaConverter<LuaString> {
|
||||||
static LuaValue from(LuaEngine&, LuaString v) {
|
static LuaValue from(LuaEngine&, LuaString v) {
|
||||||
return LuaValue(move(v));
|
return LuaValue(std::move(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Maybe<LuaString> to(LuaEngine& engine, LuaValue v) {
|
static Maybe<LuaString> to(LuaEngine& engine, LuaValue v) {
|
||||||
if (v.is<LuaString>())
|
if (v.is<LuaString>())
|
||||||
return LuaString(move(v.get<LuaString>()));
|
return LuaString(std::move(v.get<LuaString>()));
|
||||||
if (v.is<LuaInt>())
|
if (v.is<LuaInt>())
|
||||||
return engine.createString(toString(v.get<LuaInt>()));
|
return engine.createString(toString(v.get<LuaInt>()));
|
||||||
if (v.is<LuaFloat>())
|
if (v.is<LuaFloat>())
|
||||||
@ -909,7 +909,7 @@ struct LuaValueConverter {
|
|||||||
|
|
||||||
static Maybe<T> to(LuaEngine&, LuaValue v) {
|
static Maybe<T> to(LuaEngine&, LuaValue v) {
|
||||||
if (auto p = v.ptr<T>()) {
|
if (auto p = v.ptr<T>()) {
|
||||||
return move(*p);
|
return std::move(*p);
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -967,7 +967,7 @@ struct LuaConverter<Maybe<T>> {
|
|||||||
|
|
||||||
static Maybe<Maybe<T>> to(LuaEngine& engine, LuaValue&& v) {
|
static Maybe<Maybe<T>> to(LuaEngine& engine, LuaValue&& v) {
|
||||||
if (v != LuaNil) {
|
if (v != LuaNil) {
|
||||||
if (auto conv = engine.luaMaybeTo<T>(move(v)))
|
if (auto conv = engine.luaMaybeTo<T>(std::move(v)))
|
||||||
return conv;
|
return conv;
|
||||||
else
|
else
|
||||||
return {};
|
return {};
|
||||||
@ -991,8 +991,8 @@ struct LuaMapConverter {
|
|||||||
T result;
|
T result;
|
||||||
bool failed = false;
|
bool failed = false;
|
||||||
table->iterate([&result, &failed, &engine](LuaValue key, LuaValue value) {
|
table->iterate([&result, &failed, &engine](LuaValue key, LuaValue value) {
|
||||||
auto contKey = engine.luaMaybeTo<typename T::key_type>(move(key));
|
auto contKey = engine.luaMaybeTo<typename T::key_type>(std::move(key));
|
||||||
auto contValue = engine.luaMaybeTo<typename T::mapped_type>(move(value));
|
auto contValue = engine.luaMaybeTo<typename T::mapped_type>(std::move(value));
|
||||||
if (!contKey || !contValue) {
|
if (!contKey || !contValue) {
|
||||||
failed = true;
|
failed = true;
|
||||||
return false;
|
return false;
|
||||||
@ -1026,7 +1026,7 @@ struct LuaContainerConverter {
|
|||||||
failed = true;
|
failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto contVal = engine.luaMaybeTo<typename T::value_type>(move(value));
|
auto contVal = engine.luaMaybeTo<typename T::value_type>(std::move(value));
|
||||||
if (!contVal) {
|
if (!contVal) {
|
||||||
failed = true;
|
failed = true;
|
||||||
return false;
|
return false;
|
||||||
@ -1086,7 +1086,7 @@ struct LuaConverter<JsonArray> {
|
|||||||
|
|
||||||
namespace LuaDetail {
|
namespace LuaDetail {
|
||||||
inline LuaHandle::LuaHandle(LuaEnginePtr engine, int handleIndex)
|
inline LuaHandle::LuaHandle(LuaEnginePtr engine, int handleIndex)
|
||||||
: engine(move(engine)), handleIndex(handleIndex) {}
|
: engine(std::move(engine)), handleIndex(handleIndex) {}
|
||||||
|
|
||||||
inline LuaHandle::~LuaHandle() {
|
inline LuaHandle::~LuaHandle() {
|
||||||
if (engine)
|
if (engine)
|
||||||
@ -1213,7 +1213,7 @@ namespace LuaDetail {
|
|||||||
struct ArgGet {
|
struct ArgGet {
|
||||||
static T get(LuaEngine& engine, size_t argc, LuaValue* argv, size_t index) {
|
static T get(LuaEngine& engine, size_t argc, LuaValue* argv, size_t index) {
|
||||||
if (index < argc)
|
if (index < argc)
|
||||||
return engine.luaTo<T>(move(argv[index]));
|
return engine.luaTo<T>(std::move(argv[index]));
|
||||||
return engine.luaTo<T>(LuaNil);
|
return engine.luaTo<T>(LuaNil);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1226,7 +1226,7 @@ namespace LuaDetail {
|
|||||||
|
|
||||||
LuaVariadic<T> subargs(argc - index);
|
LuaVariadic<T> subargs(argc - index);
|
||||||
for (size_t i = index; i < argc; ++i)
|
for (size_t i = index; i < argc; ++i)
|
||||||
subargs[i - index] = engine.luaTo<T>(move(argv[i]));
|
subargs[i - index] = engine.luaTo<T>(std::move(argv[i]));
|
||||||
return subargs;
|
return subargs;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1235,14 +1235,14 @@ namespace LuaDetail {
|
|||||||
struct FunctionWrapper {
|
struct FunctionWrapper {
|
||||||
template <typename Function, size_t... Indexes>
|
template <typename Function, size_t... Indexes>
|
||||||
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> const&) {
|
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> 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<Args>::get(engine, argc, argv, Indexes)...));
|
return toWrappedReturn(engine, (Return const&)func(ArgGet<Args>::get(engine, argc, argv, Indexes)...));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
static LuaWrappedFunction wrap(Function func) {
|
static LuaWrappedFunction wrap(Function func) {
|
||||||
return wrapIndexes(forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
return wrapIndexes(std::forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1250,7 +1250,7 @@ namespace LuaDetail {
|
|||||||
struct FunctionWrapper<void, Args...> {
|
struct FunctionWrapper<void, Args...> {
|
||||||
template <typename Function, size_t... Indexes>
|
template <typename Function, size_t... Indexes>
|
||||||
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> const&) {
|
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> 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<Args>::get(engine, argc, argv, Indexes)...);
|
func(ArgGet<Args>::get(engine, argc, argv, Indexes)...);
|
||||||
return LuaFunctionReturn();
|
return LuaFunctionReturn();
|
||||||
};
|
};
|
||||||
@ -1258,7 +1258,7 @@ namespace LuaDetail {
|
|||||||
|
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
static LuaWrappedFunction wrap(Function func) {
|
static LuaWrappedFunction wrap(Function func) {
|
||||||
return wrapIndexes(forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
return wrapIndexes(std::forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1266,14 +1266,14 @@ namespace LuaDetail {
|
|||||||
struct FunctionWrapper<Return, LuaEngine, Args...> {
|
struct FunctionWrapper<Return, LuaEngine, Args...> {
|
||||||
template <typename Function, size_t... Indexes>
|
template <typename Function, size_t... Indexes>
|
||||||
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> const&) {
|
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> 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<Args>::get(engine, argc, argv, Indexes)...));
|
return toWrappedReturn(engine, (Return const&)func(engine, ArgGet<Args>::get(engine, argc, argv, Indexes)...));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
static LuaWrappedFunction wrap(Function func) {
|
static LuaWrappedFunction wrap(Function func) {
|
||||||
return wrapIndexes(forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
return wrapIndexes(std::forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1281,7 +1281,7 @@ namespace LuaDetail {
|
|||||||
struct FunctionWrapper<void, LuaEngine, Args...> {
|
struct FunctionWrapper<void, LuaEngine, Args...> {
|
||||||
template <typename Function, size_t... Indexes>
|
template <typename Function, size_t... Indexes>
|
||||||
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> const&) {
|
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> 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<Args>::get(engine, argc, argv, Indexes)...);
|
func(engine, ArgGet<Args>::get(engine, argc, argv, Indexes)...);
|
||||||
return LuaFunctionReturn();
|
return LuaFunctionReturn();
|
||||||
};
|
};
|
||||||
@ -1289,31 +1289,31 @@ namespace LuaDetail {
|
|||||||
|
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
static LuaWrappedFunction wrap(Function func) {
|
static LuaWrappedFunction wrap(Function func) {
|
||||||
return wrapIndexes(forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
return wrapIndexes(std::forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Return, typename... Args, typename Function>
|
template <typename Return, typename... Args, typename Function>
|
||||||
LuaWrappedFunction wrapFunctionWithSignature(Function&& func) {
|
LuaWrappedFunction wrapFunctionWithSignature(Function&& func) {
|
||||||
return FunctionWrapper<Return, typename std::decay<Args>::type...>::wrap(forward<Function>(func));
|
return FunctionWrapper<Return, typename std::decay<Args>::type...>::wrap(std::forward<Function>(func));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Return, typename Function, typename... Args>
|
template <typename Return, typename Function, typename... Args>
|
||||||
LuaWrappedFunction wrapFunctionArgs(Function&& func, VariadicTypedef<Args...> const&) {
|
LuaWrappedFunction wrapFunctionArgs(Function&& func, VariadicTypedef<Args...> const&) {
|
||||||
return wrapFunctionWithSignature<Return, Args...>(forward<Function>(func));
|
return wrapFunctionWithSignature<Return, Args...>(std::forward<Function>(func));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
LuaWrappedFunction wrapFunction(Function&& func) {
|
LuaWrappedFunction wrapFunction(Function&& func) {
|
||||||
return wrapFunctionArgs<typename FunctionTraits<Function>::Return>(
|
return wrapFunctionArgs<typename FunctionTraits<Function>::Return>(
|
||||||
forward<Function>(func), typename FunctionTraits<Function>::Args());
|
std::forward<Function>(func), typename FunctionTraits<Function>::Args());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Return, typename T, typename... Args>
|
template <typename Return, typename T, typename... Args>
|
||||||
struct MethodWrapper {
|
struct MethodWrapper {
|
||||||
template <typename Function, size_t... Indexes>
|
template <typename Function, size_t... Indexes>
|
||||||
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> const&) {
|
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> 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)
|
if (argc == 0)
|
||||||
throw LuaException("No object argument passed to wrapped method");
|
throw LuaException("No object argument passed to wrapped method");
|
||||||
return toWrappedReturn(engine,
|
return toWrappedReturn(engine,
|
||||||
@ -1323,7 +1323,7 @@ namespace LuaDetail {
|
|||||||
|
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
static LuaWrappedFunction wrap(Function&& func) {
|
static LuaWrappedFunction wrap(Function&& func) {
|
||||||
return wrapIndexes(forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
return wrapIndexes(std::forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1331,7 +1331,7 @@ namespace LuaDetail {
|
|||||||
struct MethodWrapper<void, T, Args...> {
|
struct MethodWrapper<void, T, Args...> {
|
||||||
template <typename Function, size_t... Indexes>
|
template <typename Function, size_t... Indexes>
|
||||||
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> const&) {
|
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> 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)
|
if (argc == 0)
|
||||||
throw LuaException("No object argument passed to wrapped method");
|
throw LuaException("No object argument passed to wrapped method");
|
||||||
func(argv[0].get<LuaUserData>().get<T>(), ArgGet<Args>::get(engine, argc - 1, argv + 1, Indexes)...);
|
func(argv[0].get<LuaUserData>().get<T>(), ArgGet<Args>::get(engine, argc - 1, argv + 1, Indexes)...);
|
||||||
@ -1341,7 +1341,7 @@ namespace LuaDetail {
|
|||||||
|
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
static LuaWrappedFunction wrap(Function func) {
|
static LuaWrappedFunction wrap(Function func) {
|
||||||
return wrapIndexes(forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
return wrapIndexes(std::forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1349,7 +1349,7 @@ namespace LuaDetail {
|
|||||||
struct MethodWrapper<Return, T, LuaEngine, Args...> {
|
struct MethodWrapper<Return, T, LuaEngine, Args...> {
|
||||||
template <typename Function, size_t... Indexes>
|
template <typename Function, size_t... Indexes>
|
||||||
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> const&) {
|
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> 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)
|
if (argc == 0)
|
||||||
throw LuaException("No object argument passed to wrapped method");
|
throw LuaException("No object argument passed to wrapped method");
|
||||||
return toWrappedReturn(
|
return toWrappedReturn(
|
||||||
@ -1360,7 +1360,7 @@ namespace LuaDetail {
|
|||||||
|
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
static LuaWrappedFunction wrap(Function func) {
|
static LuaWrappedFunction wrap(Function func) {
|
||||||
return wrapIndexes(forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
return wrapIndexes(std::forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1368,7 +1368,7 @@ namespace LuaDetail {
|
|||||||
struct MethodWrapper<void, T, LuaEngine, Args...> {
|
struct MethodWrapper<void, T, LuaEngine, Args...> {
|
||||||
template <typename Function, size_t... Indexes>
|
template <typename Function, size_t... Indexes>
|
||||||
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> const&) {
|
static LuaWrappedFunction wrapIndexes(Function func, IndexSequence<Indexes...> 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)
|
if (argc == 0)
|
||||||
throw LuaException("No object argument passed to wrapped method");
|
throw LuaException("No object argument passed to wrapped method");
|
||||||
func(argv[0].get<LuaUserData>().get<T>(), engine, ArgGet<Args>::get(engine, argc - 1, argv + 1, Indexes)...);
|
func(argv[0].get<LuaUserData>().get<T>(), engine, ArgGet<Args>::get(engine, argc - 1, argv + 1, Indexes)...);
|
||||||
@ -1378,24 +1378,24 @@ namespace LuaDetail {
|
|||||||
|
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
static LuaWrappedFunction wrap(Function func) {
|
static LuaWrappedFunction wrap(Function func) {
|
||||||
return wrapIndexes(forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
return wrapIndexes(std::forward<Function>(func), typename GenIndexSequence<0, sizeof...(Args)>::type());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Return, typename... Args, typename Function>
|
template <typename Return, typename... Args, typename Function>
|
||||||
LuaWrappedFunction wrapMethodWithSignature(Function&& func) {
|
LuaWrappedFunction wrapMethodWithSignature(Function&& func) {
|
||||||
return MethodWrapper<Return, typename std::decay<Args>::type...>::wrap(forward<Function>(func));
|
return MethodWrapper<Return, typename std::decay<Args>::type...>::wrap(std::forward<Function>(func));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Return, typename Function, typename... Args>
|
template <typename Return, typename Function, typename... Args>
|
||||||
LuaWrappedFunction wrapMethodArgs(Function&& func, VariadicTypedef<Args...> const&) {
|
LuaWrappedFunction wrapMethodArgs(Function&& func, VariadicTypedef<Args...> const&) {
|
||||||
return wrapMethodWithSignature<Return, Args...>(forward<Function>(func));
|
return wrapMethodWithSignature<Return, Args...>(std::forward<Function>(func));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
LuaWrappedFunction wrapMethod(Function&& func) {
|
LuaWrappedFunction wrapMethod(Function&& func) {
|
||||||
return wrapMethodArgs<typename FunctionTraits<Function>::Return>(
|
return wrapMethodArgs<typename FunctionTraits<Function>::Return>(
|
||||||
forward<Function>(func), typename FunctionTraits<Function>::Args());
|
std::forward<Function>(func), typename FunctionTraits<Function>::Args());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Ret, typename... Args>
|
template <typename Ret, typename... Args>
|
||||||
@ -1405,8 +1405,8 @@ namespace LuaDetail {
|
|||||||
struct TableIteratorWrapper<bool, LuaEngine&, Key, Value> {
|
struct TableIteratorWrapper<bool, LuaEngine&, Key, Value> {
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
static function<bool(LuaValue, LuaValue)> wrap(LuaEngine& engine, Function&& func) {
|
static function<bool(LuaValue, LuaValue)> wrap(LuaEngine& engine, Function&& func) {
|
||||||
return [&engine, func = move(func)](LuaValue key, LuaValue value) -> bool {
|
return [&engine, func = std::move(func)](LuaValue key, LuaValue value) -> bool {
|
||||||
return func(engine, engine.luaTo<Key>(move(key)), engine.luaTo<Value>(move(value)));
|
return func(engine, engine.luaTo<Key>(std::move(key)), engine.luaTo<Value>(std::move(value)));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1415,8 +1415,8 @@ namespace LuaDetail {
|
|||||||
struct TableIteratorWrapper<void, LuaEngine&, Key, Value> {
|
struct TableIteratorWrapper<void, LuaEngine&, Key, Value> {
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
static function<bool(LuaValue, LuaValue)> wrap(LuaEngine& engine, Function&& func) {
|
static function<bool(LuaValue, LuaValue)> wrap(LuaEngine& engine, Function&& func) {
|
||||||
return [&engine, func = move(func)](LuaValue key, LuaValue value) -> bool {
|
return [&engine, func = std::move(func)](LuaValue key, LuaValue value) -> bool {
|
||||||
func(engine, engine.luaTo<Key>(move(key)), engine.luaTo<Value>(move(value)));
|
func(engine, engine.luaTo<Key>(std::move(key)), engine.luaTo<Value>(std::move(value)));
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1426,8 +1426,8 @@ namespace LuaDetail {
|
|||||||
struct TableIteratorWrapper<bool, Key, Value> {
|
struct TableIteratorWrapper<bool, Key, Value> {
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
static function<bool(LuaValue, LuaValue)> wrap(LuaEngine& engine, Function&& func) {
|
static function<bool(LuaValue, LuaValue)> wrap(LuaEngine& engine, Function&& func) {
|
||||||
return [&engine, func = move(func)](LuaValue key, LuaValue value) -> bool {
|
return [&engine, func = std::move(func)](LuaValue key, LuaValue value) -> bool {
|
||||||
return func(engine.luaTo<Key>(move(key)), engine.luaTo<Value>(move(value)));
|
return func(engine.luaTo<Key>(std::move(key)), engine.luaTo<Value>(std::move(value)));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1436,8 +1436,8 @@ namespace LuaDetail {
|
|||||||
struct TableIteratorWrapper<void, Key, Value> {
|
struct TableIteratorWrapper<void, Key, Value> {
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
static function<bool(LuaValue, LuaValue)> wrap(LuaEngine& engine, Function&& func) {
|
static function<bool(LuaValue, LuaValue)> wrap(LuaEngine& engine, Function&& func) {
|
||||||
return [&engine, func = move(func)](LuaValue key, LuaValue value) -> bool {
|
return [&engine, func = std::move(func)](LuaValue key, LuaValue value) -> bool {
|
||||||
func(engine.luaTo<Key>(move(key)), engine.luaTo<Value>(move(value)));
|
func(engine.luaTo<Key>(std::move(key)), engine.luaTo<Value>(std::move(value)));
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1445,19 +1445,19 @@ namespace LuaDetail {
|
|||||||
|
|
||||||
template <typename Return, typename... Args, typename Function>
|
template <typename Return, typename... Args, typename Function>
|
||||||
function<bool(LuaValue, LuaValue)> wrapTableIteratorWithSignature(LuaEngine& engine, Function&& func) {
|
function<bool(LuaValue, LuaValue)> wrapTableIteratorWithSignature(LuaEngine& engine, Function&& func) {
|
||||||
return TableIteratorWrapper<Return, typename std::decay<Args>::type...>::wrap(engine, forward<Function>(func));
|
return TableIteratorWrapper<Return, typename std::decay<Args>::type...>::wrap(engine, std::forward<Function>(func));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Return, typename Function, typename... Args>
|
template <typename Return, typename Function, typename... Args>
|
||||||
function<bool(LuaValue, LuaValue)> wrapTableIteratorArgs(
|
function<bool(LuaValue, LuaValue)> wrapTableIteratorArgs(
|
||||||
LuaEngine& engine, Function&& func, VariadicTypedef<Args...> const&) {
|
LuaEngine& engine, Function&& func, VariadicTypedef<Args...> const&) {
|
||||||
return wrapTableIteratorWithSignature<Return, Args...>(engine, forward<Function>(func));
|
return wrapTableIteratorWithSignature<Return, Args...>(engine, std::forward<Function>(func));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
function<bool(LuaValue, LuaValue)> wrapTableIterator(LuaEngine& engine, Function&& func) {
|
function<bool(LuaValue, LuaValue)> wrapTableIterator(LuaEngine& engine, Function&& func) {
|
||||||
return wrapTableIteratorArgs<typename FunctionTraits<Function>::Return>(
|
return wrapTableIteratorArgs<typename FunctionTraits<Function>::Return>(
|
||||||
engine, forward<Function>(func), typename FunctionTraits<Function>::Args());
|
engine, std::forward<Function>(func), typename FunctionTraits<Function>::Args());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Like lua_setfield / lua_getfield but raw.
|
// Like lua_setfield / lua_getfield but raw.
|
||||||
@ -1520,7 +1520,7 @@ LuaVariadic<typename std::decay<Container>::type::value_type> luaUnpack(Containe
|
|||||||
LuaVariadic<typename std::decay<Container>::type::value_type> ret;
|
LuaVariadic<typename std::decay<Container>::type::value_type> ret;
|
||||||
if (std::is_rvalue_reference<Container&&>::value) {
|
if (std::is_rvalue_reference<Container&&>::value) {
|
||||||
for (auto& e : c)
|
for (auto& e : c)
|
||||||
ret.append(move(e));
|
ret.append(std::move(e));
|
||||||
} else {
|
} else {
|
||||||
for (auto const& e : c)
|
for (auto const& e : c)
|
||||||
ret.append(e);
|
ret.append(e);
|
||||||
@ -1535,7 +1535,7 @@ LuaTupleReturn<Types...>::LuaTupleReturn(Types const&... args)
|
|||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
template <typename... UTypes>
|
template <typename... UTypes>
|
||||||
LuaTupleReturn<Types...>::LuaTupleReturn(UTypes&&... args)
|
LuaTupleReturn<Types...>::LuaTupleReturn(UTypes&&... args)
|
||||||
: Base(move(args)...) {}
|
: Base(std::move(args)...) {}
|
||||||
|
|
||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
template <typename... UTypes>
|
template <typename... UTypes>
|
||||||
@ -1548,7 +1548,7 @@ LuaTupleReturn<Types...>::LuaTupleReturn(LuaTupleReturn const& rhs)
|
|||||||
|
|
||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
LuaTupleReturn<Types...>::LuaTupleReturn(LuaTupleReturn&& rhs)
|
LuaTupleReturn<Types...>::LuaTupleReturn(LuaTupleReturn&& rhs)
|
||||||
: Base(move(rhs)) {}
|
: Base(std::move(rhs)) {}
|
||||||
|
|
||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
template <typename... UTypes>
|
template <typename... UTypes>
|
||||||
@ -1558,7 +1558,7 @@ LuaTupleReturn<Types...>::LuaTupleReturn(LuaTupleReturn<UTypes...> const& rhs)
|
|||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
template <typename... UTypes>
|
template <typename... UTypes>
|
||||||
LuaTupleReturn<Types...>::LuaTupleReturn(LuaTupleReturn<UTypes...>&& rhs)
|
LuaTupleReturn<Types...>::LuaTupleReturn(LuaTupleReturn<UTypes...>&& rhs)
|
||||||
: Base(move(rhs)) {}
|
: Base(std::move(rhs)) {}
|
||||||
|
|
||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
LuaTupleReturn<Types...>& LuaTupleReturn<Types...>::operator=(LuaTupleReturn const& rhs) {
|
LuaTupleReturn<Types...>& LuaTupleReturn<Types...>::operator=(LuaTupleReturn const& rhs) {
|
||||||
@ -1568,7 +1568,7 @@ LuaTupleReturn<Types...>& LuaTupleReturn<Types...>::operator=(LuaTupleReturn con
|
|||||||
|
|
||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
LuaTupleReturn<Types...>& LuaTupleReturn<Types...>::operator=(LuaTupleReturn&& rhs) {
|
LuaTupleReturn<Types...>& LuaTupleReturn<Types...>::operator=(LuaTupleReturn&& rhs) {
|
||||||
Base::operator=(move(rhs));
|
Base::operator=(std::move(rhs));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1582,7 +1582,7 @@ LuaTupleReturn<Types...>& LuaTupleReturn<Types...>::operator=(LuaTupleReturn<UTy
|
|||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
template <typename... UTypes>
|
template <typename... UTypes>
|
||||||
LuaTupleReturn<Types...>& LuaTupleReturn<Types...>::operator=(LuaTupleReturn<UTypes...>&& rhs) {
|
LuaTupleReturn<Types...>& LuaTupleReturn<Types...>::operator=(LuaTupleReturn<UTypes...>&& rhs) {
|
||||||
Base::operator=((tuple<UTypes...> && )move(rhs));
|
Base::operator=((tuple<UTypes...> && )std::move(rhs));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1593,10 +1593,10 @@ LuaTupleReturn<Types&...> luaTie(Types&... args) {
|
|||||||
|
|
||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
LuaTupleReturn<typename std::decay<Types>::type...> luaTupleReturn(Types&&... args) {
|
LuaTupleReturn<typename std::decay<Types>::type...> luaTupleReturn(Types&&... args) {
|
||||||
return LuaTupleReturn<typename std::decay<Types>::type...>(forward<Types>(args)...);
|
return LuaTupleReturn<typename std::decay<Types>::type...>(std::forward<Types>(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 {
|
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);
|
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 <typename T, typename K>
|
template <typename T, typename K>
|
||||||
T LuaTable::get(K key) const {
|
T LuaTable::get(K key) const {
|
||||||
return engine().luaTo<T>(engine().tableGet(false, handleIndex(), engine().luaFrom(move(key))));
|
return engine().luaTo<T>(engine().tableGet(false, handleIndex(), engine().luaFrom(std::move(key))));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -1698,17 +1698,17 @@ T LuaTable::get(char const* key) const {
|
|||||||
|
|
||||||
template <typename T, typename K>
|
template <typename T, typename K>
|
||||||
void LuaTable::set(K key, T value) const {
|
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 <typename T>
|
template <typename T>
|
||||||
void LuaTable::set(char const* key, T value) const {
|
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 <typename K>
|
template <typename K>
|
||||||
bool LuaTable::contains(K key) const {
|
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 <typename K>
|
template <typename K>
|
||||||
@ -1718,12 +1718,12 @@ void LuaTable::remove(K key) const {
|
|||||||
|
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
void LuaTable::iterate(Function&& function) const {
|
void LuaTable::iterate(Function&& function) const {
|
||||||
return engine().tableIterate(handleIndex(), LuaDetail::wrapTableIterator(engine(), forward<Function>(function)));
|
return engine().tableIterate(handleIndex(), LuaDetail::wrapTableIterator(engine(), std::forward<Function>(function)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Return, typename... Args, typename Function>
|
template <typename Return, typename... Args, typename Function>
|
||||||
void LuaTable::iterateWithSignature(Function&& func) const {
|
void LuaTable::iterateWithSignature(Function&& func) const {
|
||||||
return engine().tableIterate(handleIndex(), LuaDetail::wrapTableIteratorWithSignature<Return, Args...>(engine(), forward<Function>(func)));
|
return engine().tableIterate(handleIndex(), LuaDetail::wrapTableIteratorWithSignature<Return, Args...>(engine(), std::forward<Function>(func)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename K>
|
template <typename T, typename K>
|
||||||
@ -1779,27 +1779,27 @@ T& LuaUserData::get() const {
|
|||||||
|
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
void LuaCallbacks::registerCallback(String name, Function&& func) {
|
void LuaCallbacks::registerCallback(String name, Function&& func) {
|
||||||
if (!m_callbacks.insert(name, LuaDetail::wrapFunction(forward<Function>(func))).second)
|
if (!m_callbacks.insert(name, LuaDetail::wrapFunction(std::forward<Function>(func))).second)
|
||||||
throw LuaException::format("Lua callback '{}' was registered twice", name);
|
throw LuaException::format("Lua callback '{}' was registered twice", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Return, typename... Args, typename Function>
|
template <typename Return, typename... Args, typename Function>
|
||||||
void LuaCallbacks::registerCallbackWithSignature(String name, Function&& func) {
|
void LuaCallbacks::registerCallbackWithSignature(String name, Function&& func) {
|
||||||
if (!m_callbacks.insert(name, LuaDetail::wrapFunctionWithSignature<Return, Args...>(forward<Function>(func))).second)
|
if (!m_callbacks.insert(name, LuaDetail::wrapFunctionWithSignature<Return, Args...>(std::forward<Function>(func))).second)
|
||||||
throw LuaException::format("Lua callback '{}' was registered twice", name);
|
throw LuaException::format("Lua callback '{}' was registered twice", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
void LuaMethods<T>::registerMethod(String name, Function&& func) {
|
void LuaMethods<T>::registerMethod(String name, Function&& func) {
|
||||||
if (!m_methods.insert(name, LuaDetail::wrapMethod(forward<Function>(move(func)))).second)
|
if (!m_methods.insert(name, LuaDetail::wrapMethod(std::forward<Function>(std::move(func)))).second)
|
||||||
throw LuaException::format("Lua method '{}' was registered twice", name);
|
throw LuaException::format("Lua method '{}' was registered twice", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
template <typename Return, typename... Args, typename Function>
|
template <typename Return, typename... Args, typename Function>
|
||||||
void LuaMethods<T>::registerMethodWithSignature(String name, Function&& func) {
|
void LuaMethods<T>::registerMethodWithSignature(String name, Function&& func) {
|
||||||
if (!m_methods.insert(name, LuaDetail::wrapMethodWithSignature<Return, Args...>(forward<Function>(move(func))))
|
if (!m_methods.insert(name, LuaDetail::wrapMethodWithSignature<Return, Args...>(std::forward<Function>(std::move(func))))
|
||||||
.second)
|
.second)
|
||||||
throw LuaException::format("Lua method '{}' was registered twice", name);
|
throw LuaException::format("Lua method '{}' was registered twice", name);
|
||||||
}
|
}
|
||||||
@ -1811,12 +1811,12 @@ StringMap<LuaDetail::LuaWrappedFunction> const& LuaMethods<T>::methods() const {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T LuaContext::getPath(String path) const {
|
T LuaContext::getPath(String path) const {
|
||||||
return engine().luaTo<T>(engine().contextGetPath(handleIndex(), move(path)));
|
return engine().luaTo<T>(engine().contextGetPath(handleIndex(), std::move(path)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void LuaContext::setPath(String key, T value) {
|
void LuaContext::setPath(String key, T value) {
|
||||||
engine().contextSetPath(handleIndex(), move(key), engine().luaFrom<T>(move(value)));
|
engine().contextSetPath(handleIndex(), std::move(key), engine().luaFrom<T>(std::move(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Ret>
|
template <typename Ret>
|
||||||
@ -1834,7 +1834,7 @@ Ret LuaContext::invokePath(String const& key, Args const&... args) const {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
LuaValue LuaContext::luaFrom(T&& t) {
|
LuaValue LuaContext::luaFrom(T&& t) {
|
||||||
return engine().luaFrom(forward<T>(t));
|
return engine().luaFrom(std::forward<T>(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -1844,7 +1844,7 @@ LuaValue LuaContext::luaFrom(T const& t) {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Maybe<T> LuaContext::luaMaybeTo(LuaValue&& v) {
|
Maybe<T> LuaContext::luaMaybeTo(LuaValue&& v) {
|
||||||
return engine().luaFrom(move(v));
|
return engine().luaFrom(std::move(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -1854,7 +1854,7 @@ Maybe<T> LuaContext::luaMaybeTo(LuaValue const& v) {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T LuaContext::luaTo(LuaValue&& v) {
|
T LuaContext::luaTo(LuaValue&& v) {
|
||||||
return engine().luaTo<T>(move(v));
|
return engine().luaTo<T>(std::move(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -1874,17 +1874,17 @@ LuaTable LuaContext::createArrayTable(Container const& array) {
|
|||||||
|
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
LuaFunction LuaContext::createFunction(Function&& func) {
|
LuaFunction LuaContext::createFunction(Function&& func) {
|
||||||
return engine().createFunction(forward<Function>(func));
|
return engine().createFunction(std::forward<Function>(func));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Return, typename... Args, typename Function>
|
template <typename Return, typename... Args, typename Function>
|
||||||
LuaFunction LuaContext::createFunctionWithSignature(Function&& func) {
|
LuaFunction LuaContext::createFunctionWithSignature(Function&& func) {
|
||||||
return engine().createFunctionWithSignature<Return, Args...>(forward<Function>(func));
|
return engine().createFunctionWithSignature<Return, Args...>(std::forward<Function>(func));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
LuaUserData LuaContext::createUserData(T t) {
|
LuaUserData LuaContext::createUserData(T t) {
|
||||||
return engine().createUserData(move(t));
|
return engine().createUserData(std::move(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -1894,7 +1894,7 @@ LuaMethods<T> LuaUserDataMethods<T>::make() {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
LuaValue LuaUserDataConverter<T>::from(LuaEngine& engine, T t) {
|
LuaValue LuaUserDataConverter<T>::from(LuaEngine& engine, T t) {
|
||||||
return engine.createUserData(move(t));
|
return engine.createUserData(std::move(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -1908,7 +1908,7 @@ Maybe<T> LuaUserDataConverter<T>::to(LuaEngine&, LuaValue const& v) {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
LuaValue LuaEngine::luaFrom(T&& t) {
|
LuaValue LuaEngine::luaFrom(T&& t) {
|
||||||
return LuaConverter<typename std::decay<T>::type>::from(*this, forward<T>(t));
|
return LuaConverter<typename std::decay<T>::type>::from(*this, std::forward<T>(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -1918,7 +1918,7 @@ LuaValue LuaEngine::luaFrom(T const& t) {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Maybe<T> LuaEngine::luaMaybeTo(LuaValue&& v) {
|
Maybe<T> LuaEngine::luaMaybeTo(LuaValue&& v) {
|
||||||
return LuaConverter<T>::to(*this, move(v));
|
return LuaConverter<T>::to(*this, std::move(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -1928,7 +1928,7 @@ Maybe<T> LuaEngine::luaMaybeTo(LuaValue const& v) {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T LuaEngine::luaTo(LuaValue&& v) {
|
T LuaEngine::luaTo(LuaValue&& v) {
|
||||||
if (auto res = luaMaybeTo<T>(move(v)))
|
if (auto res = luaMaybeTo<T>(std::move(v)))
|
||||||
return res.take();
|
return res.take();
|
||||||
throw LuaConversionException::format("Error converting LuaValue to type '{}'", typeid(T).name());
|
throw LuaConversionException::format("Error converting LuaValue to type '{}'", typeid(T).name());
|
||||||
}
|
}
|
||||||
@ -1961,12 +1961,12 @@ LuaTable LuaEngine::createArrayTable(Container const& array) {
|
|||||||
|
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
LuaFunction LuaEngine::createFunction(Function&& func) {
|
LuaFunction LuaEngine::createFunction(Function&& func) {
|
||||||
return createWrappedFunction(LuaDetail::wrapFunction(forward<Function>(func)));
|
return createWrappedFunction(LuaDetail::wrapFunction(std::forward<Function>(func)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Return, typename... Args, typename Function>
|
template <typename Return, typename... Args, typename Function>
|
||||||
LuaFunction LuaEngine::createFunctionWithSignature(Function&& func) {
|
LuaFunction LuaEngine::createFunctionWithSignature(Function&& func) {
|
||||||
return createWrappedFunction(LuaDetail::wrapFunctionWithSignature<Return, Args...>(forward<Function>(func)));
|
return createWrappedFunction(LuaDetail::wrapFunctionWithSignature<Return, Args...>(std::forward<Function>(func)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
@ -2026,7 +2026,7 @@ Maybe<LuaDetail::LuaFunctionReturn> LuaEngine::resumeThread(int handleIndex, Arg
|
|||||||
LuaVariadic<LuaValue> ret(returnValues);
|
LuaVariadic<LuaValue> ret(returnValues);
|
||||||
for (int i = returnValues - 1; i >= 0; --i)
|
for (int i = returnValues - 1; i >= 0; --i)
|
||||||
ret[i] = popLuaValue(threadState);
|
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);
|
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_rawgeti(m_state, LUA_REGISTRYINDEX, typeMetatable);
|
||||||
lua_setmetatable(m_state, -2);
|
lua_setmetatable(m_state, -2);
|
||||||
@ -2083,7 +2083,7 @@ template <typename T, typename K>
|
|||||||
T LuaEngine::getGlobal(K key) {
|
T LuaEngine::getGlobal(K key) {
|
||||||
lua_checkstack(m_state, 1);
|
lua_checkstack(m_state, 1);
|
||||||
lua_rawgeti(m_state, LUA_REGISTRYINDEX, m_scriptDefaultEnvRegistryId);
|
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);
|
lua_rawget(m_state, -2);
|
||||||
|
|
||||||
LuaValue v = popLuaValue(m_state);
|
LuaValue v = popLuaValue(m_state);
|
||||||
@ -2109,8 +2109,8 @@ void LuaEngine::setGlobal(K key, T value) {
|
|||||||
lua_checkstack(m_state, 1);
|
lua_checkstack(m_state, 1);
|
||||||
|
|
||||||
lua_rawgeti(m_state, LUA_REGISTRYINDEX, m_scriptDefaultEnvRegistryId);
|
lua_rawgeti(m_state, LUA_REGISTRYINDEX, m_scriptDefaultEnvRegistryId);
|
||||||
pushLuaValue(m_state, luaFrom(move(key)));
|
pushLuaValue(m_state, luaFrom(std::move(key)));
|
||||||
pushLuaValue(m_state, luaFrom(move(value)));
|
pushLuaValue(m_state, luaFrom(std::move(value)));
|
||||||
|
|
||||||
lua_rawset(m_state, -3);
|
lua_rawset(m_state, -3);
|
||||||
lua_pop(m_state, 1);
|
lua_pop(m_state, 1);
|
||||||
|
@ -33,8 +33,8 @@ template <typename T1, typename T2>
|
|||||||
struct LuaConverter<pair<T1, T2>> {
|
struct LuaConverter<pair<T1, T2>> {
|
||||||
static LuaValue from(LuaEngine& engine, pair<T1, T2>&& v) {
|
static LuaValue from(LuaEngine& engine, pair<T1, T2>&& v) {
|
||||||
auto t = engine.createTable();
|
auto t = engine.createTable();
|
||||||
t.set(1, move(v.first));
|
t.set(1, std::move(v.first));
|
||||||
t.set(2, move(v.second));
|
t.set(2, std::move(v.second));
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ struct LuaConverter<pair<T1, T2>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Maybe<pair<T1, T2>> to(LuaEngine& engine, LuaValue const& v) {
|
static Maybe<pair<T1, T2>> to(LuaEngine& engine, LuaValue const& v) {
|
||||||
if (auto table = engine.luaMaybeTo<LuaTable>(move(v))) {
|
if (auto table = engine.luaMaybeTo<LuaTable>(std::move(v))) {
|
||||||
auto p1 = engine.luaMaybeTo<T1>(table->get(1));
|
auto p1 = engine.luaMaybeTo<T1>(table->get(1));
|
||||||
auto p2 = engine.luaMaybeTo<T2>(table->get(2));
|
auto p2 = engine.luaMaybeTo<T2>(table->get(2));
|
||||||
if (p1 && p2)
|
if (p1 && p2)
|
||||||
@ -173,7 +173,7 @@ struct LuaConverter<Variant<FirstType, RestTypes...>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static LuaValue from(LuaEngine& engine, Variant<FirstType, RestTypes...>&& variant) {
|
static LuaValue from(LuaEngine& engine, Variant<FirstType, RestTypes...>&& 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<Variant<FirstType, RestTypes...>> to(LuaEngine& engine, LuaValue const& v) {
|
static Maybe<Variant<FirstType, RestTypes...>> to(LuaEngine& engine, LuaValue const& v) {
|
||||||
@ -194,7 +194,7 @@ struct LuaConverter<Variant<FirstType, RestTypes...>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Maybe<Variant<FirstType, RestTypes...>> to(LuaEngine& engine, LuaValue&& v) {
|
static Maybe<Variant<FirstType, RestTypes...>> to(LuaEngine& engine, LuaValue&& v) {
|
||||||
return checkTypeTo<FirstType, RestTypes...>(engine, move(v));
|
return checkTypeTo<FirstType, RestTypes...>(engine, std::move(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename CheckType1, typename CheckType2, typename... CheckTypeRest>
|
template <typename CheckType1, typename CheckType2, typename... CheckTypeRest>
|
||||||
@ -202,12 +202,12 @@ struct LuaConverter<Variant<FirstType, RestTypes...>> {
|
|||||||
if (auto t1 = engine.luaMaybeTo<CheckType1>(v))
|
if (auto t1 = engine.luaMaybeTo<CheckType1>(v))
|
||||||
return t1;
|
return t1;
|
||||||
else
|
else
|
||||||
return checkTypeTo<CheckType2, CheckTypeRest...>(engine, move(v));
|
return checkTypeTo<CheckType2, CheckTypeRest...>(engine, std::move(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
static Maybe<Variant<FirstType, RestTypes...>> checkTypeTo(LuaEngine& engine, LuaValue&& v) {
|
static Maybe<Variant<FirstType, RestTypes...>> checkTypeTo(LuaEngine& engine, LuaValue&& v) {
|
||||||
return engine.luaMaybeTo<Type>(move(v));
|
return engine.luaMaybeTo<Type>(std::move(v));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ struct LuaConverter<MVariant<Types...>> {
|
|||||||
static LuaValue from(LuaEngine& engine, MVariant<Types...>&& variant) {
|
static LuaValue from(LuaEngine& engine, MVariant<Types...>&& variant) {
|
||||||
LuaValue value;
|
LuaValue value;
|
||||||
variant.call([&value, &engine](auto& a) {
|
variant.call([&value, &engine](auto& a) {
|
||||||
value = luaFrom(engine, move(a));
|
value = luaFrom(engine, std::move(a));
|
||||||
});
|
});
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -253,7 +253,7 @@ struct LuaConverter<MVariant<Types...>> {
|
|||||||
static Maybe<MVariant<Types...>> to(LuaEngine& engine, LuaValue&& v) {
|
static Maybe<MVariant<Types...>> to(LuaEngine& engine, LuaValue&& v) {
|
||||||
if (v == LuaNil)
|
if (v == LuaNil)
|
||||||
return MVariant<Types...>();
|
return MVariant<Types...>();
|
||||||
return checkTypeTo<Types...>(engine, move(v));
|
return checkTypeTo<Types...>(engine, std::move(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename CheckType1, typename CheckType2, typename... CheckTypeRest>
|
template <typename CheckType1, typename CheckType2, typename... CheckTypeRest>
|
||||||
@ -261,12 +261,12 @@ struct LuaConverter<MVariant<Types...>> {
|
|||||||
if (auto t1 = engine.luaMaybeTo<CheckType1>(v))
|
if (auto t1 = engine.luaMaybeTo<CheckType1>(v))
|
||||||
return t1;
|
return t1;
|
||||||
else
|
else
|
||||||
return checkTypeTo<CheckType2, CheckTypeRest...>(engine, move(v));
|
return checkTypeTo<CheckType2, CheckTypeRest...>(engine, std::move(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename CheckType>
|
template <typename CheckType>
|
||||||
static Maybe<MVariant<Types...>> checkTypeTo(LuaEngine& engine, LuaValue&& v) {
|
static Maybe<MVariant<Types...>> checkTypeTo(LuaEngine& engine, LuaValue&& v) {
|
||||||
return engine.luaMaybeTo<CheckType>(move(v));
|
return engine.luaMaybeTo<CheckType>(std::move(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -172,7 +172,7 @@ auto MapMixin<BaseMap>::maybeTake(key_type const& k) -> Maybe<mapped_type> {
|
|||||||
if (i != Base::end()) {
|
if (i != Base::end()) {
|
||||||
mapped_type v = std::move(i->second);
|
mapped_type v = std::move(i->second);
|
||||||
Base::erase(i);
|
Base::erase(i);
|
||||||
return move(v);
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
@ -198,7 +198,7 @@ template <typename BaseMap>
|
|||||||
auto MapMixin<BaseMap>::value(key_type const& k, mapped_type d) const -> mapped_type {
|
auto MapMixin<BaseMap>::value(key_type const& k, mapped_type d) const -> mapped_type {
|
||||||
const_iterator i = Base::find(k);
|
const_iterator i = Base::find(k);
|
||||||
if (i == Base::end())
|
if (i == Base::end())
|
||||||
return std::move(d);
|
return d;
|
||||||
else
|
else
|
||||||
return i->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
@ -260,12 +260,12 @@ auto MapMixin<BaseMap>::hasValue(mapped_type const& v) const -> bool {
|
|||||||
|
|
||||||
template <typename BaseMap>
|
template <typename BaseMap>
|
||||||
auto MapMixin<BaseMap>::insert(key_type k, mapped_type v) -> pair<iterator, bool> {
|
auto MapMixin<BaseMap>::insert(key_type k, mapped_type v) -> pair<iterator, bool> {
|
||||||
return Base::insert(value_type(move(k), move(v)));
|
return Base::insert(value_type(std::move(k), std::move(v)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename BaseMap>
|
template <typename BaseMap>
|
||||||
auto MapMixin<BaseMap>::add(key_type k, mapped_type v) -> mapped_type& {
|
auto MapMixin<BaseMap>::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)
|
if (!pair.second)
|
||||||
throw MapException(strf("Entry with key '{}' already present.", outputAny(k)));
|
throw MapException(strf("Entry with key '{}' already present.", outputAny(k)));
|
||||||
else
|
else
|
||||||
@ -276,10 +276,10 @@ template <typename BaseMap>
|
|||||||
auto MapMixin<BaseMap>::set(key_type k, mapped_type v) -> mapped_type& {
|
auto MapMixin<BaseMap>::set(key_type k, mapped_type v) -> mapped_type& {
|
||||||
auto i = Base::find(k);
|
auto i = Base::find(k);
|
||||||
if (i != Base::end()) {
|
if (i != Base::end()) {
|
||||||
i->second = move(v);
|
i->second = std::move(v);
|
||||||
return i->second;
|
return i->second;
|
||||||
} else {
|
} 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ Maybe<T>::Maybe(T const& t)
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
Maybe<T>::Maybe(T&& t)
|
Maybe<T>::Maybe(T&& t)
|
||||||
: Maybe() {
|
: Maybe() {
|
||||||
new (&m_data) T(forward<T>(t));
|
new (&m_data) T(std::forward<T>(t));
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ template <typename T>
|
|||||||
Maybe<T>::Maybe(Maybe&& rhs)
|
Maybe<T>::Maybe(Maybe&& rhs)
|
||||||
: Maybe() {
|
: Maybe() {
|
||||||
if (rhs.m_initialized) {
|
if (rhs.m_initialized) {
|
||||||
new (&m_data) T(move(rhs.m_data));
|
new (&m_data) T(std::move(rhs.m_data));
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
rhs.reset();
|
rhs.reset();
|
||||||
}
|
}
|
||||||
@ -308,7 +308,7 @@ T Maybe<T>::take() {
|
|||||||
if (!m_initialized)
|
if (!m_initialized)
|
||||||
throw InvalidMaybeAccessException();
|
throw InvalidMaybeAccessException();
|
||||||
|
|
||||||
T val(move(m_data));
|
T val(std::move(m_data));
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ T Maybe<T>::take() {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
bool Maybe<T>::put(T& t) {
|
bool Maybe<T>::put(T& t) {
|
||||||
if (m_initialized) {
|
if (m_initialized) {
|
||||||
t = move(m_data);
|
t = std::move(m_data);
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ void Maybe<T>::set(T const& t) {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void Maybe<T>::set(T&& t) {
|
void Maybe<T>::set(T&& t) {
|
||||||
emplace(forward<T>(t));
|
emplace(std::forward<T>(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -343,7 +343,7 @@ template <typename... Args>
|
|||||||
void Maybe<T>::emplace(Args&&... t) {
|
void Maybe<T>::emplace(Args&&... t) {
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
new (&m_data) T(forward<Args>(t)...);
|
new (&m_data) T(std::forward<Args>(t)...);
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,14 +326,14 @@ void MultiArray<Element, Rank>::set(IndexArray const& index, Element element) {
|
|||||||
throw MultiArrayException(strf("Out of bounds on MultiArray::set({})", index));
|
throw MultiArrayException(strf("Out of bounds on MultiArray::set({})", index));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_data[storageIndex(index)] = move(element);
|
m_data[storageIndex(index)] = std::move(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, size_t Rank>
|
template <typename Element, size_t Rank>
|
||||||
Element MultiArray<Element, Rank>::get(IndexArray const& index, Element def) {
|
Element MultiArray<Element, Rank>::get(IndexArray const& index, Element def) {
|
||||||
for (size_t i = Rank; i != 0; --i) {
|
for (size_t i = Rank; i != 0; --i) {
|
||||||
if (index[i - 1] >= m_shape[i - 1])
|
if (index[i - 1] >= m_shape[i - 1])
|
||||||
return move(def);
|
return std::move(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_data[storageIndex(index)];
|
return m_data[storageIndex(index)];
|
||||||
@ -346,7 +346,7 @@ void MultiArray<Element, Rank>::setResize(IndexArray const& index, Element eleme
|
|||||||
newShape[i] = std::max(m_shape[i], index[i] + 1);
|
newShape[i] = std::max(m_shape[i], index[i] + 1);
|
||||||
resize(newShape);
|
resize(newShape);
|
||||||
|
|
||||||
m_data[storageIndex(index)] = move(element);
|
m_data[storageIndex(index)] = std::move(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, size_t Rank>
|
template <typename Element, size_t Rank>
|
||||||
@ -369,26 +369,26 @@ template <typename Element, size_t Rank>
|
|||||||
template <typename OpType>
|
template <typename OpType>
|
||||||
void MultiArray<Element, Rank>::forEach(IndexArray const& min, SizeArray const& size, OpType&& op) {
|
void MultiArray<Element, Rank>::forEach(IndexArray const& min, SizeArray const& size, OpType&& op) {
|
||||||
IndexArray index;
|
IndexArray index;
|
||||||
subForEach(min, size, forward<OpType>(op), index, 0, 0);
|
subForEach(min, size, std::forward<OpType>(op), index, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, size_t Rank>
|
template <typename Element, size_t Rank>
|
||||||
template <typename OpType>
|
template <typename OpType>
|
||||||
void MultiArray<Element, Rank>::forEach(IndexArray const& min, SizeArray const& size, OpType&& op) const {
|
void MultiArray<Element, Rank>::forEach(IndexArray const& min, SizeArray const& size, OpType&& op) const {
|
||||||
IndexArray index;
|
IndexArray index;
|
||||||
subForEach(min, size, forward<OpType>(op), index, 0, 0);
|
subForEach(min, size, std::forward<OpType>(op), index, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, size_t Rank>
|
template <typename Element, size_t Rank>
|
||||||
template <typename OpType>
|
template <typename OpType>
|
||||||
void MultiArray<Element, Rank>::forEach(OpType&& op) {
|
void MultiArray<Element, Rank>::forEach(OpType&& op) {
|
||||||
forEach(IndexArray::filled(0), size(), forward<OpType>(op));
|
forEach(IndexArray::filled(0), size(), std::forward<OpType>(op));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, size_t Rank>
|
template <typename Element, size_t Rank>
|
||||||
template <typename OpType>
|
template <typename OpType>
|
||||||
void MultiArray<Element, Rank>::forEach(OpType&& op) const {
|
void MultiArray<Element, Rank>::forEach(OpType&& op) const {
|
||||||
forEach(IndexArray::filled(0), size(), forward<OpType>(op));
|
forEach(IndexArray::filled(0), size(), std::forward<OpType>(op));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, size_t Rank>
|
template <typename Element, size_t Rank>
|
||||||
@ -461,7 +461,7 @@ void MultiArray<Element, Rank>::subForEach(IndexArray const& min, SizeArray cons
|
|||||||
if (dim == Rank - 1)
|
if (dim == Rank - 1)
|
||||||
op(index, m_data[offset + i]);
|
op(index, m_data[offset + i]);
|
||||||
else
|
else
|
||||||
subForEach(min, size, forward<OpType>(op), index, (offset + i) * m_shape[dim + 1], dim + 1);
|
subForEach(min, size, std::forward<OpType>(op), index, (offset + i) * m_shape[dim + 1], dim + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,7 +475,7 @@ void MultiArray<Element, Rank>::subForEach(IndexArray const& min, SizeArray cons
|
|||||||
if (dim == Rank - 1)
|
if (dim == Rank - 1)
|
||||||
op(index, m_data[offset + i]);
|
op(index, m_data[offset + i]);
|
||||||
else
|
else
|
||||||
subForEach(min, size, forward<OpType>(op), index, (offset + i) * m_shape[dim + 1], dim + 1);
|
subForEach(min, size, std::forward<OpType>(op), index, (offset + i) * m_shape[dim + 1], dim + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ void NetElementBasicField<T>::set(T const& value) {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void NetElementBasicField<T>::push(T value) {
|
void NetElementBasicField<T>::push(T value) {
|
||||||
m_value = move(value);
|
m_value = std::move(value);
|
||||||
updated();
|
updated();
|
||||||
m_latestUpdateVersion = m_netVersion ? m_netVersion->current() : 0;
|
m_latestUpdateVersion = m_netVersion ? m_netVersion->current() : 0;
|
||||||
if (m_pendingInterpolatedValues)
|
if (m_pendingInterpolatedValues)
|
||||||
@ -251,14 +251,14 @@ void NetElementBasicField<T>::readNetDelta(DataStream& ds, float interpolationTi
|
|||||||
// case, this is an error or the step tracking is wildly off, so just clear
|
// case, this is an error or the step tracking is wildly off, so just clear
|
||||||
// any other incoming values.
|
// any other incoming values.
|
||||||
if (interpolationTime > 0.0f && (m_pendingInterpolatedValues->empty() || interpolationTime >= m_pendingInterpolatedValues->last().first)) {
|
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 {
|
} else {
|
||||||
m_value = move(t);
|
m_value = std::move(t);
|
||||||
m_pendingInterpolatedValues->clear();
|
m_pendingInterpolatedValues->clear();
|
||||||
updated();
|
updated();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_value = move(t);
|
m_value = std::move(t);
|
||||||
updated();
|
updated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -314,7 +314,7 @@ NetElementData<T>::NetElementData()
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
NetElementData<T>::NetElementData(function<void(DataStream&, T&)> reader, function<void(DataStream&, T const&)> writer)
|
NetElementData<T>::NetElementData(function<void(DataStream&, T&)> reader, function<void(DataStream&, T const&)> writer)
|
||||||
: m_reader(move(reader)), m_writer(move(writer)) {}
|
: m_reader(std::move(reader)), m_writer(std::move(writer)) {}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void NetElementData<T>::readData(DataStream& ds, T& v) const {
|
void NetElementData<T>::readData(DataStream& ds, T& v) const {
|
||||||
|
@ -124,7 +124,7 @@ void NetElementMapWrapper<BaseMap>::initNetVersion(NetElementVersion const* vers
|
|||||||
m_changeDataLastVersion = 0;
|
m_changeDataLastVersion = 0;
|
||||||
|
|
||||||
for (auto& change : Star::take(m_pendingChangeData))
|
for (auto& change : Star::take(m_pendingChangeData))
|
||||||
applyChange(move(change.second));
|
applyChange(std::move(change.second));
|
||||||
|
|
||||||
addChangeData(ClearChange());
|
addChangeData(ClearChange());
|
||||||
for (auto const& p : *this)
|
for (auto const& p : *this)
|
||||||
@ -140,7 +140,7 @@ template <typename BaseMap>
|
|||||||
void NetElementMapWrapper<BaseMap>::disableNetInterpolation() {
|
void NetElementMapWrapper<BaseMap>::disableNetInterpolation() {
|
||||||
m_interpolationEnabled = false;
|
m_interpolationEnabled = false;
|
||||||
for (auto& change : Star::take(m_pendingChangeData))
|
for (auto& change : Star::take(m_pendingChangeData))
|
||||||
applyChange(move(change.second));
|
applyChange(std::move(change.second));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename BaseMap>
|
template <typename BaseMap>
|
||||||
@ -175,7 +175,7 @@ void NetElementMapWrapper<BaseMap>::netLoad(DataStream& ds) {
|
|||||||
for (uint64_t i = 0; i < count; ++i) {
|
for (uint64_t i = 0; i < count; ++i) {
|
||||||
auto change = readChange(ds);
|
auto change = readChange(ds);
|
||||||
addChangeData(change);
|
addChangeData(change);
|
||||||
applyChange(move(change));
|
applyChange(std::move(change));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_updated = true;
|
m_updated = true;
|
||||||
@ -219,9 +219,9 @@ void NetElementMapWrapper<BaseMap>::readNetDelta(DataStream& ds, float interpola
|
|||||||
addChangeData(change);
|
addChangeData(change);
|
||||||
|
|
||||||
if (m_interpolationEnabled && interpolationTime > 0.0f)
|
if (m_interpolationEnabled && interpolationTime > 0.0f)
|
||||||
addPendingChangeData(move(change), interpolationTime);
|
addPendingChangeData(std::move(change), interpolationTime);
|
||||||
else
|
else
|
||||||
applyChange(move(change));
|
applyChange(std::move(change));
|
||||||
} else {
|
} else {
|
||||||
throw IOException("Improper delta code received in NetElementMapWrapper::readNetDelta");
|
throw IOException("Improper delta code received in NetElementMapWrapper::readNetDelta");
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ template <typename BaseMap>
|
|||||||
auto NetElementMapWrapper<BaseMap>::insert(value_type v) -> pair<const_iterator, bool> {
|
auto NetElementMapWrapper<BaseMap>::insert(value_type v) -> pair<const_iterator, bool> {
|
||||||
auto res = BaseMap::insert(v);
|
auto res = BaseMap::insert(v);
|
||||||
if (res.second) {
|
if (res.second) {
|
||||||
addChangeData(SetChange{move(v.first), move(v.second)});
|
addChangeData(SetChange{std::move(v.first), std::move(v.second)});
|
||||||
m_updated = true;
|
m_updated = true;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
@ -260,12 +260,12 @@ auto NetElementMapWrapper<BaseMap>::insert(value_type v) -> pair<const_iterator,
|
|||||||
|
|
||||||
template <typename BaseMap>
|
template <typename BaseMap>
|
||||||
auto NetElementMapWrapper<BaseMap>::insert(key_type k, mapped_type v) -> pair<const_iterator, bool> {
|
auto NetElementMapWrapper<BaseMap>::insert(key_type k, mapped_type v) -> pair<const_iterator, bool> {
|
||||||
return insert(value_type(move(k), move(v)));
|
return insert(value_type(std::move(k), std::move(v)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename BaseMap>
|
template <typename BaseMap>
|
||||||
void NetElementMapWrapper<BaseMap>::add(key_type k, mapped_type v) {
|
void NetElementMapWrapper<BaseMap>::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));
|
throw MapException::format("Entry with key '{}' already present.", outputAny(k));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,13 +274,13 @@ void NetElementMapWrapper<BaseMap>::set(key_type k, mapped_type v) {
|
|||||||
auto i = BaseMap::find(k);
|
auto i = BaseMap::find(k);
|
||||||
if (i != BaseMap::end()) {
|
if (i != BaseMap::end()) {
|
||||||
if (!(i->second == v)) {
|
if (!(i->second == v)) {
|
||||||
addChangeData(SetChange{move(k), v});
|
addChangeData(SetChange{std::move(k), v});
|
||||||
i->second = move(v);
|
i->second = std::move(v);
|
||||||
m_updated = true;
|
m_updated = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
addChangeData(SetChange{k, v});
|
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;
|
m_updated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -289,11 +289,11 @@ template <typename BaseMap>
|
|||||||
void NetElementMapWrapper<BaseMap>::push(key_type k, mapped_type v) {
|
void NetElementMapWrapper<BaseMap>::push(key_type k, mapped_type v) {
|
||||||
auto i = BaseMap::find(k);
|
auto i = BaseMap::find(k);
|
||||||
if (i != BaseMap::end()) {
|
if (i != BaseMap::end()) {
|
||||||
addChangeData(SetChange(move(k), v));
|
addChangeData(SetChange(std::move(k), v));
|
||||||
i->second = move(v);
|
i->second = std::move(v);
|
||||||
} else {
|
} else {
|
||||||
addChangeData(SetChange(k, v));
|
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;
|
m_updated = true;
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ auto NetElementMapWrapper<BaseMap>::take(key_type const& k) -> mapped_type {
|
|||||||
auto i = BaseMap::find(k);
|
auto i = BaseMap::find(k);
|
||||||
if (i == BaseMap::end())
|
if (i == BaseMap::end())
|
||||||
throw MapException::format("Key '{}' not found in Map::take()", outputAny(k));
|
throw MapException::format("Key '{}' not found in Map::take()", outputAny(k));
|
||||||
auto m = move(i->second);
|
auto m = std::move(i->second);
|
||||||
erase(i);
|
erase(i);
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
@ -332,9 +332,9 @@ auto NetElementMapWrapper<BaseMap>::maybeTake(key_type const& k) -> Maybe<mapped
|
|||||||
auto i = BaseMap::find(k);
|
auto i = BaseMap::find(k);
|
||||||
if (i == BaseMap::end())
|
if (i == BaseMap::end())
|
||||||
return {};
|
return {};
|
||||||
auto m = move(i->second);
|
auto m = std::move(i->second);
|
||||||
erase(i);
|
erase(i);
|
||||||
return Maybe<mapped_type>(move(m));
|
return Maybe<mapped_type>(std::move(m));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename BaseMap>
|
template <typename BaseMap>
|
||||||
@ -368,7 +368,7 @@ void NetElementMapWrapper<BaseMap>::reset(BaseMap values) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseMap::operator=(move(values));
|
BaseMap::operator=(std::move(values));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename BaseMap>
|
template <typename BaseMap>
|
||||||
@ -420,7 +420,7 @@ void NetElementMapWrapper<BaseMap>::addChangeData(ElementChange change) {
|
|||||||
uint64_t currentVersion = m_netVersion ? m_netVersion->current() : 0;
|
uint64_t currentVersion = m_netVersion ? m_netVersion->current() : 0;
|
||||||
starAssert(m_changeData.empty() || m_changeData.last().first <= currentVersion);
|
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>((int64_t)currentVersion - MaxChangeDataVersions, 0);
|
m_changeDataLastVersion = max<int64_t>((int64_t)currentVersion - MaxChangeDataVersions, 0);
|
||||||
while (!m_changeData.empty() && m_changeData.first().first < m_changeDataLastVersion)
|
while (!m_changeData.empty() && m_changeData.first().first < m_changeDataLastVersion)
|
||||||
@ -431,17 +431,17 @@ template <typename BaseMap>
|
|||||||
void NetElementMapWrapper<BaseMap>::addPendingChangeData(ElementChange change, float interpolationTime) {
|
void NetElementMapWrapper<BaseMap>::addPendingChangeData(ElementChange change, float interpolationTime) {
|
||||||
if (!m_pendingChangeData.empty() && interpolationTime < m_pendingChangeData.last().first) {
|
if (!m_pendingChangeData.empty() && interpolationTime < m_pendingChangeData.last().first) {
|
||||||
for (auto& change : Star::take(m_pendingChangeData))
|
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 <typename BaseMap>
|
template <typename BaseMap>
|
||||||
void NetElementMapWrapper<BaseMap>::applyChange(ElementChange change) {
|
void NetElementMapWrapper<BaseMap>::applyChange(ElementChange change) {
|
||||||
if (auto set = change.template ptr<SetChange>())
|
if (auto set = change.template ptr<SetChange>())
|
||||||
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<RemoveChange>())
|
else if (auto remove = change.template ptr<RemoveChange>())
|
||||||
BaseMap::remove(move(remove->key));
|
BaseMap::remove(std::move(remove->key));
|
||||||
else
|
else
|
||||||
BaseMap::clear();
|
BaseMap::clear();
|
||||||
m_updated = true;
|
m_updated = true;
|
||||||
|
@ -91,7 +91,7 @@ auto NetElementDynamicGroup<Element>::addNetElement(ElementPtr element) -> Eleme
|
|||||||
readyElement(element);
|
readyElement(element);
|
||||||
DataStreamBuffer storeBuffer;
|
DataStreamBuffer storeBuffer;
|
||||||
element->netStore(storeBuffer);
|
element->netStore(storeBuffer);
|
||||||
auto id = m_idMap.add(move(element));
|
auto id = m_idMap.add(std::move(element));
|
||||||
|
|
||||||
addChangeData(ElementAddition(id, storeBuffer.takeData()));
|
addChangeData(ElementAddition(id, storeBuffer.takeData()));
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ void NetElementDynamicGroup<Element>::netLoad(DataStream& ds) {
|
|||||||
element->netLoad(storeBuffer);
|
element->netLoad(storeBuffer);
|
||||||
readyElement(element);
|
readyElement(element);
|
||||||
|
|
||||||
m_idMap.add(id, move(element));
|
m_idMap.add(id, std::move(element));
|
||||||
addChangeData(ElementAddition(id, storeBuffer.takeData()));
|
addChangeData(ElementAddition(id, storeBuffer.takeData()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,10 +256,10 @@ void NetElementDynamicGroup<Element>::readNetDelta(DataStream& ds, float interpo
|
|||||||
m_idMap.clear();
|
m_idMap.clear();
|
||||||
} else if (auto addition = changeUpdate.template ptr<ElementAddition>()) {
|
} else if (auto addition = changeUpdate.template ptr<ElementAddition>()) {
|
||||||
ElementPtr element = make_shared<Element>();
|
ElementPtr element = make_shared<Element>();
|
||||||
DataStreamBuffer storeBuffer(move(get<1>(*addition)));
|
DataStreamBuffer storeBuffer(std::move(get<1>(*addition)));
|
||||||
element->netLoad(storeBuffer);
|
element->netLoad(storeBuffer);
|
||||||
readyElement(element);
|
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<ElementRemoval>()) {
|
} else if (auto removal = changeUpdate.template ptr<ElementRemoval>()) {
|
||||||
m_idMap.remove(*removal);
|
m_idMap.remove(*removal);
|
||||||
}
|
}
|
||||||
@ -296,7 +296,7 @@ void NetElementDynamicGroup<Element>::addChangeData(ElementChange change) {
|
|||||||
uint64_t currentVersion = m_netVersion ? m_netVersion->current() : 0;
|
uint64_t currentVersion = m_netVersion ? m_netVersion->current() : 0;
|
||||||
starAssert(m_changeData.empty() || m_changeData.last().first <= currentVersion);
|
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>((int64_t)currentVersion - MaxChangeDataVersions, 0);
|
m_changeDataLastVersion = max<int64_t>((int64_t)currentVersion - MaxChangeDataVersions, 0);
|
||||||
while (!m_changeData.empty() && m_changeData.first().first < m_changeDataLastVersion)
|
while (!m_changeData.empty() && m_changeData.first().first < m_changeDataLastVersion)
|
||||||
|
@ -92,7 +92,7 @@ void NetElementFloating<T>::setFixedPointBase(Maybe<T> fixedPointBase) {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void NetElementFloating<T>::setInterpolator(function<T(T, T, T)> interpolator) {
|
void NetElementFloating<T>::setInterpolator(function<T(T, T, T)> interpolator) {
|
||||||
m_interpolator = move(interpolator);
|
m_interpolator = std::move(interpolator);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -71,7 +71,7 @@ template <typename Signal>
|
|||||||
void NetElementSignal<Signal>::disableNetInterpolation() {
|
void NetElementSignal<Signal>::disableNetInterpolation() {
|
||||||
m_netInterpolationEnabled = false;
|
m_netInterpolationEnabled = false;
|
||||||
for (auto& p : take(m_pendingSignals))
|
for (auto& p : take(m_pendingSignals))
|
||||||
send(move(p.second));
|
send(std::move(p.second));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Signal>
|
template <typename Signal>
|
||||||
@ -112,11 +112,11 @@ void NetElementSignal<Signal>::readNetDelta(DataStream& ds, float interpolationT
|
|||||||
if (m_netInterpolationEnabled && interpolationTime > 0.0f) {
|
if (m_netInterpolationEnabled && interpolationTime > 0.0f) {
|
||||||
if (!m_pendingSignals.empty() && m_pendingSignals.last().first > interpolationTime) {
|
if (!m_pendingSignals.empty() && m_pendingSignals.last().first > interpolationTime) {
|
||||||
for (auto& p : take(m_pendingSignals))
|
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 {
|
} else {
|
||||||
send(move(s));
|
send(std::move(s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,11 +68,11 @@ void NetElementSyncGroup::netElementsNeedLoad(bool) {}
|
|||||||
void NetElementSyncGroup::netElementsNeedStore() {}
|
void NetElementSyncGroup::netElementsNeedStore() {}
|
||||||
|
|
||||||
void NetElementCallbackGroup::setNeedsLoadCallback(function<void(bool)> needsLoadCallback) {
|
void NetElementCallbackGroup::setNeedsLoadCallback(function<void(bool)> needsLoadCallback) {
|
||||||
m_netElementsNeedLoad = move(needsLoadCallback);
|
m_netElementsNeedLoad = std::move(needsLoadCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetElementCallbackGroup::setNeedsStoreCallback(function<void()> needsStoreCallback) {
|
void NetElementCallbackGroup::setNeedsStoreCallback(function<void()> needsStoreCallback) {
|
||||||
m_netElementsNeedStore = move(needsStoreCallback);
|
m_netElementsNeedStore = std::move(needsStoreCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetElementCallbackGroup::netElementsNeedLoad(bool load) {
|
void NetElementCallbackGroup::netElementsNeedLoad(bool load) {
|
||||||
|
@ -68,7 +68,7 @@ void NetElementTop<BaseNetElement>::readNetState(ByteArray data, float interpola
|
|||||||
BaseNetElement::blankNetDelta(interpolationTime);
|
BaseNetElement::blankNetDelta(interpolationTime);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
DataStreamBuffer ds(move(data));
|
DataStreamBuffer ds(std::move(data));
|
||||||
|
|
||||||
if (ds.read<bool>())
|
if (ds.read<bool>())
|
||||||
BaseNetElement::netLoad(ds);
|
BaseNetElement::netLoad(ds);
|
||||||
|
@ -61,7 +61,7 @@ void ObserverStream<T>::setHistoryLimit(uint64_t historyLimit) {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void ObserverStream<T>::add(T value) {
|
void ObserverStream<T>::add(T value) {
|
||||||
m_values.append({m_nextStep, move(value)});
|
m_values.append({m_nextStep, std::move(value)});
|
||||||
tick(1);
|
tick(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,29 +4,29 @@
|
|||||||
namespace Star {
|
namespace Star {
|
||||||
|
|
||||||
void OptionParser::setCommandName(String commandName) {
|
void OptionParser::setCommandName(String commandName) {
|
||||||
m_commandName = move(commandName);
|
m_commandName = std::move(commandName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionParser::setSummary(String summary) {
|
void OptionParser::setSummary(String summary) {
|
||||||
m_summary = move(summary);
|
m_summary = std::move(summary);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionParser::setAdditionalHelp(String help) {
|
void OptionParser::setAdditionalHelp(String help) {
|
||||||
m_additionalHelp = move(help);
|
m_additionalHelp = std::move(help);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionParser::addSwitch(String const& flag, String description) {
|
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);
|
throw OptionParserException::format("Duplicate switch '-{}' added", flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionParser::addParameter(String const& flag, String argument, RequirementMode requirementMode, String description) {
|
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);
|
throw OptionParserException::format("Duplicate flag '-{}' added", flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionParser::addArgument(String argument, RequirementMode requirementMode, String description) {
|
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::Options, StringList> OptionParser::parseOptions(StringList const& arguments) const {
|
pair<OptionParser::Options, StringList> OptionParser::parseOptions(StringList const& arguments) const {
|
||||||
@ -51,7 +51,7 @@ pair<OptionParser::Options, StringList> OptionParser::parseOptions(StringList co
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (option->is<Switch>()) {
|
if (option->is<Switch>()) {
|
||||||
result.switches.add(move(flag));
|
result.switches.add(std::move(flag));
|
||||||
} else {
|
} else {
|
||||||
auto const& parameter = option->get<Parameter>();
|
auto const& parameter = option->get<Parameter>();
|
||||||
if (!it.hasNext()) {
|
if (!it.hasNext()) {
|
||||||
@ -63,7 +63,7 @@ pair<OptionParser::Options, StringList> OptionParser::parseOptions(StringList co
|
|||||||
errors.append(strf("Option with argument '-{}' specified multiple times", flag));
|
errors.append(strf("Option with argument '-{}' specified multiple times", flag));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result.parameters[move(flag)].append(move(val));
|
result.parameters[std::move(flag)].append(std::move(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -96,7 +96,7 @@ pair<OptionParser::Options, StringList> OptionParser::parseOptions(StringList co
|
|||||||
errors.append(strf(
|
errors.append(strf(
|
||||||
"Too many positional arguments given, expected at most {} got {}", maximumArguments, result.arguments.size()));
|
"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 {
|
void OptionParser::printHelp(std::ostream& os) const {
|
||||||
|
@ -192,7 +192,7 @@ OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::OrderedMapWrapper(Inp
|
|||||||
template <template <typename...> class Map, typename Key, typename Value, typename Allocator, typename... MapArgs>
|
template <template <typename...> class Map, typename Key, typename Value, typename Allocator, typename... MapArgs>
|
||||||
OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::OrderedMapWrapper(initializer_list<value_type> list) {
|
OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::OrderedMapWrapper(initializer_list<value_type> list) {
|
||||||
for (value_type v : list)
|
for (value_type v : list)
|
||||||
insert(move(v));
|
insert(std::move(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <template <typename...> class Map, typename Key, typename Value, typename Allocator, typename... MapArgs>
|
template <template <typename...> class Map, typename Key, typename Value, typename Allocator, typename... MapArgs>
|
||||||
@ -242,7 +242,7 @@ template <template <typename...> class Map, typename Key, typename Value, typena
|
|||||||
auto OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::value(key_type const& k, mapped_type d) const -> mapped_type {
|
auto OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::value(key_type const& k, mapped_type d) const -> mapped_type {
|
||||||
auto i = m_map.find(k);
|
auto i = m_map.find(k);
|
||||||
if (i == m_map.end())
|
if (i == m_map.end())
|
||||||
return move(d);
|
return d;
|
||||||
else
|
else
|
||||||
return i->second->second;
|
return i->second->second;
|
||||||
}
|
}
|
||||||
@ -335,7 +335,7 @@ auto OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::insert(value_typ
|
|||||||
|
|
||||||
template <template <typename...> class Map, typename Key, typename Value, typename Allocator, typename... MapArgs>
|
template <template <typename...> class Map, typename Key, typename Value, typename Allocator, typename... MapArgs>
|
||||||
auto OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::insert(key_type k, mapped_type v) -> pair<iterator, bool> {
|
auto OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::insert(key_type k, mapped_type v) -> pair<iterator, bool> {
|
||||||
return insert(value_type(move(k), move(v)));
|
return insert(value_type(std::move(k), std::move(v)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <template <typename...> class Map, typename Key, typename Value, typename Allocator, typename... MapArgs>
|
template <template <typename...> class Map, typename Key, typename Value, typename Allocator, typename... MapArgs>
|
||||||
@ -352,12 +352,12 @@ auto OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::insertFront(valu
|
|||||||
|
|
||||||
template <template <typename...> class Map, typename Key, typename Value, typename Allocator, typename... MapArgs>
|
template <template <typename...> class Map, typename Key, typename Value, typename Allocator, typename... MapArgs>
|
||||||
auto OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::insertFront(key_type k, mapped_type v) -> pair<iterator, bool> {
|
auto OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::insertFront(key_type k, mapped_type v) -> pair<iterator, bool> {
|
||||||
return insertFront(value_type(move(k), move(v)));
|
return insertFront(value_type(std::move(k), std::move(v)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <template <typename...> class Map, typename Key, typename Value, typename Allocator, typename... MapArgs>
|
template <template <typename...> class Map, typename Key, typename Value, typename Allocator, typename... MapArgs>
|
||||||
auto OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::add(key_type k, mapped_type v) -> mapped_type& {
|
auto OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::add(key_type k, mapped_type v) -> mapped_type& {
|
||||||
auto pair = insert(value_type(move(k), move(v)));
|
auto pair = insert(value_type(std::move(k), std::move(v)));
|
||||||
if (!pair.second)
|
if (!pair.second)
|
||||||
throw MapException(strf("Entry with key '{}' already present.", outputAny(k)));
|
throw MapException(strf("Entry with key '{}' already present.", outputAny(k)));
|
||||||
else
|
else
|
||||||
@ -368,10 +368,10 @@ template <template <typename...> class Map, typename Key, typename Value, typena
|
|||||||
auto OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::set(key_type k, mapped_type v) -> mapped_type& {
|
auto OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::set(key_type k, mapped_type v) -> mapped_type& {
|
||||||
auto i = find(k);
|
auto i = find(k);
|
||||||
if (i != end()) {
|
if (i != end()) {
|
||||||
i->second = move(v);
|
i->second = std::move(v);
|
||||||
return i->second;
|
return i->second;
|
||||||
} else {
|
} else {
|
||||||
return insert(value_type(move(k), move(v))).first->second;
|
return insert(value_type(std::move(k), std::move(v))).first->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -575,11 +575,11 @@ template <template <typename...> class Map, typename Key, typename Value, typena
|
|||||||
auto OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::insert(iterator pos, value_type v) -> iterator {
|
auto OrderedMapWrapper<Map, Key, Value, Allocator, MapArgs...>::insert(iterator pos, value_type v) -> iterator {
|
||||||
auto i = m_map.find(v.first);
|
auto i = m_map.find(v.first);
|
||||||
if (i == m_map.end()) {
|
if (i == m_map.end()) {
|
||||||
iterator orderIt = m_order.insert(pos, move(v));
|
iterator orderIt = m_order.insert(pos, std::move(v));
|
||||||
m_map.insert(typename MapType::value_type(std::cref(orderIt->first), orderIt));
|
m_map.insert(typename MapType::value_type(std::cref(orderIt->first), orderIt));
|
||||||
return orderIt;
|
return orderIt;
|
||||||
} else {
|
} else {
|
||||||
i->second->second = move(v.second);
|
i->second->second = std::move(v.second);
|
||||||
m_order.splice(pos, m_order, i->second);
|
m_order.splice(pos, m_order, i->second);
|
||||||
return i->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ template <template <typename...> class Map, typename Value, typename Allocator,
|
|||||||
auto OrderedSetWrapper<Map, Value, Allocator, Args...>::values() const -> List<value_type> {
|
auto OrderedSetWrapper<Map, Value, Allocator, Args...>::values() const -> List<value_type> {
|
||||||
List<value_type> values;
|
List<value_type> values;
|
||||||
for (auto p : *this)
|
for (auto p : *this)
|
||||||
values.append(move(p));
|
values.append(std::move(p));
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ struct OutputProxy {
|
|||||||
typedef function<void(std::ostream&)> PrintFunction;
|
typedef function<void(std::ostream&)> PrintFunction;
|
||||||
|
|
||||||
OutputProxy(PrintFunction p)
|
OutputProxy(PrintFunction p)
|
||||||
: print(move(p)) {}
|
: print(std::move(p)) {}
|
||||||
|
|
||||||
PrintFunction print;
|
PrintFunction print;
|
||||||
};
|
};
|
||||||
|
@ -125,8 +125,8 @@ ParametricTable<IndexType, ValueType>::ParametricTable(PairContainer indexValueP
|
|||||||
});
|
});
|
||||||
|
|
||||||
for (auto const& pair : indexValuePairs) {
|
for (auto const& pair : indexValuePairs) {
|
||||||
m_indexes.push_back(move(std::get<0>(pair)));
|
m_indexes.push_back(std::move(std::get<0>(pair)));
|
||||||
m_values.push_back(move(std::get<1>(pair)));
|
m_values.push_back(std::move(std::get<1>(pair)));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < size() - 1; ++i) {
|
for (size_t i = 0; i < size() - 1; ++i) {
|
||||||
@ -138,8 +138,8 @@ ParametricTable<IndexType, ValueType>::ParametricTable(PairContainer indexValueP
|
|||||||
template <typename IndexType, typename ValueType>
|
template <typename IndexType, typename ValueType>
|
||||||
size_t ParametricTable<IndexType, ValueType>::addPoint(IndexType index, ValueType value) {
|
size_t ParametricTable<IndexType, ValueType>::addPoint(IndexType index, ValueType value) {
|
||||||
size_t insertLocation = std::distance(m_indexes.begin(), std::upper_bound(m_indexes.begin(), m_indexes.end(), index));
|
size_t insertLocation = std::distance(m_indexes.begin(), std::upper_bound(m_indexes.begin(), m_indexes.end(), index));
|
||||||
m_indexes.insert(m_indexes.begin() + insertLocation, move(index));
|
m_indexes.insert(m_indexes.begin() + insertLocation, std::move(index));
|
||||||
m_values.insert(m_values.begin() + insertLocation, move(value));
|
m_values.insert(m_values.begin() + insertLocation, std::move(value));
|
||||||
return insertLocation;
|
return insertLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ Perlin<Float>::Perlin(Perlin const& perlin) {
|
|||||||
|
|
||||||
template <typename Float>
|
template <typename Float>
|
||||||
Perlin<Float>::Perlin(Perlin&& perlin) {
|
Perlin<Float>::Perlin(Perlin&& perlin) {
|
||||||
*this = move(perlin);
|
*this = std::move(perlin);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Float>
|
template <typename Float>
|
||||||
@ -261,10 +261,10 @@ Perlin<Float>& Perlin<Float>::operator=(Perlin&& perlin) {
|
|||||||
m_offset = perlin.m_offset;
|
m_offset = perlin.m_offset;
|
||||||
m_gain = perlin.m_gain;
|
m_gain = perlin.m_gain;
|
||||||
|
|
||||||
p = move(perlin.p);
|
p = std::move(perlin.p);
|
||||||
g3 = move(perlin.g3);
|
g3 = std::move(perlin.g3);
|
||||||
g2 = move(perlin.g2);
|
g2 = std::move(perlin.g2);
|
||||||
g1 = move(perlin.g1);
|
g1 = std::move(perlin.g1);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ Polygon<DataType> Polygon<DataType>::convexHull(VertexList points) {
|
|||||||
upper.removeLast();
|
upper.removeLast();
|
||||||
lower.removeLast();
|
lower.removeLast();
|
||||||
lower.appendAll(take(upper));
|
lower.appendAll(take(upper));
|
||||||
return Polygon<DataType>(move(lower));
|
return Polygon<DataType>(std::move(lower));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DataType>
|
template <typename DataType>
|
||||||
@ -218,7 +218,7 @@ Polygon<DataType> Polygon<DataType>::clip(Polygon inputPoly, Polygon convexClipP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Polygon(move(outputVertexes));
|
return Polygon(std::move(outputVertexes));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DataType>
|
template <typename DataType>
|
||||||
@ -230,7 +230,7 @@ Polygon<DataType>::Polygon(Polygon const& rhs)
|
|||||||
|
|
||||||
template <typename DataType>
|
template <typename DataType>
|
||||||
Polygon<DataType>::Polygon(Polygon&& rhs)
|
Polygon<DataType>::Polygon(Polygon&& rhs)
|
||||||
: m_vertexes(move(rhs.m_vertexes)) {}
|
: m_vertexes(std::move(rhs.m_vertexes)) {}
|
||||||
|
|
||||||
template <typename DataType>
|
template <typename DataType>
|
||||||
template <typename DataType2>
|
template <typename DataType2>
|
||||||
@ -303,7 +303,7 @@ void Polygon<DataType>::deduplicateVertexes(float maxDistance) {
|
|||||||
if (vmagSquared(newVertexes.first() - newVertexes.last()) <= distSquared)
|
if (vmagSquared(newVertexes.first() - newVertexes.last()) <= distSquared)
|
||||||
newVertexes.removeLast();
|
newVertexes.removeLast();
|
||||||
|
|
||||||
m_vertexes = move(newVertexes);
|
m_vertexes = std::move(newVertexes);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DataType>
|
template <typename DataType>
|
||||||
@ -426,7 +426,7 @@ Polygon<DataType>& Polygon<DataType>::operator=(Polygon const& rhs) {
|
|||||||
|
|
||||||
template <typename DataType>
|
template <typename DataType>
|
||||||
Polygon<DataType>& Polygon<DataType>::operator=(Polygon&& rhs) {
|
Polygon<DataType>& Polygon<DataType>::operator=(Polygon&& rhs) {
|
||||||
m_vertexes = move(rhs.m_vertexes);
|
m_vertexes = std::move(rhs.m_vertexes);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,7 +599,7 @@ template <typename ResultContainer, typename Iterable>
|
|||||||
ResultContainer enumerateConstruct(Iterable&& list) {
|
ResultContainer enumerateConstruct(Iterable&& list) {
|
||||||
ResultContainer res;
|
ResultContainer res;
|
||||||
for (auto el : enumerateIterator(list))
|
for (auto el : enumerateIterator(list))
|
||||||
res.push_back(move(el));
|
res.push_back(std::move(el));
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ RefPtr<Type1 const> as(RefPtr<Type2 const> const& p) {
|
|||||||
|
|
||||||
template <typename T, typename... Args>
|
template <typename T, typename... Args>
|
||||||
RefPtr<T> make_ref(Args&&... args) {
|
RefPtr<T> make_ref(Args&&... args) {
|
||||||
return RefPtr<T>(new T(forward<Args>(args)...));
|
return RefPtr<T>(new T(std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -70,17 +70,17 @@ private:
|
|||||||
|
|
||||||
template <typename Result, typename Error>
|
template <typename Result, typename Error>
|
||||||
void RpcPromiseKeeper<Result, Error>::fulfill(Result result) {
|
void RpcPromiseKeeper<Result, Error>::fulfill(Result result) {
|
||||||
m_fulfill(move(result));
|
m_fulfill(std::move(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Result, typename Error>
|
template <typename Result, typename Error>
|
||||||
void RpcPromiseKeeper<Result, Error>::fail(Error error) {
|
void RpcPromiseKeeper<Result, Error>::fail(Error error) {
|
||||||
m_fail(move(error));
|
m_fail(std::move(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Result, typename Error>
|
template <typename Result, typename Error>
|
||||||
pair<RpcPromise<Result, Error>, RpcPromiseKeeper<Result, Error>> RpcPromise<Result, Error>::createPair() {
|
pair<RpcPromise<Result, Error>, RpcPromiseKeeper<Result, Error>> RpcPromise<Result, Error>::createPair() {
|
||||||
auto valuePtr = make_shared<Value>();
|
auto valuePtr = std::make_shared<Value>();
|
||||||
|
|
||||||
RpcPromise promise;
|
RpcPromise promise;
|
||||||
promise.m_getValue = [valuePtr]() {
|
promise.m_getValue = [valuePtr]() {
|
||||||
@ -91,21 +91,21 @@ pair<RpcPromise<Result, Error>, RpcPromiseKeeper<Result, Error>> RpcPromise<Resu
|
|||||||
keeper.m_fulfill = [valuePtr](Result result) {
|
keeper.m_fulfill = [valuePtr](Result result) {
|
||||||
if (valuePtr->result || valuePtr->error)
|
if (valuePtr->result || valuePtr->error)
|
||||||
throw RpcPromiseException("fulfill called on already finished RpcPromise");
|
throw RpcPromiseException("fulfill called on already finished RpcPromise");
|
||||||
valuePtr->result = move(result);
|
valuePtr->result = std::move(result);
|
||||||
};
|
};
|
||||||
keeper.m_fail = [valuePtr](Error error) {
|
keeper.m_fail = [valuePtr](Error error) {
|
||||||
if (valuePtr->result || valuePtr->error)
|
if (valuePtr->result || valuePtr->error)
|
||||||
throw RpcPromiseException("fail called on already finished RpcPromise");
|
throw RpcPromiseException("fail called on already finished RpcPromise");
|
||||||
valuePtr->error = move(error);
|
valuePtr->error = std::move(error);
|
||||||
};
|
};
|
||||||
|
|
||||||
return {move(promise), move(keeper)};
|
return {std::move(promise), std::move(keeper)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Result, typename Error>
|
template <typename Result, typename Error>
|
||||||
RpcPromise<Result, Error> RpcPromise<Result, Error>::createFulfilled(Result result) {
|
RpcPromise<Result, Error> RpcPromise<Result, Error>::createFulfilled(Result result) {
|
||||||
auto valuePtr = make_shared<Value>();
|
auto valuePtr = std::make_shared<Value>();
|
||||||
valuePtr->result = move(result);
|
valuePtr->result = std::move(result);
|
||||||
|
|
||||||
RpcPromise<Result, Error> promise;
|
RpcPromise<Result, Error> promise;
|
||||||
promise.m_getValue = [valuePtr]() {
|
promise.m_getValue = [valuePtr]() {
|
||||||
@ -116,8 +116,8 @@ RpcPromise<Result, Error> RpcPromise<Result, Error>::createFulfilled(Result resu
|
|||||||
|
|
||||||
template <typename Result, typename Error>
|
template <typename Result, typename Error>
|
||||||
RpcPromise<Result, Error> RpcPromise<Result, Error>::createFailed(Error error) {
|
RpcPromise<Result, Error> RpcPromise<Result, Error>::createFailed(Error error) {
|
||||||
auto valuePtr = make_shared<Value>();
|
auto valuePtr = std::make_shared<Value>();
|
||||||
valuePtr->error = move(error);
|
valuePtr->error = std::move(error);
|
||||||
|
|
||||||
RpcPromise<Result, Error> promise;
|
RpcPromise<Result, Error> promise;
|
||||||
promise.m_getValue = [valuePtr]() {
|
promise.m_getValue = [valuePtr]() {
|
||||||
@ -157,7 +157,7 @@ template <typename Function>
|
|||||||
decltype(auto) RpcPromise<Result, Error>::wrap(Function function) {
|
decltype(auto) RpcPromise<Result, Error>::wrap(Function function) {
|
||||||
typedef RpcPromise<typename std::decay<decltype(function(std::declval<Result>()))>::type, Error> WrappedPromise;
|
typedef RpcPromise<typename std::decay<decltype(function(std::declval<Result>()))>::type, Error> WrappedPromise;
|
||||||
WrappedPromise wrappedPromise;
|
WrappedPromise wrappedPromise;
|
||||||
wrappedPromise.m_getValue = [wrapper = move(function), valuePtr = make_shared<typename WrappedPromise::Value>(), otherGetValue = m_getValue]() {
|
wrappedPromise.m_getValue = [wrapper = std::move(function), valuePtr = std::make_shared<typename WrappedPromise::Value>(), otherGetValue = m_getValue]() {
|
||||||
if (!valuePtr->result && !valuePtr->error) {
|
if (!valuePtr->result && !valuePtr->error) {
|
||||||
auto otherValue = otherGetValue();
|
auto otherValue = otherGetValue();
|
||||||
if (otherValue->result)
|
if (otherValue->result)
|
||||||
|
@ -66,12 +66,12 @@ private:
|
|||||||
|
|
||||||
template <typename Result, typename Error>
|
template <typename Result, typename Error>
|
||||||
void RpcThreadPromiseKeeper<Result, Error>::fulfill(Result result) {
|
void RpcThreadPromiseKeeper<Result, Error>::fulfill(Result result) {
|
||||||
m_fulfill(move(result));
|
m_fulfill(std::move(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Result, typename Error>
|
template <typename Result, typename Error>
|
||||||
void RpcThreadPromiseKeeper<Result, Error>::fail(Error error) {
|
void RpcThreadPromiseKeeper<Result, Error>::fail(Error error) {
|
||||||
m_fail(move(error));
|
m_fail(std::move(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Result, typename Error>
|
template <typename Result, typename Error>
|
||||||
@ -88,22 +88,22 @@ pair<RpcThreadPromise<Result, Error>, RpcThreadPromiseKeeper<Result, Error>> Rpc
|
|||||||
MutexLocker lock(valuePtr->mutex);
|
MutexLocker lock(valuePtr->mutex);
|
||||||
if (valuePtr->result || valuePtr->error)
|
if (valuePtr->result || valuePtr->error)
|
||||||
throw RpcThreadPromiseException("fulfill called on already finished RpcThreadPromise");
|
throw RpcThreadPromiseException("fulfill called on already finished RpcThreadPromise");
|
||||||
valuePtr->result = move(result);
|
valuePtr->result = std::move(result);
|
||||||
};
|
};
|
||||||
keeper.m_fail = [valuePtr](Error error) {
|
keeper.m_fail = [valuePtr](Error error) {
|
||||||
MutexLocker lock(valuePtr->mutex);
|
MutexLocker lock(valuePtr->mutex);
|
||||||
if (valuePtr->result || valuePtr->error)
|
if (valuePtr->result || valuePtr->error)
|
||||||
throw RpcThreadPromiseException("fail called on already finished RpcThreadPromise");
|
throw RpcThreadPromiseException("fail called on already finished RpcThreadPromise");
|
||||||
valuePtr->error = move(error);
|
valuePtr->error = std::move(error);
|
||||||
};
|
};
|
||||||
|
|
||||||
return {move(promise), move(keeper)};
|
return {std::move(promise), std::move(keeper)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Result, typename Error>
|
template <typename Result, typename Error>
|
||||||
RpcThreadPromise<Result, Error> RpcThreadPromise<Result, Error>::createFulfilled(Result result) {
|
RpcThreadPromise<Result, Error> RpcThreadPromise<Result, Error>::createFulfilled(Result result) {
|
||||||
auto valuePtr = make_shared<Value>();
|
auto valuePtr = make_shared<Value>();
|
||||||
valuePtr->result = move(result);
|
valuePtr->result = std::move(result);
|
||||||
|
|
||||||
RpcThreadPromise<Result, Error> promise;
|
RpcThreadPromise<Result, Error> promise;
|
||||||
promise.m_getValue = [valuePtr]() {
|
promise.m_getValue = [valuePtr]() {
|
||||||
@ -115,7 +115,7 @@ RpcThreadPromise<Result, Error> RpcThreadPromise<Result, Error>::createFulfilled
|
|||||||
template <typename Result, typename Error>
|
template <typename Result, typename Error>
|
||||||
RpcThreadPromise<Result, Error> RpcThreadPromise<Result, Error>::createFailed(Error error) {
|
RpcThreadPromise<Result, Error> RpcThreadPromise<Result, Error>::createFailed(Error error) {
|
||||||
auto valuePtr = make_shared<Value>();
|
auto valuePtr = make_shared<Value>();
|
||||||
valuePtr->error = move(error);
|
valuePtr->error = std::move(error);
|
||||||
|
|
||||||
RpcThreadPromise<Result, Error> promise;
|
RpcThreadPromise<Result, Error> promise;
|
||||||
promise.m_getValue = [valuePtr]() {
|
promise.m_getValue = [valuePtr]() {
|
||||||
|
@ -213,7 +213,7 @@ auto SectorArray2D<ElementT, SectorSize>::sector(Sector const& id) const -> Arra
|
|||||||
template <typename ElementT, size_t SectorSize>
|
template <typename ElementT, size_t SectorSize>
|
||||||
void SectorArray2D<ElementT, SectorSize>::loadSector(Sector const& id, ArrayPtr array) {
|
void SectorArray2D<ElementT, SectorSize>::loadSector(Sector const& id, ArrayPtr array) {
|
||||||
auto& data = m_sectors(id[0], id[1]);
|
auto& data = m_sectors(id[0], id[1]);
|
||||||
data = move(array);
|
data = std::move(array);
|
||||||
if (data)
|
if (data)
|
||||||
m_loadedSectors.add(id);
|
m_loadedSectors.add(id);
|
||||||
else
|
else
|
||||||
@ -224,7 +224,7 @@ template <typename ElementT, size_t SectorSize>
|
|||||||
typename SectorArray2D<ElementT, SectorSize>::ArrayPtr SectorArray2D<ElementT, SectorSize>::copySector(
|
typename SectorArray2D<ElementT, SectorSize>::ArrayPtr SectorArray2D<ElementT, SectorSize>::copySector(
|
||||||
Sector const& id) {
|
Sector const& id) {
|
||||||
if (auto const& array = m_sectors(id))
|
if (auto const& array = m_sectors(id))
|
||||||
return make_unique<Array>(*array);
|
return std::make_unique<Array>(*array);
|
||||||
else
|
else
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -235,7 +235,7 @@ typename SectorArray2D<ElementT, SectorSize>::ArrayPtr SectorArray2D<ElementT, S
|
|||||||
ArrayPtr ret;
|
ArrayPtr ret;
|
||||||
m_loadedSectors.remove(id);
|
m_loadedSectors.remove(id);
|
||||||
std::swap(m_sectors(id[0], id[1]), ret);
|
std::swap(m_sectors(id[0], id[1]), ret);
|
||||||
return move(ret);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ElementT, size_t SectorSize>
|
template <typename ElementT, size_t SectorSize>
|
||||||
@ -268,14 +268,14 @@ template <typename ElementT, size_t SectorSize>
|
|||||||
template <typename Function>
|
template <typename Function>
|
||||||
bool SectorArray2D<ElementT, SectorSize>::eval(
|
bool SectorArray2D<ElementT, SectorSize>::eval(
|
||||||
size_t minX, size_t minY, size_t width, size_t height, Function&& function, bool evalEmpty) const {
|
size_t minX, size_t minY, size_t width, size_t height, Function&& function, bool evalEmpty) const {
|
||||||
return const_cast<SectorArray2D*>(this)->evalPriv(minX, minY, width, height, forward<Function>(function), evalEmpty);
|
return const_cast<SectorArray2D*>(this)->evalPriv(minX, minY, width, height, std::forward<Function>(function), evalEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ElementT, size_t SectorSize>
|
template <typename ElementT, size_t SectorSize>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
bool SectorArray2D<ElementT, SectorSize>::eval(
|
bool SectorArray2D<ElementT, SectorSize>::eval(
|
||||||
size_t minX, size_t minY, size_t width, size_t height, Function&& function, bool evalEmpty) {
|
size_t minX, size_t minY, size_t width, size_t height, Function&& function, bool evalEmpty) {
|
||||||
return evalPriv(minX, minY, width, height, forward<Function>(function), evalEmpty);
|
return evalPriv(minX, minY, width, height, std::forward<Function>(function), evalEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ElementT, size_t SectorSize>
|
template <typename ElementT, size_t SectorSize>
|
||||||
@ -283,14 +283,14 @@ template <typename Function>
|
|||||||
bool SectorArray2D<ElementT, SectorSize>::evalColumns(
|
bool SectorArray2D<ElementT, SectorSize>::evalColumns(
|
||||||
size_t minX, size_t minY, size_t width, size_t height, Function&& function, bool evalEmpty) const {
|
size_t minX, size_t minY, size_t width, size_t height, Function&& function, bool evalEmpty) const {
|
||||||
return const_cast<SectorArray2D*>(this)->evalColumnsPriv(
|
return const_cast<SectorArray2D*>(this)->evalColumnsPriv(
|
||||||
minX, minY, width, height, forward<Function>(function), evalEmpty);
|
minX, minY, width, height, std::forward<Function>(function), evalEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ElementT, size_t SectorSize>
|
template <typename ElementT, size_t SectorSize>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
bool SectorArray2D<ElementT, SectorSize>::evalColumns(
|
bool SectorArray2D<ElementT, SectorSize>::evalColumns(
|
||||||
size_t minX, size_t minY, size_t width, size_t height, Function&& function, bool evalEmpty) {
|
size_t minX, size_t minY, size_t width, size_t height, Function&& function, bool evalEmpty) {
|
||||||
return evalColumnsPriv(minX, minY, width, height, forward<Function>(function), evalEmpty);
|
return evalColumnsPriv(minX, minY, width, height, std::forward<Function>(function), evalEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ElementT, size_t SectorSize>
|
template <typename ElementT, size_t SectorSize>
|
||||||
|
@ -129,7 +129,7 @@ bool SetMixin<BaseSet>::add(value_type const& v) {
|
|||||||
template <typename BaseSet>
|
template <typename BaseSet>
|
||||||
bool SetMixin<BaseSet>::replace(value_type v) {
|
bool SetMixin<BaseSet>::replace(value_type v) {
|
||||||
bool replaced = remove(v);
|
bool replaced = remove(v);
|
||||||
Base::insert(move(v));
|
Base::insert(std::move(v));
|
||||||
return replaced;
|
return replaced;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ auto SetMixin<BaseSet>::takeFirst() -> value_type {
|
|||||||
if (Base::empty())
|
if (Base::empty())
|
||||||
throw SetException("takeFirst called on empty set");
|
throw SetException("takeFirst called on empty set");
|
||||||
auto i = Base::begin();
|
auto i = Base::begin();
|
||||||
value_type v = move(*i);
|
value_type v = std::move(*i);
|
||||||
Base::erase(i);
|
Base::erase(i);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
@ -180,9 +180,9 @@ auto SetMixin<BaseSet>::maybeTakeFirst() -> Maybe<value_type> {
|
|||||||
if (Base::empty())
|
if (Base::empty())
|
||||||
return {};
|
return {};
|
||||||
auto i = Base::begin();
|
auto i = Base::begin();
|
||||||
value_type v = move(*i);
|
value_type v = std::move(*i);
|
||||||
Base::erase(i);
|
Base::erase(i);
|
||||||
return move(v);
|
return std::move(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename BaseSet>
|
template <typename BaseSet>
|
||||||
@ -204,7 +204,7 @@ auto SetMixin<BaseSet>::takeLast() -> value_type {
|
|||||||
if (Base::empty())
|
if (Base::empty())
|
||||||
throw SetException("takeLast called on empty set");
|
throw SetException("takeLast called on empty set");
|
||||||
auto i = prev(Base::end());
|
auto i = prev(Base::end());
|
||||||
value_type v = move(*i);
|
value_type v = std::move(*i);
|
||||||
Base::erase(i);
|
Base::erase(i);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
@ -214,9 +214,9 @@ auto SetMixin<BaseSet>::maybeTakeLast() -> Maybe<value_type> {
|
|||||||
if (Base::empty())
|
if (Base::empty())
|
||||||
return {};
|
return {};
|
||||||
auto i = prev(Base::end());
|
auto i = prev(Base::end());
|
||||||
value_type v = move(*i);
|
value_type v = std::move(*i);
|
||||||
Base::erase(i);
|
Base::erase(i);
|
||||||
return move(v);
|
return std::move(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename BaseSet>
|
template <typename BaseSet>
|
||||||
|
@ -21,7 +21,7 @@ StringList ShellParser::tokenizeToStringList(String const& command) {
|
|||||||
StringList res;
|
StringList res;
|
||||||
for (auto token : tokenize(command)) {
|
for (auto token : tokenize(command)) {
|
||||||
if (token.type == TokenType::Word) {
|
if (token.type == TokenType::Word) {
|
||||||
res.append(move(token.token));
|
res.append(std::move(token.token));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ template <typename Element, size_t MaxStackSize>
|
|||||||
SmallVector<Element, MaxStackSize>::SmallVector(SmallVector&& other)
|
SmallVector<Element, MaxStackSize>::SmallVector(SmallVector&& other)
|
||||||
: SmallVector() {
|
: SmallVector() {
|
||||||
for (auto& e : other)
|
for (auto& e : other)
|
||||||
emplace_back(move(e));
|
emplace_back(std::move(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, size_t MaxStackSize>
|
template <typename Element, size_t MaxStackSize>
|
||||||
@ -169,7 +169,7 @@ template <typename Element, size_t MaxStackSize>
|
|||||||
auto SmallVector<Element, MaxStackSize>::operator=(SmallVector&& other) -> SmallVector& {
|
auto SmallVector<Element, MaxStackSize>::operator=(SmallVector&& other) -> SmallVector& {
|
||||||
resize(other.size());
|
resize(other.size());
|
||||||
for (size_t i = 0; i < size(); ++i)
|
for (size_t i = 0; i < size(); ++i)
|
||||||
operator[](i) = move(other[i]);
|
operator[](i) = std::move(other[i]);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ template <typename Element, size_t MaxStackSize>
|
|||||||
auto SmallVector<Element, MaxStackSize>::operator=(std::initializer_list<Element> list) -> SmallVector& {
|
auto SmallVector<Element, MaxStackSize>::operator=(std::initializer_list<Element> list) -> SmallVector& {
|
||||||
resize(list.size());
|
resize(list.size());
|
||||||
for (size_t i = 0; i < size(); ++i)
|
for (size_t i = 0; i < size(); ++i)
|
||||||
operator[](i) = move(list[i]);
|
operator[](i) = std::move(list[i]);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ void SmallVector<Element, MaxStackSize>::reserve(size_t newCapacity) {
|
|||||||
|
|
||||||
// We assume that move constructors can never throw.
|
// We assume that move constructors can never throw.
|
||||||
for (size_t i = 0; i < size; ++i) {
|
for (size_t i = 0; i < size; ++i) {
|
||||||
new (&newMem[i]) Element(move(oldMem[i]));
|
new (&newMem[i]) Element(std::move(oldMem[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_begin = newMem;
|
m_begin = newMem;
|
||||||
@ -313,7 +313,7 @@ Element* SmallVector<Element, MaxStackSize>::ptr() {
|
|||||||
|
|
||||||
template <typename Element, size_t MaxStackSize>
|
template <typename Element, size_t MaxStackSize>
|
||||||
void SmallVector<Element, MaxStackSize>::push_back(Element e) {
|
void SmallVector<Element, MaxStackSize>::push_back(Element e) {
|
||||||
emplace_back(move(e));
|
emplace_back(std::move(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, size_t MaxStackSize>
|
template <typename Element, size_t MaxStackSize>
|
||||||
@ -326,7 +326,7 @@ void SmallVector<Element, MaxStackSize>::pop_back() {
|
|||||||
|
|
||||||
template <typename Element, size_t MaxStackSize>
|
template <typename Element, size_t MaxStackSize>
|
||||||
auto SmallVector<Element, MaxStackSize>::insert(iterator pos, Element e) -> iterator {
|
auto SmallVector<Element, MaxStackSize>::insert(iterator pos, Element e) -> iterator {
|
||||||
emplace(pos, move(e));
|
emplace(pos, std::move(e));
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +341,7 @@ auto SmallVector<Element, MaxStackSize>::insert(iterator pos, Iterator begin, It
|
|||||||
resize(size() + toAdd);
|
resize(size() + toAdd);
|
||||||
|
|
||||||
for (size_t i = toShift; i != 0; --i)
|
for (size_t i = toShift; i != 0; --i)
|
||||||
operator[](endIndex + i - 1) = move(operator[](startIndex + i - 1));
|
operator[](endIndex + i - 1) = std::move(operator[](startIndex + i - 1));
|
||||||
|
|
||||||
for (size_t i = 0; i != toAdd; ++i)
|
for (size_t i = 0; i != toAdd; ++i)
|
||||||
operator[](startIndex + i) = *begin++;
|
operator[](startIndex + i) = *begin++;
|
||||||
@ -360,8 +360,8 @@ void SmallVector<Element, MaxStackSize>::emplace(iterator pos, Args&&... args) {
|
|||||||
size_t index = pos - m_begin;
|
size_t index = pos - m_begin;
|
||||||
emplace_back(Element());
|
emplace_back(Element());
|
||||||
for (size_t i = size() - 1; i != index; --i)
|
for (size_t i = size() - 1; i != index; --i)
|
||||||
operator[](i) = move(operator[](i - 1));
|
operator[](i) = std::move(operator[](i - 1));
|
||||||
operator[](index) = Element(forward<Args>(args)...);
|
operator[](index) = Element(std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, size_t MaxStackSize>
|
template <typename Element, size_t MaxStackSize>
|
||||||
@ -369,7 +369,7 @@ template <typename... Args>
|
|||||||
void SmallVector<Element, MaxStackSize>::emplace_back(Args&&... args) {
|
void SmallVector<Element, MaxStackSize>::emplace_back(Args&&... args) {
|
||||||
if (m_end == m_capacity)
|
if (m_end == m_capacity)
|
||||||
reserve(size() + 1);
|
reserve(size() + 1);
|
||||||
new (m_end) Element(forward<Args>(args)...);
|
new (m_end) Element(std::forward<Args>(args)...);
|
||||||
++m_end;
|
++m_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,7 +383,7 @@ template <typename Element, size_t MaxStackSize>
|
|||||||
auto SmallVector<Element, MaxStackSize>::erase(iterator pos) -> iterator {
|
auto SmallVector<Element, MaxStackSize>::erase(iterator pos) -> iterator {
|
||||||
size_t index = pos - ptr();
|
size_t index = pos - ptr();
|
||||||
for (size_t i = index; i < size() - 1; ++i)
|
for (size_t i = index; i < size() - 1; ++i)
|
||||||
operator[](i) = move(operator[](i + 1));
|
operator[](i) = std::move(operator[](i + 1));
|
||||||
pop_back();
|
pop_back();
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
@ -394,7 +394,7 @@ auto SmallVector<Element, MaxStackSize>::erase(iterator begin, iterator end) ->
|
|||||||
size_t endIndex = end - ptr();
|
size_t endIndex = end - ptr();
|
||||||
size_t toRemove = endIndex - startIndex;
|
size_t toRemove = endIndex - startIndex;
|
||||||
for (size_t i = endIndex; i < size(); ++i)
|
for (size_t i = endIndex; i < size(); ++i)
|
||||||
operator[](startIndex + (i - endIndex)) = move(operator[](i));
|
operator[](startIndex + (i - endIndex)) = std::move(operator[](i));
|
||||||
resize(size() - toRemove);
|
resize(size() - toRemove);
|
||||||
return begin;
|
return begin;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ Maybe<SocketPollResult> Socket::poll(SocketPollQuery const& query, unsigned time
|
|||||||
pr.exception = pfd.revents & POLLHUP || pfd.revents & POLLNVAL || pfd.revents & POLLERR;
|
pr.exception = pfd.revents & POLLHUP || pfd.revents & POLLNVAL || pfd.revents & POLLERR;
|
||||||
if (pfd.revents & POLLHUP)
|
if (pfd.revents & POLLHUP)
|
||||||
p.first.first->doShutdown();
|
p.first.first->doShutdown();
|
||||||
result.add(p.first.first, move(pr));
|
result.add(p.first.first, std::move(pr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -239,19 +239,19 @@ void SpatialHash2D<KeyT, ScalarT, ValueT, IntT, AllocatorBlockSize>::set(Key con
|
|||||||
|
|
||||||
template <typename KeyT, typename ScalarT, typename ValueT, typename IntT, size_t AllocatorBlockSize>
|
template <typename KeyT, typename ScalarT, typename ValueT, typename IntT, size_t AllocatorBlockSize>
|
||||||
void SpatialHash2D<KeyT, ScalarT, ValueT, IntT, AllocatorBlockSize>::set(Key const& key, Coord const& pos, Value value) {
|
void SpatialHash2D<KeyT, ScalarT, ValueT, IntT, AllocatorBlockSize>::set(Key const& key, Coord const& pos, Value value) {
|
||||||
set(key, {Rect(pos, pos)}, move(value));
|
set(key, {Rect(pos, pos)}, std::move(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename KeyT, typename ScalarT, typename ValueT, typename IntT, size_t AllocatorBlockSize>
|
template <typename KeyT, typename ScalarT, typename ValueT, typename IntT, size_t AllocatorBlockSize>
|
||||||
void SpatialHash2D<KeyT, ScalarT, ValueT, IntT, AllocatorBlockSize>::set(Key const& key, Rect const& rect, Value value) {
|
void SpatialHash2D<KeyT, ScalarT, ValueT, IntT, AllocatorBlockSize>::set(Key const& key, Rect const& rect, Value value) {
|
||||||
set(key, {rect}, move(value));
|
set(key, {rect}, std::move(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename KeyT, typename ScalarT, typename ValueT, typename IntT, size_t AllocatorBlockSize>
|
template <typename KeyT, typename ScalarT, typename ValueT, typename IntT, size_t AllocatorBlockSize>
|
||||||
template <typename RectCollection>
|
template <typename RectCollection>
|
||||||
void SpatialHash2D<KeyT, ScalarT, ValueT, IntT, AllocatorBlockSize>::set(Key const& key, RectCollection const& rects, Value value) {
|
void SpatialHash2D<KeyT, ScalarT, ValueT, IntT, AllocatorBlockSize>::set(Key const& key, RectCollection const& rects, Value value) {
|
||||||
Entry& entry = m_entryMap[key];
|
Entry& entry = m_entryMap[key];
|
||||||
entry.value = move(value);
|
entry.value = std::move(value);
|
||||||
updateSpatial(&entry, rects);
|
updateSpatial(&entry, rects);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ auto SpatialHash2D<KeyT, ScalarT, ValueT, IntT, AllocatorBlockSize>::remove(Key
|
|||||||
return {};
|
return {};
|
||||||
|
|
||||||
removeSpatial(&iter->second);
|
removeSpatial(&iter->second);
|
||||||
Maybe<Value> val = move(iter->second.value);
|
Maybe<Value> val = std::move(iter->second.value);
|
||||||
m_entryMap.erase(iter);
|
m_entryMap.erase(iter);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ template <typename Element, size_t MaxSize>
|
|||||||
StaticVector<Element, MaxSize>::StaticVector(StaticVector&& other)
|
StaticVector<Element, MaxSize>::StaticVector(StaticVector&& other)
|
||||||
: StaticVector() {
|
: StaticVector() {
|
||||||
for (auto& e : other)
|
for (auto& e : other)
|
||||||
emplace_back(move(e));
|
emplace_back(std::move(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, size_t MaxSize>
|
template <typename Element, size_t MaxSize>
|
||||||
@ -162,7 +162,7 @@ template <typename Element, size_t MaxSize>
|
|||||||
auto StaticVector<Element, MaxSize>::operator=(StaticVector&& other) -> StaticVector& {
|
auto StaticVector<Element, MaxSize>::operator=(StaticVector&& other) -> StaticVector& {
|
||||||
resize(other.size());
|
resize(other.size());
|
||||||
for (size_t i = 0; i < m_size; ++i)
|
for (size_t i = 0; i < m_size; ++i)
|
||||||
operator[](i) = move(other[i]);
|
operator[](i) = std::move(other[i]);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ template <typename Element, size_t MaxSize>
|
|||||||
auto StaticVector<Element, MaxSize>::operator=(std::initializer_list<Element> list) -> StaticVector& {
|
auto StaticVector<Element, MaxSize>::operator=(std::initializer_list<Element> list) -> StaticVector& {
|
||||||
resize(list.size());
|
resize(list.size());
|
||||||
for (size_t i = 0; i < m_size; ++i)
|
for (size_t i = 0; i < m_size; ++i)
|
||||||
operator[](i) = move(list[i]);
|
operator[](i) = std::move(list[i]);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ Element* StaticVector<Element, MaxSize>::ptr() {
|
|||||||
|
|
||||||
template <typename Element, size_t MaxSize>
|
template <typename Element, size_t MaxSize>
|
||||||
void StaticVector<Element, MaxSize>::push_back(Element e) {
|
void StaticVector<Element, MaxSize>::push_back(Element e) {
|
||||||
emplace_back(move(e));
|
emplace_back(std::move(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, size_t MaxSize>
|
template <typename Element, size_t MaxSize>
|
||||||
@ -287,7 +287,7 @@ void StaticVector<Element, MaxSize>::pop_back() {
|
|||||||
|
|
||||||
template <typename Element, size_t MaxSize>
|
template <typename Element, size_t MaxSize>
|
||||||
auto StaticVector<Element, MaxSize>::insert(iterator pos, Element e) -> iterator {
|
auto StaticVector<Element, MaxSize>::insert(iterator pos, Element e) -> iterator {
|
||||||
emplace(pos, move(e));
|
emplace(pos, std::move(e));
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ auto StaticVector<Element, MaxSize>::insert(iterator pos, Iterator begin, Iterat
|
|||||||
resize(m_size + toAdd);
|
resize(m_size + toAdd);
|
||||||
|
|
||||||
for (size_t i = toShift; i != 0; --i)
|
for (size_t i = toShift; i != 0; --i)
|
||||||
operator[](endIndex + i - 1) = move(operator[](startIndex + i - 1));
|
operator[](endIndex + i - 1) = std::move(operator[](startIndex + i - 1));
|
||||||
|
|
||||||
for (size_t i = 0; i != toAdd; ++i)
|
for (size_t i = 0; i != toAdd; ++i)
|
||||||
operator[](startIndex + i) = *begin++;
|
operator[](startIndex + i) = *begin++;
|
||||||
@ -321,8 +321,8 @@ void StaticVector<Element, MaxSize>::emplace(iterator pos, Args&&... args) {
|
|||||||
size_t index = pos - ptr();
|
size_t index = pos - ptr();
|
||||||
resize(m_size + 1);
|
resize(m_size + 1);
|
||||||
for (size_t i = m_size - 1; i != index; --i)
|
for (size_t i = m_size - 1; i != index; --i)
|
||||||
operator[](i) = move(operator[](i - 1));
|
operator[](i) = std::move(operator[](i - 1));
|
||||||
operator[](index) = Element(forward<Args>(args)...);
|
operator[](index) = Element(std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, size_t MaxSize>
|
template <typename Element, size_t MaxSize>
|
||||||
@ -332,7 +332,7 @@ void StaticVector<Element, MaxSize>::emplace_back(Args&&... args) {
|
|||||||
throw StaticVectorSizeException::format("StaticVector::emplace_back would extend StaticVector beyond size {}", MaxSize);
|
throw StaticVectorSizeException::format("StaticVector::emplace_back would extend StaticVector beyond size {}", MaxSize);
|
||||||
|
|
||||||
m_size += 1;
|
m_size += 1;
|
||||||
new (ptr() + m_size - 1) Element(forward<Args>(args)...);
|
new (ptr() + m_size - 1) Element(std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element, size_t MaxSize>
|
template <typename Element, size_t MaxSize>
|
||||||
@ -345,7 +345,7 @@ template <typename Element, size_t MaxSize>
|
|||||||
auto StaticVector<Element, MaxSize>::erase(iterator pos) -> iterator {
|
auto StaticVector<Element, MaxSize>::erase(iterator pos) -> iterator {
|
||||||
size_t index = pos - ptr();
|
size_t index = pos - ptr();
|
||||||
for (size_t i = index; i < m_size - 1; ++i)
|
for (size_t i = index; i < m_size - 1; ++i)
|
||||||
operator[](i) = move(operator[](i + 1));
|
operator[](i) = std::move(operator[](i + 1));
|
||||||
resize(m_size - 1);
|
resize(m_size - 1);
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
@ -356,7 +356,7 @@ auto StaticVector<Element, MaxSize>::erase(iterator begin, iterator end) -> iter
|
|||||||
size_t endIndex = end - ptr();
|
size_t endIndex = end - ptr();
|
||||||
size_t toRemove = endIndex - startIndex;
|
size_t toRemove = endIndex - startIndex;
|
||||||
for (size_t i = endIndex; i < m_size; ++i)
|
for (size_t i = endIndex; i < m_size; ++i)
|
||||||
operator[](startIndex + (i - endIndex)) = move(operator[](i));
|
operator[](startIndex + (i - endIndex)) = std::move(operator[](i));
|
||||||
resize(m_size - toRemove);
|
resize(m_size - toRemove);
|
||||||
return begin;
|
return begin;
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ StringList String::splitAny(String const& chars, size_t maxSplit) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!next.empty())
|
if (!next.empty())
|
||||||
ret.append(move(next));
|
ret.append(std::move(next));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,43 +661,43 @@ void String::append(Char c) {
|
|||||||
void String::prepend(String const& s) {
|
void String::prepend(String const& s) {
|
||||||
auto ns = s;
|
auto ns = s;
|
||||||
ns.append(*this);
|
ns.append(*this);
|
||||||
*this = move(ns);
|
*this = std::move(ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
void String::prepend(std::string const& s) {
|
void String::prepend(std::string const& s) {
|
||||||
auto ns = String(s);
|
auto ns = String(s);
|
||||||
ns.append(*this);
|
ns.append(*this);
|
||||||
*this = move(ns);
|
*this = std::move(ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
void String::prepend(Char const* s) {
|
void String::prepend(Char const* s) {
|
||||||
auto ns = String(s);
|
auto ns = String(s);
|
||||||
ns.append(*this);
|
ns.append(*this);
|
||||||
*this = move(ns);
|
*this = std::move(ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
void String::prepend(Char const* s, size_t n) {
|
void String::prepend(Char const* s, size_t n) {
|
||||||
auto ns = String(s, n);
|
auto ns = String(s, n);
|
||||||
ns.append(*this);
|
ns.append(*this);
|
||||||
*this = move(ns);
|
*this = std::move(ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
void String::prepend(char const* s) {
|
void String::prepend(char const* s) {
|
||||||
auto ns = String(s);
|
auto ns = String(s);
|
||||||
ns.append(*this);
|
ns.append(*this);
|
||||||
*this = move(ns);
|
*this = std::move(ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
void String::prepend(char const* s, size_t n) {
|
void String::prepend(char const* s, size_t n) {
|
||||||
auto ns = String(s, n);
|
auto ns = String(s, n);
|
||||||
ns.append(*this);
|
ns.append(*this);
|
||||||
*this = move(ns);
|
*this = std::move(ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
void String::prepend(Char c) {
|
void String::prepend(Char c) {
|
||||||
auto ns = String(c, 1);
|
auto ns = String(c, 1);
|
||||||
ns.append(*this);
|
ns.append(*this);
|
||||||
*this = move(ns);
|
*this = std::move(ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
void String::push_back(Char c) {
|
void String::push_back(Char c) {
|
||||||
@ -809,7 +809,7 @@ String& String::operator=(String const& s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String& String::operator=(String&& s) {
|
String& String::operator=(String&& s) {
|
||||||
m_string = move(s.m_string);
|
m_string = std::move(s.m_string);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,7 +473,7 @@ Maybe<String> String::maybeLookupTagsView(Lookup&& lookup) const {
|
|||||||
template <typename Lookup>
|
template <typename Lookup>
|
||||||
String String::lookupTagsView(Lookup&& lookup) const {
|
String String::lookupTagsView(Lookup&& lookup) const {
|
||||||
auto result = maybeLookupTagsView(lookup);
|
auto result = maybeLookupTagsView(lookup);
|
||||||
return result ? move(result.take()) : String();
|
return result ? std::move(result.take()) : String();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename MapType>
|
template <typename MapType>
|
||||||
|
@ -17,13 +17,13 @@ String& String::operator+=(std::string_view s) {
|
|||||||
|
|
||||||
StringView::StringView() {}
|
StringView::StringView() {}
|
||||||
StringView::StringView(StringView const& s) : m_view(s.m_view) {}
|
StringView::StringView(StringView const& s) : m_view(s.m_view) {}
|
||||||
StringView::StringView(StringView&& s) noexcept : m_view(move(s.m_view)) {};
|
StringView::StringView(StringView&& s) noexcept : m_view(std::move(s.m_view)) {};
|
||||||
StringView::StringView(String const& s) : m_view(s.utf8()) {};
|
StringView::StringView(String const& s) : m_view(s.utf8()) {};
|
||||||
StringView::StringView(char const* s) : m_view(s) {};
|
StringView::StringView(char const* s) : m_view(s) {};
|
||||||
StringView::StringView(char const* s, size_t n) : m_view(s, n) {};
|
StringView::StringView(char const* s, size_t n) : m_view(s, n) {};
|
||||||
|
|
||||||
StringView::StringView(std::string_view const& s) : m_view(s) {};
|
StringView::StringView(std::string_view const& s) : m_view(s) {};
|
||||||
StringView::StringView(std::string_view&& s) noexcept : m_view(move(s)) {};
|
StringView::StringView(std::string_view&& s) noexcept : m_view(std::move(s)) {};
|
||||||
StringView::StringView(std::string const& s) : m_view(s) {}
|
StringView::StringView(std::string const& s) : m_view(s) {}
|
||||||
|
|
||||||
StringView::StringView(Char const* s) : m_view((char const*)s, sizeof(*s)) {}
|
StringView::StringView(Char const* s) : m_view((char const*)s, sizeof(*s)) {}
|
||||||
|
@ -352,7 +352,7 @@ bool MLocker<MutexType>::tryLock() {
|
|||||||
|
|
||||||
template <typename Function, typename... Args>
|
template <typename Function, typename... Args>
|
||||||
ThreadFunction<decltype(std::declval<Function>()(std::declval<Args>()...))> Thread::invoke(String const& name, Function&& f, Args&&... args) {
|
ThreadFunction<decltype(std::declval<Function>()(std::declval<Args>()...))> Thread::invoke(String const& name, Function&& f, Args&&... args) {
|
||||||
return {bind(forward<Function>(f), forward<Args>(args)...), name};
|
return {bind(std::forward<Function>(f), std::forward<Args>(args)...), name};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Return>
|
template <typename Return>
|
||||||
@ -364,7 +364,7 @@ ThreadFunction<Return>::ThreadFunction(ThreadFunction&&) = default;
|
|||||||
template <typename Return>
|
template <typename Return>
|
||||||
ThreadFunction<Return>::ThreadFunction(function<Return()> function, String const& name) {
|
ThreadFunction<Return>::ThreadFunction(function<Return()> function, String const& name) {
|
||||||
m_return = make_shared<Maybe<Return>>();
|
m_return = make_shared<Maybe<Return>>();
|
||||||
m_function = ThreadFunction<void>([function = move(function), retValue = m_return]() {
|
m_function = ThreadFunction<void>([function = std::move(function), retValue = m_return]() {
|
||||||
*retValue = function();
|
*retValue = function();
|
||||||
}, name);
|
}, name);
|
||||||
}
|
}
|
||||||
|
@ -101,10 +101,10 @@ struct ThreadImpl {
|
|||||||
|
|
||||||
struct ThreadFunctionImpl : ThreadImpl {
|
struct ThreadFunctionImpl : ThreadImpl {
|
||||||
ThreadFunctionImpl(std::function<void()> function, String name)
|
ThreadFunctionImpl(std::function<void()> function, String name)
|
||||||
: ThreadImpl(wrapFunction(move(function)), move(name)) {}
|
: ThreadImpl(wrapFunction(std::move(function)), std::move(name)) {}
|
||||||
|
|
||||||
std::function<void()> wrapFunction(std::function<void()> function) {
|
std::function<void()> wrapFunction(std::function<void()> function) {
|
||||||
return [function = move(function), this]() {
|
return [function = std::move(function), this]() {
|
||||||
try {
|
try {
|
||||||
function();
|
function();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
@ -283,7 +283,7 @@ ThreadFunction<void>::ThreadFunction() {}
|
|||||||
ThreadFunction<void>::ThreadFunction(ThreadFunction&&) = default;
|
ThreadFunction<void>::ThreadFunction(ThreadFunction&&) = default;
|
||||||
|
|
||||||
ThreadFunction<void>::ThreadFunction(function<void()> function, String const& name) {
|
ThreadFunction<void>::ThreadFunction(function<void()> function, String const& name) {
|
||||||
m_impl.reset(new ThreadFunctionImpl(move(function), name));
|
m_impl.reset(new ThreadFunctionImpl(std::move(function), name));
|
||||||
m_impl->start();
|
m_impl->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,10 +106,10 @@ private:
|
|||||||
|
|
||||||
struct ThreadFunctionImpl : ThreadImpl {
|
struct ThreadFunctionImpl : ThreadImpl {
|
||||||
ThreadFunctionImpl(std::function<void()> function, String name)
|
ThreadFunctionImpl(std::function<void()> function, String name)
|
||||||
: ThreadImpl(wrapFunction(move(function)), move(name)) {}
|
: ThreadImpl(wrapFunction(std::move(function)), std::move(name)) {}
|
||||||
|
|
||||||
std::function<void()> wrapFunction(std::function<void()> function) {
|
std::function<void()> wrapFunction(std::function<void()> function) {
|
||||||
return [function = move(function), this]() {
|
return [function = std::move(function), this]() {
|
||||||
try {
|
try {
|
||||||
function();
|
function();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
@ -437,7 +437,7 @@ ThreadFunction<void>::ThreadFunction() {}
|
|||||||
ThreadFunction<void>::ThreadFunction(ThreadFunction&&) = default;
|
ThreadFunction<void>::ThreadFunction(ThreadFunction&&) = default;
|
||||||
|
|
||||||
ThreadFunction<void>::ThreadFunction(function<void()> function, String const& name) {
|
ThreadFunction<void>::ThreadFunction(function<void()> function, String const& name) {
|
||||||
m_impl.reset(new ThreadFunctionImpl(move(function), name));
|
m_impl.reset(new ThreadFunctionImpl(std::move(function), name));
|
||||||
m_impl->start();
|
m_impl->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ template <typename LruCacheType>
|
|||||||
auto TtlCacheBase<LruCacheType>::values() const -> List<Value> {
|
auto TtlCacheBase<LruCacheType>::values() const -> List<Value> {
|
||||||
List<Value> values;
|
List<Value> values;
|
||||||
for (auto& p : m_cache.values())
|
for (auto& p : m_cache.values())
|
||||||
values.append(move(p.second));
|
values.append(std::move(p.second));
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ public:
|
|||||||
typename std::enable_if< std::is_constructible<T, Args...>::value, int >::type = 0
|
typename std::enable_if< std::is_constructible<T, Args...>::value, int >::type = 0
|
||||||
>
|
>
|
||||||
Variant(std::in_place_type_t<T>, Args&&... args) {
|
Variant(std::in_place_type_t<T>, Args&&... args) {
|
||||||
new (&m_buffer) T(forward<Args>(args)...);
|
new (&m_buffer) T(std::forward<Args>(args)...);
|
||||||
m_typeIndex = TypeIndex<T>::value;
|
m_typeIndex = TypeIndex<T>::value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
typename std::enable_if< std::is_constructible<T, std::initializer_list<U>&, Args...>::value, int >::type = 0
|
typename std::enable_if< std::is_constructible<T, std::initializer_list<U>&, Args...>::value, int >::type = 0
|
||||||
>
|
>
|
||||||
Variant(std::in_place_type_t<T>, std::initializer_list<U> il, Args&&... args) {
|
Variant(std::in_place_type_t<T>, std::initializer_list<U> il, Args&&... args) {
|
||||||
new (&m_buffer) T(il, forward<Args>(args)...);
|
new (&m_buffer) T(il, std::forward<Args>(args)...);
|
||||||
m_typeIndex = TypeIndex<T>::value;
|
m_typeIndex = TypeIndex<T>::value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,12 +373,12 @@ Variant<FirstType, RestTypes...>::Variant(T const& x) {
|
|||||||
template <typename FirstType, typename... RestTypes>
|
template <typename FirstType, typename... RestTypes>
|
||||||
template <typename T, typename>
|
template <typename T, typename>
|
||||||
Variant<FirstType, RestTypes...>::Variant(T&& x) {
|
Variant<FirstType, RestTypes...>::Variant(T&& x) {
|
||||||
assign(forward<T>(x));
|
assign(std::forward<T>(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FirstType, typename... RestTypes>
|
template <typename FirstType, typename... RestTypes>
|
||||||
Variant<FirstType, RestTypes...>::Variant(Variant const& x) {
|
Variant<FirstType, RestTypes...>::Variant(Variant const& x) {
|
||||||
x.call([this](auto const& t) {
|
x.call([&](auto const& t) {
|
||||||
assign(t);
|
assign(t);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -386,8 +386,8 @@ Variant<FirstType, RestTypes...>::Variant(Variant const& x) {
|
|||||||
template <typename FirstType, typename... RestTypes>
|
template <typename FirstType, typename... RestTypes>
|
||||||
Variant<FirstType, RestTypes...>::Variant(Variant&& x)
|
Variant<FirstType, RestTypes...>::Variant(Variant&& x)
|
||||||
noexcept(detail::IsNothrowMoveConstructible<FirstType, RestTypes...>::value) {
|
noexcept(detail::IsNothrowMoveConstructible<FirstType, RestTypes...>::value) {
|
||||||
x.call([this](auto& t) {
|
x.call([&](auto& t) {
|
||||||
assign(move(t));
|
assign(std::move(t));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ Variant<FirstType, RestTypes...>& Variant<FirstType, RestTypes...>::operator=(Va
|
|||||||
if (&x == this)
|
if (&x == this)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
x.call([this](auto const& t) {
|
x.call([&](auto const& t) {
|
||||||
assign(t);
|
assign(t);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -414,8 +414,8 @@ Variant<FirstType, RestTypes...>& Variant<FirstType, RestTypes...>::operator=(Va
|
|||||||
if (&x == this)
|
if (&x == this)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
x.call([this](auto& t) {
|
x.call([&](auto& t) {
|
||||||
assign(move(t));
|
assign(std::move(t));
|
||||||
});
|
});
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
@ -431,7 +431,7 @@ Variant<FirstType, RestTypes...>& Variant<FirstType, RestTypes...>::operator=(T
|
|||||||
template <typename FirstType, typename... RestTypes>
|
template <typename FirstType, typename... RestTypes>
|
||||||
template <typename T, typename>
|
template <typename T, typename>
|
||||||
Variant<FirstType, RestTypes...>& Variant<FirstType, RestTypes...>::operator=(T&& x) {
|
Variant<FirstType, RestTypes...>& Variant<FirstType, RestTypes...>::operator=(T&& x) {
|
||||||
assign(forward<T>(x));
|
assign(std::forward<T>(x));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,13 +484,13 @@ bool Variant<FirstType, RestTypes...>::is() const {
|
|||||||
template <typename FirstType, typename... RestTypes>
|
template <typename FirstType, typename... RestTypes>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
decltype(auto) Variant<FirstType, RestTypes...>::call(Function&& function) {
|
decltype(auto) Variant<FirstType, RestTypes...>::call(Function&& function) {
|
||||||
return doCall<Function, FirstType, RestTypes...>(forward<Function>(function));
|
return doCall<Function, FirstType, RestTypes...>(std::forward<Function>(function));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FirstType, typename... RestTypes>
|
template <typename FirstType, typename... RestTypes>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
decltype(auto) Variant<FirstType, RestTypes...>::call(Function&& function) const {
|
decltype(auto) Variant<FirstType, RestTypes...>::call(Function&& function) const {
|
||||||
return doCall<Function, FirstType, RestTypes...>(forward<Function>(function));
|
return doCall<Function, FirstType, RestTypes...>(std::forward<Function>(function));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FirstType, typename... RestTypes>
|
template <typename FirstType, typename... RestTypes>
|
||||||
@ -588,10 +588,10 @@ template <typename T>
|
|||||||
void Variant<FirstType, RestTypes...>::assign(T&& x) {
|
void Variant<FirstType, RestTypes...>::assign(T&& x) {
|
||||||
typedef typename std::decay<T>::type AssignType;
|
typedef typename std::decay<T>::type AssignType;
|
||||||
if (auto p = ptr<AssignType>()) {
|
if (auto p = ptr<AssignType>()) {
|
||||||
*p = forward<T>(x);
|
*p = std::forward<T>(x);
|
||||||
} else {
|
} else {
|
||||||
destruct();
|
destruct();
|
||||||
new (&m_buffer) AssignType(forward<T>(x));
|
new (&m_buffer) AssignType(std::forward<T>(x));
|
||||||
m_typeIndex = TypeIndex<AssignType>::value;
|
m_typeIndex = TypeIndex<AssignType>::value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -611,7 +611,7 @@ decltype(auto) Variant<FirstType, RestTypes...>::doCall(Function&& function) {
|
|||||||
if (T1* p = ptr<T1>())
|
if (T1* p = ptr<T1>())
|
||||||
return function(*p);
|
return function(*p);
|
||||||
else
|
else
|
||||||
return doCall<Function, T2, TL...>(forward<Function>(function));
|
return doCall<Function, T2, TL...>(std::forward<Function>(function));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FirstType, typename... RestTypes>
|
template <typename FirstType, typename... RestTypes>
|
||||||
@ -629,7 +629,7 @@ decltype(auto) Variant<FirstType, RestTypes...>::doCall(Function&& function) con
|
|||||||
if (T1 const* p = ptr<T1>())
|
if (T1 const* p = ptr<T1>())
|
||||||
return function(*p);
|
return function(*p);
|
||||||
else
|
else
|
||||||
return doCall<Function, T2, TL...>(forward<Function>(function));
|
return doCall<Function, T2, TL...>(std::forward<Function>(function));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FirstType, typename... RestTypes>
|
template <typename FirstType, typename... RestTypes>
|
||||||
@ -665,7 +665,7 @@ MVariant<Types...>::MVariant(MVariant const& x)
|
|||||||
|
|
||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
MVariant<Types...>::MVariant(MVariant&& x) {
|
MVariant<Types...>::MVariant(MVariant&& x) {
|
||||||
m_variant = move(x.m_variant);
|
m_variant = std::move(x.m_variant);
|
||||||
x.m_variant = MVariantEmpty();
|
x.m_variant = MVariantEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -676,7 +676,7 @@ MVariant<Types...>::MVariant(Variant<Types...> const& x) {
|
|||||||
|
|
||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
MVariant<Types...>::MVariant(Variant<Types...>&& x) {
|
MVariant<Types...>::MVariant(Variant<Types...>&& x) {
|
||||||
operator=(move(x));
|
operator=(std::move(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
@ -687,7 +687,7 @@ MVariant<Types...>::MVariant(T const& x)
|
|||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
template <typename T, typename>
|
template <typename T, typename>
|
||||||
MVariant<Types...>::MVariant(T&& x)
|
MVariant<Types...>::MVariant(T&& x)
|
||||||
: m_variant(forward<T>(x)) {}
|
: m_variant(std::forward<T>(x)) {}
|
||||||
|
|
||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
MVariant<Types...>::~MVariant() {}
|
MVariant<Types...>::~MVariant() {}
|
||||||
@ -707,7 +707,7 @@ MVariant<Types...>& MVariant<Types...>::operator=(MVariant const& x) {
|
|||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
MVariant<Types...>& MVariant<Types...>::operator=(MVariant&& x) {
|
MVariant<Types...>& MVariant<Types...>::operator=(MVariant&& x) {
|
||||||
try {
|
try {
|
||||||
m_variant = move(x.m_variant);
|
m_variant = std::move(x.m_variant);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
if (m_variant.invalid())
|
if (m_variant.invalid())
|
||||||
m_variant = MVariantEmpty();
|
m_variant = MVariantEmpty();
|
||||||
@ -733,7 +733,7 @@ template <typename... Types>
|
|||||||
template <typename T, typename>
|
template <typename T, typename>
|
||||||
MVariant<Types...>& MVariant<Types...>::operator=(T&& x) {
|
MVariant<Types...>& MVariant<Types...>::operator=(T&& x) {
|
||||||
try {
|
try {
|
||||||
m_variant = forward<T>(x);
|
m_variant = std::forward<T>(x);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
if (m_variant.invalid())
|
if (m_variant.invalid())
|
||||||
m_variant = MVariantEmpty();
|
m_variant = MVariantEmpty();
|
||||||
@ -753,7 +753,7 @@ MVariant<Types...>& MVariant<Types...>::operator=(Variant<Types...> const& x) {
|
|||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
MVariant<Types...>& MVariant<Types...>::operator=(Variant<Types...>&& x) {
|
MVariant<Types...>& MVariant<Types...>::operator=(Variant<Types...>&& x) {
|
||||||
x.call([this](auto& t) {
|
x.call([this](auto& t) {
|
||||||
*this = move(t);
|
*this = std::move(t);
|
||||||
});
|
});
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -830,7 +830,7 @@ bool MVariant<Types...>::is() const {
|
|||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
template <typename T, typename>
|
template <typename T, typename>
|
||||||
T MVariant<Types...>::take() {
|
T MVariant<Types...>::take() {
|
||||||
T t = move(m_variant.template get<T>());
|
T t = std::move(m_variant.template get<T>());
|
||||||
m_variant = MVariantEmpty();
|
m_variant = MVariantEmpty();
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
@ -854,7 +854,7 @@ Variant<Types...> MVariant<Types...>::takeValue() {
|
|||||||
|
|
||||||
Variant<Types...> r;
|
Variant<Types...> r;
|
||||||
call([&r](auto& v) {
|
call([&r](auto& v) {
|
||||||
r = move(v);
|
r = std::move(v);
|
||||||
});
|
});
|
||||||
m_variant = MVariantEmpty();
|
m_variant = MVariantEmpty();
|
||||||
return r;
|
return r;
|
||||||
@ -878,13 +878,13 @@ MVariant<Types...>::operator bool() const {
|
|||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
void MVariant<Types...>::call(Function&& function) {
|
void MVariant<Types...>::call(Function&& function) {
|
||||||
m_variant.call(RefCaller<Function>(forward<Function>(function)));
|
m_variant.call(RefCaller<Function>(std::forward<Function>(function)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
void MVariant<Types...>::call(Function&& function) const {
|
void MVariant<Types...>::call(Function&& function) const {
|
||||||
m_variant.call(ConstRefCaller<Function>(forward<Function>(function)));
|
m_variant.call(ConstRefCaller<Function>(std::forward<Function>(function)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
@ -910,7 +910,7 @@ bool MVariant<Types...>::MVariantEmpty::operator<(MVariantEmpty const&) const {
|
|||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
MVariant<Types...>::RefCaller<Function>::RefCaller(Function&& function)
|
MVariant<Types...>::RefCaller<Function>::RefCaller(Function&& function)
|
||||||
: function(forward<Function>(function)) {}
|
: function(std::forward<Function>(function)) {}
|
||||||
|
|
||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
@ -926,7 +926,7 @@ void MVariant<Types...>::RefCaller<Function>::operator()(T& t) {
|
|||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
MVariant<Types...>::ConstRefCaller<Function>::ConstRefCaller(Function&& function)
|
MVariant<Types...>::ConstRefCaller<Function>::ConstRefCaller(Function&& function)
|
||||||
: function(forward<Function>(function)) {}
|
: function(std::forward<Function>(function)) {}
|
||||||
|
|
||||||
template <typename... Types>
|
template <typename... Types>
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
|
@ -69,7 +69,7 @@ void WeightedPool<Item>::add(double weight, Item item) {
|
|||||||
if (weight <= 0.0)
|
if (weight <= 0.0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_items.append({weight, move(item)});
|
m_items.append({weight, std::move(item)});
|
||||||
m_totalWeight += weight;
|
m_totalWeight += weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user