out-of-class swap method to be consistent
This commit is contained in:
parent
eb0b4dbc0b
commit
c8b8937bf9
2 changed files with 10 additions and 11 deletions
|
@ -57,7 +57,14 @@ private:
|
|||
T miny_;
|
||||
T maxx_;
|
||||
T maxy_;
|
||||
void swap(box2d_type & rhs);
|
||||
friend inline void swap(box2d_type & lhs, box2d_type & rhs)
|
||||
{
|
||||
using std::swap;
|
||||
swap(lhs.minx_, rhs.minx_);
|
||||
swap(lhs.miny_, rhs.miny_);
|
||||
swap(lhs.maxx_, rhs.maxx_);
|
||||
swap(lhs.maxy_, rhs.maxy_);
|
||||
}
|
||||
public:
|
||||
box2d();
|
||||
box2d(T minx,T miny,T maxx,T maxy);
|
||||
|
|
|
@ -80,19 +80,10 @@ box2d<T>::box2d(box2d_type && rhs)
|
|||
template <typename T>
|
||||
box2d<T>& box2d<T>::operator=(box2d_type other)
|
||||
{
|
||||
swap(other);
|
||||
swap(*this, other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void box2d<T>::swap(box2d_type & other)
|
||||
{
|
||||
std::swap(minx_, other.minx_);
|
||||
std::swap(miny_, other.miny_);
|
||||
std::swap(maxx_, other.maxx_);
|
||||
std::swap(maxy_, other.maxy_);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
box2d<T>::box2d(box2d_type const& rhs, agg::trans_affine const& tr)
|
||||
{
|
||||
|
@ -471,4 +462,5 @@ box2d<T>& box2d<T>::operator*=(agg::trans_affine const& tr)
|
|||
|
||||
template class box2d<int>;
|
||||
template class box2d<double>;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue