diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-02-11 23:10:29 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-02-11 23:10:29 +0000 |
commit | a1e0dc13df3cdc7033c940f0f3311a2bd47d3b2e (patch) | |
tree | 72cf696511c00bb4dfc135f43f8c0ae0498140cf /libs/pbd/pbd/stateful.h | |
parent | f938687f8798d094c99cd4308ad6aa1c467e4a97 (diff) |
tweak Stateful/StatefulDiffCommand changes so that SessionObject's actually get a name; make StatefulDiffCommand use a weak_ptr, not a raw ptr; use .val() rather than .get() to avoid confusion with boost:: smart ptr method of the same name
git-svn-id: svn://localhost/ardour2/branches/3.0@6678 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/pbd/stateful.h')
-rw-r--r-- | libs/pbd/pbd/stateful.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libs/pbd/pbd/stateful.h b/libs/pbd/pbd/stateful.h index 5d3c98439c..02224bb5e1 100644 --- a/libs/pbd/pbd/stateful.h +++ b/libs/pbd/pbd/stateful.h @@ -99,20 +99,20 @@ public: set (_current + v); return _current; } - - bool operator== (std::string const & o) const { - return o == to_string (_current); + + bool operator== (const T& other) const { + return _current == other; } - bool operator!= (std::string const & o) const { - return o != to_string (_current); + bool operator!= (const T& other) const { + return _current != other; } operator T const & () const { return _current; } - T const & get () const { + T const & val () const { return _current; } @@ -165,7 +165,7 @@ protected: template<class T> std::ostream& operator<< (std::ostream& os, StateTemplate<T> const & s) { - os << s.get(); + os << s.val(); return os; } @@ -190,6 +190,7 @@ public: private: std::string to_string (T const & v) const { std::stringstream s; + s.precision (12); // in case its floating point s << v; return s.str (); } @@ -197,6 +198,7 @@ private: T from_string (std::string const & s) const { std::stringstream t (s); T v; + t.precision (12); // in case its floating point t >> v; return v; } |