Skip to content

Commit a1bc5ab

Browse files
committed
Move MP_Float.cpp to a header MP_Float_impl.h
Having MP_Float.cpp in the CGAL library exposes the ABI of the STL container std::vector<limb>. That is not recommended because the ABI of the STL depends on compilation flags (debug, thread-safe, etc.)
1 parent 88ef561 commit a1bc5ab

File tree

2 files changed

+62
-77
lines changed

2 files changed

+62
-77
lines changed

Number_types/include/CGAL/MP_Float.h

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -66,91 +66,54 @@ template < typename > class Quotient; // Needed for overloaded To_double
6666

6767
namespace INTERN_MP_FLOAT {
6868

69-
CGAL_EXPORT
7069
Comparison_result compare(const MP_Float&, const MP_Float&);
7170

72-
CGAL_EXPORT
7371
MP_Float square(const MP_Float&);
7472

7573
// to_double() returns, not the closest double, but a one bit error is allowed.
7674
// We guarantee : to_double(MP_Float(double d)) == d.
77-
CGAL_EXPORT
75+
7876
double to_double(const MP_Float&);
79-
CGAL_EXPORT
77+
8078
double to_double(const Quotient<MP_Float>&);
8179

82-
CGAL_EXPORT
8380
std::pair<double,double> to_interval(const MP_Float &);
8481

85-
CGAL_EXPORT
8682
std::pair<double,double> to_interval(const Quotient<MP_Float>&);
8783

88-
CGAL_EXPORT
8984
MP_Float div(const MP_Float& n1, const MP_Float& n2);
9085

91-
CGAL_EXPORT
9286
MP_Float gcd(const MP_Float& a, const MP_Float& b);
9387

9488
} //namespace INTERN_MP_FLOAT
9589

96-
CGAL_EXPORT
9790
std::pair<double, int>
9891
to_double_exp(const MP_Float &b);
9992

10093
// Returns (first * 2^second), an interval surrounding b.
101-
CGAL_EXPORT
10294
std::pair<std::pair<double, double>, int>
10395
to_interval_exp(const MP_Float &b);
10496

105-
CGAL_EXPORT
10697
std::ostream &
10798
operator<< (std::ostream & os, const MP_Float &b);
10899

109100
// This one is for debug.
110-
CGAL_EXPORT
111101
std::ostream &
112102
print (std::ostream & os, const MP_Float &b);
113103

114-
CGAL_EXPORT
115104
std::istream &
116105
operator>> (std::istream & is, MP_Float &b);
117106

118-
CGAL_EXPORT
119107
MP_Float operator+(const MP_Float &a, const MP_Float &b);
120108

121-
CGAL_EXPORT
122109
MP_Float operator-(const MP_Float &a, const MP_Float &b);
123110

124-
CGAL_EXPORT
125111
MP_Float operator*(const MP_Float &a, const MP_Float &b);
126112

127-
CGAL_EXPORT
128113
MP_Float operator%(const MP_Float &a, const MP_Float &b);
129114

130-
} // Close the CGAL namespace for the following explicit instantiation of
131-
// std:: template classes.
132-
133-
// We have to export the instantiated vector class
134-
// as it is used in inlined functions defined in the MP_Float.h file
135-
136-
//disable warnings on extern before template instantiation
137-
138-
#if defined(BOOST_MSVC)
139-
# pragma warning(push)
140-
# pragma warning (disable : 4231)
141-
#endif
142115

143-
// short == MP_Float::limb
144-
CGAL_EXPIMP_TEMPLATE template class CGAL_EXPORT std::allocator<short>;
145-
CGAL_EXPIMP_TEMPLATE template class CGAL_EXPORT std::vector<short>;
146-
147-
#if defined(BOOST_MSVC)
148-
# pragma warning(pop)
149-
#endif
150-
151-
namespace CGAL { // Reopen the namespace CGAL
152-
153-
class CGAL_EXPORT MP_Float
116+
class MP_Float
154117
{
155118
public:
156119
typedef short limb;
@@ -434,11 +397,9 @@ inline
434397
bool operator!=(const MP_Float &a, const MP_Float &b)
435398
{ return ! (a == b); }
436399

437-
CGAL_EXPORT
438400
MP_Float
439401
approximate_sqrt(const MP_Float &d);
440402

441-
CGAL_EXPORT
442403
MP_Float
443404
approximate_division(const MP_Float &n, const MP_Float &d);
444405

@@ -921,6 +882,8 @@ CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int, MP_Float)
921882

922883
} //namespace CGAL
923884

885+
#include <CGAL/MP_Float_impl.h>
886+
924887
//specialization for Get_arithmetic_kernel
925888
#include <CGAL/MP_Float_arithmetic_kernel.h>
926889

0 commit comments

Comments
 (0)