From e44f1b89978ca291c63aa8302ddff118f00bfec6 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sun, 8 Nov 2009 19:36:35 +0100 Subject: [PATCH] Make it possible to clone const formulae. * src/ltlast/formula.hh, src/ltlast/formula.cc (clone): Declare as const. --- ChangeLog | 7 +++++++ src/ltlast/formula.cc | 6 +++--- src/ltlast/formula.hh | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e5e44a709..e5d7390fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-11-08 Alexandre Duret-Lutz + + Make it possible to clone const formulae. + + * src/ltlast/formula.hh, src/ltlast/formula.cc (clone): Declare + as const. + 2009-11-08 Alexandre Duret-Lutz Rename formula::ref and formula::unref as formula::clone diff --git a/src/ltlast/formula.cc b/src/ltlast/formula.cc index c0c498e78..7cee80f7f 100644 --- a/src/ltlast/formula.cc +++ b/src/ltlast/formula.cc @@ -27,10 +27,10 @@ namespace spot namespace ltl { formula* - formula::clone() + formula::clone() const { - ref_(); - return this; + const_cast(this)->ref_(); + return const_cast(this); } formula::~formula() diff --git a/src/ltlast/formula.hh b/src/ltlast/formula.hh index 1667d7d1c..fb92a119a 100644 --- a/src/ltlast/formula.hh +++ b/src/ltlast/formula.hh @@ -80,7 +80,7 @@ namespace spot /// /// This increments the reference counter of this node (if one is /// used). - formula* clone(); + formula* clone() const; /// \brief release this node /// /// This decrements the reference counter of this node (if one is