mirror of https://github.com/CGAL/cgal
Missing includes and I/O.
This commit is contained in:
parent
7857964f3b
commit
4bb4fde1f7
|
|
@ -21,6 +21,7 @@
|
|||
#include <CGAL/Get_arithmetic_kernel.h>
|
||||
|
||||
#include <CGAL/boost_mp.h>
|
||||
#include <boost/multiprecision/cpp_int.hpp>
|
||||
|
||||
// FIXME: the could be several kernels based on Boost.Multiprecision.
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <CGAL/Modular_traits.h>
|
||||
// We can't just include all Boost.Multiprecision here...
|
||||
#include <boost/multiprecision/number.hpp>
|
||||
#include <boost/type_traits/common_type.hpp>
|
||||
|
||||
// TODO: work on the coercions (end of the file)
|
||||
|
||||
|
|
@ -452,6 +453,29 @@ CGAL_COERCE_FLOAT(float);
|
|||
CGAL_COERCE_FLOAT(double);
|
||||
#undef CGAL_COERCE_FLOAT
|
||||
|
||||
template <>
|
||||
class Input_rep<mpq_class> : public IO_rep_is_specialized {
|
||||
mpq_class& q;
|
||||
public:
|
||||
Input_rep( mpq_class& qq) : q(qq) {}
|
||||
std::istream& operator()( std::istream& in) const {
|
||||
internal::read_float_or_quotient<mpz_class,mpq_class>(in, q);
|
||||
return in;
|
||||
}
|
||||
};
|
||||
|
||||
// Copied from leda_rational.h
|
||||
namespace internal {
|
||||
// See: Stream_support/include/CGAL/IO/io.h
|
||||
template <typename ET>
|
||||
void read_float_or_quotient(std::istream & is, ET& et);
|
||||
|
||||
template <>
|
||||
inline void read_float_or_quotient(std::istream & is, boost::multiprecision::cpp_rational& et)
|
||||
{
|
||||
internal::read_float_or_quotient<boost::multiprecision::cpp_int,boost::multiprecision::cpp_rational>(is, et);
|
||||
}
|
||||
} // namespace internal
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <CGAL/boost/iterator/transform_iterator.hpp>
|
||||
#include <boost/iterator/zip_iterator.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/multiprecision/cpp_int.hpp>
|
||||
|
||||
#include <CGAL/Exact_rational.h>
|
||||
#include <CGAL/MP_Float.h>
|
||||
|
|
@ -58,6 +59,14 @@ namespace QP_from_mps_detail {
|
|||
struct MPS_type_name<int> {
|
||||
static const char *name() { return "integer"; }
|
||||
};
|
||||
template<>
|
||||
struct MPS_type_name<boost::multiprecision::cpp_rational> {
|
||||
static const char *name() { return "rational"; }
|
||||
};
|
||||
template<>
|
||||
struct MPS_type_name<boost::multiprecision::cpp_int> {
|
||||
static const char *name() { return "integer"; }
|
||||
};
|
||||
#ifdef CGAL_USE_GMPXX
|
||||
template<>
|
||||
struct MPS_type_name<mpq_class> {
|
||||
|
|
@ -80,7 +89,9 @@ namespace QP_from_mps_detail {
|
|||
template<>
|
||||
struct MPS_type_name<CGAL::Quotient<CGAL::MP_Float> > {
|
||||
static const char *name() { return "rational"; }
|
||||
}; template<typename IT>
|
||||
};
|
||||
|
||||
template<typename IT>
|
||||
struct IT_to_ET {
|
||||
};
|
||||
|
||||
|
|
@ -88,6 +99,10 @@ namespace QP_from_mps_detail {
|
|||
struct IT_to_ET<double> {
|
||||
typedef CGAL::MP_Float ET;
|
||||
};
|
||||
template<>
|
||||
struct IT_to_ET<boost::multiprecision::cpp_rational> {
|
||||
typedef boost::multiprecision::cpp_rational ET;
|
||||
};
|
||||
|
||||
#ifdef CGAL_USE_GMP
|
||||
#ifdef CGAL_USE_GMPXX
|
||||
|
|
|
|||
Loading…
Reference in New Issue