declare thread local, or const

This commit is contained in:
Andreas Fabri 2016-09-26 12:49:24 +02:00
parent 4ee96e11c0
commit 9dd43b7d0a
3 changed files with 14 additions and 8 deletions

View File

@ -25,6 +25,7 @@
#include <CGAL/Interval_arithmetic.h>
#include <CGAL/Homogeneous.h>
#include <CGAL/number_utils.h>
#include <CGAL/tss.h>
#undef CGAL_NEF_DEBUG
#define CGAL_NEF_DEBUG 5
#include <CGAL/Nef_2/debug.h>
@ -93,14 +94,18 @@ public:
// only for visualization:
static void set_R(const RT& R) { R_ = R; }
static RT& R()
{
CGAL_STATIC_THREAD_LOCAL_VARIABLE(RT,R_,0);
}
static void set_R(const RT& r) { R() = r; }
RT eval_at(const RT& r) const { return _m*r+_n; }
RT eval_at_R() const { return _m*R_+_n; }
protected:
static RT R_;
RT eval_at_R() const { return _m*R()+_n; }
};
template <class RT> RT SPolynomial<RT>::R_;
template <typename RT>
int sign(const SPolynomial<RT>& p)
@ -138,7 +143,7 @@ bool operator<(const SPolynomial<RT>& p1, int i)
template <class RT>
inline double to_double(const SPolynomial<RT>& p)
{ return (CGAL::to_double(p.eval_at(SPolynomial<RT>::R_))); }
{ return (CGAL::to_double(p.eval_at(SPolynomial<RT>::R()))); }
template <class RT>
std::ostream& operator<<(std::ostream& os, const SPolynomial<RT>& p)

View File

@ -27,7 +27,7 @@
#include <LEDA/graphics/color.h>
namespace CGAL {
static int frame_default = 100;
static const int frame_default = 100;
template <typename CIRC>
leda_list<leda_point>

View File

@ -29,6 +29,7 @@
#include <vector>
#include <CGAL/Kernel/mpl.h>
#include <CGAL/tss.h>
#include <boost/operators.hpp>
@ -70,7 +71,7 @@ class Nef_polynomial
const Base & polynomial() const { return static_cast<const Base&>(*this); }
static NT& infi_maximal_value() {
static NT R_ = 1;
CGAL_STATIC_THREAD_LOCAL_VARIABLE(NT, R_, 1);
return R_;
}
};