[PPL-devel] [GIT] ppl/ppl(floating_point): Added a temporary implementation for external method neg_assign.

Fabio Bossi bossi at cs.unipr.it
Thu Sep 3 14:03:06 CEST 2009


Module: ppl/ppl
Branch: floating_point
Commit: 9b98cc5348d01790871f0c4c12b7cb4cbd46f64d
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=9b98cc5348d01790871f0c4c12b7cb4cbd46f64d

Author: Fabio Bossi <bossi at cs.unipr.it>
Date:   Thu Sep  3 14:05:27 2009 +0200

Added a temporary implementation for external method neg_assign.

---

 src/Interval.defs.hh    |    5 +++++
 src/Interval.inlines.hh |   11 +++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/Interval.defs.hh b/src/Interval.defs.hh
index d39505a..b373cba 100644
--- a/src/Interval.defs.hh
+++ b/src/Interval.defs.hh
@@ -55,6 +55,11 @@ struct Is_Singleton : public Is_Native_Or_Checked<T> {};
 template <typename T>
 struct Is_Interval : public Is_Same_Or_Derived<Interval_Base, T> {};
 
+// FIXME: This has been added as a workaraound.
+template <typename From>
+typename Enable_If<Is_Interval<From>::value, I_Result>::type
+neg_assign(From& x);
+
 //! A generic, not necessarily closed, possibly restricted interval.
 /*! \ingroup PPL_CXX_interface
   The class template type parameter \p Boundary represents the type
diff --git a/src/Interval.inlines.hh b/src/Interval.inlines.hh
index 2db333e..88a0b1e 100644
--- a/src/Interval.inlines.hh
+++ b/src/Interval.inlines.hh
@@ -25,6 +25,17 @@ site: http://www.cs.unipr.it/ppl/ . */
 
 namespace Parma_Polyhedra_Library {
 
+template <typename From>
+typename Enable_If<Is_Interval<From>::value, I_Result>::type
+neg_assign(From& x) {
+  // FIXME: Avoid the creation of a temporary.
+  From y;
+  typename Enable_If<Is_Interval<From>::value, I_Result>::type res =
+                                                               y.neg_assign(x);
+  x = y;
+  return res;
+}
+
 template <typename Boundary, typename Info>
 inline memory_size_type
 Interval<Boundary, Info>::external_memory_in_bytes() const {




More information about the PPL-devel mailing list