Implementing < and == operators in image
This commit is contained in:
parent
5c65dadd72
commit
454398985c
3 changed files with 18 additions and 5 deletions
|
@ -94,6 +94,8 @@ public:
|
||||||
image(image<T> && rhs) noexcept;
|
image(image<T> && rhs) noexcept;
|
||||||
image<T>& operator=(image<T> rhs);
|
image<T>& operator=(image<T> rhs);
|
||||||
image<T>const& operator=(image<T> const& rhs) const;
|
image<T>const& operator=(image<T> const& rhs) const;
|
||||||
|
bool operator==(image<T> const& rhs) const;
|
||||||
|
bool operator<(image<T> const& rhs) const;
|
||||||
|
|
||||||
void swap(image<T> & rhs);
|
void swap(image<T> & rhs);
|
||||||
pixel_type& operator() (std::size_t i, std::size_t j);
|
pixel_type& operator() (std::size_t i, std::size_t j);
|
||||||
|
|
|
@ -20,9 +20,6 @@
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef MAPNIK_IMAGE_IMPL_HPP
|
|
||||||
#define MAPNIK_IMAGE_IMPL_HPP
|
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/image.hpp>
|
#include <mapnik/image.hpp>
|
||||||
|
|
||||||
|
@ -134,6 +131,18 @@ image<T> const& image<T>::operator=(image<T> const& rhs) const
|
||||||
return rhs;
|
return rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool image<T>::operator==(image<T> const& rhs) const
|
||||||
|
{
|
||||||
|
return rhs.getBytes() == getBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool image<T>::operator<(image<T> const& rhs) const
|
||||||
|
{
|
||||||
|
return getSize() < rhs.getSize();
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void image<T>::swap(image<T> & rhs)
|
void image<T>::swap(image<T> & rhs)
|
||||||
{
|
{
|
||||||
|
@ -314,4 +323,3 @@ inline image_dtype image<T>::get_dtype() const
|
||||||
|
|
||||||
} // end ns
|
} // end ns
|
||||||
|
|
||||||
#endif // MAPNIK_IMAGE_IMPL_HPP
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/config.hpp>
|
#include <mapnik/config.hpp>
|
||||||
//#include <mapnik/image.hpp>
|
|
||||||
#include <mapnik/pixel_types.hpp>
|
#include <mapnik/pixel_types.hpp>
|
||||||
|
|
||||||
//stl
|
//stl
|
||||||
|
@ -50,6 +49,10 @@ public:
|
||||||
bool painted = false) {}
|
bool painted = false) {}
|
||||||
image(image<null_t> const& rhs) {}
|
image(image<null_t> const& rhs) {}
|
||||||
image(image<null_t> && rhs) noexcept {}
|
image(image<null_t> && rhs) noexcept {}
|
||||||
|
image<null_t>& operator=(image<null_t> rhs) { return *this; }
|
||||||
|
image<null_t>const& operator=(image<null_t> const& rhs) const { return rhs; }
|
||||||
|
bool operator==(image<null_t> const& rhs) const { return true; }
|
||||||
|
bool operator<(image<null_t> const& rhs) const { return false; }
|
||||||
|
|
||||||
std::size_t width() const { return 0; }
|
std::size_t width() const { return 0; }
|
||||||
std::size_t height() const { return 0; }
|
std::size_t height() const { return 0; }
|
||||||
|
|
Loading…
Reference in a new issue