Change Box_with_info to use the policy ID_EXPLICIT by default

ID_FROM_BOX_ADDRESS does not work when you pass a range of boxes
by value and not by pointers. Since doing that while using
ID_FROM_BOX_ADDRESS is completely silent (no errors despite
not being compatible), this is super dangerous.

Besides, the Box_d has default policy ID_EXPLICIT, so it should
have been that in the first place.
This commit is contained in:
Mael Rouxel-Labbé 2019-11-19 16:40:11 +01:00
parent b7d20e0033
commit 52ce0b6ac4
1 changed files with 12 additions and 12 deletions

View File

@ -16,34 +16,34 @@
#include <CGAL/license/Box_intersection_d.h> #include <CGAL/license/Box_intersection_d.h>
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/Box_intersection_d/Box_d.h> #include <CGAL/Box_intersection_d/Box_d.h>
namespace CGAL { namespace CGAL {
namespace Box_intersection_d { namespace Box_intersection_d {
template<class NT_, int N, class Info_> template<class NT_, int N, class Info_, class IdPolicy = ID_EXPLICIT>
class Box_with_info_d : public Box_d< NT_, N, ID_FROM_BOX_ADDRESS> { class Box_with_info_d
: public Box_d< NT_, N, IdPolicy>
{
protected: protected:
Info_ m_info; Info_ m_info;
public: public:
typedef Box_d< NT_, N, ID_FROM_BOX_ADDRESS> Base; typedef Box_d< NT_, N, ID_EXPLICIT> Base;
typedef NT_ NT; typedef NT_ NT;
typedef Info_ Info; typedef Info_ Info;
Box_with_info_d() {} Box_with_info_d() {}
Box_with_info_d( Info h) : m_info(h) {} Box_with_info_d( Info h) : m_info(h) {}
Box_with_info_d( bool complete, Info h): Base(complete), m_info(h) {} Box_with_info_d( bool complete, Info h): Base(complete), m_info(h) {}
Box_with_info_d(NT l[N], NT h[N], Info n) : Base( l, h), m_info(n) {} Box_with_info_d(NT l[N], NT h[N], Info n) : Base( l, h), m_info(n) {}
Box_with_info_d( const Bbox_2& b, Info h) : Base( b), m_info(h) {} Box_with_info_d( const Bbox_2& b, Info h) : Base( b), m_info(h) {}
Box_with_info_d( const Bbox_3& b, Info h) : Base( b), m_info(h) {} Box_with_info_d( const Bbox_3& b, Info h) : Base( b), m_info(h) {}
Info info() const { return m_info; } Info info() const { return m_info; }
}; };
} // end namespace Box_intersection_d } // namespace Box_intersection_d
} // namespace CGAL
#endif // CGAL_BOX_INTERSECTION_D_BOX_WITH_INFO_D_H
} //namespace CGAL
#endif