Compare commits

...

2 commits

2 changed files with 45 additions and 8 deletions

View file

@ -72,10 +72,19 @@ public:
////////////////////////////////////////////////////////////
/// \brief Copy constructor
///
/// \param copy instance to copy
/// \param copied instance to copy
///
////////////////////////////////////////////////////////////
Texture(const Texture& copy);
Texture(const Texture& copied);
////////////////////////////////////////////////////////////
/// \brief Move constructor
///
/// \param moved instance to move from. Behaves like a
/// default-constructed object after the move.
///
////////////////////////////////////////////////////////////
Texture(Texture&& moved) noexcept;
////////////////////////////////////////////////////////////
/// \brief Destructor
@ -507,16 +516,27 @@ public:
///
////////////////////////////////////////////////////////////
bool generateMipmap();
////////////////////////////////////////////////////////////
/// \brief Overload of assignment operator
/// \brief Copy assignment operator
///
/// \param right Instance to assign
/// \param copied Instance to assign
///
/// \return Reference to self
///
////////////////////////////////////////////////////////////
Texture& operator =(const Texture& right);
Texture& operator =(const Texture& copied);
////////////////////////////////////////////////////////////
/// \brief Move assignment operator
///
/// \param moved instance to move from. Behaves like a
/// default-constructed object after the move.
///
/// \return Reference to self
///
////////////////////////////////////////////////////////////
Texture& operator =(Texture&& moved);
////////////////////////////////////////////////////////////
/// \brief Swap the contents of this texture with those of another

View file

@ -101,6 +101,14 @@ m_cacheId (getUniqueId())
}
////////////////////////////////////////////////////////////
Texture::Texture(Texture&& moved) noexcept :
Texture()
{
swap(moved);
}
////////////////////////////////////////////////////////////
Texture::~Texture()
{
@ -809,10 +817,19 @@ unsigned int Texture::getMaximumSize()
////////////////////////////////////////////////////////////
Texture& Texture::operator =(const Texture& right)
Texture& Texture::operator =(const Texture& copied)
{
Texture temp(right);
Texture temp(copied);
swap(temp);
return *this;
}
////////////////////////////////////////////////////////////
Texture& Texture::operator =(Texture&& moved)
{
Texture temp(std::move(moved));
swap(temp);
return *this;