Omit copy constructors for strings in constructors
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define LUA_SCRIPT_COMPONENT_H
|
||||
|
||||
#include <string> // std::string
|
||||
#include <utility> // std::move
|
||||
|
||||
namespace Inferno {
|
||||
|
||||
@@ -14,7 +15,7 @@ namespace Inferno {
|
||||
// Dont allow manually setting instance during construction
|
||||
LuaScriptComponent() {}
|
||||
LuaScriptComponent(const std::string& path)
|
||||
: path(path) {}
|
||||
: path(std::move(path)) {}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define TAG_COMPONENT_H
|
||||
|
||||
#include <string> // std::string
|
||||
#include <utility> // std::move
|
||||
|
||||
namespace Inferno {
|
||||
|
||||
@@ -10,7 +11,7 @@ namespace Inferno {
|
||||
|
||||
TagComponent() = default;
|
||||
TagComponent(const std::string& tag)
|
||||
: tag(tag) {}
|
||||
: tag(std::move(tag)) {}
|
||||
|
||||
operator const std::string&() const { return tag; }
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <limits> // std::numeric_limits
|
||||
#include <string> // std::getline, std::stoi
|
||||
#include <utility> // std::move
|
||||
|
||||
#include "inferno/assert.h"
|
||||
#include "inferno/io/file.h"
|
||||
@@ -10,6 +11,7 @@
|
||||
namespace Inferno {
|
||||
|
||||
Font::Font(const std::string& name)
|
||||
: m_name(std::move(name))
|
||||
{
|
||||
std::string path = name + ".fnt";
|
||||
std::string image = name + ".png";
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
namespace Inferno {
|
||||
|
||||
Gltf::Gltf(const std::string& path)
|
||||
: m_path(path)
|
||||
: m_path(std::move(path))
|
||||
{
|
||||
auto gltf = GltfFile::read(path);
|
||||
ASSERT(gltf.first, "Gltf model invalid JSON content '{}'", path);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <utility> // std::move
|
||||
#include <vector> // std::vector
|
||||
|
||||
#include "glad/glad.h"
|
||||
@@ -12,7 +13,8 @@
|
||||
namespace Inferno {
|
||||
|
||||
Shader::Shader(const std::string& name)
|
||||
: m_id(0)
|
||||
: m_name(std::move(name)),
|
||||
m_id(0)
|
||||
{
|
||||
// Get file contents
|
||||
std::string vertexSrc = File::read(name + ".vert");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <climits> // UINT_MAX
|
||||
#include <memory>
|
||||
#include <memory> // std::shared_ptr
|
||||
#include <utility> // std::move
|
||||
|
||||
#include "glad/glad.h"
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
@@ -11,6 +12,7 @@
|
||||
namespace Inferno {
|
||||
|
||||
Texture::Texture(const std::string& path)
|
||||
: m_path(std::move(path))
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
|
||||
Reference in New Issue
Block a user