Benchmark_rep specializations moved to CGAL.

This commit is contained in:
Sebastian Limbach 2008-04-02 14:24:25 +00:00
parent d9fbc22596
commit 337eca5ccc
3 changed files with 57 additions and 0 deletions

View File

@ -170,6 +170,25 @@ struct Needs_parens_as_product<CORE::BigInt>{
}
};
// Benchmark_rep specialization
template<>
class Benchmark_rep< CORE::BigInt > {
const CORE::BigInt& t;
public:
//! initialize with a const reference to \a t.
Benchmark_rep( const CORE::BigInt& tt) : t(tt) {}
//! perform the output, calls \c operator\<\< by default.
std::ostream& operator()( std::ostream& out) const {
out << t;
return out;
}
static std::string get_benchmark_name() {
return "Integer";
}
};
CGAL_END_NAMESPACE
//since types are included by CORE_coercion_traits.h:

View File

@ -231,6 +231,24 @@ public:
}
};
// Benchmark_rep specialization
template<>
class Benchmark_rep< CORE::BigRat > {
const CORE::BigRat& t;
public:
//! initialize with a const reference to \a t.
Benchmark_rep( const CORE::BigRat& tt) : t(tt) {}
//! perform the output, calls \c operator\<\< by default.
std::ostream& operator()( std::ostream& out) const {
out << "Rational(" << numerator(t) << "," << denominator(t) << ")";
return out;
}
static std::string get_benchmark_name() {
return "Rational";
}
};
CGAL_END_NAMESPACE
//since types are included by CORE_coercion_traits.h:

View File

@ -276,6 +276,26 @@ public:
}
};
template < >
class Benchmark_rep< leda_rational > {
const leda_rational& t;
public:
//! initialize with a const reference to \a t.
Benchmark_rep( const leda_rational& tt) : t(tt) {}
//! perform the output, calls \c operator\<\< by default.
std::ostream& operator()( std::ostream& out) const {
return
out << "Rational(" << t.numerator() << ","
<< t.denominator() << ")";
}
static std::string get_benchmark_name() {
return "Rational";
}
};
CGAL_END_NAMESPACE
// Unary + is missing for leda::rational