mirror of https://github.com/CGAL/cgal
const-ify some member functions (bug-report of Roger House on cgal-discuss).
This commit is contained in:
parent
27c49feaee
commit
393c1cc458
|
|
@ -31,13 +31,6 @@
|
|||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
//-----------------------------------------------------------------------//
|
||||
// Polygon_2_const_edge_circulator
|
||||
//-----------------------------------------------------------------------//
|
||||
// Ideally the class Polygon_2_const_edge_circulator would be a nested
|
||||
// class of Polygon_2, but this leads to compiler problems with
|
||||
// SGI C++ 4.0 with the iterator_category() function
|
||||
|
||||
template <class _Traits, class _Container> class Polygon_2;
|
||||
|
||||
template <class _Traits, class _Container>
|
||||
|
|
@ -136,7 +129,7 @@ class Polygon_2_const_edge_circulator {
|
|||
}
|
||||
|
||||
Polygon_2_const_edge_circulator<_Traits, _Container>
|
||||
operator+(difference_type n)
|
||||
operator+(difference_type n) const
|
||||
{
|
||||
return Polygon_2_const_edge_circulator<_Traits, _Container>(
|
||||
this->container, first_vertex + n);
|
||||
|
|
@ -149,7 +142,7 @@ class Polygon_2_const_edge_circulator {
|
|||
}
|
||||
|
||||
Polygon_2_const_edge_circulator<_Traits, _Container>
|
||||
operator-(difference_type n)
|
||||
operator-(difference_type n) const
|
||||
{
|
||||
return Polygon_2_const_edge_circulator<_Traits, _Container>(
|
||||
this->container, first_vertex - n);
|
||||
|
|
@ -157,37 +150,37 @@ class Polygon_2_const_edge_circulator {
|
|||
|
||||
difference_type
|
||||
operator-(
|
||||
const Polygon_2_const_edge_circulator<_Traits, _Container>& a)
|
||||
const Polygon_2_const_edge_circulator<_Traits, _Container>& a) const
|
||||
{
|
||||
return first_vertex - a.first_vertex;
|
||||
}
|
||||
|
||||
Segment_2 operator[](int n)
|
||||
Segment_2 operator[](int n) const
|
||||
{
|
||||
return *Polygon_2_const_edge_circulator<_Traits, _Container>(
|
||||
this->container, first_vertex+n);
|
||||
}
|
||||
|
||||
bool operator<(
|
||||
const Polygon_2_const_edge_circulator<_Traits, _Container>& a)
|
||||
const Polygon_2_const_edge_circulator<_Traits, _Container>& a) const
|
||||
{
|
||||
return first_vertex < a.first_vertex;
|
||||
}
|
||||
|
||||
bool operator>(
|
||||
const Polygon_2_const_edge_circulator<_Traits, _Container>& a)
|
||||
const Polygon_2_const_edge_circulator<_Traits, _Container>& a) const
|
||||
{
|
||||
return first_vertex > a.first_vertex;
|
||||
}
|
||||
|
||||
bool operator<=(
|
||||
const Polygon_2_const_edge_circulator<_Traits, _Container>& a)
|
||||
const Polygon_2_const_edge_circulator<_Traits, _Container>& a) const
|
||||
{
|
||||
return first_vertex <= a.first_vertex;
|
||||
}
|
||||
|
||||
bool operator>=(
|
||||
const Polygon_2_const_edge_circulator<_Traits, _Container>& a)
|
||||
const Polygon_2_const_edge_circulator<_Traits, _Container>& a) const
|
||||
{
|
||||
return first_vertex >= a.first_vertex;
|
||||
}
|
||||
|
|
@ -229,4 +222,3 @@ value_type(const Polygon_2_const_edge_circulator<_Traits,_Container>&)
|
|||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@
|
|||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
//-----------------------------------------------------------------------//
|
||||
// Polygon_2_edge_iterator
|
||||
//-----------------------------------------------------------------------//
|
||||
// Ideally the class Polygon_2_edge_iterator would be a nested class of
|
||||
// Polygon_2, but this leads to compiler problems with SGI C++ 4.0
|
||||
// with the iterator_category() function
|
||||
|
||||
template <class Traits_, class Container_> class Polygon_2;
|
||||
|
||||
template <class Segment_>
|
||||
|
|
@ -80,7 +73,7 @@ class Polygon_2_edge_iterator {
|
|||
return !(first_vertex == x.first_vertex);
|
||||
}
|
||||
|
||||
Segment_2 operator*() {
|
||||
Segment_2 operator*() const {
|
||||
const_iterator second_vertex = first_vertex;
|
||||
++second_vertex;
|
||||
if (second_vertex == container->end())
|
||||
|
|
@ -90,7 +83,7 @@ class Polygon_2_edge_iterator {
|
|||
return construct_segment_2(*first_vertex, *second_vertex);
|
||||
}
|
||||
|
||||
Polygon_2__Segment_ptr<Segment_2> operator->()
|
||||
Polygon_2__Segment_ptr<Segment_2> operator->() const
|
||||
{return Polygon_2__Segment_ptr<Segment_2>(operator*());}
|
||||
|
||||
Polygon_2_edge_iterator<Traits_, Container_>& operator++() {
|
||||
|
|
@ -123,7 +116,7 @@ class Polygon_2_edge_iterator {
|
|||
}
|
||||
|
||||
Polygon_2_edge_iterator<Traits_, Container_>
|
||||
operator+(difference_type n) {
|
||||
operator+(difference_type n) const {
|
||||
return Polygon_2_edge_iterator<Traits_, Container_>(
|
||||
container, first_vertex + n);
|
||||
}
|
||||
|
|
@ -134,37 +127,37 @@ class Polygon_2_edge_iterator {
|
|||
}
|
||||
|
||||
Polygon_2_edge_iterator<Traits_, Container_>
|
||||
operator-(difference_type n) {
|
||||
operator-(difference_type n) const {
|
||||
return Polygon_2_edge_iterator<Traits_, Container_>(
|
||||
container, first_vertex - n);
|
||||
}
|
||||
|
||||
difference_type
|
||||
operator-(const Polygon_2_edge_iterator<Traits_, Container_>& a) {
|
||||
operator-(const Polygon_2_edge_iterator<Traits_, Container_>& a) const {
|
||||
return first_vertex - a.first_vertex;
|
||||
}
|
||||
|
||||
Segment_2 operator[](int n) {
|
||||
Segment_2 operator[](int n) const {
|
||||
return *Polygon_2_edge_iterator<Traits_, Container_>(
|
||||
container, first_vertex+n);
|
||||
}
|
||||
|
||||
bool operator<(const Polygon_2_edge_iterator<Traits_, Container_>& a)
|
||||
bool operator<(const Polygon_2_edge_iterator<Traits_, Container_>& a) const
|
||||
{
|
||||
return first_vertex < a.first_vertex;
|
||||
}
|
||||
|
||||
bool operator>(const Polygon_2_edge_iterator<Traits_, Container_>& a)
|
||||
bool operator>(const Polygon_2_edge_iterator<Traits_, Container_>& a) const
|
||||
{
|
||||
return first_vertex > a.first_vertex;
|
||||
}
|
||||
|
||||
bool operator<=(const Polygon_2_edge_iterator<Traits_, Container_>& a)
|
||||
bool operator<=(const Polygon_2_edge_iterator<Traits_, Container_>& a) const
|
||||
{
|
||||
return first_vertex <= a.first_vertex;
|
||||
}
|
||||
|
||||
bool operator>=(const Polygon_2_edge_iterator<Traits_, Container_>& a)
|
||||
bool operator>=(const Polygon_2_edge_iterator<Traits_, Container_>& a) const
|
||||
{
|
||||
return first_vertex >= a.first_vertex;
|
||||
}
|
||||
|
|
@ -201,4 +194,3 @@ value_type(const Polygon_2_edge_iterator<Traits_,Container_>&)
|
|||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue