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<T>& operator=(image<T> rhs);
|
||||
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);
|
||||
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
|
||||
#include <mapnik/image.hpp>
|
||||
|
||||
|
@ -134,6 +131,18 @@ image<T> const& image<T>::operator=(image<T> const& rhs) const
|
|||
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>
|
||||
void image<T>::swap(image<T> & rhs)
|
||||
{
|
||||
|
@ -314,4 +323,3 @@ inline image_dtype image<T>::get_dtype() const
|
|||
|
||||
} // end ns
|
||||
|
||||
#endif // MAPNIK_IMAGE_IMPL_HPP
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
//#include <mapnik/image.hpp>
|
||||
#include <mapnik/pixel_types.hpp>
|
||||
|
||||
//stl
|
||||
|
@ -50,6 +49,10 @@ public:
|
|||
bool painted = false) {}
|
||||
image(image<null_t> const& rhs) {}
|
||||
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 height() const { return 0; }
|
||||
|
|
Loading…
Reference in a new issue