mirror of https://github.com/CGAL/cgal
experiment adding tuple-like support for Segment_3
This commit is contained in:
parent
cb933b1391
commit
ac47f30cd8
|
|
@ -20,6 +20,8 @@
|
|||
#include <CGAL/array.h>
|
||||
#include <CGAL/Handle_for.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < class R_ >
|
||||
|
|
@ -59,6 +61,11 @@ public:
|
|||
return get_pointee_or_identity(base)[1];
|
||||
}
|
||||
|
||||
template <std::size_t i>
|
||||
const Point_3& get() const {
|
||||
return get_pointee_or_identity(base)[i];
|
||||
}
|
||||
|
||||
const Point_3 & start() const;
|
||||
const Point_3 & end() const;
|
||||
|
||||
|
|
@ -210,4 +217,12 @@ collinear_has_on(const typename SegmentC3<R>::Point_3 &p) const
|
|||
|
||||
} //namespace CGAL
|
||||
|
||||
template < class R_ >
|
||||
struct std::tuple_size<CGAL::SegmentC3<R_> > : std::integral_constant<std::size_t, 2> {};
|
||||
|
||||
template < class R_, size_t i >
|
||||
struct std::tuple_element<i, CGAL::SegmentC3<R_> > {
|
||||
using type = typename R_::Point_3;
|
||||
};
|
||||
|
||||
#endif // CGAL_CARTESIAN_SEGMENT_3_H
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
#include <CGAL/Bbox_3.h>
|
||||
#include <CGAL/Dimension.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R_>
|
||||
|
|
@ -94,6 +96,11 @@ public:
|
|||
return target();
|
||||
}
|
||||
|
||||
template <std::size_t i>
|
||||
decltype(auto) get() const {
|
||||
return Rep::template get<i>();
|
||||
}
|
||||
|
||||
decltype(auto)
|
||||
min BOOST_PREVENT_MACRO_SUBSTITUTION() const {
|
||||
typename R_::Less_xyz_3 less_xyz;
|
||||
|
|
@ -197,4 +204,12 @@ operator>>(std::istream &is, Segment_3<R> &s)
|
|||
|
||||
} //namespace CGAL
|
||||
|
||||
template < class R_ >
|
||||
struct std::tuple_size<CGAL::Segment_3<R_> > : std::integral_constant<std::size_t, 2> {};
|
||||
|
||||
template < class R_, size_t i >
|
||||
struct std::tuple_element<i, CGAL::Segment_3<R_> > {
|
||||
using type = typename R_::Point_3;
|
||||
};
|
||||
|
||||
#endif // CGAL_SEGMENT_3_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue