Fix always returning by copy when it is possible to return by reference

This commit is contained in:
Mael Rouxel-Labbé 2020-03-09 15:31:51 +01:00
parent 3a64414705
commit fe1fd95d23
2 changed files with 9 additions and 12 deletions

View File

@ -128,6 +128,8 @@ public:
typedef typename Tds::Halfedge_iterator All_halfedges_iterator;
typedef typename Tds::Vertex_iterator All_vertices_iterator;
typedef typename Gt::Construct_point_2 Construct_point_2;
class Perturbation_order
{
const Self *t;
@ -277,7 +279,9 @@ public:
Face_handle &fr) const;
// GEOMETRIC FEATURES AND CONSTRUCTION
Point_2 construct_point(const Point& p) const;
typename boost::result_of<const Construct_point_2(const Point&)>::type
construct_point(const Point& p) const { return geom_traits().construct_point_2_object()(p); }
const Point& point(Face_handle c, int i) const;
const Point& point(Vertex_handle v) const;
Segment segment(Face_handle f, int i) const;
@ -595,7 +599,6 @@ std::ptrdiff_t insert(InputIterator first, InputIterator last)
std::vector<Point> points (first, last);
typedef typename Geom_traits::Construct_point_2 Construct_point_2;
typedef typename boost::result_of<const Construct_point_2(const Point&)>::type Ret;
typedef CGAL::internal::boost_::function_property_map<Construct_point_2, Point, Ret> fpmap;
typedef CGAL::Spatial_sort_traits_adapter_2<Geom_traits, fpmap> Search_traits_2;
@ -967,14 +970,6 @@ is_face(Vertex_handle v1,
return _tds.is_face(v1, v2, v3, fr);
}
template <class Gt, class Tds >
typename Triangulation_2<Gt, Tds>::Point_2
Triangulation_2<Gt, Tds>::
construct_point(const Point& p) const
{
return geom_traits().construct_point_2_object()(p);
}
template <class Gt, class Tds >
const typename Triangulation_2<Gt, Tds>::Point&
Triangulation_2<Gt, Tds>::

View File

@ -433,6 +433,8 @@ public:
typedef typename Tds::Simplex Simplex;
typedef typename GT::Construct_point_3 Construct_point_3;
private:
// This class is used to generate the Finite_*_iterators.
class Infinite_tester
@ -553,7 +555,8 @@ protected:
public:
template<typename P> // Point or Point_3
Point_3 construct_point(const P& p) const
typename boost::result_of<const Construct_point_3(const P&)>::type
construct_point(const P& p) const
{
return geom_traits().construct_point_3_object()(p);
}
@ -1127,7 +1130,6 @@ public:
// Nevertheless, to make it more generic (that is, allowing the user to pass
// a `Point` type that is not GT::Point_3), we still use the spatial sort
// adapter traits and Construct_point_3 here.
typedef typename Geom_traits::Construct_point_3 Construct_point_3;
typedef typename boost::result_of<const Construct_point_3(const Point&)>::type Ret;
typedef CGAL::internal::boost_::function_property_map<Construct_point_3, Point, Ret> fpmap;
typedef CGAL::Spatial_sort_traits_adapter_3<Geom_traits, fpmap> Search_traits_3;