From a6fdd6c915d527d0f5502a7739eefac25d413448 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 15 May 2012 00:06:33 +0000 Subject: Maybe fix typename / no-typename problems better. git-svn-id: svn://localhost/ardour2/branches/3.0@12282 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/pbd/pbd/signals.py | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) (limited to 'libs/pbd/pbd/signals.py') diff --git a/libs/pbd/pbd/signals.py b/libs/pbd/pbd/signals.py index e5ea09ae2e..da7756c359 100644 --- a/libs/pbd/pbd/signals.py +++ b/libs/pbd/pbd/signals.py @@ -66,6 +66,14 @@ def signal(f, n, v): for a in An: an.append(a.lower()) + # If the template is fully specialized, use of typename SomeTypedef::iterator is illegal + # in c++03 (should use just SomeTypedef::iterator) [although use of typename is ok in c++0x] + # http://stackoverflow.com/questions/6076015/typename-outside-of-template + if n == 0 and v: + typename = "" + else: + typename = "typename " + if v: print >>f,"template <%s>" % comma_separated(An, "typename ") print >>f,"class Signal%d<%s> : public SignalBase" % (n, comma_separated(["void"] + An)) @@ -94,19 +102,14 @@ def signal(f, n, v): print >>f,"public:" print >>f,"" - print >>f,"\t~Signal%d () {" % n, + print >>f,"\t~Signal%d () {" % n - print >>f,""" - boost::mutex::scoped_lock lm (_mutex); -#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 6)) - for (typename Slots::iterator i = _slots.begin(); i != _slots.end(); ++i) { -#else - for (Slots::iterator i = _slots.begin(); i != _slots.end(); ++i) { -#endif - i->first->signal_going_away (); - } - } -""" + print >>f,"\t\tboost::mutex::scoped_lock lm (_mutex);" + print >>f,"\t\tfor (%sSlots::iterator i = _slots.begin(); i != _slots.end(); ++i) {" % typename + + print >>f,"\t\t\ti->first->signal_going_away ();" + print >>f,"\t\t}" + print >>f,"\t}" if n == 0: p = "" @@ -115,7 +118,7 @@ def signal(f, n, v): p = ", %s" % comma_separated(Anan) q = ", %s" % comma_separated(an) - print >>f,"\tstatic void compositor (typename boost::function f, EventLoop* event_loop, EventLoop::InvalidationRecord* ir%s) {" % (comma_separated(An), p) + print >>f,"\tstatic void compositor (%sboost::function f, EventLoop* event_loop, EventLoop::InvalidationRecord* ir%s) {" % (typename, comma_separated(An), p) print >>f,"\t\tevent_loop->call_slot (ir, boost::bind (f%s));" % q print >>f,"\t}" @@ -227,17 +230,7 @@ def signal(f, n, v): print >>f,"\t\t}" if not v: print >>f,"\t\tstd::list r;" - if n == 0 and v: - print >>f,""" -#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 6)) - for (typename Slots::iterator i = s.begin(); i != s.end(); ++i) { -#else - for (Slots::iterator i = s.begin(); i != s.end(); ++i) { -#endif -""" - else: - print >>f,"\t\tfor (typename Slots::iterator i = s.begin(); i != s.end(); ++i) {" - + print >>f,"for (%sSlots::iterator i = s.begin(); i != s.end(); ++i) {" % typename print >>f,""" bool still_there = false; { -- cgit v1.2.3