mirror of https://github.com/CGAL/cgal
C++14 tweaks
This commit is contained in:
parent
140e407bf8
commit
678f911a47
|
|
@ -63,7 +63,7 @@ before_script:
|
||||||
- sudo chmod +x /usr/bin/doxygen
|
- sudo chmod +x /usr/bin/doxygen
|
||||||
- mkdir -p build
|
- mkdir -p build
|
||||||
- cd build
|
- cd build
|
||||||
- cmake -DCMAKE_CXX_FLAGS="-std=c++11" -DCGAL_HEADER_ONLY=ON -DQt5_DIR="/opt/qt55/lib/cmake/Qt5" -DQt5Svg_DIR="/opt/qt55/lib/cmake/Qt5Svg" -DQt5OpenGL_DIR="/opt/qt55/lib/cmake/Qt5OpenGL" -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG -DWITH_examples=ON -DWITH_demos=ON -DWITH_tests=ON ..
|
- cmake -DCMAKE_CXX_FLAGS="-std=c++1y" -DCGAL_HEADER_ONLY=ON -DQt5_DIR="/opt/qt55/lib/cmake/Qt5" -DQt5Svg_DIR="/opt/qt55/lib/cmake/Qt5Svg" -DQt5OpenGL_DIR="/opt/qt55/lib/cmake/Qt5OpenGL" -DCMAKE_CXX_FLAGS_RELEASE=-DCGAL_NDEBUG -DWITH_examples=ON -DWITH_demos=ON -DWITH_tests=ON ..
|
||||||
- make
|
- make
|
||||||
- sudo make install &>/dev/null
|
- sudo make install &>/dev/null
|
||||||
- cd ..
|
- cd ..
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include <CGAL/Bbox_2.h>
|
#include <CGAL/Bbox_2.h>
|
||||||
#include <CGAL/Bbox_3.h>
|
#include <CGAL/Bbox_3.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <type_traits>
|
||||||
#include <CGAL/Default.h>
|
#include <CGAL/Default.h>
|
||||||
#include<CGAL/tss.h>
|
#include<CGAL/tss.h>
|
||||||
#include <CGAL/is_iterator.h>
|
#include <CGAL/is_iterator.h>
|
||||||
|
|
@ -237,7 +238,7 @@ struct Depth_base {
|
||||||
template <typename AT_, typename ET, typename E2A>
|
template <typename AT_, typename ET, typename E2A>
|
||||||
class Lazy_rep : public Rep, public Depth_base
|
class Lazy_rep : public Rep, public Depth_base
|
||||||
{
|
{
|
||||||
Lazy_rep (const Lazy_rep&); // cannot be copied.
|
Lazy_rep (const Lazy_rep&) = delete; // cannot be copied.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
@ -247,13 +248,15 @@ public:
|
||||||
mutable ET *et;
|
mutable ET *et;
|
||||||
|
|
||||||
Lazy_rep ()
|
Lazy_rep ()
|
||||||
: at(), et(NULL){}
|
: at(), et(nullptr){}
|
||||||
|
|
||||||
Lazy_rep (const AT& a)
|
template<class A>
|
||||||
: at(a), et(NULL){}
|
Lazy_rep (A&& a)
|
||||||
|
: at(std::forward<A>(a)), et(nullptr){}
|
||||||
|
|
||||||
Lazy_rep (const AT& a, const ET& e)
|
template<class A, class E>
|
||||||
: at(a), et(new ET(e)) {}
|
Lazy_rep (A&& a, E&& e)
|
||||||
|
: at(std::forward<A>(a)), et(new ET(std::forward<E>(e))) {}
|
||||||
|
|
||||||
const AT& approx() const
|
const AT& approx() const
|
||||||
{
|
{
|
||||||
|
|
@ -332,8 +335,9 @@ class Lazy_rep_n :
|
||||||
void update_exact() const {
|
void update_exact() const {
|
||||||
update_exact_helper(std::make_index_sequence<sizeof...(L)>{});
|
update_exact_helper(std::make_index_sequence<sizeof...(L)>{});
|
||||||
}
|
}
|
||||||
Lazy_rep_n(const AC& ac, const EC& ec, L const&...ll) :
|
template<class...LL>
|
||||||
Lazy_rep<AT, ET, E2A>(ac(CGAL::approx(ll)...)), EC(ec), l(ll...)
|
Lazy_rep_n(const AC& ac, const EC& ec, LL&&...ll) :
|
||||||
|
Lazy_rep<AT, ET, E2A>(ac(CGAL::approx(ll)...)), EC(ec), l(std::forward<LL>(ll)...)
|
||||||
{
|
{
|
||||||
this->set_depth(std::max({ -1, (int)CGAL::depth(ll)...}) + 1);
|
this->set_depth(std::max({ -1, (int)CGAL::depth(ll)...}) + 1);
|
||||||
}
|
}
|
||||||
|
|
@ -377,14 +381,23 @@ public:
|
||||||
Lazy_rep_0()
|
Lazy_rep_0()
|
||||||
: Lazy_rep<AT,ET, E2A>() {}
|
: Lazy_rep<AT,ET, E2A>() {}
|
||||||
|
|
||||||
Lazy_rep_0(const AT& a, const ET& e)
|
template<class A, class E>
|
||||||
: Lazy_rep<AT,ET,E2A>(a, e) {}
|
Lazy_rep_0(A&& a, E&& e)
|
||||||
|
: Lazy_rep<AT,ET,E2A>(std::forward<A>(a), std::forward<E>(e)) {}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// unused. Find a less ambiguous placeholder if necessary
|
||||||
Lazy_rep_0(const AT& a, void*)
|
Lazy_rep_0(const AT& a, void*)
|
||||||
: Lazy_rep<AT,ET,E2A>(a) {}
|
: Lazy_rep<AT,ET,E2A>(a) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
Lazy_rep_0(const ET& e)
|
// E2A()(e) and std::forward<E>(e) could be evaluated in any order, but
|
||||||
: Lazy_rep<AT,ET,E2A>(E2A()(e), e) {}
|
// that's ok, "forward" itself does not modify e, it may only mark it as
|
||||||
|
// modifyable by the outer call, which is obviously sequenced after the inner
|
||||||
|
// call E2A()(e).
|
||||||
|
template<class E>
|
||||||
|
Lazy_rep_0(E&& e)
|
||||||
|
: Lazy_rep<AT,ET,E2A>(E2A()(e), std::forward<E>(e)) {}
|
||||||
|
|
||||||
void
|
void
|
||||||
print_dag(std::ostream& os, int level) const
|
print_dag(std::ostream& os, int level) const
|
||||||
|
|
@ -722,6 +735,11 @@ public :
|
||||||
PTR = new Lazy_rep_0<AT,ET,E2A>(e);
|
PTR = new Lazy_rep_0<AT,ET,E2A>(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Lazy(ET&& e)
|
||||||
|
{
|
||||||
|
PTR = new Lazy_rep_0<AT,ET,E2A>(std::move(e));
|
||||||
|
}
|
||||||
|
|
||||||
const AT& approx() const
|
const AT& approx() const
|
||||||
{ return ptr()->approx(); }
|
{ return ptr()->approx(); }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -211,8 +211,6 @@ struct Lazy_cartesian :
|
||||||
typedef Lazy_construction_nt<Kernel,FA,FE> type;
|
typedef Lazy_construction_nt<Kernel,FA,FE> type;
|
||||||
};
|
};
|
||||||
template<class T,class D> struct Functor<T,D,Construct_tag> {
|
template<class T,class D> struct Functor<T,D,Construct_tag> {
|
||||||
typedef typename Get_functor<Approximate_kernel, T>::type FA;
|
|
||||||
typedef typename Get_functor<Exact_kernel, T>::type FE;
|
|
||||||
typedef Lazy_construction2<T,Kernel> type;
|
typedef Lazy_construction2<T,Kernel> type;
|
||||||
};
|
};
|
||||||
template<class D> struct Functor<Point_dimension_tag,D,Misc_tag> {
|
template<class D> struct Functor<Point_dimension_tag,D,Misc_tag> {
|
||||||
|
|
|
||||||
|
|
@ -312,6 +312,7 @@ operator>>(std::istream &is, Point_d<K> & p)
|
||||||
read(is, coords[i]);
|
read(is, coords[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: with Epeck_d, currently, this stores pointers to coords which will soon be dead.
|
||||||
if(is)
|
if(is)
|
||||||
p = P(coords.begin(), coords.end());
|
p = P(coords.begin(), coords.end());
|
||||||
return is;
|
return is;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue